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

Unified Diff: lib/contentPolicy.js

Issue 29329404: Issue 443 - Fix blocking pop-ups after redirect (Closed)
Patch Set: Created Oct. 26, 2015, 8:28 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
@@ -546,20 +546,24 @@ var PolicyImplementation =
} catch(e2) {}
if (!newLocation)
return;
let wnd = Utils.getRequestWindow(newChannel);
if (!wnd)
return;
- if (contentType == Policy.type.POPUP && wnd.opener)
+ if (contentType == Ci.nsIContentPolicy.TYPE_DOCUMENT)
Wladimir Palant 2015/10/26 20:50:26 This relies on the changes from https://codereview
{
- // Popups are initiated by their opener, not their own window.
- wnd = wnd.opener;
+ if (wnd.history.length <= 1 && wnd.opener)
+ {
+ // Special treatment for pop-up windows
+ this.observe(wnd, "content-document-global-created", null, newLocation);
+ }
+ return;
}
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.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld