1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/tests/mochitest/webapps/cross_origin.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,38 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<head> 1.7 + <meta charset="utf-8"> 1.8 + <title>Cross Origin Helper</title> 1.9 + <script type="application/javascript" src="head.js"></script> 1.10 +</head> 1.11 +<body> 1.12 +<script type="application/javascript"> 1.13 + 1.14 +/** 1.15 + * Install an app, check that getSelf() works, and then tell the test page 1.16 + * to continue the tests. 1.17 + * 1.18 + * This page loads on a different origin than the one for the test page, 1.19 + * which enables that page to check the behavior of various API calls when apps 1.20 + * have been installed from multiple origins. 1.21 + */ 1.22 + 1.23 +var parent = SpecialPowers.wrap(window).parent; 1.24 + 1.25 +confirmNextInstall(); 1.26 +navigator.mozApps.install(parent.url2, null).onsuccess = function onInstall() { 1.27 + // Give the test page a reference to the installed app, so it can uninstall it 1.28 + // after it finishes the tests. 1.29 + parent.app2 = this.result; 1.30 + 1.31 + navigator.mozApps.getSelf().onsuccess = function onGetSelf() { 1.32 + parent.ok(this.result == null, "getSelf() from app's origin returns null if called from a browser"); 1.33 + 1.34 + // Tell the test page to continue the tests. 1.35 + parent.postMessage("next", "*"); 1.36 + } 1.37 +} 1.38 + 1.39 +</script> 1.40 +</body> 1.41 +</html>