dom/permission/tests/test_embed-apps.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=815105
     5 -->
     6 <head>
     7   <meta charset="utf-8">
     8   <title>Test for Bug 815105 </title>
     9   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    10   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    11 </head>
    12 <body>
    13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=815105">Mozilla Bug 815105 </a>
    14 <p id="display"></p>
    15 <div id="content" style="display: none"></div>
    16 <pre id="test">
    17 <script type="application/javascript;version=1.8" src="file_framework.js"></script>
    18 <script type="application/javascript;version=1.8">
    19 /*
    20  * embed-apps allows us to create app iframes,
    21  * creator must also have the browser permission
    22  */
    23 function verifier(success, failure) {
    24   var iframe = document.createElement('iframe');
    25   iframe.setAttribute('mozbrowser', '');
    26   iframe.setAttribute('mozapp', 'http://example.org/manifest.webapp');
    27   iframe.src = "http://example.org/";
    28   iframe.addEventListener('load', function() {
    29     var appStatus = SpecialPowers.wrap(iframe)
    30                                  .contentDocument.nodePrincipal.appStatus;
    32     if (appStatus != SpecialPowers.Ci
    33                                   .nsIPrincipal.APP_STATUS_NOT_INSTALLED) {
    34       success("Got mozapp");
    35     } else {
    36       failure("Didn't get mozapp") ;
    37     }
    38   });
    40   document.getElementById('content').appendChild(iframe);
    41 }
    43 var gData = [
    44   {
    45     perm: ["embed-apps", "browser"],
    46     /*
    47      * Android doesn't have working apps
    48      * Mobile is for B2G which has a weird testing setup
    49      * the app iframe gets embed in the test-container iframe
    50      * which returns APP_STATUS_NOT_INSTALLED
    51      */
    52     skip: ["Android", "Mobile"],
    53     settings: [["dom.mozBrowserFramesEnabled", true]],
    54     verifier: verifier.toSource(),
    55   }
    56 ]
    57 </script>
    58 </pre>
    59 </body>
    60 </html>

mercurial