1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/identity/tests/mochitest/file_declareAudience.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,55 @@ 1.4 +<!-- 1.5 + * This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + --> 1.9 +<!DOCTYPE html> 1.10 +<html> 1.11 + <!-- 1.12 + Certified and packaged apps should be able to declare assertion audience. 1.13 + https://bugzilla.mozilla.org/show_bug.cgi?id=947374 1.14 + --> 1.15 +<head> 1.16 + <meta charset="utf-8"> 1.17 + <title>Test app for bug 947374</title> 1.18 +</head> 1.19 + 1.20 +<body> 1.21 + <div id='test'> 1.22 +<script type="application/javascript;version=1.8"> 1.23 + 1.24 + function postResults(message) { 1.25 + window.realParent.postMessage(JSON.stringify(message), "*"); 1.26 + } 1.27 + 1.28 + function onready() { 1.29 + navigator.mozId.request(); 1.30 + } 1.31 + 1.32 + function onlogin(backedAssertion) { 1.33 + postResults({success: true, backedAssertion: backedAssertion}); 1.34 + } 1.35 + 1.36 + function onerror(error) { 1.37 + postResults({success: false, error: error}); 1.38 + } 1.39 + 1.40 + onmessage = function(event) { 1.41 + navigator.mozId.watch({ 1.42 + wantIssuer: "firefox-accounts", 1.43 + audience: event.data.audience, 1.44 + onready: onready, 1.45 + onlogin: onlogin, 1.46 + onerror: onerror, 1.47 + 1.48 + // onlogout will actually be called every time watch() is invoked, 1.49 + // because fxa will find no signed-in user and so trigger logout. 1.50 + // For this test, though, we don't care and just ignore logout. 1.51 + onlogout: function () {}, 1.52 + }); 1.53 + }; 1.54 + 1.55 +</script> 1.56 +</div> 1.57 +</body> 1.58 +</html>