2012-08-13 19:19:09 +00:00
|
|
|
/* Any copyright is dedicated to the public domain.
|
|
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
|
|
|
|
// Bug 780351 - Test that mozapp divides the window name namespace.
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
2013-03-28 19:51:10 +00:00
|
|
|
browserElementTestHelpers.setEnabledPref(true);
|
|
|
|
browserElementTestHelpers.addPermission();
|
|
|
|
// Permission to embed an app.
|
|
|
|
SpecialPowers.addPermission("embed-apps", true, document);
|
2012-08-13 19:19:09 +00:00
|
|
|
|
|
|
|
function runTest() {
|
|
|
|
|
|
|
|
var iframe1 = document.createElement('iframe');
|
2013-02-27 02:26:10 +00:00
|
|
|
SpecialPowers.wrap(iframe1).mozbrowser = true;
|
2012-08-13 19:19:09 +00:00
|
|
|
iframe1.setAttribute('mozapp', 'http://example.org/manifest.webapp');
|
|
|
|
|
|
|
|
// Two mozapp frames for different apps with the same code both do the same
|
|
|
|
// window.open("foo", "bar") call. We should get two mozbrowseropenwindow
|
|
|
|
// events.
|
|
|
|
|
|
|
|
iframe1.addEventListener('mozbrowseropenwindow', function(e) {
|
|
|
|
ok(true, "Got first mozbrowseropenwindow event.");
|
|
|
|
document.body.appendChild(e.detail.frameElement);
|
|
|
|
|
|
|
|
SimpleTest.executeSoon(function() {
|
|
|
|
var iframe2 = document.createElement('iframe');
|
2013-02-27 02:26:10 +00:00
|
|
|
SpecialPowers.wrap(iframe2).mozbrowser = true;
|
2012-08-13 19:19:09 +00:00
|
|
|
iframe2.setAttribute('mozapp', 'http://example.com/manifest.webapp');
|
|
|
|
|
|
|
|
iframe2.addEventListener('mozbrowseropenwindow', function(e) {
|
|
|
|
ok(true, "Got second mozbrowseropenwindow event.");
|
2012-09-26 17:47:57 +00:00
|
|
|
SpecialPowers.removePermission("embed-apps", document);
|
2013-09-10 04:18:46 +00:00
|
|
|
|
|
|
|
// We're not going to open this, but we don't want the platform to either
|
|
|
|
e.preventDefault();
|
2012-08-13 19:19:09 +00:00
|
|
|
SimpleTest.finish();
|
|
|
|
});
|
|
|
|
|
|
|
|
document.body.appendChild(iframe2);
|
|
|
|
iframe2.src = 'http://example.com/tests/dom/browser-element/mochitest/file_browserElement_AppWindowNamespace.html';
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
document.body.appendChild(iframe1);
|
|
|
|
iframe1.src = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_AppWindowNamespace.html';
|
|
|
|
}
|
|
|
|
|
2013-03-28 19:51:10 +00:00
|
|
|
addEventListener('testready', runTest);
|