Bug 1580348 - Port |Bug 906190 - Persist "disable protection" option for Mixed Content Blocker in child tabs| to SeaMonkey. r=frg DONTBUILD
This commit is contained in:
Родитель
80f21e89a7
Коммит
f6b978c6c1
|
@ -109,10 +109,27 @@ function handleLinkClick(event, href, linkNode) {
|
|||
return true;
|
||||
}
|
||||
|
||||
var referrerURI = doc.documentURIObject;
|
||||
// if the mixedContentChannel is present and the referring URI passes
|
||||
// a same origin check with the target URI, we can preserve the users
|
||||
// decision of disabling MCB on a page for it's child tabs.
|
||||
var persistAllowMixedContentInChildTab = false;
|
||||
|
||||
if (where == "tab" && getBrowser().docShell.mixedContentChannel) {
|
||||
const sm = Services.scriptSecurityManager;
|
||||
try {
|
||||
var targetURI = makeURI(href);
|
||||
sm.checkSameOriginURI(referrerURI, targetURI, false);
|
||||
persistAllowMixedContentInChildTab = true;
|
||||
}
|
||||
catch (e) { }
|
||||
}
|
||||
|
||||
urlSecurityCheck(href, doc.nodePrincipal);
|
||||
openLinkIn(href, where, { referrerURI: doc.documentURIObject,
|
||||
openLinkIn(href, where, { referrerURI: referrerURI,
|
||||
charset: doc.characterSet,
|
||||
private: gPrivate ? true : false });
|
||||
private: gPrivate ? true : false,
|
||||
allowMixedContent: persistAllowMixedContentInChildTab });
|
||||
event.preventDefault();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -978,10 +978,28 @@ nsContextMenu.prototype = {
|
|||
openLinkInTab: function(aEvent) {
|
||||
var doc = this.target.ownerDocument;
|
||||
urlSecurityCheck(this.linkURL, doc.nodePrincipal);
|
||||
var referrerURI = doc.documentURIObject;
|
||||
|
||||
// if the mixedContentChannel is present and the referring URI passes
|
||||
// a same origin check with the target URI, we can preserve the users
|
||||
// decision of disabling MCB on a page for it's child tabs.
|
||||
var persistAllowMixedContentInChildTab = false;
|
||||
|
||||
if (this.browser.docShell.mixedContentChannel) {
|
||||
const sm = Services.scriptSecurityManager;
|
||||
try {
|
||||
var targetURI = this.linkURI;
|
||||
sm.checkSameOriginURI(referrerURI, targetURI, false);
|
||||
persistAllowMixedContentInChildTab = true;
|
||||
}
|
||||
catch (e) { }
|
||||
}
|
||||
|
||||
openLinkIn(this.linkURL,
|
||||
aEvent && aEvent.shiftKey ? "tabshifted" : "tab",
|
||||
{ charset: doc.characterSet,
|
||||
referrerURI: doc.documentURIObject });
|
||||
referrerURI: referrerURI,
|
||||
allowMixedContent: persistAllowMixedContentInChildTab });
|
||||
},
|
||||
|
||||
// Open linked-to URL in a new window.
|
||||
|
|
|
@ -1483,6 +1483,7 @@ function openLinkIn(url, where, params)
|
|||
var aReferrerPolicy = ("referrerPolicy" in params ?
|
||||
params.referrerPolicy : Ci.nsIHttpChannel.REFERRER_POLICY_UNSET);
|
||||
var aRelatedToCurrent = params.relatedToCurrent;
|
||||
var aAllowMixedContent = params.allowMixedContent;
|
||||
var aInBackground = params.inBackground;
|
||||
var aDisallowInheritPrincipal = params.disallowInheritPrincipal;
|
||||
var aInitiatingDoc = params.initiatingDoc ? params.initiatingDoc : document;
|
||||
|
@ -1627,6 +1628,7 @@ function openLinkIn(url, where, params)
|
|||
postData: aPostData,
|
||||
allowThirdPartyFixup: aAllowThirdPartyFixup,
|
||||
relatedToCurrent: aRelatedToCurrent,
|
||||
allowMixedContent: aAllowMixedContent,
|
||||
userContextId: aUserContextId,
|
||||
originPrincipal: aPrincipal,
|
||||
triggeringPrincipal: aTriggeringPrincipal,
|
||||
|
|
|
@ -1413,6 +1413,7 @@
|
|||
postData: aPostData,
|
||||
inBackground: aLoadInBackground,
|
||||
allowThirdPartyFixup: aAllowThirdPartyFixup,
|
||||
allowMixedContent: false,
|
||||
userContextId: null,
|
||||
opener: null,
|
||||
};
|
||||
|
@ -1534,6 +1535,7 @@
|
|||
var aReferrerPolicy;
|
||||
var aFromExternal;
|
||||
var aRelatedToCurrent;
|
||||
var aAllowMixedContent;
|
||||
var aUserContextId;
|
||||
var aOpener;
|
||||
if (arguments.length == 2 &&
|
||||
|
@ -1550,6 +1552,7 @@
|
|||
aAllowThirdPartyFixup = params.allowThirdPartyFixup;
|
||||
aFromExternal = params.fromExternal;
|
||||
aRelatedToCurrent = params.relatedToCurrent;
|
||||
aAllowMixedContent = params.allowMixedContent;
|
||||
aUserContextId = params.userContextId;
|
||||
aOpener = params.opener;
|
||||
}
|
||||
|
@ -1628,13 +1631,14 @@
|
|||
// the document successfully loads
|
||||
b.userTypedValue = aURI;
|
||||
|
||||
let nsIWebNavigation = Ci.nsIWebNavigation;
|
||||
let flags = nsIWebNavigation.LOAD_FLAGS_NONE;
|
||||
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
|
||||
if (aAllowThirdPartyFixup)
|
||||
flags = nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
|
||||
nsIWebNavigation.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
|
||||
flags = Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
|
||||
Ci.nsIWebNavigation.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
|
||||
if (aFromExternal)
|
||||
flags |= nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL;
|
||||
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL;
|
||||
if (aAllowMixedContent)
|
||||
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_MIXED_CONTENT;
|
||||
try {
|
||||
b.loadURIWithFlags(aURI, {
|
||||
flags,
|
||||
|
|
Загрузка…
Ссылка в новой задаче