Bug 546857 Part 4b: Fix some errors in previous patch to not use XUL on error pages. r=dao a=blocker
authorJonas Sicking <jonas@sicking.cc>
Fri, 20 Aug 2010 17:50:35 -0700
changeset 51155 baff7b7b32bc3dd7132cddd3957f6898b5bebfaf
parent 51154 c866e73f32092f8e9299a049e923f64acdfd15a6
child 51157 ee6fb954cbc3de0f76e84cad6bdff452116e1b03
push idunknown
push userunknown
push dateunknown
reviewersdao, blocker
bugs546857
milestone2.0b5pre
Bug 546857 Part 4b: Fix some errors in previous patch to not use XUL on error pages. r=dao a=blocker
browser/base/content/browser.js
browser/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml
browser/locales/en-US/chrome/overrides/netError.dtd
docshell/resources/content/netError.xhtml
dom/locales/en-US/chrome/netErrorApp.dtd
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -2599,21 +2599,16 @@ function BrowserOnClick(event) {
           title,
           value,
           "chrome://global/skin/icons/blacklist_favicon.png",
           notificationBox.PRIORITY_CRITICAL_HIGH,
           buttons
         );
       }
     }
-    else if (/^about:privatebrowsing/.test(errorDoc.documentURI)) {
-      if (ot == errorDoc.getElementById("startPrivateBrowsing")) {
-        gPrivateBrowsingUI.toggleMode();
-      }
-    }
 }
 
 /**
  * Re-direct the browser to a known-safe page.  This function is
  * used when, for example, the user browses to a known malware page
  * and is presented with about:blocked.  The "Get me out of here!"
  * button should take the user to the default start page so that even
  * when their own homepage is infected, we can get them somewhere safe.
--- a/browser/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml
+++ b/browser/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml
@@ -109,16 +109,20 @@
         // Set up the help link
         let moreInfoURL = Cc["@mozilla.org/toolkit/URLFormatterService;1"].
                           getService(Ci.nsIURLFormatter).
                           formatURLPref("app.support.baseURL");
         let moreInfoLink = document.getElementById("moreInfoLink");
         if (moreInfoLink)
           moreInfoLink.setAttribute("href", moreInfoURL + "private-browsing");
       }, false);
+      
+      function togglePrivateBrowsing() {
+        mainWindow.gPrivateBrowsingUI.toggleMode();
+      }
     ]]></script>
   </head>
 
   <body dir="&locale.dir;"
         class="private">
 
     <!-- PAGE CONTAINER (for styling purposes only) -->
     <div id="errorPageContainer">
@@ -140,19 +144,20 @@
 
         <!-- Long Description -->
         <div id="errorLongDesc">
           <p id="errorLongDescText">&privatebrowsingpage.description;</p>
         </div>
 
         <!-- Start Private Browsing -->
         <div id="startPrivateBrowsingDesc" class="showNormal">
-          <button id="startPrivateBrowsing"
+          <button xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+                  id="startPrivateBrowsing" label="&privatebrowsingpage.startPrivateBrowsing.label;"
                   accesskey="&privatebrowsingpage.startPrivateBrowsing.accesskey;"
-                  >&privatebrowsingpage.startPrivateBrowsing.label;</button>
+                  oncommand="togglePrivateBrowsing();"/>
         </div>
 
         <!-- Footer -->
         <div id="footerDesc">
           <p id="footerText" class="showPrivate">&privatebrowsingpage.howToStop;</p>
           <p id="footerTextNormal" class="showNormal">&privatebrowsingpage.howToStart;</p>
         </div>
 
--- a/browser/locales/en-US/chrome/overrides/netError.dtd
+++ b/browser/locales/en-US/chrome/overrides/netError.dtd
@@ -165,19 +165,19 @@ be temporary, and you can try again late
 
 <!ENTITY cspFrameAncestorBlocked.title "Blocked by Content Security Policy">
 <!ENTITY cspFrameAncestorBlocked.longDesc "<p>&brandShortName; prevented this page from loading in this way because the page has a content security policy that disallows it.</p>">
 
 <!ENTITY securityOverride.linkText "Or you can add an exception…">
 <!ENTITY securityOverride.getMeOutOfHereButton "Get me out of here!">
 <!ENTITY securityOverride.exceptionButtonLabel "Add Exception…">
 
-<!-- LOCALIZATION NOTE (securityOverride.warningText) - Do not translate the
-contents of the <xul:button> tags.  The only language content is the label= field,
-which uses strings already defined above. The button is included here (instead of
-netError.xhtml) because it exposes functionality specific to firefox. -->
+<!-- LOCALIZATION NOTE (securityOverride.warningContent) - Do not translate the
+contents of the <button> tags. It uses strings already defined above. The
+button is included here (instead of netError.xhtml) because it exposes
+functionality specific to firefox. -->
 
-<!ENTITY securityOverride.warningText "
+<!ENTITY securityOverride.warningContent "
 <p>You should not add an exception if you are using an internet connection that you do not trust completely or if you are not used to seeing a warning for this server.</p>
 
 <button id='getMeOutOfHereButton'>&securityOverride.getMeOutOfHereButton;</button>
 <button id='exceptionDialogButton'>&securityOverride.exceptionButtonLabel;</button>
 ">
--- a/docshell/resources/content/netError.xhtml
+++ b/docshell/resources/content/netError.xhtml
@@ -364,17 +364,17 @@
 
         <!-- Long Description (Note: See netError.dtd for used XHTML tags) -->
         <div id="errorLongDesc" />
 
         <!-- Override section - For ssl errors only.  Removed on init for other
              error types.  -->
         <div id="securityOverrideDiv">
           <a id="securityOverrideLink" href="javascript:showSecuritySection();" >&securityOverride.linkText;</a>
-          <div id="securityOverrideContent" style="display: none;">&securityOverride.warningText;</div>
+          <div id="securityOverrideContent" style="display: none;">&securityOverride.warningContent;</div>
         </div>
       </div>
 
       <!-- Retry Button -->
       <button id="errorTryAgain" onclick="retryThis(this);">&retry.label;</button>
 
     </div>
 
--- a/dom/locales/en-US/chrome/netErrorApp.dtd
+++ b/dom/locales/en-US/chrome/netErrorApp.dtd
@@ -1,9 +1,9 @@
 <!-- Error messages that are likely to be overridden by applications go in this
      file, all messages that likely don't need to tie into app-specific UI
      should go into netError.dtd -->
 
 <!ENTITY securityOverride.linkText "Or you can add an exception…">
-<!ENTITY securityOverride.warningText "
+<!ENTITY securityOverride.warningContent "
 <p>You should not add an exception if you are using an internet connection that you do not trust completely or if you are not used to seeing a warning for this server.</p>
 <p>If you still wish to add an exception for this site, you can do so in your advanced encryption settings.</p>
 ">