dom/browser-element/mochitest/browserElement_AppWindowNamespace.js

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

     1 /* Any copyright is dedicated to the public domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 // Bug 780351 - Test that mozapp divides the window name namespace.
     5 "use strict";
     7 SimpleTest.waitForExplicitFinish();
     8 browserElementTestHelpers.setEnabledPref(true);
     9 browserElementTestHelpers.addPermission();
    10 // Permission to embed an app.
    11 SpecialPowers.addPermission("embed-apps", true, document);
    13 function runTest() {
    15   var iframe1 = document.createElement('iframe');
    16   SpecialPowers.wrap(iframe1).mozbrowser = true;
    17   iframe1.setAttribute('mozapp', 'http://example.org/manifest.webapp');
    19   // Two mozapp frames for different apps with the same code both do the same
    20   // window.open("foo", "bar") call.  We should get two mozbrowseropenwindow
    21   // events.
    23   iframe1.addEventListener('mozbrowseropenwindow', function(e) {
    24     ok(true, "Got first mozbrowseropenwindow event.");
    25     document.body.appendChild(e.detail.frameElement);
    27     SimpleTest.executeSoon(function() {
    28       var iframe2 = document.createElement('iframe');
    29       SpecialPowers.wrap(iframe2).mozbrowser = true;
    30       iframe2.setAttribute('mozapp', 'http://example.com/manifest.webapp');
    32       iframe2.addEventListener('mozbrowseropenwindow', function(e) {
    33         ok(true, "Got second mozbrowseropenwindow event.");
    34         SpecialPowers.removePermission("embed-apps", document);
    36         // We're not going to open this, but we don't want the platform to either
    37         e.preventDefault();
    38         SimpleTest.finish();
    39       });
    41       document.body.appendChild(iframe2);
    42       iframe2.src = 'http://example.com/tests/dom/browser-element/mochitest/file_browserElement_AppWindowNamespace.html';
    43     });
    44   });
    46   document.body.appendChild(iframe1);
    47   iframe1.src = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_AppWindowNamespace.html';
    48 }
    50 addEventListener('testready', runTest);

mercurial