mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 12:20:56 +00:00
Bug 1064580 - Add definitions for onCurrentSelection to the listeners since RemoteFinder.jsm expects them to be present. Also add an error check in Finder.jsm for empty selections. r=evilpie
MozReview-Commit-ID: E6lgH8OZhaH --HG-- extra : rebase_source : 2e646f82a0f851775e2dc2893f170d58db0979ae
This commit is contained in:
parent
4099eeaee2
commit
10738b2e3f
@ -9,7 +9,6 @@ skip-if = buildapp == 'mulet' || e10s # Relies on drop to be handled in the pare
|
||||
[browser_bug295977_autoscroll_overflow.js]
|
||||
[browser_bug594509.js]
|
||||
[browser_bug982298.js]
|
||||
skip-if = e10s # Bug 1064580
|
||||
[browser_bug1198465.js]
|
||||
[browser_contentTitle.js]
|
||||
[browser_default_image_filename.js]
|
||||
|
@ -25,19 +25,23 @@ function test()
|
||||
gBrowser.selectedTab = tab;
|
||||
|
||||
browser.addEventListener("load", find, true);
|
||||
info("waiting for load event");
|
||||
}
|
||||
|
||||
function find()
|
||||
{
|
||||
info("got load event in 'find' function");
|
||||
browser.removeEventListener("load", find, true);
|
||||
let listener = {
|
||||
onFindResult: function(aData) {
|
||||
onFindResult(aData) {
|
||||
info("got find result");
|
||||
browser.finder.removeResultListener(listener);
|
||||
|
||||
ok(aData.result == Ci.nsITypeAheadFind.FIND_FOUND, "should find string");
|
||||
|
||||
browser.messageManager.addMessageListener("ScrollDone",
|
||||
function f(aMsg) {
|
||||
info("got ScrollDone event");
|
||||
browser.messageManager.removeMessageListener("ScrollDone", f);
|
||||
browser.loadURI("about:blank");
|
||||
browser.addEventListener("load", findAgain, true);
|
||||
@ -48,22 +52,28 @@ function find()
|
||||
btoa(scrollTest), false);
|
||||
|
||||
},
|
||||
onCurrentSelection() {}
|
||||
};
|
||||
info("about to add results listener, open find bar, and send 'F' string");
|
||||
browser.finder.addResultListener(listener);
|
||||
gFindBar.onFindCommand();
|
||||
EventUtils.sendString("F");
|
||||
info("added result listener and sent string 'F'");
|
||||
}
|
||||
|
||||
function findAgain()
|
||||
{
|
||||
info("got load event in 'findAgain' function");
|
||||
browser.removeEventListener("load", findAgain, true);
|
||||
|
||||
ok(browser.currentURI.spec == "about:blank", "cannot navigate to about:blank");
|
||||
let listener = {
|
||||
onFindResult: function(aData) {
|
||||
onFindResult(aData) {
|
||||
info("got find result #2");
|
||||
browser.finder.removeResultListener(listener);
|
||||
cleanup();
|
||||
},
|
||||
onCurrentSelection() {}
|
||||
};
|
||||
|
||||
browser.finder.addResultListener(listener);
|
||||
@ -71,15 +81,20 @@ function findAgain()
|
||||
setTimeout(function() {
|
||||
// ignore exception if occured
|
||||
try {
|
||||
info("about to send find again command");
|
||||
gFindBar.onFindAgainCommand(false);
|
||||
info("sent find again command");
|
||||
} catch (e) {
|
||||
info("got exception from onFindAgainCommand: " + e);
|
||||
}
|
||||
cleanup();
|
||||
}, 0);
|
||||
info("added result listener");
|
||||
}
|
||||
|
||||
function cleanup()
|
||||
{
|
||||
info("in cleanup function");
|
||||
gBrowser.removeTab(tab);
|
||||
finish();
|
||||
}
|
||||
|
@ -528,6 +528,10 @@ Finder.prototype = {
|
||||
}
|
||||
}
|
||||
|
||||
if (!selection.rangeCount || selection.isCollapsed) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let utils = topWin.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user