[Pkg-mozext-commits] [requestpolicy] 115/257: [fix] http-on-examine-response: top-level doc detection
David Prévot
taffit at moszumanska.debian.org
Thu Jan 28 03:20:03 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository requestpolicy.
commit 53a1174534aab7eac747b559c15b44f034b7078d
Author: Martin Kimmerle <dev at 256k.de>
Date: Thu Oct 22 02:42:09 2015 +0200
[fix] http-on-examine-response: top-level doc detection
On E10s there was an error in the "http-on-examine-response"
observer, specifically in the function
`eventuallyShowRedirectNotification()`. The function checks if
the load corresponding to the request is a top-level document
request. If true, the redirection notification is shown.
The function used the DocShell's "busy" flags, but the DocShell
lives in the content process. The solution is to use the
channel's load flags instead. It's compatible with E10s and it's
even less code.
However, the redirection notification still isn't shown on
http://www.maindomain.test/redirect-http-location-header-png.php
because there are more issues. See also #721.
---
src/content/lib/request-processor.redirects.js | 35 +++-----------------------
1 file changed, 4 insertions(+), 31 deletions(-)
diff --git a/src/content/lib/request-processor.redirects.js b/src/content/lib/request-processor.redirects.js
index 203ee5e..78d8deb 100644
--- a/src/content/lib/request-processor.redirects.js
+++ b/src/content/lib/request-processor.redirects.js
@@ -320,39 +320,12 @@ RequestProcessor = (function(self) {
* @param {RedirectRequest} aRequest
*/
function eventuallyShowRedirectNotification(aRequest) {
- var httpResponse = aRequest.httpResponse;
-
- // Check whether the request is associated with a `document` element.
+ // Check if the request corresponds to a top-level document load.
{
- let docShell = httpResponse.docShell;
-
- if (docShell === null) {
- return;
- }
-
- let busyFlags = docShell.busyFlags;
- const expectedFlags = Ci.nsIDocShell.BUSY_FLAGS_BUSY
- | Ci.nsIDocShell.BUSY_FLAGS_BEFORE_PAGE_LOAD;
-
- // The document is loading AND nothing has been received yet.
- let isDocumentRequest = (busyFlags & expectedFlags) === expectedFlags;
-
- if (isDocumentRequest === false) {
- // This is probably a redirect of an "inline" element, e.g. <img>.
- return;
- }
- }
-
- // Check whether it's the top-level document that is being loaded.
- {
- let loadContext = httpResponse.loadContext;
-
- if (loadContext === null) {
- return;
- }
+ let loadFlags = aRequest.httpResponse.httpChannel.loadFlags;
+ let topLevelDocFlag = Ci.nsIChannel.LOAD_INITIAL_DOCUMENT_URI;
- if (loadContext.associatedWindow !== loadContext.topWindow) {
- // this request belongs to a sub-document, e.g. an iframe.
+ if ((loadFlags & topLevelDocFlag) !== topLevelDocFlag) {
return;
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/requestpolicy.git
More information about the Pkg-mozext-commits
mailing list