Backed out changeset a7882c91ca20 (bug 1305194) for leaking docshells, e.g. in browser_Finder_hidden_textarea.js and browser_findbar.js. r=backout

This commit is contained in:
Sebastian Hengst 2016-10-11 21:00:52 +02:00
parent ab270319b9
commit 8bf44b24d0
3 changed files with 9 additions and 34 deletions

View File

@ -31,7 +31,7 @@
const SAMPLE_TEXT = "Some text in a text field.";
const SEARCH_TEXT = "Text Test";
const NOT_FOUND_TEXT = "This text is not on the page."
const ITERATOR_TIMEOUT = gPrefsvc.getIntPref("findbar.iteratorTimeout");
const ITERATOR_TIMEOUT = gPrefsvc.getIntPref("findbar.iteratorTimeout") + 20;
var gFindBar = null;
var gBrowser;
@ -255,7 +255,7 @@
};
gFindBar.browser.finder.addResultListener(listener);
// Make sure we resolve _at least_ after five times the find iterator timeout.
setTimeout(resolve, (ITERATOR_TIMEOUT * 5) + 20);
setTimeout(resolve, ITERATOR_TIMEOUT * 5);
});
}
@ -523,7 +523,7 @@
if (matchCase.checked) {
promise = promiseFindResult();
matchCase.click();
yield new Promise(resolve => setTimeout(resolve, ITERATOR_TIMEOUT + 20));
yield new Promise(resolve => setTimeout(resolve, ITERATOR_TIMEOUT));
yield promise;
}
@ -558,13 +558,7 @@
gFindBar._findField.select();
gFindBar._findField.focus();
let timeout = ITERATOR_TIMEOUT;
if (test.text.length == 1)
timeout *= 4;
else if (test.text.length == 2)
timeout *= 2;
timeout += 20;
yield new Promise(resolve => setTimeout(resolve, timeout));
yield new Promise(resolve => setTimeout(resolve, ITERATOR_TIMEOUT));
yield enterStringIntoFindField(test.text, false);
yield promiseMatchesCountResult();
let matches = foundMatches.value.match(regex);
@ -573,7 +567,7 @@
} else {
assertMatches(test, matches);
for (let i = 1; i < test.total; i++) {
yield new Promise(resolve => setTimeout(resolve, timeout));
yield new Promise(resolve => setTimeout(resolve, ITERATOR_TIMEOUT));
gFindBar.onFindAgainCommand();
yield promiseMatchesCountResult();
// test.current + 1, test.current + 2, ..., test.total, 1, ..., test.current
@ -665,7 +659,7 @@
let result = yield promise;
is(result.result, Ci.nsITypeAheadFind.FIND_FOUND, "Text should be found");
yield new Promise(resolve => setTimeout(resolve, ITERATOR_TIMEOUT + 20));
yield new Promise(resolve => setTimeout(resolve, ITERATOR_TIMEOUT));
promise = promiseFindResult();
let check = gFindBar.getElement("find-entire-word");
check.click();

View File

@ -421,22 +421,8 @@ this.FinderIterator = {
if (this._timeout) {
if (this._timer)
clearTimeout(this._timer);
if (this._runningFindResolver)
this._runningFindResolver();
let timeout = this._timeout;
let searchTerm = this._currentParams.word;
// Wait a little longer when the first or second character is typed into
// the findbar.
if (searchTerm.length == 1)
timeout *= 4;
else if (searchTerm.length == 2)
timeout *= 2;
yield new Promise(resolve => {
this._runningFindResolver = resolve;
this._timer = setTimeout(resolve, timeout);
});
this._timer = this._runningFindResolver = null;
yield new Promise(resolve => this._timer = setTimeout(resolve, this._timeout));
this._timer = null;
// During the timeout, we could have gotten the signal to stop iterating.
// Make sure we do here.
if (!this.running || spawnId !== this._spawnId)

View File

@ -221,12 +221,7 @@ add_task(function* testModalResults() {
yield promiseOpenFindbar(findbar);
Assert.ok(!findbar.hidden, "Findbar should be open now.");
let timeout = kIteratorTimeout;
if (word.length == 1)
timeout *= 4;
else if (word.length == 2)
timeout *= 2;
yield new Promise(resolve => setTimeout(resolve, timeout));
yield new Promise(resolve => setTimeout(resolve, kIteratorTimeout));
let promise = promiseTestHighlighterOutput(browser, word, expectedResult,
expectedResult.extraTest);
yield promiseEnterStringIntoFindField(findbar, word);