mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
69 lines
2.4 KiB
HTML
69 lines
2.4 KiB
HTML
|
<!DOCTYPE HTML>
|
||
|
<html>
|
||
|
<!--
|
||
|
https://bugzilla.mozilla.org/show_bug.cgi?id=462856
|
||
|
-->
|
||
|
<head>
|
||
|
<title>Test offline app notification</title>
|
||
|
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
||
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||
|
</head>
|
||
|
<body onload="loaded()">
|
||
|
<p id="display">
|
||
|
<!-- Load the test frame twice from the same domain,
|
||
|
to make sure we get notifications for both -->
|
||
|
<iframe name="testFrame" src="offlineChild.html"></iframe>
|
||
|
<iframe name="testFrame2" src="offlineChild2.html"></iframe>
|
||
|
<!-- Load from another domain to make sure we get a second allow/deny
|
||
|
notification -->
|
||
|
<iframe name="testFrame3" src="http://example.com/tests/browser/base/content/test/offlineChild.html"></iframe>
|
||
|
|
||
|
<div id="content" style="display: none">
|
||
|
</div>
|
||
|
<pre id="test">
|
||
|
<script class="testbody" type="text/javascript">
|
||
|
|
||
|
SimpleTest.waitForExplicitFinish();
|
||
|
|
||
|
var numFinished = 0;
|
||
|
|
||
|
window.addEventListener("message", function(event) {
|
||
|
is(event.data, "success", "Child was successfully cached.");
|
||
|
|
||
|
if (++numFinished == 3) {
|
||
|
// Clean up after ourself
|
||
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||
|
var pm = Components.classes["@mozilla.org/permissionmanager;1"].
|
||
|
getService(Components.interfaces.nsIPermissionManager);
|
||
|
|
||
|
pm.remove(frames.testFrame.document.documentURIObject.host, "offline-app");
|
||
|
pm.remove(frames.testFrame3.document.documentURIObject.host, "offline-app");
|
||
|
|
||
|
SimpleTest.finish();
|
||
|
}
|
||
|
}, false);
|
||
|
|
||
|
function loaded() {
|
||
|
// Click the notification bar's "Allow" button. This should kick
|
||
|
// off updates, which will eventually lead to getting messages from
|
||
|
// the children.
|
||
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||
|
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].
|
||
|
getService(Components.interfaces.nsIWindowMediator);
|
||
|
var win = wm.getMostRecentWindow("navigator:browser");
|
||
|
var notificationBox = win.gBrowser.getNotificationBox();
|
||
|
|
||
|
var notification = notificationBox.getNotificationWithValue("offline-app-requested-localhost");
|
||
|
notification.childNodes[0].click();
|
||
|
|
||
|
notification = notificationBox.getNotificationWithValue("offline-app-requested-example.com");
|
||
|
notification.childNodes[0].click();
|
||
|
}
|
||
|
|
||
|
</script>
|
||
|
</pre>
|
||
|
</body>
|
||
|
</html>
|
||
|
|