summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/extensions/test/browser/browser_purchase.js
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/mozapps/extensions/test/browser/browser_purchase.js')
-rw-r--r--toolkit/mozapps/extensions/test/browser/browser_purchase.js64
1 files changed, 31 insertions, 33 deletions
diff --git a/toolkit/mozapps/extensions/test/browser/browser_purchase.js b/toolkit/mozapps/extensions/test/browser/browser_purchase.js
index a815d10d5..bb30a1eb4 100644
--- a/toolkit/mozapps/extensions/test/browser/browser_purchase.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_purchase.js
@@ -121,7 +121,7 @@ add_test(function() {
info("Changing sort order");
EventUtils.synthesizeMouseAtCenter(priceSorter, { }, gManagerWindow);
- items = Array.filter(list.childNodes, function(e) {
+ var items = Array.filter(list.childNodes, function(e) {
return e.tagName == "richlistitem";
});
@@ -136,24 +136,23 @@ add_test(function() {
// Tests that clicking the buy button works from the list
add_test(function() {
- gBrowser.tabContainer.addEventListener("TabOpen", function listener(event) {
- gBrowser.tabContainer.removeEventListener("TabOpen", listener, true);
- function wantLoad(url) {
- return url != "about:blank";
- }
- BrowserTestUtils.browserLoaded(event.target.linkedBrowser, false, wantLoad).then(() => {
- is(gBrowser.currentURI.spec, TESTROOT + "releaseNotes.xhtml?addon5", "Should have loaded the right page");
+ gBrowser.addEventListener("load", function(event) {
+ if (!(event.target instanceof Document) ||
+ event.target.location.href == "about:blank")
+ return;
+ gBrowser.removeEventListener("load", arguments.callee, true);
- gBrowser.removeCurrentTab();
+ is(gBrowser.currentURI.spec, TESTROOT + "releaseNotes.xhtml?addon5", "Should have loaded the right page");
- if (gUseInContentUI) {
- is(gBrowser.currentURI.spec, "about:addons", "Should be back to the add-ons manager");
- run_next_test();
- }
- else {
- waitForFocus(run_next_test, gManagerWindow);
- }
- });
+ gBrowser.removeCurrentTab();
+
+ if (gUseInContentUI) {
+ is(gBrowser.currentURI.spec, "about:addons", "Should be back to the add-ons manager");
+ run_next_test();
+ }
+ else {
+ waitForFocus(run_next_test, gManagerWindow);
+ }
}, true);
var list = gManagerWindow.document.getElementById("search-list");
@@ -162,24 +161,23 @@ add_test(function() {
// Tests that clicking the buy button from the details view works
add_test(function() {
- gBrowser.tabContainer.addEventListener("TabOpen", function listener(event) {
- gBrowser.tabContainer.removeEventListener("TabOpen", listener, true);
- function wantLoad(url) {
- return url != "about:blank";
- }
- BrowserTestUtils.browserLoaded(event.target.linkedBrowser, false, wantLoad).then(() => {
- is(gBrowser.currentURI.spec, TESTROOT + "releaseNotes.xhtml?addon4", "Should have loaded the right page");
+ gBrowser.addEventListener("load", function(event) {
+ if (!(event.target instanceof Document) ||
+ event.target.location.href == "about:blank")
+ return;
+ gBrowser.removeEventListener("load", arguments.callee, true);
- gBrowser.removeCurrentTab();
+ is(gBrowser.currentURI.spec, TESTROOT + "releaseNotes.xhtml?addon4", "Should have loaded the right page");
- if (gUseInContentUI) {
- is(gBrowser.currentURI.spec, "about:addons", "Should be back to the add-ons manager");
- run_next_test();
- }
- else {
- waitForFocus(run_next_test, gManagerWindow);
- }
- });
+ gBrowser.removeCurrentTab();
+
+ if (gUseInContentUI) {
+ is(gBrowser.currentURI.spec, "about:addons", "Should be back to the add-ons manager");
+ run_next_test();
+ }
+ else {
+ waitForFocus(run_next_test, gManagerWindow);
+ }
}, true);
var list = gManagerWindow.document.getElementById("search-list");