2
/* This Source Code Form is subject to the terms of the Mozilla Public
3
* License, v. 2.0. If a copy of the MPL was not distributed with this
4
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7
From mozilla/toolkit/content
8
These files did not have a license
13
var xhr = new XMLHttpRequest();
14
xhr.open("GET", "http://" + location.host + "/server/shutdown", true);
15
xhr.onreadystatechange = function (event)
17
if (xhr.readyState == 4)
23
function canQuitApplication()
25
var os = Components.classes["@mozilla.org/observer-service;1"]
26
.getService(Components.interfaces.nsIObserverService);
34
var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"]
35
.createInstance(Components.interfaces.nsISupportsPRBool);
36
os.notifyObservers(cancelQuit, "quit-application-requested", null);
38
// Something aborted the quit process.
47
os.notifyObservers(null, "quit-application-granted", null);
51
function goQuitApplication()
53
const privs = 'UniversalXPConnect';
57
netscape.security.PrivilegeManager.enablePrivilege(privs);
61
throw('goQuitApplication: privilege failure ' + ex);
64
if (!canQuitApplication())
69
const kAppStartup = '@mozilla.org/toolkit/app-startup;1';
70
const kAppShell = '@mozilla.org/appshell/appShellService;1';
74
if (kAppStartup in Components.classes)
76
appService = Components.classes[kAppStartup].
77
getService(Components.interfaces.nsIAppStartup);
78
forceQuit = Components.interfaces.nsIAppStartup.eForceQuit;
81
else if (kAppShell in Components.classes)
83
appService = Components.classes[kAppShell].
84
getService(Components.interfaces.nsIAppShellService);
85
forceQuit = Components.interfaces.nsIAppShellService.eForceQuit;
89
throw 'goQuitApplication: no AppStartup/appShell';
92
var windowManager = Components.
93
classes['@mozilla.org/appshell/window-mediator;1'].getService();
95
var windowManagerInterface = windowManager.
96
QueryInterface(Components.interfaces.nsIWindowMediator);
98
var enumerator = windowManagerInterface.getEnumerator(null);
100
while (enumerator.hasMoreElements())
102
var domWindow = enumerator.getNext();
103
if (("tryToClose" in domWindow) && !domWindow.tryToClose())
112
appService.quit(forceQuit);
116
throw('goQuitApplication: ' + ex);
122
// bloat test driver for TestGtkEmbed
124
// set |user_pref("dom.allow_scripts_to_close_windows", true);| to
125
// allow this to close the window when the loop is done.
127
// "ftp://ftp.mozilla.org", // not supported for TestGtkEmbed
138
var interval = 5000; // 15000
142
window.onload = function () {
143
w = window.open("about:blank");
144
window.setTimeout(loadURL, interval);
146
function loadURL () {
147
w.location.href = list[idx++];
148
if (idx < list.length) {
149
window.setTimeout(loadURL, interval);
151
if (navigator.platform.indexOf('Mac') != -1) {
154
window.setTimeout("w.close();", interval);
155
window.setTimeout("window.close();", interval*2);
161
for(i=0; i < list.length;i++) {
162
document.write(list[i]);
163
document.write("<br>");