|
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> |
|
16 |
|
17 <body> |
|
18 <div id='test'> |
|
19 <script type="application/javascript;version=1.8"> |
|
20 |
|
21 function postResults(message) { |
|
22 window.realParent.postMessage(JSON.stringify(message), "*"); |
|
23 } |
|
24 |
|
25 function onready() { |
|
26 navigator.mozId.request(); |
|
27 } |
|
28 |
|
29 function onlogin(backedAssertion) { |
|
30 postResults({success: true, backedAssertion: backedAssertion}); |
|
31 } |
|
32 |
|
33 function onerror(error) { |
|
34 postResults({success: false, error: error}); |
|
35 } |
|
36 |
|
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, |
|
44 |
|
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 }; |
|
51 |
|
52 </script> |
|
53 </div> |
|
54 </body> |
|
55 </html> |