Index: lib/contentPolicy.js |
=================================================================== |
--- a/lib/contentPolicy.js |
+++ b/lib/contentPolicy.js |
@@ -476,22 +476,25 @@ var PolicyImplementation = |
if (!Policy.processNode(subject.opener, subject.opener.document, Policy.type.POPUP, uri, false)) |
{ |
subject.stop(); |
Utils.runAsync(() => subject.close()); |
} |
else if (uri.spec == "about:blank") |
{ |
// An about:blank pop-up most likely means that a load will be |
- // initiated synchronously. Set a flag for our "http-on-opening-request" |
- // handler. |
- this.expectingPopupLoad = true; |
- Utils.runAsync(function() |
+ // initiated asynchronously. Wait for that. |
+ Utils.runAsync(() => |
{ |
- this.expectingPopupLoad = false; |
+ let channel = subject.QueryInterface(Ci.nsIInterfaceRequestor) |
+ .getInterface(Ci.nsIDocShell) |
+ .QueryInterface(Ci.nsIDocumentLoader) |
+ .documentChannel; |
+ if (channel) |
+ this.observe(subject, topic, data, channel.URI); |
}); |
} |
break; |
} |
case "http-on-opening-request": |
case "http-on-modify-request": |
{ |
if (!(subject instanceof Ci.nsIHttpChannel)) |
@@ -500,28 +503,16 @@ var PolicyImplementation = |
if (this.previousRequest && subject.URI == this.previousRequest[0] && |
subject instanceof Ci.nsIWritablePropertyBag) |
{ |
// We just handled a content policy call for this request - associate |
// the data with the channel so that we can find it in case of a redirect. |
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; |
} |
} |
}, |
// |
// nsIChannelEventSink interface implementation |
// |