Bug 1327212 - undo a line removal done in
bug 935521 that causes regressions. r?Gijs
MozReview-Commit-ID: HaUEOSpEsXs
--- a/browser/base/content/test/general/browser_bug537013.js
+++ b/browser/base/content/test/general/browser_bug537013.js
@@ -122,14 +122,14 @@ function continueTests3() {
// Test that findbar gets restored when a tab is moved to a new window.
function checkNewWindow() {
ok(!newWindow.gFindBar.hidden, "New window shows find bar!");
// Disabled the following assertion due to intermittent failure on OSX 10.6 Debug.
if (!HasFindClipboard) {
is(newWindow.gFindBar._findField.value, texts[1],
"New window find bar has correct find value!");
+ ok(!newWindow.gFindBar.getElement("find-next").disabled,
+ "New window findbar has disabled buttons!");
}
- ok(newWindow.gFindBar.getElement("find-next").disabled,
- "New window findbar has disabled buttons!");
newWindow.close();
finish();
}
--- a/toolkit/content/tests/chrome/findbar_window.xul
+++ b/toolkit/content/tests/chrome/findbar_window.xul
@@ -150,17 +150,21 @@
yield testQuickFindClose();
// TODO: This doesn't seem to work when the findbar is connected to a
// remote browser element.
if (!gBrowser.hasAttribute("remote"))
yield testFindAgainNotFound();
yield testToggleEntireWord();
}
- function testFindButtonsState(enabled = true) {
+ function testFindButtonsState(enabled = null) {
+ // If `enabled` is not explicitly passed in, we set it to its most logical
+ // value.
+ if (enabled === null)
+ enabled = !!gFindBar._findField.value;
is(gFindBar.getElement("find-next").disabled, !enabled,
`Expected the 'next' button to be ${enabled ? 'enabled' : 'disabled'}`);
is(gFindBar.getElement("find-previous").disabled, !enabled,
`Expected the 'previous' button to be ${enabled ? 'enabled' : 'disabled'}`);
}
function* testFindbarSelection() {
function checkFindbarState(aTestName, aExpSelection) {
--- a/toolkit/content/widgets/findbar.xml
+++ b/toolkit/content/widgets/findbar.xml
@@ -1092,17 +1092,18 @@
]]></body>
</method>
<method name="updateControlState">
<parameter name="aResult"/>
<parameter name="aFindPrevious"/>
<body><![CDATA[
this._updateStatusUI(aResult, aFindPrevious);
- this._enableFindButtons(aResult !== this.nsITypeAheadFind.FIND_NOTFOUND);
+ this._enableFindButtons(aResult !== this.nsITypeAheadFind.FIND_NOTFOUND &&
+ !!this._findField.value);
]]></body>
</method>
<method name="_dispatchFindEvent">
<parameter name="aType"/>
<parameter name="aFindPrevious"/>
<body><![CDATA[
let event = document.createEvent("CustomEvent");
@@ -1341,16 +1342,17 @@
if (clipboardSearchString)
aSelectionString = clipboardSearchString;
}
if (aSelectionString)
this._findField.value = aSelectionString;
if (aIsInitialSelection) {
+ this._enableFindButtons(!!this._findField.value);
this._findField.select();
this._findField.focus();
this._startFindDeferred.resolve();
this._startFindDeferred = null;
}
]]></body>
</method>