| Index: lib/contentPolicy.js |
| =================================================================== |
| --- a/lib/contentPolicy.js |
| +++ b/lib/contentPolicy.js |
| @@ -491,35 +491,34 @@ var PolicyImplementation = |
| { |
| // nsILoadInfo.contentPolicyType was introduced in Gecko 35, then |
| // renamed to nsILoadInfo.externalContentPolicyType in Gecko 44. |
| let loadInfo = oldChannel.loadInfo; |
| let contentType = loadInfo.externalContentPolicyType || loadInfo.contentPolicyType; |
| if (!contentType) |
| return; |
| - let newLocation = null; |
| - try |
| - { |
| - newLocation = newChannel.URI; |
| - } 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) |
| { |
| - // 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. Note that we might not have |
| + // seen the original channel yet because the redirect happened before |
| + // the async code in observe() had a chance to run. |
| + this.observe(wnd, "content-document-global-created", null, oldChannel.URI); |
| + this.observe(wnd, "content-document-global-created", null, newChannel.URI); |
| + } |
|
tschuster
2015/11/05 15:27:18
I think your comment about this patch set would he
Wladimir Palant
2015/11/05 15:51:59
Done.
|
| + return; |
| } |
| - if (!Policy.processNode(wnd, wnd.document, contentType, newLocation, false)) |
| + if (!Policy.processNode(wnd, wnd.document, contentType, newChannel.URI, false)) |
| result = Cr.NS_BINDING_ABORTED; |
| } |
| catch (e) |
| { |
| // We shouldn't throw exceptions here - this will prevent the redirect. |
| Cu.reportError(e); |
| } |
| finally |