Bug 666660 - convert mochitest plugin harness code to specialpowers. r=ted, a=test-only

This commit is contained in:
Joel Maher 2011-07-23 09:02:43 -04:00
Родитель bb2e78799b
Коммит 874643b9f7
3 изменённых файлов: 18 добавлений и 16 удалений

Просмотреть файл

@ -16,13 +16,9 @@
SimpleTest.expectChildProcessCrash();
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var prefs = Components.classes['@mozilla.org/preferences-service;1']
.getService(Components.interfaces.nsIPrefBranch);
// the default timeout is annoying high for mochitest runs
var timeoutPref = "dom.ipc.plugins.timeoutSecs";
prefs.setIntPref(timeoutPref, 5);
SpecialPowers.setIntPref(timeoutPref, 5);
var iframe = document.getElementById('iframe1');
var p = iframe.contentDocument.getElementById('plugin1');
@ -56,11 +52,7 @@
}
try {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var prefs = Components.classes['@mozilla.org/preferences-service;1']
.getService(Components.interfaces.nsIPrefBranch);
prefs.clearUserPref(timeoutPref);
SpecialPowers.clearUserPref(timeoutPref);
}
catch(e) {
ok(false, "Couldn't reset timeout pref");

Просмотреть файл

@ -253,6 +253,20 @@ SpecialPowers.prototype = {
}
},
_xpcomabi: null,
get XPCOMABI() {
if (this._xpcomabi != null)
return this._xpcomabi;
var xulRuntime = Cc["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULAppInfo)
.QueryInterface(Components.interfaces.nsIXULRuntime);
this._xpcomabi = xulRuntime.XPCOMABI;
return this._xpcomabi;
},
registerProcessCrashObservers: function() {
addMessageListener("SPProcessCrashService", this._messageListener);
sendSyncMessage("SPProcessCrashService", { op: "register-observer" });

Просмотреть файл

@ -36,20 +36,16 @@ if (parentRunner) {
* Check for OOP test plugin
**/
SimpleTest.testPluginIsOOP = function () {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var testPluginIsOOP = false;
if (navigator.platform.indexOf("Mac") == 0) {
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULAppInfo)
.QueryInterface(Components.interfaces.nsIXULRuntime);
if (xulRuntime.XPCOMABI.match(/x86-/)) {
if (SpecialPowers.XPCOMABI.match(/x86-/)) {
try {
testPluginIsOOP = SpecialPowers.getBoolPref("dom.ipc.plugins.enabled.i386.test.plugin");
} catch (e) {
testPluginIsOOP = SpecialPowers.getBoolPref("dom.ipc.plugins.enabled.i386");
}
}
else if (xulRuntime.XPCOMABI.match(/x86_64-/)) {
else if (SpecialPowers.XPCOMABI.match(/x86_64-/)) {
try {
testPluginIsOOP = SpecialPowers.getBoolPref("dom.ipc.plugins.enabled.x86_64.test.plugin");
} catch (e) {