Backout 7209f50695da (bug 788378) due to debug xpcshell orange

This commit is contained in:
Blair McBride 2012-09-18 19:27:55 +12:00
Родитель 34d5f5c6d5
Коммит 62800a36c3
3 изменённых файлов: 40 добавлений и 115 удалений

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

@ -1932,26 +1932,14 @@ var AddonManagerInternal = {
},
get addonTypes() {
if (!gStarted)
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
return this.typesProxy;
},
get autoUpdateDefault() {
if (!gStarted)
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
return gAutoUpdateDefault;
},
set autoUpdateDefault(aValue) {
if (!gStarted)
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
aValue = !!aValue;
if (aValue != gAutoUpdateDefault)
Services.prefs.setBoolPref(PREF_EM_AUTOUPDATE_DEFAULT, aValue);
@ -1959,18 +1947,10 @@ var AddonManagerInternal = {
},
get checkCompatibility() {
if (!gStarted)
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
return gCheckCompatibility;
},
set checkCompatibility(aValue) {
if (!gStarted)
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
aValue = !!aValue;
if (aValue != gCheckCompatibility) {
if (!aValue)
@ -1982,18 +1962,10 @@ var AddonManagerInternal = {
},
get strictCompatibility() {
if (!gStarted)
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
return gStrictCompatibility;
},
set strictCompatibility(aValue) {
if (!gStarted)
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
aValue = !!aValue;
if (aValue != gStrictCompatibility)
Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, aValue);
@ -2001,26 +1973,14 @@ var AddonManagerInternal = {
},
get checkUpdateSecurityDefault() {
if (!gStarted)
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
return gCheckUpdateSecurityDefault;
},
get checkUpdateSecurity() {
if (!gStarted)
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
return gCheckUpdateSecurity;
},
set checkUpdateSecurity(aValue) {
if (!gStarted)
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
aValue = !!aValue;
if (aValue != gCheckUpdateSecurity) {
if (aValue != gCheckUpdateSecurityDefault)
@ -2032,18 +1992,10 @@ var AddonManagerInternal = {
},
get updateEnabled() {
if (!gStarted)
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
return gUpdateEnabled;
},
set updateEnabled(aValue) {
if (!gStarted)
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
aValue = !!aValue;
if (aValue != gUpdateEnabled)
Services.prefs.setBoolPref(PREF_EM_UPDATE_ENABLED, aValue);
@ -2051,10 +2003,6 @@ var AddonManagerInternal = {
},
get hotfixID() {
if (!gStarted)
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
return gHotfixID;
},
};
@ -2392,10 +2340,6 @@ var AddonManager = {
* @return true if the addon should auto-update, false otherwise.
*/
shouldAutoUpdate: function AM_shouldAutoUpdate(aAddon) {
if (!gStarted)
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
if (!aAddon || typeof aAddon != "object")
throw Components.Exception("aAddon must be specified",
Cr.NS_ERROR_INVALID_ARG);

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

@ -4,75 +4,57 @@
// Verify that API functions fail if the Add-ons Manager isn't initialised.
const IGNORE = {
funcs: ["escapeAddonURI", "getStartupChanges", "addTypeListener",
"removeTypeListener", "addAddonListener", "removeAddonListener",
"addInstallListener", "removeInstallListener", "addManagerListener",
"removeManagerListener"],
getters: [],
setters: []
};
const IGNORE = ["escapeAddonURI", "shouldAutoUpdate", "getStartupChanges",
"addTypeListener", "removeTypeListener",
"addAddonListener", "removeAddonListener",
"addInstallListener", "removeInstallListener",
"addManagerListener", "removeManagerListener"];
const IGNORE_PRIVATE = {
funcs: ["AddonAuthor", "AddonCompatibilityOverride", "AddonScreenshot",
"AddonType", "startup", "shutdown", "registerProvider",
"unregisterProvider", "addStartupChange", "removeStartupChange"],
getters: [],
setters: []
};
const IGNORE_PRIVATE = ["AddonAuthor", "AddonCompatibilityOverride",
"AddonScreenshot", "AddonType", "startup", "shutdown",
"registerProvider", "unregisterProvider",
"addStartupChange", "removeStartupChange"];
function test_functions() {
for (let prop in AddonManager) {
if (typeof AddonManager[prop] != "function")
continue;
if (IGNORE.indexOf(prop) != -1)
continue;
function test_functions(aObjName, aIgnore) {
let obj = this[aObjName];
for (let prop in obj) {
let desc = Object.getOwnPropertyDescriptor(obj, prop);
try {
do_print("AddonManager." + prop);
AddonManager[prop]();
do_throw(prop + " did not throw an exception");
}
catch (e) {
if (e.result != Components.results.NS_ERROR_NOT_INITIALIZED)
do_throw(prop + " threw an unexpected exception: " + e);
}
}
if (typeof desc.value == "function") {
if (aIgnore.funcs.indexOf(prop) != -1)
continue;
for (let prop in AddonManagerPrivate) {
if (typeof AddonManagerPrivate[prop] != "function")
continue;
if (IGNORE_PRIVATE.indexOf(prop) != -1)
continue;
try {
do_print(aObjName + "." + prop + "()");
obj[prop]();
do_throw(prop + " did not throw an exception");
}
catch (e) {
if (e.result != Components.results.NS_ERROR_NOT_INITIALIZED)
do_throw(prop + " threw an unexpected exception: " + e);
}
} else {
if (typeof desc.get == "function" && aIgnore.getters.indexOf(prop) == -1) {
do_print(aObjName + "." + prop + " getter");
try {
let temp = obj[prop];
do_throw(prop + " did not throw an exception");
}
catch (e) {
if (e.result != Components.results.NS_ERROR_NOT_INITIALIZED)
do_throw(prop + " threw an unexpected exception: " + e);
}
}
if (typeof desc.set == "function" && aIgnore.setters.indexOf(prop) == -1) {
do_print(aObjName + "." + prop + " setter");
try {
obj[prop] = "i am the walrus";
do_throw(prop + " did not throw an exception");
}
catch (e) {
if (e.result != Components.results.NS_ERROR_NOT_INITIALIZED)
do_throw(prop + " threw an unexpected exception: " + e);
}
}
try {
do_print("AddonManagerPrivate." + prop);
AddonManagerPrivate[prop]();
do_throw(prop + " did not throw an exception");
}
catch (e) {
if (e.result != Components.results.NS_ERROR_NOT_INITIALIZED)
do_throw(prop + " threw an unexpected exception: " + e);
}
}
}
function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
test_functions("AddonManager", IGNORE);
test_functions("AddonManagerPrivate", IGNORE_PRIVATE);
test_functions();
startupManager();
shutdownManager();
test_functions("AddonManager", IGNORE);
test_functions("AddonManagerPrivate", IGNORE_PRIVATE);
test_functions();
}

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

@ -18,7 +18,6 @@ function run_test() {
testserver.start(4444);
do_test_pending();
startupManager();
run_test_1();
}