Bug 569342: Find bar should not be enabled in about:addons. r=gavin, a=blocks-final
authorDave Townsend <dtownsend@oxymoronical.com>
Tue, 11 Jan 2011 13:33:51 -0800
changeset 60323 e2e5b5e57ca4a13c913c4aba789567ebf16fb6ec
parent 60322 bddac4e2bf745c8389c383f0ea3b2a54d887f4bd
child 60324 58d9f36e3a49ee93cf307ebeaaffe7a4fe005c17
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin, blocks-final
bugs569342
milestone2.0b10pre
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 569342: Find bar should not be enabled in about:addons. r=gavin, a=blocks-final
browser/base/content/test/Makefile.in
browser/base/content/test/browser_zbug569342.js
toolkit/components/viewconfig/content/config.xul
toolkit/content/widgets/findbar.xml
toolkit/mozapps/extensions/content/extensions.xul
--- a/browser/base/content/test/Makefile.in
+++ b/browser/base/content/test/Makefile.in
@@ -141,16 +141,17 @@ endif
                  browser_bug555767.js \
                  browser_bug556061.js \
                  browser_bug559991.js \
                  browser_bug561623.js \
                  browser_bug561636.js \
                  browser_bug562649.js \
                  browser_bug563588.js \
                  browser_bug565575.js \
+                 browser_zbug569342.js \
                  browser_bug575561.js \
                  browser_bug577121.js \
                  browser_bug579872.js \
                  browser_bug580956.js \
                  browser_bug581242.js \
                  browser_bug581253.js \
                  browser_bug581947.js \
                  browser_bug585785.js \
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/browser_zbug569342.js
@@ -0,0 +1,48 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+var gTab = null;
+
+function cleanUp() {
+  gBrowser.removeTab(gTab);
+  finish();
+}
+
+// function borrowed from browser_bug386835.js
+function load(tab, url, cb) {
+  tab.linkedBrowser.addEventListener("load", function (event) {
+    event.currentTarget.removeEventListener("load", arguments.callee, true);
+    cb();
+  }, true);
+  tab.linkedBrowser.loadURI(url);
+}
+
+function test() {
+  waitForExplicitFinish();
+
+  gTab = gBrowser.selectedTab = gBrowser.addTab();
+  ok(gFindBar.hidden, "Find bar should not be visible");
+
+  run_test_1();
+}
+
+function run_test_1() {
+  load(gTab, "about:config", function() {
+    ok(gFindBar.hidden, "Find bar should not be visible");
+    EventUtils.synthesizeKey("/", {}, gTab.linkedBrowser.contentWindow);
+    ok(gFindBar.hidden, "Find bar should not be visible");
+
+    run_test_2();
+  });
+}
+
+function run_test_2() {
+  load(gTab, "about:addons", function() {
+    ok(gFindBar.hidden, "Find bar should not be visible");
+    EventUtils.synthesizeKey("/", {}, gTab.linkedBrowser.contentWindow);
+    ok(gFindBar.hidden, "Find bar should not be visible");
+
+    cleanUp();
+  });
+}
--- a/toolkit/components/viewconfig/content/config.xul
+++ b/toolkit/components/viewconfig/content/config.xul
@@ -44,16 +44,17 @@
 
 <window id="config"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 
         title="&window.title;"
         windowtype="Preferences:ConfigManager"
         role="application"
         width="750"
         height="500"
+        disablefastfind="true"
         onunload="onConfigUnload();"
         onload="onConfigLoad();">
 
 <script src="chrome://global/content/config.js"/>
 
 <stringbundle id="configBundle" src="chrome://global/locale/config.properties"/>
 
 <menupopup id="configContext" onpopupshowing="if (event.target == this) updateContextMenu();">
--- a/toolkit/content/widgets/findbar.xml
+++ b/toolkit/content/widgets/findbar.xml
@@ -1355,20 +1355,25 @@
                 elt instanceof HTMLEmbedElement)
               return false;
           }
 
           var win = document.commandDispatcher.focusedWindow;
           if (win && !this._mimeTypeIsTextBased(win.document.contentType))
               return false;
 
-          // disable FAYT in about:config and about:blank to prevent FAYT
-          // opening unexpectedly - to fix bugs 264562, 267150, 269712
-          var url = this.browser.currentURI.spec;
-          if (url == "about:blank" || url == "about:config")
+          // disable FAYT in about:blank to prevent FAYT opening unexpectedly.
+          var url = this.browser.currentURI;
+          if (url.spec == "about:blank")
+            return false;
+
+          // disable FAYT in documents that ask for it to be disabled.
+          if ((url.schemeIs("about") || url.schemeIs("chrome")) &&
+              (win.document.documentElement &&
+               win.document.documentElement.getAttribute("disablefastfind") == "true"))
             return false;
 
           if (win) {
             try {
               var editingSession = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
                                    .getInterface(Components.interfaces.nsIWebNavigation)
                                    .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
                                    .getInterface(Components.interfaces.nsIEditingSession);
--- a/toolkit/mozapps/extensions/content/extensions.xul
+++ b/toolkit/mozapps/extensions/content/extensions.xul
@@ -46,17 +46,17 @@
 %brandDTD;
 <!ENTITY % extensionsDTD SYSTEM "chrome://mozapps/locale/extensions/extensions.dtd">
 %extensionsDTD;
 ]>
 
 <page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
       xmlns:xhtml="http://www.w3.org/1999/xhtml"
       id="addons-page" title="&addons.windowTitle;" disablechrome="true"
-      role="application" windowtype="Addons:Manager"
+      role="application" windowtype="Addons:Manager" disablefastfind="true"
       ondragenter="gDragDrop.onDragOver(event)"
       ondragover="gDragDrop.onDragOver(event)"
       ondrop="gDragDrop.onDrop(event)">
 
   <xhtml:link rel="shortcut icon"
               href="chrome://mozapps/skin/extensions/extensionGeneric-16.png"/>
 
   <script type="application/javascript"