From 0adc8ded6e9212e271b2552e10c5eb5c6fa366f4 Mon Sep 17 00:00:00 2001 From: Wes Kocher Date: Wed, 8 Jun 2016 14:53:57 -0700 Subject: [PATCH] Backed out 6 changesets (bug 384458) for frequent browser_FinderHighlighter.js failures Backed out changeset ded915ec401f (bug 384458) Backed out changeset 63ec66da50fa (bug 384458) Backed out changeset ae71396d3be0 (bug 384458) Backed out changeset 3b025cbfbe3c (bug 384458) Backed out changeset 091c5465acf7 (bug 384458) Backed out changeset 5eabde153def (bug 384458) --- browser/app/profile/firefox.js | 2 - .../mochitest/browserElement_Find.js | 18 +- modules/libpref/init/all.js | 6 +- testing/profiles/prefs_general.js | 2 - toolkit/content/tests/browser/browser.ini | 1 - .../tests/browser/browser_bug451286.js | 16 - .../content/tests/chrome/bug360437_window.xul | 41 +- toolkit/content/widgets/browser.xml | 1 + toolkit/content/widgets/editor.xml | 1 + toolkit/content/widgets/findbar.xml | 110 +- toolkit/modules/Finder.jsm | 500 ++++++-- toolkit/modules/FinderHighlighter.jsm | 1062 ----------------- toolkit/modules/RemoteFinder.jsm | 39 +- toolkit/modules/moz.build | 1 - toolkit/modules/tests/browser/browser.ini | 2 - .../browser/browser_FinderHighlighter.js | 188 --- widget/nsXPLookAndFeel.cpp | 9 - widget/nsXPLookAndFeel.h | 1 - 18 files changed, 481 insertions(+), 1519 deletions(-) delete mode 100644 toolkit/modules/FinderHighlighter.jsm delete mode 100644 toolkit/modules/tests/browser/browser_FinderHighlighter.js diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 498aed3ce3bf..e59f98ba82a1 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -614,8 +614,6 @@ pref("accessibility.typeaheadfind", false); pref("accessibility.typeaheadfind.timeout", 5000); pref("accessibility.typeaheadfind.linksonly", false); pref("accessibility.typeaheadfind.flashBar", 1); -pref("findbar.highlightAll", true); -pref("findbar.modalHighlight", true); // Tracks when accessibility is loaded into the previous session. pref("accessibility.loadedInLastSession", false); diff --git a/dom/browser-element/mochitest/browserElement_Find.js b/dom/browser-element/mochitest/browserElement_Find.js index 03eef4385552..2ab378ff1884 100644 --- a/dom/browser-element/mochitest/browserElement_Find.js +++ b/dom/browser-element/mochitest/browserElement_Find.js @@ -37,7 +37,7 @@ function runTest() { msg_name: "findchange", active: true, searchString: 'foo', - searchLimit: 1000, + searchLimit: 100, activeMatchOrdinal: 1, numberOfMatches: 5, }), `test ${testCount++}`); @@ -48,7 +48,7 @@ function runTest() { msg_name: "findchange", active: true, searchString: 'foo', - searchLimit: 1000, + searchLimit: 100, activeMatchOrdinal: 2, numberOfMatches: 5, }), `test ${testCount++}`); @@ -59,7 +59,7 @@ function runTest() { msg_name: "findchange", active: true, searchString: 'foo', - searchLimit: 1000, + searchLimit: 100, activeMatchOrdinal: 1, numberOfMatches: 5, }), `test ${testCount++}`); @@ -70,7 +70,7 @@ function runTest() { msg_name: "findchange", active: true, searchString: 'xxx', - searchLimit: 1000, + searchLimit: 100, activeMatchOrdinal: 0, numberOfMatches: 0, }), `test ${testCount++}`); @@ -81,7 +81,7 @@ function runTest() { msg_name: "findchange", active: true, searchString: 'bar', - searchLimit: 1000, + searchLimit: 100, activeMatchOrdinal: 1, numberOfMatches: 4, }), `test ${testCount++}`); @@ -92,7 +92,7 @@ function runTest() { msg_name: "findchange", active: true, searchString: 'bar', - searchLimit: 1000, + searchLimit: 100, activeMatchOrdinal: 2, numberOfMatches: 4, }), `test ${testCount++}`); @@ -103,7 +103,7 @@ function runTest() { msg_name: "findchange", active: true, searchString: 'bar', - searchLimit: 1000, + searchLimit: 100, activeMatchOrdinal: 3, numberOfMatches: 4, }), `test ${testCount++}`); @@ -114,7 +114,7 @@ function runTest() { msg_name: "findchange", active: true, searchString: 'bar', - searchLimit: 1000, + searchLimit: 100, activeMatchOrdinal: 4, numberOfMatches: 4, }), `test ${testCount++}`); @@ -125,7 +125,7 @@ function runTest() { msg_name: "findchange", active: true, searchString: 'bar', - searchLimit: 1000, + searchLimit: 100, activeMatchOrdinal: 1, numberOfMatches: 4, }), `test ${testCount++}`); diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index ec268f74ed0f..fbcabb6cc046 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -856,10 +856,8 @@ pref("accessibility.typeaheadfind.prefillwithselection", false); #else pref("accessibility.typeaheadfind.prefillwithselection", true); #endif -pref("accessibility.typeaheadfind.matchesCountTimeout", 100); -pref("accessibility.typeaheadfind.matchesCountLimit", 1000); -pref("findbar.highlightAll", false); -pref("findbar.modalHighlight", false); +pref("accessibility.typeaheadfind.matchesCountTimeout", 250); +pref("accessibility.typeaheadfind.matchesCountLimit", 100); // use Mac OS X Appearance panel text smoothing setting when rendering text, disabled by default pref("gfx.use_text_smoothing_setting", false); diff --git a/testing/profiles/prefs_general.js b/testing/profiles/prefs_general.js index 4fb0c1cf66b7..0a85eedc90ea 100644 --- a/testing/profiles/prefs_general.js +++ b/testing/profiles/prefs_general.js @@ -23,8 +23,6 @@ user_pref("browser.shell.checkDefaultBrowser", false); user_pref("shell.checkDefaultClient", false); user_pref("browser.warnOnQuit", false); user_pref("accessibility.typeaheadfind.autostart", false); -user_pref("findbar.highlightAll", false); -user_pref("findbar.modalHighlight", false); user_pref("javascript.options.showInConsole", true); user_pref("devtools.browsertoolbox.panel", "jsdebugger"); user_pref("devtools.debugger.remote-port", 6023); diff --git a/toolkit/content/tests/browser/browser.ini b/toolkit/content/tests/browser/browser.ini index 295360d85c2f..12139b6412ff 100644 --- a/toolkit/content/tests/browser/browser.ini +++ b/toolkit/content/tests/browser/browser.ini @@ -11,7 +11,6 @@ support-files = [browser_autoscroll_disabled.js] [browser_bug295977_autoscroll_overflow.js] [browser_bug451286.js] -skip-if = !e10s [browser_bug594509.js] [browser_bug982298.js] [browser_bug1198465.js] diff --git a/toolkit/content/tests/browser/browser_bug451286.js b/toolkit/content/tests/browser/browser_bug451286.js index a5dadeb84929..f467f034f962 100644 --- a/toolkit/content/tests/browser/browser_bug451286.js +++ b/toolkit/content/tests/browser/browser_bug451286.js @@ -20,7 +20,6 @@ add_task(function*() { yield openFindBarAndWait(); gFindBar._findField.value = SEARCH_TEXT; - yield findAgainAndWait(); var matchCase = gFindBar.getElement("find-case-sensitive"); if (matchCase.checked) matchCase.doCommand(); @@ -119,21 +118,6 @@ function toggleHighlightAndWait(shouldHighlight) { }); } -function findAgainAndWait() { - return new Promise(resolve => { - let listener = { - onFindResult() { - gFindBar.browser.finder.removeResultListener(listener); - resolve(); - }, - onHighlightFinished() {}, - onMatchesCountResult() {} - }; - gFindBar.browser.finder.addResultListener(listener); - gFindBar.onFindAgainCommand(); - }); -} - function* openFindBarAndWait() { let awaitTransitionEnd = BrowserTestUtils.waitForEvent(gFindBar, "transitionend"); gFindBar.open(); diff --git a/toolkit/content/tests/chrome/bug360437_window.xul b/toolkit/content/tests/chrome/bug360437_window.xul index a09d48599bad..b937c8c8b493 100644 --- a/toolkit/content/tests/chrome/bug360437_window.xul +++ b/toolkit/content/tests/chrome/bug360437_window.xul @@ -64,7 +64,7 @@ // Make sure the findfield is correctly focused on open var searchStr = "text inside an input element"; - yield promiseEnterStringIntoFindField(searchStr); + yield* enterStringIntoFindField(searchStr); is(document.commandDispatcher.focusedElement, gFindBar._findField.inputField, "Find field isn't focused"); @@ -72,6 +72,12 @@ // when the find bar is closed. gFindBar.close(); gFindBar.onFindAgainCommand(false); + // For remote browsers, the content document DOM tree is not accessible, thus + // the focused element should fall back to the browser element. + if (gBrowser.hasAttribute("remote")) { + is(document.commandDispatcher.focusedElement, gBrowser, + "Browser element isn't focused"); + } yield ContentTask.spawn(gBrowser, null, function* () { Assert.equal(content.document.activeElement, content.document.getElementById("input"), "Input Element isn't focused"); @@ -87,30 +93,23 @@ "Focus was stolen from a chrome element"); } - function promiseFindResult(str = null) { - return new Promise(resolve => { - let listener = { - onFindResult: function({ searchString }) { - if (str !== null && str != searchString) { - return; - } - gFindBar.browser.finder.removeResultListener(listener); - resolve(); - } - }; - gFindBar.browser.finder.addResultListener(listener); - }); - } - - function promiseEnterStringIntoFindField(str) { - let promise = promiseFindResult(str); - for (let i = 0; i < str.length; i++) { + function* enterStringIntoFindField(aString) { + for (let i = 0; i < aString.length; i++) { let event = document.createEvent("KeyEvents"); + let promise = new Promise(resolve => { + let listener = { + onFindResult: function() { + gFindBar.browser.finder.removeResultListener(listener); + resolve(); + } + }; + gFindBar.browser.finder.addResultListener(listener); + }); event.initKeyEvent("keypress", true, true, null, false, false, - false, false, 0, str.charCodeAt(i)); + false, false, 0, aString.charCodeAt(i)); gFindBar._findField.inputField.dispatchEvent(event); + yield promise; } - return promise; } ]]> diff --git a/toolkit/content/widgets/browser.xml b/toolkit/content/widgets/browser.xml index a5423540151e..d802bc215f4a 100644 --- a/toolkit/content/widgets/browser.xml +++ b/toolkit/content/widgets/browser.xml @@ -436,6 +436,7 @@ null + false null + false - null - - - - @@ -357,7 +340,9 @@ this._foundURL = null; - let prefsvc = this._prefsvc; + let prefsvc = + Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefBranch); this._quickFindTimeoutLength = prefsvc.getIntPref("accessibility.typeaheadfind.timeout"); @@ -367,7 +352,6 @@ prefsvc.getIntPref("accessibility.typeaheadfind.matchesCountTimeout"); this._matchesCountLimit = prefsvc.getIntPref("accessibility.typeaheadfind.matchesCountLimit"); - this._useModalHighlight = prefsvc.getBoolPref("findbar.modalHighlight"); prefsvc.addObserver("accessibility.typeaheadfind", this._observer, false); @@ -375,8 +359,6 @@ this._observer, false); prefsvc.addObserver("accessibility.typeaheadfind.casesensitive", this._observer, false); - prefsvc.addObserver("findbar.highlightAll", this._observer, false); - prefsvc.addObserver("findbar.modalHighlight", this._observer, false); this._findAsYouType = prefsvc.getBoolPref("accessibility.typeaheadfind"); @@ -384,7 +366,6 @@ prefsvc.getBoolPref("accessibility.typeaheadfind.linksonly"); this._typeAheadCaseSensitive = prefsvc.getIntPref("accessibility.typeaheadfind.casesensitive"); - this._highlightAll = prefsvc.getBoolPref("findbar.highlightAll"); // Convenience this.nsITypeAheadFind = Components.interfaces.nsITypeAheadFind; @@ -412,20 +393,17 @@ return; this._destroyed = true; - if (this.browser.finder) - this.browser.finder.destroy(); - this.browser = null; - let prefsvc = this._prefsvc; + let prefsvc = + Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefBranch); prefsvc.removeObserver("accessibility.typeaheadfind", this._observer); prefsvc.removeObserver("accessibility.typeaheadfind.linksonly", this._observer); prefsvc.removeObserver("accessibility.typeaheadfind.casesensitive", this._observer); - prefsvc.removeObserver("findbar.highlightAll", this._observer); - prefsvc.removeObserver("findbar.modalHighlight", this._observer); // Clear all timers that might still be running. this._cancelTimers(); @@ -513,30 +491,19 @@ - Turns highlight on or off. - @param aHighlight (boolean) - Whether to turn the highlight on or off - - @param aFromPrefObserver (boolean) - - Whether the callee is the pref observer, which means we should - - not set the same pref again. --> - - - - - - - -