dom/identity/tests/mochitest/file_syntheticEvents.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/identity/tests/mochitest/file_syntheticEvents.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,51 @@
     1.4 +<!--
     1.5 +  * This Source Code Form is subject to the terms of the Mozilla Public
     1.6 +  * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 +  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 + -->
     1.9 +<!DOCTYPE html>
    1.10 +<html>
    1.11 +  <!--
    1.12 +  Certified and privileged apps can call mozId outside an event handler
    1.13 +  Certified apps:  https://bugzilla.mozilla.org/show_bug.cgi?id=971379
    1.14 +  Privileged apps: https://bugzilla.mozilla.org/show_bug.cgi?id=982460
    1.15 +  -->
    1.16 +<head>
    1.17 +  <meta charset="utf-8">
    1.18 +  <title>Test app for bug 971379</title>
    1.19 +</head>
    1.20 +
    1.21 +<body>
    1.22 +    <div id='test'>
    1.23 +<script type="application/javascript;version=1.8">
    1.24 +
    1.25 +  function postResults(message) {
    1.26 +    window.realParent.postMessage(JSON.stringify(message), "*");
    1.27 +  }
    1.28 +
    1.29 +  function onready() {
    1.30 +    navigator.mozId.request();
    1.31 +  }
    1.32 +
    1.33 +  function onlogin(backedAssertion) {
    1.34 +    postResults({success: true, backedAssertion: backedAssertion});
    1.35 +  }
    1.36 +
    1.37 +  function onerror(error) {
    1.38 +    postResults({success: false, error: error});
    1.39 +  }
    1.40 +
    1.41 +  onmessage = function(message) {
    1.42 +    navigator.mozId.watch({
    1.43 +      wantIssuer: message.data.wantIssuer,
    1.44 +      onready: onready,
    1.45 +      onerror: onerror,
    1.46 +      onlogin: onlogin,
    1.47 +      onlogout: function() {},
    1.48 +    });
    1.49 +  };
    1.50 +
    1.51 +</script>
    1.52 +</div>
    1.53 +</body>
    1.54 +</html>

mercurial