Bug 1269238 - allow text-links to use origin principals for link opening checks, r=mikedeboer
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Fri, 06 May 2016 10:05:47 +0100
changeset 296588 8deb0d7312e5688d4a2e8cb7837b1a9bca2f9006
parent 296587 8fe0095972a5f19d2c078e218d44631c75a4fd7e
child 296589 ab8ae2c23df566acee8cbeb64e5164fae8a10b0e
push id30244
push usercbook@mozilla.com
push dateTue, 10 May 2016 10:03:11 +0000
treeherdermozilla-central@1522462dc620 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer
bugs1269238
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1269238 - allow text-links to use origin principals for link opening checks, r=mikedeboer MozReview-Commit-ID: HPWxEyNEsps
browser/base/content/aboutDialog.xul
toolkit/content/widgets/text.xml
--- 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&#38;ref=firefox_about&#38;utm_campaign=firefox_about&#38;tm_source=firefox&#38;tm_medium=referral&#38;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({});
+            let 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;
             }