|
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 privileged apps can call mozId outside an event handler |
|
10 Certified apps: https://bugzilla.mozilla.org/show_bug.cgi?id=971379 |
|
11 Privileged apps: https://bugzilla.mozilla.org/show_bug.cgi?id=982460 |
|
12 --> |
|
13 <head> |
|
14 <meta charset="utf-8"> |
|
15 <title>Test app for bug 971379</title> |
|
16 </head> |
|
17 |
|
18 <body> |
|
19 <div id='test'> |
|
20 <script type="application/javascript;version=1.8"> |
|
21 |
|
22 function postResults(message) { |
|
23 window.realParent.postMessage(JSON.stringify(message), "*"); |
|
24 } |
|
25 |
|
26 function onready() { |
|
27 navigator.mozId.request(); |
|
28 } |
|
29 |
|
30 function onlogin(backedAssertion) { |
|
31 postResults({success: true, backedAssertion: backedAssertion}); |
|
32 } |
|
33 |
|
34 function onerror(error) { |
|
35 postResults({success: false, error: error}); |
|
36 } |
|
37 |
|
38 onmessage = function(message) { |
|
39 navigator.mozId.watch({ |
|
40 wantIssuer: message.data.wantIssuer, |
|
41 onready: onready, |
|
42 onerror: onerror, |
|
43 onlogin: onlogin, |
|
44 onlogout: function() {}, |
|
45 }); |
|
46 }; |
|
47 |
|
48 </script> |
|
49 </div> |
|
50 </body> |
|
51 </html> |