Index: lib/contentPolicy.js |
=================================================================== |
--- a/lib/contentPolicy.js |
+++ b/lib/contentPolicy.js |
@@ -509,17 +509,21 @@ let PolicyImplementation = |
subject.setProperty("abpRequestType", this.previousRequest[1]); |
this.previousRequest = null; |
} |
if (this.expectingPopupLoad) |
{ |
let wnd = Utils.getRequestWindow(subject); |
if (wnd && wnd.opener && wnd.location.href == "about:blank") |
+ { |
this.observe(wnd, "content-document-global-created", null, subject.URI); |
+ if (subject instanceof Ci.nsIWritablePropertyBag) |
+ subject.setProperty("abpRequestType", Policy.type.POPUP); |
+ } |
} |
break; |
} |
case "xpcom-category-entry-removed": |
case "xpcom-category-cleared": |
{ |
let category = data; |
@@ -579,16 +583,22 @@ let PolicyImplementation = |
if (contentType == Policy.type.SUBDOCUMENT && wnd.parent == wnd.top && wnd.opener) |
{ |
// This is a window opened in a new tab miscategorized as frame load, |
// see bug 467514. Get the frame as context to be at least consistent. |
wnd = wnd.opener; |
} |
+ if (contentType == Policy.type.POPUP && wnd.opener) |
+ { |
+ // Popups are initiated by their opener, not their own window. |
+ wnd = wnd.opener; |
+ } |
+ |
if (!Policy.processNode(wnd, wnd.document, contentType, newLocation, false)) |
result = Cr.NS_BINDING_ABORTED; |
} |
catch (e) |
{ |
// We shouldn't throw exceptions here - this will prevent the redirect. |
Cu.reportError(e); |
} |