Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/contentPolicy.js

Issue 29329396: Issue 3208 - Improve the approach used to detect pop-up URL (Closed)
Patch Set: Created Oct. 26, 2015, 8:11 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/contentPolicy.js
===================================================================
--- a/lib/contentPolicy.js
+++ b/lib/contentPolicy.js
@@ -478,22 +478,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;
+ // initiated asynchronously. Wait for that.
Utils.runAsync(function()
{
- 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.spec);
});
}
break;
}
case "http-on-opening-request":
case "http-on-modify-request":
{
if (!(subject instanceof Ci.nsIHttpChannel))
@@ -502,28 +505,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
//
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld