dom/permission/tests/test_embed-apps.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/permission/tests/test_embed-apps.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,61 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=815105
     1.8 +-->
     1.9 +<head>
    1.10 +  <meta charset="utf-8">
    1.11 +  <title>Test for Bug 815105 </title>
    1.12 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.14 +</head>
    1.15 +<body>
    1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=815105">Mozilla Bug 815105 </a>
    1.17 +<p id="display"></p>
    1.18 +<div id="content" style="display: none"></div>
    1.19 +<pre id="test">
    1.20 +<script type="application/javascript;version=1.8" src="file_framework.js"></script>
    1.21 +<script type="application/javascript;version=1.8">
    1.22 +/*
    1.23 + * embed-apps allows us to create app iframes,
    1.24 + * creator must also have the browser permission
    1.25 + */
    1.26 +function verifier(success, failure) {
    1.27 +  var iframe = document.createElement('iframe');
    1.28 +  iframe.setAttribute('mozbrowser', '');
    1.29 +  iframe.setAttribute('mozapp', 'http://example.org/manifest.webapp');
    1.30 +  iframe.src = "http://example.org/";
    1.31 +  iframe.addEventListener('load', function() {
    1.32 +    var appStatus = SpecialPowers.wrap(iframe)
    1.33 +                                 .contentDocument.nodePrincipal.appStatus;
    1.34 +
    1.35 +    if (appStatus != SpecialPowers.Ci
    1.36 +                                  .nsIPrincipal.APP_STATUS_NOT_INSTALLED) {
    1.37 +      success("Got mozapp");
    1.38 +    } else {
    1.39 +      failure("Didn't get mozapp") ;
    1.40 +    }
    1.41 +  });
    1.42 +
    1.43 +  document.getElementById('content').appendChild(iframe);
    1.44 +}
    1.45 +
    1.46 +var gData = [
    1.47 +  {
    1.48 +    perm: ["embed-apps", "browser"],
    1.49 +    /*
    1.50 +     * Android doesn't have working apps
    1.51 +     * Mobile is for B2G which has a weird testing setup
    1.52 +     * the app iframe gets embed in the test-container iframe
    1.53 +     * which returns APP_STATUS_NOT_INSTALLED
    1.54 +     */
    1.55 +    skip: ["Android", "Mobile"],
    1.56 +    settings: [["dom.mozBrowserFramesEnabled", true]],
    1.57 +    verifier: verifier.toSource(),
    1.58 +  }
    1.59 +]
    1.60 +</script>
    1.61 +</pre>
    1.62 +</body>
    1.63 +</html>
    1.64 +

mercurial