Bug 682944 - Prevent snippets with iframes from breaking about:home. r=gavin
☠☠ backed out by ab8c08dfe9c4 ☠ ☠
authorFrank Yan <fyan@mozilla.com>
Tue, 24 Apr 2012 13:43:38 -0400
changeset 94165 7a5807d68ddc5597f4d87ba6742ad72d596c5149
parent 94164 6aa19c67af2f1fe3878cb200953e5a64541f4eca
child 94166 ab8c08dfe9c4bbe9ea245a6ee011222e0c8de419
push id9504
push userryanvm@gmail.com
push dateThu, 17 May 2012 00:46:10 +0000
treeherdermozilla-inbound@bd69b36934cb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin
bugs682944
milestone15.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 682944 - Prevent snippets with iframes from breaking about:home. r=gavin
browser/base/content/browser.js
browser/components/nsBrowserContentHandler.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -5224,19 +5224,21 @@ var TabsProgressListener = {
     // pages and other similar page. This lets us fix bugs like 401575 which
     // require error page UI to do privileged things, without letting error
     // pages have any privilege themselves.
     // We can't look for this during onLocationChange since at that point the
     // document URI is not yet the about:-uri of the error page.
 
     if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
         Components.isSuccessCode(aStatus) &&
-        /^about:/.test(aWebProgress.DOMWindow.document.documentURI)) {
+        /^about:(?!newtab)/.test(aWebProgress.DOMWindow.document.documentURI)) {
       aBrowser.addEventListener("click", BrowserOnClick, false);
-      aBrowser.addEventListener("pagehide", function onPageHide() {
+      aBrowser.addEventListener("pagehide", function onPageHide(event) {
+        if (aBrowser.contentDocument && event.target != aBrowser.contentDocument)
+          return;
         aBrowser.removeEventListener("click", BrowserOnClick, false);
         aBrowser.removeEventListener("pagehide", onPageHide, true);
       }, true);
 
       // We also want to make changes to page UI for unprivileged about pages.
       BrowserOnAboutPageLoad(aWebProgress.DOMWindow.document);
     }
   },
--- a/browser/components/nsBrowserContentHandler.js
+++ b/browser/components/nsBrowserContentHandler.js
@@ -891,17 +891,17 @@ let AboutHomeUtils = {
       name: defaultEngine.name
     , searchUrl: submission.uri.spec
     }
     this._storage.setItem("search-engine", JSON.stringify(engine));
   },
 
   loadSnippetsURL: function AHU_loadSnippetsURL()
   {
-    const STARTPAGE_VERSION = 2;
+    const STARTPAGE_VERSION = 3;
     let updateURL = Services.prefs
                             .getCharPref(this.SNIPPETS_URL_PREF)
                             .replace("%STARTPAGE_VERSION%", STARTPAGE_VERSION);
     updateURL = Services.urlFormatter.formatURL(updateURL);
     this._storage.setItem("snippets-update-url", updateURL);
   },
 };