Bug 1269238 - allow text-links to use origin principals for link opening checks, r?mikedeboer
MozReview-Commit-ID: HPWxEyNEsps
--- a/browser/base/content/aboutDialog.xul
+++ b/browser/base/content/aboutDialog.xul
@@ -124,32 +124,32 @@
<vbox id="experimental" hidden="true">
<description class="text-blurb" id="warningDesc">
&warningDesc.version;
#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
&warningDesc.telemetryDesc;
#endif
</description>
<description class="text-blurb" id="communityExperimentalDesc">
- &community.exp.start;<label class="text-link" href="http://www.mozilla.org/">&community.exp.mozillaLink;</label>&community.exp.middle;<label class="text-link" href="about:credits">&community.exp.creditsLink;</label>&community.exp.end;
+ &community.exp.start;<label class="text-link" href="http://www.mozilla.org/">&community.exp.mozillaLink;</label>&community.exp.middle;<label class="text-link" useoriginprincipal="true" href="about:credits">&community.exp.creditsLink;</label>&community.exp.end;
</description>
</vbox>
<description class="text-blurb" id="communityDesc">
- &community.start2;<label class="text-link" href="http://www.mozilla.org/">&community.mozillaLink;</label>&community.middle2;<label class="text-link" href="about:credits">&community.creditsLink;</label>&community.end3;
+ &community.start2;<label class="text-link" href="http://www.mozilla.org/">&community.mozillaLink;</label>&community.middle2;<label class="text-link" useoriginprincipal="true" href="about:credits">&community.creditsLink;</label>&community.end3;
</description>
<description class="text-blurb" id="contributeDesc">
&helpus.start;<label class="text-link" href="https://sendto.mozilla.org/page/contribute/Give-Now?source=mozillaorg_default_footer&ref=firefox_about&utm_campaign=firefox_about&tm_source=firefox&tm_medium=referral&utm_content=20140929_FireFoxAbout">&helpus.donateLink;</label>&helpus.middle;<label class="text-link" href="http://www.mozilla.org/contribute/">&helpus.getInvolvedLink;</label>&helpus.end;
</description>
</vbox>
</vbox>
</hbox>
<vbox id="bottomBox">
<hbox pack="center">
- <label class="text-link bottom-link" href="about:license">&bottomLinks.license;</label>
- <label class="text-link bottom-link" href="about:rights">&bottomLinks.rights;</label>
+ <label class="text-link bottom-link" useoriginprincipal="true" href="about:license">&bottomLinks.license;</label>
+ <label class="text-link bottom-link" useoriginprincipal="true" href="about:rights">&bottomLinks.rights;</label>
<label class="text-link bottom-link" href="https://www.mozilla.org/privacy/">&bottomLinks.privacy;</label>
</hbox>
<description id="trademark">&trademarkInfo.part1;</description>
</vbox>
</vbox>
<keyset>
<key keycode="VK_ESCAPE" oncommand="window.close();"/>
--- a/toolkit/content/widgets/text.xml
+++ b/toolkit/content/widgets/text.xml
@@ -309,20 +309,25 @@
.getService(nsISSM);
const ioService =
Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
uri = ioService.newURI(href, null, null);
- var nullPrincipal = secMan.createNullPrincipal({});
+ var principal;
+ if (this.getAttribute("useoriginprincipal") == "true") {
+ principal = this.nodePrincipal;
+ } else {
+ principal = secMan.createNullPrincipal({});
+ }
try {
- secMan.checkLoadURIWithPrincipal(nullPrincipal, uri,
- nsISSM.DISALLOW_INHERIT_PRINCIPAL)
+ secMan.checkLoadURIWithPrincipal(principal, uri,
+ nsISSM.DISALLOW_INHERIT_PRINCIPAL);
}
catch (ex) {
var msg = "Error: Cannot open a " + uri.scheme + ": link using \
the text-link binding.";
Components.utils.reportError(msg);
return;
}