diff options
author | Matt A. Tobin <email@mattatobin.com> | 2018-02-11 07:03:16 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2018-02-11 07:03:16 -0500 |
commit | 203eb0f61a09372310a2a8fb57e169cb3f47800b (patch) | |
tree | 8490329d3dae4de3c7ffd127bce1f65fdc009abd /toolkit/mozapps/extensions/test/xpinstall/browser_bug638292.js | |
parent | e45706ca3acbb6530419433212becc61d5953a2d (diff) | |
parent | 8f6d3dab81c7f8f97ef197e26ab9439b09735b8f (diff) | |
download | UXP-203eb0f61a09372310a2a8fb57e169cb3f47800b.tar UXP-203eb0f61a09372310a2a8fb57e169cb3f47800b.tar.gz UXP-203eb0f61a09372310a2a8fb57e169cb3f47800b.tar.lz UXP-203eb0f61a09372310a2a8fb57e169cb3f47800b.tar.xz UXP-203eb0f61a09372310a2a8fb57e169cb3f47800b.zip |
Merge branch 'ext-work'FF_Checkpoint_1
Diffstat (limited to 'toolkit/mozapps/extensions/test/xpinstall/browser_bug638292.js')
-rw-r--r-- | toolkit/mozapps/extensions/test/xpinstall/browser_bug638292.js | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/toolkit/mozapps/extensions/test/xpinstall/browser_bug638292.js b/toolkit/mozapps/extensions/test/xpinstall/browser_bug638292.js new file mode 100644 index 000000000..d5d590a3f --- /dev/null +++ b/toolkit/mozapps/extensions/test/xpinstall/browser_bug638292.js @@ -0,0 +1,63 @@ +// ---------------------------------------------------------------------------- +// Test whether an InstallTrigger.enabled is working +function test() { + waitForExplicitFinish(); + + gBrowser.selectedTab = gBrowser.addTab(); + gBrowser.selectedBrowser.addEventListener("load", function() { + gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); + waitForFocus(page_loaded, gBrowser.contentWindow); + }, true); + gBrowser.loadURI(TESTROOT + "bug638292.html"); +} + +function check_load(aCallback) { + gBrowser.addEventListener("load", function(aEvent) { + if (!gBrowser.browsers[2] || + aEvent.target != gBrowser.browsers[2].contentDocument) { + // SeaMonkey tabbrowser needs to deal with additional loads. + if (navigator.userAgent.match(/ SeaMonkey\//)) + info("Ignoring unrelated load on SeaMonkey. (Expected 2-3 times.)"); + else + ok(false, "Ignoring unrelated load on Firefox. (Should never happen!)"); + return; + } + + gBrowser.removeEventListener("load", arguments.callee, true); + + // Let the load handler complete + executeSoon(function() { + var doc = gBrowser.browsers[2].contentDocument; + is(doc.getElementById("enabled").textContent, "true", "installTrigger should have been enabled"); + + // Focus the old tab + gBrowser.selectedTab = gBrowser.tabs[1]; + waitForFocus(function() { + // Close the new tab + gBrowser.removeTab(gBrowser.tabs[2]); + aCallback(); + }, gBrowser.contentWindow); + }); + }, true); +} + +function page_loaded() { + var doc = gBrowser.contentDocument; + info("Clicking link 1"); + EventUtils.synthesizeMouseAtCenter(doc.getElementById("link1"), { }, gBrowser.contentWindow); + + check_load(function() { + info("Clicking link 2"); + EventUtils.synthesizeMouseAtCenter(doc.getElementById("link2"), { }, gBrowser.contentWindow); + + check_load(function() { + info("Clicking link 3"); + EventUtils.synthesizeMouseAtCenter(doc.getElementById("link3"), { button: 1 }, gBrowser.contentWindow); + + check_load(function() { + gBrowser.removeCurrentTab(); + finish(); + }); + }); + }); +} |