Kumar, thanks for the pointer to the source. Between that and Firefox's own
source I was finally able to figure this out.

Turns out `purgeHistory()` does not actually work as advertised. Instead it
only deletes the history. In order to delete the cookies, I have to call
`clearBrowserData()` on the app itself, which is what the FxOS browser
actually does. I can see cases where this would be a bit too limited, but
it should do the job in my specific case.

Thank you again,


On 18 August 2014 20:26, Kumar McMillan <[email protected]> wrote:

>
> On Aug 17, 2014, at 6:22 AM, Pablo Brasero Moreno <[email protected]>
> wrote:
>
> > Hi all, I'm having a problem with the Browser API. I hope someone might
> be
> > able to enlighten me.
> >
> > As the subject line says: does purgeHistory() delete cookies? Working on
> a
> > privileged FxOS 1.1 app, I found that it doesn't seem to, even though the
> > documentation says otherwise[1].
> >
> > I have built a small test app to isolate the problem, it's at
> > https://github.com/pablobm/fxos-experiments You can just clone it, fire
> up
> > your FxOS Simulator (as it's 1.1 I'm targeting) and point it to the
> > iframe/manifest.webapp in there[2].
> >
> > The "Purge history" button in the app will call purgeHistory() on the
> > iframe. If you do something that will reveal whether cookies are being
> > persisted (such as logging into a site), you should be able to check that
> > these are not deleted.
> >
> > Any ideas?
>
> It doesn’t seem to be documented very well but I think purgeHistory()
> returns a DOMRequest object (
> https://developer.mozilla.org/en-US/docs/Web/API/DOMRequest). I would try
> changing your code to see if you are getting an error like:
>
> var domReq = iframe.purgeHistory();
> domReq.onerror = function() {
>   console.error(this.error.name);
> }
>
> You can maybe get more ideas from reading the Browser app source:
> https://github.com/mozilla-b2g/gaia/blob/master/apps/browser/js/browser.js#L1847
>
> >
> > Thank you in advance,
> >
> > [1]
> >
> https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement.purgeHistory
> > [2]
> >
> https://github.com/pablobm/fxos-experiments/blob/master/iframe/manifest.webapp
> >
> > --
> > Pablo Brasero Moreno
> > [email protected]
> > _______________________________________________
> > dev-webapps mailing list
> > [email protected]
> > https://lists.mozilla.org/listinfo/dev-webapps
>
>


-- 
Pablo Brasero Moreno
[email protected]
_______________________________________________
dev-webapps mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-webapps

Reply via email to