mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-11-20 10:33:36 +00:00
74 lines
1.8 KiB
HTML
74 lines
1.8 KiB
HTML
|
<!--
|
||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||
|
-->
|
||
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<!--
|
||
|
Certified and packaged apps should be able to declare assertion audience.
|
||
|
https://bugzilla.mozilla.org/show_bug.cgi?id=947374
|
||
|
-->
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<title>Test app for bug 947374</title>
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
<div id='test'>
|
||
|
<script type="application/javascript;version=1.8">
|
||
|
|
||
|
function postResults(message) {
|
||
|
doPostMessage(JSON.stringify(message), "*");
|
||
|
}
|
||
|
|
||
|
onmessage = function(event) {
|
||
|
try {
|
||
|
navigator.mozId.watch({
|
||
|
wantIssuer: "firefox-accounts",
|
||
|
audience: event.data.audience,
|
||
|
onready: function() {
|
||
|
try {
|
||
|
navigator.mozId.request();
|
||
|
} catch(e) {
|
||
|
postResults({
|
||
|
success: false,
|
||
|
error: e,
|
||
|
appIndex: event.data.appIndex
|
||
|
});
|
||
|
}
|
||
|
},
|
||
|
onlogin: function(backedAssertion) {
|
||
|
postResults({
|
||
|
success: true,
|
||
|
backedAssertion: backedAssertion,
|
||
|
appIndex: event.data.appIndex
|
||
|
});
|
||
|
},
|
||
|
onerror: function(error) {
|
||
|
postResults({
|
||
|
success: false,
|
||
|
error: error,
|
||
|
appIndex: event.data.appIndex
|
||
|
});
|
||
|
},
|
||
|
|
||
|
// onlogout will actually be called every time watch() is invoked,
|
||
|
// because fxa will find no signed-in user and so trigger logout.
|
||
|
// For this test, though, we don't care and just ignore logout.
|
||
|
onlogout: function () {},
|
||
|
});
|
||
|
} catch (e) {
|
||
|
postResults({
|
||
|
success: false,
|
||
|
error: e,
|
||
|
appIndex: event.data.appIndex
|
||
|
});
|
||
|
}
|
||
|
};
|
||
|
|
||
|
</script>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|