| 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. |