Clean up browser_contextmenu.js, no bug

--HG--
extra : rebase_source : 0c06c1377f09e413740e00f4d07267853242f343
This commit is contained in:
Gavin Sharp 2013-06-07 15:34:25 -07:00
parent d1519fbef7
commit 27804c2fa4

View File

@ -30,7 +30,6 @@ function test() {
}
}
registerCleanupFunction(finalize);
Services.obs.addObserver(observer, "browser-search-engine-modified", false);
ss.addEngine("http://mochi.test:8888/browser/browser/components/search/test/testEngine_mozsearch.xml",
Ci.nsISearchEngine.DATA_XML, "data:image/x-icon,%00",
@ -41,7 +40,10 @@ function test() {
ok(contextMenu, "Got context menu XUL");
doOnloadOnce(testContextMenu);
gBrowser.selectedTab = gBrowser.addTab("data:text/plain;charset=utf8,test%20search");
let tab = gBrowser.selectedTab = gBrowser.addTab("data:text/plain;charset=utf8,test%20search");
registerCleanupFunction(function () {
gBrowser.removeTab(tab);
});
}
function testContextMenu() {
@ -69,7 +71,9 @@ function test() {
is(event.originalTarget.URL,
"http://mochi.test:8888/browser/browser/components/search/test/?test=test+search&ie=utf-8&client=app&channel=contextsearch",
"Checking context menu search URL");
finalize();
// Remove the tab opened by the search
gBrowser.removeCurrentTab();
ss.removeEngine(ss.currentEngine);
}
var selectionListener = {
@ -93,14 +97,4 @@ function test() {
goDoCommand('cmd_selectAll');
}, 500);
}
function finalize() {
while (gBrowser.tabs.length != 1) {
gBrowser.removeTab(gBrowser.tabs[0]);
}
content.location.href = "about:blank";
var engine = ss.getEngineByName(ENGINE_NAME);
if (engine)
ss.removeEngine(engine);
}
}