Index: lib/child/contentPolicy.js |
=================================================================== |
--- a/lib/child/contentPolicy.js |
+++ b/lib/child/contentPolicy.js |
@@ -306,43 +306,46 @@ var PolicyImplementation = |
shouldProcess: function(contentType, contentLocation, requestOrigin, insecNode, mimeType, extra) |
{ |
return Ci.nsIContentPolicy.ACCEPT; |
}, |
// |
// nsIObserver interface implementation |
// |
- observe: function(subject, topic, data, additional) |
+ observe: function(subject, topic, data, uri, opener) |
{ |
switch (topic) |
{ |
case "content-document-global-created": |
{ |
- if (!(subject instanceof Ci.nsIDOMWindow) || !subject.opener) |
+ if (!opener && subject instanceof Ci.nsIDOMWindow) |
+ opener = subject.opener; |
+ if (!opener) |
return; |
- let uri = additional || subject.location.href; |
- if (!shouldAllow(subject.opener, subject.opener.document, "POPUP", uri)) |
+ if (!uri && subject instanceof Ci.nsIDOMWindow) |
+ uri = subject.location.href; |
+ if (!shouldAllow(opener, opener.document, "POPUP", uri)) |
{ |
subject.stop(); |
Utils.runAsync(() => subject.close()); |
} |
else if (uri == "about:blank") |
{ |
// An about:blank pop-up most likely means that a load will be |
// initiated asynchronously. Wait for that. |
Utils.runAsync(() => |
{ |
let channel = subject.QueryInterface(Ci.nsIInterfaceRequestor) |
.getInterface(Ci.nsIDocShell) |
.QueryInterface(Ci.nsIDocumentLoader) |
.documentChannel; |
if (channel) |
- this.observe(subject, topic, data, channel.URI.spec); |
+ this.observe(subject, topic, data, channel.URI.spec, opener); |
}); |
} |
break; |
} |
} |
}, |
// |