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

Unified Diff: lib/contentPolicy.js

Issue 5748752404971520: Issue 341 - Pop-up blocking fails if the pop-up URL redirects (Closed)
Patch Set: Created April 16, 2014, 2:49 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
@@ -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);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld