Backout |Bug 567306 - Find command(ctrl+F) does not start looking for it with a selected text on the actual page.| due to Linux Mo(oth) and Linux64 Mo(oth) test failures.
authorJustin Wood <Callek@gmail.com>
Fri, 04 Jun 2010 21:59:40 -0400
changeset 43112 28086cf6ede84358c8d4a05be6596594a0853e5f
parent 43111 ba82b6ecb9ce7211536377aadd5754bdf37d4854
child 43113 d8dc49d5bd609668b3c4fadd6c1df12d5da20547
child 43144 2d90590dabe63ad9d6323376e6a1138add81e1cb
push id13625
push userCallek@gmail.com
push dateSat, 05 Jun 2010 02:02:21 +0000
treeherdermozilla-central@63b89b311461 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs567306
milestone1.9.3a5pre
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
Backout |Bug 567306 - Find command(ctrl+F) does not start looking for it with a selected text on the actual page.| due to Linux Mo(oth) and Linux64 Mo(oth) test failures.
browser/base/content/browser.js
browser/base/content/test/Makefile.in
browser/base/content/test/browser_bug567306.js
browser/base/content/test/browser_typeAheadFind.js
toolkit/content/widgets/findbar.xml
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -108,24 +108,24 @@ var gEditUIVisible = true;
 });
 
 // Smart getter for the findbar.  If you don't wish to force the creation of
 // the findbar, check gFindBarInitialized first.
 var gFindBarInitialized = false;
 XPCOMUtils.defineLazyGetter(window, "gFindBar", function() {
   let XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
   let findbar = document.createElementNS(XULNS, "findbar");
+  findbar.setAttribute("browserid", "content");
   findbar.id = "FindToolbar";
 
   let browserBottomBox = document.getElementById("browser-bottombox");
   browserBottomBox.insertBefore(findbar, browserBottomBox.firstChild);
 
   // Force a style flush to ensure that our binding is attached.
   findbar.clientTop;
-  findbar.browser = gBrowser;
   window.gFindBarInitialized = true;
   return findbar;
 });
 
 __defineGetter__("gPrefService", function() {
   delete this.gPrefService;
   return this.gPrefService = Services.prefs;
 });
--- a/browser/base/content/test/Makefile.in
+++ b/browser/base/content/test/Makefile.in
@@ -78,17 +78,16 @@ include $(topsrcdir)/config/rules.mk
 #   browser_sanitize-download-history.js is bug 432425
 #
 # browser_sanitizeDialog_treeView.js is disabled until the tree view is added
 # back to the clear recent history dialog (santize.xul), if it ever is (bug
 # 480169)
 
 _BROWSER_FILES = \
                  browser_typeAheadFind.js \
-                 browser_bug567306.js \
                  browser_NetworkPrioritizer.js \
                  browser_allTabsPanel.js \
                  browser_alltabslistener.js \
                  browser_bug304198.js \
                  browser_bug321000.js \
                  title_test.svg \
                  browser_bug329212.js \
                  browser_bug356571.js \
deleted file mode 100644
--- a/browser/base/content/test/browser_bug567306.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-let testWindow = null;
-function test() {
-  waitForExplicitFinish();
-  testWindow = OpenBrowserWindow();
-  testWindow.addEventListener("load", function() {
-    testWindow.removeEventListener("load", arguments.callee, true);
-    executeSoon(function() {
-      ok(true, "Load listener called");
-      testWindow.gBrowser.selectedBrowser.addEventListener("pageshow", function () {
-        ok(true, "Pageshow listener called");
-        testWindow.gBrowser.selectedBrowser.removeEventListener("pageshow", arguments.callee, false);
-        waitForFocus(onFocus, testWindow.content);
-      }, true);
-      testWindow.content.location = "data:text/html,<h1 id='h1'>Select Me</h1>";
-    });
-  }, false);
-}
-
-function selectText() {
-  let elt = testWindow.content.document.getElementById("h1");
-  let selection = testWindow.content.getSelection();
-  let range = testWindow.content.document.createRange();
-  range.setStart(elt, 0);
-  range.setEnd(elt, 1);
-  selection.removeAllRanges();
-  selection.addRange(range);
-}
-
-
-function onFocus() {
-  ok(!testWindow.gFindBarInitialized, "find bar is not yet initialized");
-  selectText();
-  testWindow.gFindBar.onFindCommand();
-  ok(testWindow.gFindBar._findField.value == "Select Me", "Findbar is initialized with selection");
-  testWindow.gFindBar.close();
-  testWindow.close();
-  finish();
-}
--- a/browser/base/content/test/browser_typeAheadFind.js
+++ b/browser/base/content/test/browser_typeAheadFind.js
@@ -1,30 +1,60 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is typeaheadfind test code.
+ *
+ * The Initial Developer of the Original Code is
+ * the Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *  Gavin Sharp <gavin@gavinsharp.com> (Original Author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
 
-let testWindow = null;
 function test() {
   waitForExplicitFinish();
-  testWindow = OpenBrowserWindow();
-  testWindow.addEventListener("load", function() {
-    testWindow.removeEventListener("load", arguments.callee, true);
+  ok(!gFindBarInitialized, "find bar is not yet initialized");
+
+  let tab = gBrowser.addTab();
+  gBrowser.selectedTab = tab;
+  tab.linkedBrowser.addEventListener("load", function(aEvent) {
+    tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
+
     ok(true, "Load listener called");
-    executeSoon(function() {
-      ok(!testWindow.gFindBarInitialized, "find bar is not yet initialized");
-      testWindow.gBrowser.selectedBrowser.addEventListener("pageshow", function () {
-        ok(true, "Pageshow listener called");
-        testWindow.gBrowser.selectedBrowser.removeEventListener("pageshow", arguments.callee, false);
-        waitForFocus(onFocus, testWindow.content);
-      }, true);
-      testWindow.content.location = "data:text/html,<h1>A Page</h1>";
-    });
-  }, false);
+    waitForFocus(onFocus, content);
+  }, true);
+
+  content.location = "data:text/html,<h1>A Page</h1>";
 }
 
 function onFocus() {
   EventUtils.synthesizeKey("/", {});
-  ok(testWindow.gFindBarInitialized, "find bar is now initialized");
-  testWindow.gFindBar.close();
-  testWindow.close();
+  ok(gFindBarInitialized, "find bar is now initialized");
+  gFindBar.close();
+  gBrowser.removeCurrentTab();
   finish();
 }
--- a/toolkit/content/widgets/findbar.xml
+++ b/toolkit/content/widgets/findbar.xml
@@ -399,18 +399,17 @@
         this.nsITypeAheadFind = Components.interfaces.nsITypeAheadFind;
         this.nsISelectionController = Components.interfaces.nsISelectionController;
         this._findSelection = this.nsISelectionController.SELECTION_FIND;
 
         this._findResetTimeout = -1;
 
         // Make sure the FAYT keypress listener is attached by initializing the
         // browser property
-        if (this.getAttribute("browserid"))
-          setTimeout(function(aSelf) { aSelf.browser = aSelf.browser; }, 0, this);
+        setTimeout(function(aSelf) { aSelf.browser = aSelf.browser; }, 0, this);
       ]]></constructor>
 
       <destructor><![CDATA[
         this.destroy();
       ]]></destructor>
 
       <!-- This is necessary because the destructor isn't called when
            we are removed from a document that is not destroyed. This