summaryrefslogtreecommitdiffstats
path: root/dom/browser-element/mochitest/browserElement_BrowserWindowNamespace.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/browser-element/mochitest/browserElement_BrowserWindowNamespace.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/browser-element/mochitest/browserElement_BrowserWindowNamespace.js')
-rw-r--r--dom/browser-element/mochitest/browserElement_BrowserWindowNamespace.js57
1 files changed, 57 insertions, 0 deletions
diff --git a/dom/browser-element/mochitest/browserElement_BrowserWindowNamespace.js b/dom/browser-element/mochitest/browserElement_BrowserWindowNamespace.js
new file mode 100644
index 000000000..87c4a216c
--- /dev/null
+++ b/dom/browser-element/mochitest/browserElement_BrowserWindowNamespace.js
@@ -0,0 +1,57 @@
+/* Any copyright is dedicated to the public domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Bug 780351 - Test that mozbrowser does /not/ divide the window name namespace.
+// Multiple mozbrowsers inside the same app are like multiple browser tabs;
+// they share a window name namespace.
+
+"use strict";
+
+SimpleTest.waitForExplicitFinish();
+browserElementTestHelpers.setEnabledPref(true);
+browserElementTestHelpers.addPermission();
+
+function runTest() {
+ var iframe1 = document.createElement('iframe');
+ iframe1.setAttribute('mozbrowser', 'true');
+
+ // Two mozbrowser frames with the same code both do the same
+ // window.open("foo", "bar") call. We should only get one
+ // mozbrowseropenwindow event.
+
+ iframe1.addEventListener('mozbrowseropenwindow', function(e) {
+ ok(true, "Got first mozbrowseropenwindow event.");
+ document.body.appendChild(e.detail.frameElement);
+
+ e.detail.frameElement.addEventListener('mozbrowserlocationchange', function(e) {
+ if (e.detail.url == "http://example.com/#2") {
+ ok(true, "Got locationchange to http://example.com/#2");
+ SimpleTest.finish();
+ }
+ else {
+ ok(true, "Got locationchange to " + e.detail.url);
+ }
+ });
+
+ SimpleTest.executeSoon(function() {
+ var iframe2 = document.createElement('iframe');
+ // Make sure that iframe1 and iframe2 are in the same TabGroup by linking
+ // them through opener. Right now this API requires chrome privileges, as
+ // it is on MozFrameLoaderOwner.
+ SpecialPowers.wrap(iframe2).presetOpenerWindow(iframe1.contentWindow);
+ iframe2.setAttribute('mozbrowser', 'true');
+
+ iframe2.addEventListener('mozbrowseropenwindow', function(e) {
+ ok(false, "Got second mozbrowseropenwindow event.");
+ });
+
+ document.body.appendChild(iframe2);
+ iframe2.src = 'file_browserElement_BrowserWindowNamespace.html#2';
+ });
+ });
+
+ document.body.appendChild(iframe1);
+ iframe1.src = 'file_browserElement_BrowserWindowNamespace.html#1';
+}
+
+addEventListener('testready', runTest);