dom/browser-element/mochitest/browserElement_AppFramePermission.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 777384 - Test mozapp permission.
     5 "use strict";
     7 SimpleTest.waitForExplicitFinish();
     8 browserElementTestHelpers.setEnabledPref(true);
     9 browserElementTestHelpers.addPermission();
    11 SpecialPowers.setAllAppsLaunchable(true);
    13 function testAppElement(expectAnApp, callback) {
    14   var iframe = document.createElement('iframe');
    15   SpecialPowers.wrap(iframe).mozbrowser = true;
    16   iframe.setAttribute('mozapp', 'http://example.org/manifest.webapp');
    17   iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
    18     is(e.detail.message == 'app', expectAnApp, e.detail.message);
    19     SimpleTest.executeSoon(callback);
    20   });
    21   document.body.appendChild(iframe);
    22   iframe.src = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_AppFramePermission.html';
    23 }
    25 function runTest() {
    26   SpecialPowers.addPermission("embed-apps", true, document);
    27   testAppElement(true, function() {
    28     SpecialPowers.removePermission("embed-apps", document);
    29     testAppElement(false, function() {
    30       SimpleTest.finish();
    31     });
    32   });
    33 }
    35 addEventListener('testready', runTest);

mercurial