зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset b89704b3bc19 (bug 1358500) for failures in browser_bug537013.js
MozReview-Commit-ID: IO4dyagNqNB --HG-- extra : rebase_source : 5a5beba51e57ac28654eb7a4dcac7db1cd9bedb0
This commit is contained in:
Родитель
e230054912
Коммит
cba671875b
|
@ -45,7 +45,7 @@ function test() {
|
||||||
|
|
||||||
setFindString(texts[0]);
|
setFindString(texts[0]);
|
||||||
// Turn on highlight for testing bug 891638
|
// Turn on highlight for testing bug 891638
|
||||||
gFindBar.getElement("highlight").checked = true;
|
gFindBar.toggleHighlight(true);
|
||||||
|
|
||||||
// Make sure the second tab is correct, then set it up
|
// Make sure the second tab is correct, then set it up
|
||||||
gBrowser.selectedTab = tabs[1];
|
gBrowser.selectedTab = tabs[1];
|
||||||
|
@ -72,20 +72,19 @@ function continueTests1() {
|
||||||
ok(gFindBar.getElement("highlight").checked,
|
ok(gFindBar.getElement("highlight").checked,
|
||||||
"Highlight button state persists!");
|
"Highlight button state persists!");
|
||||||
|
|
||||||
// While we're here, let's test bug 253793
|
// While we're here, let's test the backout of bug 253793.
|
||||||
gBrowser.reload();
|
gBrowser.reload();
|
||||||
gBrowser.addEventListener("DOMContentLoaded", continueTests2, true);
|
gBrowser.addEventListener("DOMContentLoaded", continueTests2, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function continueTests2() {
|
function continueTests2() {
|
||||||
gBrowser.removeEventListener("DOMContentLoaded", continueTests2, true);
|
gBrowser.removeEventListener("DOMContentLoaded", continueTests2, true);
|
||||||
waitForCondition(() => !gFindBar.getElement("highlight").checked,
|
ok(gFindBar.getElement("highlight").checked, "Highlight never reset!");
|
||||||
continueTests3,
|
continueTests3();
|
||||||
"Highlight never reset!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function continueTests3() {
|
function continueTests3() {
|
||||||
ok(!gFindBar.getElement("highlight").checked, "Highlight button reset!");
|
ok(gFindBar.getElement("highlight").checked, "Highlight button reset!");
|
||||||
gFindBar.close();
|
gFindBar.close();
|
||||||
ok(gFindBar.hidden, "First tab doesn't show find bar!");
|
ok(gFindBar.hidden, "First tab doesn't show find bar!");
|
||||||
gBrowser.selectedTab = tabs[1];
|
gBrowser.selectedTab = tabs[1];
|
||||||
|
@ -129,7 +128,7 @@ function checkNewWindow() {
|
||||||
is(newWindow.gFindBar._findField.value, texts[1],
|
is(newWindow.gFindBar._findField.value, texts[1],
|
||||||
"New window find bar has correct find value!");
|
"New window find bar has correct find value!");
|
||||||
ok(!newWindow.gFindBar.getElement("find-next").disabled,
|
ok(!newWindow.gFindBar.getElement("find-next").disabled,
|
||||||
"New window findbar has enabled buttons!");
|
"New window findbar has disabled buttons!");
|
||||||
}
|
}
|
||||||
newWindow.close();
|
newWindow.close();
|
||||||
finish();
|
finish();
|
||||||
|
|
|
@ -154,6 +154,17 @@
|
||||||
await testToggleEntireWord();
|
await testToggleEntireWord();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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'}`);
|
||||||
|
}
|
||||||
|
|
||||||
async function testFindbarSelection() {
|
async function testFindbarSelection() {
|
||||||
function checkFindbarState(aTestName, aExpSelection) {
|
function checkFindbarState(aTestName, aExpSelection) {
|
||||||
ok(!gFindBar.hidden, "testFindbarSelection: failed to open findbar: " + aTestName);
|
ok(!gFindBar.hidden, "testFindbarSelection: failed to open findbar: " + aTestName);
|
||||||
|
@ -164,6 +175,7 @@
|
||||||
"Incorrect selection in testFindbarSelection: " + aTestName +
|
"Incorrect selection in testFindbarSelection: " + aTestName +
|
||||||
". Selection: " + gFindBar._findField.value);
|
". Selection: " + gFindBar._findField.value);
|
||||||
}
|
}
|
||||||
|
testFindButtonsState();
|
||||||
|
|
||||||
// Clear the value, close the findbar.
|
// Clear the value, close the findbar.
|
||||||
gFindBar._findField.value = "";
|
gFindBar._findField.value = "";
|
||||||
|
@ -321,6 +333,7 @@
|
||||||
"testNormalFind: failed to find '" + args.searchStr + "'");
|
"testNormalFind: failed to find '" + args.searchStr + "'");
|
||||||
return sel;
|
return sel;
|
||||||
});
|
});
|
||||||
|
testFindButtonsState();
|
||||||
testClipboardSearchString(sel);
|
testClipboardSearchString(sel);
|
||||||
|
|
||||||
if (!matchCaseCheckbox.hidden) {
|
if (!matchCaseCheckbox.hidden) {
|
||||||
|
@ -335,6 +348,7 @@
|
||||||
promise = promiseFindResult();
|
promise = promiseFindResult();
|
||||||
matchCaseCheckbox.click();
|
matchCaseCheckbox.click();
|
||||||
await promise;
|
await promise;
|
||||||
|
testFindButtonsState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,6 +388,7 @@
|
||||||
Assert.notEqual(content.getSelection().toString().toLowerCase(), args.searchStr,
|
Assert.notEqual(content.getSelection().toString().toLowerCase(), args.searchStr,
|
||||||
"testNormalFindWithComposition: text shouldn't be found during composition");
|
"testNormalFindWithComposition: text shouldn't be found during composition");
|
||||||
});
|
});
|
||||||
|
testFindButtonsState();
|
||||||
|
|
||||||
synthesizeComposition({ type: "compositioncommitasis" });
|
synthesizeComposition({ type: "compositioncommitasis" });
|
||||||
|
|
||||||
|
@ -384,6 +399,7 @@
|
||||||
return sel;
|
return sel;
|
||||||
});
|
});
|
||||||
testClipboardSearchString(sel);
|
testClipboardSearchString(sel);
|
||||||
|
testFindButtonsState();
|
||||||
|
|
||||||
if (clicked) {
|
if (clicked) {
|
||||||
matchCaseCheckbox.click();
|
matchCaseCheckbox.click();
|
||||||
|
@ -447,6 +463,7 @@
|
||||||
Assert.equal(content.getSelection().toString(), args.searchStr,
|
Assert.equal(content.getSelection().toString(), args.searchStr,
|
||||||
"testQuickFindLink: failed to find sample link");
|
"testQuickFindLink: failed to find sample link");
|
||||||
});
|
});
|
||||||
|
testFindButtonsState();
|
||||||
testClipboardSearchString(searchStr);
|
testClipboardSearchString(searchStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -565,6 +582,7 @@
|
||||||
Assert.equal(content.getSelection().toString(), args.SEARCH_TEXT,
|
Assert.equal(content.getSelection().toString(), args.SEARCH_TEXT,
|
||||||
"testQuickFindText: failed to find '" + args.SEARCH_TEXT + "'");
|
"testQuickFindText: failed to find '" + args.SEARCH_TEXT + "'");
|
||||||
});
|
});
|
||||||
|
testFindButtonsState();
|
||||||
testClipboardSearchString(SEARCH_TEXT);
|
testClipboardSearchString(SEARCH_TEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -621,6 +639,7 @@
|
||||||
`${linksOnly ? "[Links-only] " : ""}Currently highlighted match should be at ${aTest.current} for '${aTest.text}'`);
|
`${linksOnly ? "[Links-only] " : ""}Currently highlighted match should be at ${aTest.current} for '${aTest.text}'`);
|
||||||
is(aMatches[2], String(aTest.total),
|
is(aMatches[2], String(aTest.total),
|
||||||
`${linksOnly ? "[Links-only] " : ""}Total amount of matches should be ${aTest.total} for '${aTest.text}'`);
|
`${linksOnly ? "[Links-only] " : ""}Total amount of matches should be ${aTest.total} for '${aTest.text}'`);
|
||||||
|
testFindButtonsState(aMatches.total !== 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let test of tests) {
|
for (let test of tests) {
|
||||||
|
@ -670,11 +689,13 @@
|
||||||
await ContentTask.spawn(gBrowser, null, async function() {
|
await ContentTask.spawn(gBrowser, null, async function() {
|
||||||
Assert.equal(content.getSelection().toString(), "T", "First T should be selected.");
|
Assert.equal(content.getSelection().toString(), "T", "First T should be selected.");
|
||||||
});
|
});
|
||||||
|
testFindButtonsState();
|
||||||
|
|
||||||
gPrefsvc.setIntPref("accessibility.typeaheadfind.casesensitive", 1);
|
gPrefsvc.setIntPref("accessibility.typeaheadfind.casesensitive", 1);
|
||||||
await ContentTask.spawn(gBrowser, null, async function() {
|
await ContentTask.spawn(gBrowser, null, async function() {
|
||||||
Assert.equal(content.getSelection().toString(), "t", "First t should be selected.");
|
Assert.equal(content.getSelection().toString(), "t", "First t should be selected.");
|
||||||
});
|
});
|
||||||
|
testFindButtonsState();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure that _findFailedString is cleared:
|
// Make sure that _findFailedString is cleared:
|
||||||
|
@ -687,12 +708,14 @@
|
||||||
await ContentTask.spawn(gBrowser, null, async function() {
|
await ContentTask.spawn(gBrowser, null, async function() {
|
||||||
Assert.equal(content.getSelection().toString(), "", "Not found.");
|
Assert.equal(content.getSelection().toString(), "", "Not found.");
|
||||||
});
|
});
|
||||||
|
testFindButtonsState(false);
|
||||||
|
|
||||||
gPrefsvc.setIntPref("accessibility.typeaheadfind.casesensitive", 0);
|
gPrefsvc.setIntPref("accessibility.typeaheadfind.casesensitive", 0);
|
||||||
await ContentTask.spawn(gBrowser, { SEARCH_TEXT }, async function(args) {
|
await ContentTask.spawn(gBrowser, { SEARCH_TEXT }, async function(args) {
|
||||||
Assert.equal(content.getSelection().toString(), args.SEARCH_TEXT,
|
Assert.equal(content.getSelection().toString(), args.SEARCH_TEXT,
|
||||||
"Search text should be selected.");
|
"Search text should be selected.");
|
||||||
});
|
});
|
||||||
|
testFindButtonsState();
|
||||||
}
|
}
|
||||||
|
|
||||||
function testClipboardSearchString(aExpected) {
|
function testClipboardSearchString(aExpected) {
|
||||||
|
@ -711,14 +734,17 @@
|
||||||
async function testFindAgainNotFound() {
|
async function testFindAgainNotFound() {
|
||||||
await openFindbar();
|
await openFindbar();
|
||||||
await enterStringIntoFindField(NOT_FOUND_TEXT, false);
|
await enterStringIntoFindField(NOT_FOUND_TEXT, false);
|
||||||
|
testFindButtonsState(false);
|
||||||
gFindBar.close();
|
gFindBar.close();
|
||||||
ok(gFindBar.hidden, "The findbar is closed.");
|
ok(gFindBar.hidden, "The findbar is closed.");
|
||||||
let promise = promiseFindResult();
|
let promise = promiseFindResult();
|
||||||
gFindBar.onFindAgainCommand();
|
gFindBar.onFindAgainCommand();
|
||||||
await promise;
|
await promise;
|
||||||
ok(!gFindBar.hidden, "Unsuccessful Find Again opens the find bar.");
|
ok(!gFindBar.hidden, "Unsuccessful Find Again opens the find bar.");
|
||||||
|
testFindButtonsState(false);
|
||||||
|
|
||||||
await enterStringIntoFindField(SEARCH_TEXT);
|
await enterStringIntoFindField(SEARCH_TEXT);
|
||||||
|
testFindButtonsState();
|
||||||
gFindBar.close();
|
gFindBar.close();
|
||||||
ok(gFindBar.hidden, "The findbar is closed.");
|
ok(gFindBar.hidden, "The findbar is closed.");
|
||||||
promise = promiseFindResult();
|
promise = promiseFindResult();
|
||||||
|
@ -733,6 +759,7 @@
|
||||||
await enterStringIntoFindField("Tex", false);
|
await enterStringIntoFindField("Tex", false);
|
||||||
let result = await promise;
|
let result = await promise;
|
||||||
is(result.result, Ci.nsITypeAheadFind.FIND_FOUND, "Text should be found");
|
is(result.result, Ci.nsITypeAheadFind.FIND_FOUND, "Text should be found");
|
||||||
|
testFindButtonsState();
|
||||||
|
|
||||||
await new Promise(resolve => setTimeout(resolve, ITERATOR_TIMEOUT + 20));
|
await new Promise(resolve => setTimeout(resolve, ITERATOR_TIMEOUT + 20));
|
||||||
promise = promiseFindResult();
|
promise = promiseFindResult();
|
||||||
|
@ -740,6 +767,7 @@
|
||||||
check.click();
|
check.click();
|
||||||
result = await promise;
|
result = await promise;
|
||||||
is(result.result, Ci.nsITypeAheadFind.FIND_NOTFOUND, "Text should NOT be found");
|
is(result.result, Ci.nsITypeAheadFind.FIND_NOTFOUND, "Text should NOT be found");
|
||||||
|
testFindButtonsState(false);
|
||||||
|
|
||||||
check.click();
|
check.click();
|
||||||
gFindBar.close(true);
|
gFindBar.close(true);
|
||||||
|
|
|
@ -366,8 +366,6 @@
|
||||||
this._findStatusIcon = this.getElement("find-status-icon");
|
this._findStatusIcon = this.getElement("find-status-icon");
|
||||||
this._findStatusDesc = this.getElement("find-status");
|
this._findStatusDesc = this.getElement("find-status");
|
||||||
|
|
||||||
this._foundURL = null;
|
|
||||||
|
|
||||||
let prefsvc = this._prefsvc;
|
let prefsvc = this._prefsvc;
|
||||||
|
|
||||||
this._quickFindTimeoutLength =
|
this._quickFindTimeoutLength =
|
||||||
|
@ -395,17 +393,17 @@
|
||||||
this._entireWord = prefsvc.getBoolPref("findbar.entireword");
|
this._entireWord = prefsvc.getBoolPref("findbar.entireword");
|
||||||
this._highlightAll = prefsvc.getBoolPref("findbar.highlightAll");
|
this._highlightAll = prefsvc.getBoolPref("findbar.highlightAll");
|
||||||
|
|
||||||
// Convenience
|
// Convenience.
|
||||||
this.nsITypeAheadFind = Components.interfaces.nsITypeAheadFind;
|
this.nsITypeAheadFind = Components.interfaces.nsITypeAheadFind;
|
||||||
this.nsISelectionController = Components.interfaces.nsISelectionController;
|
|
||||||
this._findSelection = this.nsISelectionController.SELECTION_FIND;
|
|
||||||
|
|
||||||
this._findResetTimeout = -1;
|
this._findResetTimeout = -1;
|
||||||
|
|
||||||
// Make sure the FAYT keypress listener is attached by initializing the
|
// Make sure the FAYT keypress listener is attached by initializing the
|
||||||
// browser property
|
// browser property.
|
||||||
if (this.getAttribute("browserid"))
|
if (this.getAttribute("browserid"))
|
||||||
setTimeout(function(aSelf) { aSelf.browser = aSelf.browser; }, 0, this);
|
setTimeout(() => this.browser = this.browser, 0);
|
||||||
|
|
||||||
|
this._enableFindButtons(false);
|
||||||
]]></constructor>
|
]]></constructor>
|
||||||
|
|
||||||
<destructor><![CDATA[
|
<destructor><![CDATA[
|
||||||
|
@ -1000,7 +998,6 @@
|
||||||
this._startFindDeferred = null;
|
this._startFindDeferred = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._enableFindButtons(val);
|
|
||||||
this._updateCaseSensitivity(val);
|
this._updateCaseSensitivity(val);
|
||||||
this._setEntireWord();
|
this._setEntireWord();
|
||||||
|
|
||||||
|
@ -1108,7 +1105,6 @@
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
- Opens the findbar, focuses the findfield and selects its contents.
|
- Opens the findbar, focuses the findfield and selects its contents.
|
||||||
- Also flashes the findbar the first time it's used.
|
- Also flashes the findbar the first time it's used.
|
||||||
|
@ -1273,7 +1269,7 @@
|
||||||
this._findFailedString = null;
|
this._findFailedString = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._updateStatusUI(aData.result, aData.findBackwards);
|
this.updateControlState(aData.result, aData.findBackwards);
|
||||||
this._updateStatusUIBar(aData.linkURL);
|
this._updateStatusUIBar(aData.linkURL);
|
||||||
|
|
||||||
if (this._findMode != this.FIND_NORMAL)
|
if (this._findMode != this.FIND_NORMAL)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче