dom/identity/tests/mochitest/file_declareAudience.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <!--
     2   * This Source Code Form is subject to the terms of the Mozilla Public
     3   * License, v. 2.0. If a copy of the MPL was not distributed with this
     4   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5  -->
     6 <!DOCTYPE html>
     7 <html>
     8   <!--
     9   Certified and packaged apps should be able to declare assertion audience.
    10   https://bugzilla.mozilla.org/show_bug.cgi?id=947374
    11   -->
    12 <head>
    13   <meta charset="utf-8">
    14   <title>Test app for bug 947374</title>
    15 </head>
    17 <body>
    18     <div id='test'>
    19 <script type="application/javascript;version=1.8">
    21   function postResults(message) {
    22     window.realParent.postMessage(JSON.stringify(message), "*");
    23   }
    25   function onready() {
    26     navigator.mozId.request();
    27   }
    29   function onlogin(backedAssertion) {
    30     postResults({success: true, backedAssertion: backedAssertion});
    31   }
    33   function onerror(error) {
    34     postResults({success: false, error: error});
    35   }
    37   onmessage = function(event) {
    38     navigator.mozId.watch({
    39       wantIssuer: "firefox-accounts",
    40       audience: event.data.audience,
    41       onready: onready,
    42       onlogin: onlogin,
    43       onerror: onerror,
    45       // onlogout will actually be called every time watch() is invoked,
    46       // because fxa will find no signed-in user and so trigger logout.
    47       // For this test, though, we don't care and just ignore logout.
    48       onlogout: function () {},
    49     });
    50   };
    52 </script>
    53 </div>
    54 </body>
    55 </html>

mercurial