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