Re: Forcing every request from a docShell to use LOAD_ANONYMOUS
Mark Hammond <[email protected]> Tue, 20 Aug 2013 16:26:08 +1000
| Newsgroups | gmane.comp.mozilla.devel.netlib |
|---|---|
| Message-ID | <[email protected]> |
On 19/08/2013 11:37 PM, Boris Zbarsky wrote: > On 8/19/13 4:45 AM, Mark Hammond wrote: >> nsLoadGroup::MergeLoadFlags() isn't actually called here > > Hmm. This is only called for sub-requests. Worse yet, the default load > request will clobber the loadgroup flags. See > nsLoadGroup::SetDefaultLoadRequest. I experimented a little with this, and it (almost) works. I initially did: docShell.loadGroup.defaultLoadRequest.loadFlags |= Ci.nsIChannel.LOAD_ANONYMOUS; before making the loadURI call - but this didn't work as the ::Stop() call made by loadURI (we pass the LOAD_FLAGS_STOP_CONTENT flag) causes the defaultRequest to be set to null - so the flag is lost. I then changed it so that call was made *after* loadURI, which worked fine in a local <browser> element, but failed to work in a <browser remote="true">. Very quick debugging implies that this might be due to the fact the request has progressed before that flag gets set on the channel in the parent process. So tl;dr - it seems very difficult to set this flag on the defaultLoadRequest. I have verified that using an nsIWebProgress listener does seem to work though - I just look for all notifications with STATE_START | STATE_IS_REQUEST and set the flag at that time - and this also doesn't need the tweak to MergeLoadFlags. Seeing as we already need a progress listener for a different bug, this seems the most pragmatic way forward. Thanks for everyone's help. Mark > > So you need to set the flag explicitly on the document load in docshell > _and_ propagate it in MergeLoadFlags. On the other hand, you don't need > to manually twiddle the flags on the loadgroup: setting them on the > document load request will handle it for the subresources. > > -Boris