|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <head> |
|
4 <meta charset="utf-8"> |
|
5 <title>Cross Origin Helper</title> |
|
6 <script type="application/javascript" src="head.js"></script> |
|
7 </head> |
|
8 <body> |
|
9 <script type="application/javascript"> |
|
10 |
|
11 /** |
|
12 * Install an app, check that getSelf() works, and then tell the test page |
|
13 * to continue the tests. |
|
14 * |
|
15 * This page loads on a different origin than the one for the test page, |
|
16 * which enables that page to check the behavior of various API calls when apps |
|
17 * have been installed from multiple origins. |
|
18 */ |
|
19 |
|
20 var parent = SpecialPowers.wrap(window).parent; |
|
21 |
|
22 confirmNextInstall(); |
|
23 navigator.mozApps.install(parent.url2, null).onsuccess = function onInstall() { |
|
24 // Give the test page a reference to the installed app, so it can uninstall it |
|
25 // after it finishes the tests. |
|
26 parent.app2 = this.result; |
|
27 |
|
28 navigator.mozApps.getSelf().onsuccess = function onGetSelf() { |
|
29 parent.ok(this.result == null, "getSelf() from app's origin returns null if called from a browser"); |
|
30 |
|
31 // Tell the test page to continue the tests. |
|
32 parent.postMessage("next", "*"); |
|
33 } |
|
34 } |
|
35 |
|
36 </script> |
|
37 </body> |
|
38 </html> |