Bug 1093642 - Part 2: Decide if we allow mixed content before sending click event to remote tab. r=tanvi.

This commit is contained in:
Henry Chang 2016-04-21 11:07:40 +08:00
parent c4d1435e06
commit a516550b03
2 changed files with 19 additions and 1 deletions

View File

@ -406,6 +406,22 @@ var ClickEventHandler = {
}
json.noReferrer = BrowserUtils.linkHasNoReferrer(node)
// Check if the link needs to be opened with mixed content allowed.
// Only when the owner doc has |mixedContentChannel| and the same origin
// should we allow mixed content.
json.allowMixedContent = false;
let docshell = ownerDoc.defaultView.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell);
if (docShell.mixedContentChannel) {
const sm = Services.scriptSecurityManager;
try {
let targetURI = BrowserUtils.makeURI(href);
sm.checkSameOriginURI(docshell.mixedContentChannel.URI, targetURI, false);
json.allowMixedContent = true;
} catch (e) {}
}
sendAsyncMessage("Content:Click", json);
return;
}

View File

@ -80,7 +80,9 @@ var ContentClick = {
let params = { charset: browser.characterSet,
referrerURI: browser.documentURI,
referrerPolicy: json.referrerPolicy,
noReferrer: json.noReferrer };
noReferrer: json.noReferrer,
allowMixedContent: json.allowMixedContent };
window.openLinkIn(json.href, where, params);
}
};