Bug 916534 - Test for find highlight should work in subframes. r=mikdeboer

This commit is contained in:
Tom Schuster 2013-09-17 12:54:35 -04:00
parent d5d7de306d
commit aa1efbba84
2 changed files with 47 additions and 1 deletions

View File

@ -6,8 +6,8 @@
MOCHITEST_BROWSER_FILES = \
browser_DeferredTask.js \
browser_Deprecated.js \
browser_Finder.js \
browser_Geometry.js \
browser_InlineSpellChecker.js \
browser_Troubleshoot.js \
$(NULL)

View File

@ -0,0 +1,46 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const Ci = Components.interfaces;
let tab, browser;
function test () {
waitForExplicitFinish();
tab = gBrowser.addTab("data:text/html,<iframe srcdoc='content'/>");
browser = gBrowser.getBrowserForTab(tab);
gBrowser.selectedTab = tab;
browser.addEventListener("load", startTests, true);
}
function startTests () {
browser.removeEventListener("load", startTests, true);
let finder = browser.finder;
let listener = {
onFindResult: function () {
ok(false, "callback wasn't replaced");
}
};
finder.addResultListener(listener);
listener.onFindResult = function (result) {
ok(result == Ci.nsITypeAheadFind.FIND_FOUND, "should find string");
listener.onFindResult = function (result) {
ok(result == Ci.nsITypeAheadFind.FIND_NOTFOUND, "should not find string");
cleanup();
}
finder.highlight(true, "Bla");
}
finder.highlight(true, "content");
}
function cleanup() {
gBrowser.removeTab(tab);
finish();
}