Backed out changeset fb0a06ceed77 (bug 1407987)

This commit is contained in:
Sebastian Hengst 2017-10-17 18:59:46 +02:00
Родитель 07b558df1b
Коммит 80c25bdd30
2 изменённых файлов: 0 добавлений и 61 удалений

Просмотреть файл

@ -27,7 +27,6 @@ support-files =
[browser_Deprecated.js]
[browser_Finder.js]
[browser_Finder_hidden_textarea.js]
[browser_Finder_offscreen_text.js]
[browser_FinderHighlighter.js]
skip-if = debug || os = "linux"
support-files = file_FinderSample.html

Просмотреть файл

@ -1,60 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
add_task(async function test_offscreen_text() {
// Generate URI of a big DOM that contains the target text at several
// line positions (to force some targets to be offscreen).
const linesToGenerate = 155;
const linesToInsertTargetText = [5, 50, 150];
let targetCount = linesToInsertTargetText.length;
let t = 0;
const TARGET_TEXT = "findthis";
let URI = "<body>";
for(let i = 0; i < linesToGenerate; i++) {
URI += i + "<br>";
if(t < targetCount && linesToInsertTargetText[t] == i) {
URI += TARGET_TEXT;
t++;
}
}
URI += "</body>";
await BrowserTestUtils.withNewTab({ gBrowser, url: "data:text/html;charset=utf-8," + encodeURIComponent(URI) },
async function(browser) {
let finder = browser.finder;
let listener = {
onFindResult() {
ok(false, "callback wasn't replaced");
}
};
finder.addResultListener(listener);
function waitForFind() {
return new Promise(resolve => {
listener.onFindResult = resolve;
})
}
// Find each of the targets.
for(let t = 0; t < targetCount; ++t) {
let promiseFind = waitForFind();
if(t == 0) {
finder.fastFind(TARGET_TEXT, false, false);
} else {
finder.findAgain(false, false, false);
}
let findResult = await promiseFind;
is(findResult.result, Ci.nsITypeAheadFind.FIND_FOUND, "Found target " + t);
}
// Find one more time and make sure we wrap.
let promiseFind = waitForFind();
finder.findAgain(false, false, false);
let findResult = await promiseFind;
is(findResult.result, Ci.nsITypeAheadFind.FIND_WRAPPED, "Wrapped to first target");
finder.removeResultListener(listener);
});
});