зеркало из https://github.com/mozilla/gecko-dev.git
Fix crashing iframes due to gtk_init, stop using windows in xpcshell tests
This commit is contained in:
Родитель
069f02260e
Коммит
175d63409f
|
@ -63,10 +63,6 @@ main(int argc, char* argv[])
|
|||
MessageBox(NULL, L"Hi", L"Hi", MB_OK);
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
gtk_init(0, 0);
|
||||
#endif
|
||||
|
||||
GeckoProcessType proctype =
|
||||
XRE_StringToChildProcessType(argv[argc - 1]);
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
function checkStatus(result) {
|
||||
if (result == "Waiting") {
|
||||
sendCommand("observer.status;", checkStatus);
|
||||
return;
|
||||
}
|
||||
|
||||
do_check_eq(result, "Success");
|
||||
function callback(result) {
|
||||
do_check_eq(result, Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT);
|
||||
do_test_finished();
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
sendCommand("load('test_ipcshell_child.js'); start();");
|
||||
sendCommand("observer.status;", checkStatus);
|
||||
|
||||
do_check_eq(runtime.processType, Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT);
|
||||
|
||||
sendCommand("load('test_ipcshell_child.js');");
|
||||
sendCommand("runtime.processType;", callback);
|
||||
}
|
||||
load('test_ipcshell_child.js');
|
||||
|
||||
|
|
|
@ -1,81 +1,9 @@
|
|||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
function WWObserver(watcher) {
|
||||
this._watcher = watcher;
|
||||
this._status = "Waiting";
|
||||
}
|
||||
WWObserver.prototype = {
|
||||
_exit: function(status) {
|
||||
var ok = (status == "Success");
|
||||
|
||||
this._status = status;
|
||||
this._window = null;
|
||||
this._watcher.unregisterNotification(this);
|
||||
this._watcher = null;
|
||||
|
||||
if (!ok) {
|
||||
throw new Error(this._status);
|
||||
}
|
||||
},
|
||||
|
||||
observe: function(subject, topic, data) {
|
||||
switch (topic) {
|
||||
case "domwindowopened":
|
||||
this._window = subject.QueryInterface(Ci.nsIDOMJSWindow);
|
||||
if (!this._window) {
|
||||
this._exit("Error");
|
||||
}
|
||||
this._window.setTimeout(function doTimeout(window) {
|
||||
window.QueryInterface(Ci.nsIDOMWindowInternal).close();
|
||||
}, 2000, this._window);
|
||||
break;
|
||||
|
||||
case "domwindowclosed":
|
||||
if (subject.QueryInterface(Ci.nsIDOMJSWindow) != this._window) {
|
||||
this._exit("Error");
|
||||
}
|
||||
this._exit("Success");
|
||||
break;
|
||||
|
||||
default:
|
||||
this._exit("Error");
|
||||
}
|
||||
},
|
||||
|
||||
get status() {
|
||||
return this._status;
|
||||
}
|
||||
};
|
||||
|
||||
var observer = null;
|
||||
|
||||
function start(standalone) {
|
||||
var windowCreator = Cc["@mozilla.org/toolkit/app-startup;1"].
|
||||
getService(Ci.nsIWindowCreator);
|
||||
var windowWatcher = Cc["@mozilla.org/embedcomp/window-watcher;1"].
|
||||
getService(Ci.nsIWindowWatcher);
|
||||
windowWatcher.setWindowCreator(windowCreator);
|
||||
|
||||
observer = new WWObserver(windowWatcher);
|
||||
windowWatcher.registerNotification(observer, standalone);
|
||||
|
||||
var promptService = Cc["@mozilla.org/embedcomp/prompt-service;1"].
|
||||
getService(Ci.nsIPromptService);
|
||||
promptService.alert(null, "Howdy!", "This window will close automatically.");
|
||||
}
|
||||
|
||||
function maybeExit() {
|
||||
if (observer.status != "Waiting") {
|
||||
do_check_eq(observer.status, "Success");
|
||||
do_test_finished();
|
||||
return;
|
||||
}
|
||||
do_timeout(100, "maybeExit();");
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
start();
|
||||
do_timeout(100, "maybeExit();");
|
||||
}
|
||||
|
||||
const runtime = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime);
|
||||
|
||||
if (typeof(run_test) == "undefined") {
|
||||
run_test = function() {
|
||||
do_check_eq(runtime.processType, Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT);
|
||||
}
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче