bug 792825 - Crash in js::gc::MarkObjectRange on CyanogenMod 10, back out changeset 9a02263d7206 r=mossop

This commit is contained in:
Brad Lassey 2012-09-29 08:03:54 -04:00
parent f13826bcd0
commit 67790e4274
3 changed files with 40 additions and 115 deletions

View File

@ -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);

View File

@ -4,47 +4,44 @@
// 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: ["__AddonManagerInternal__"],
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(aObjName, aIgnore) {
let obj = this[aObjName];
for (let prop in obj) {
let desc = Object.getOwnPropertyDescriptor(obj, prop);
if (typeof desc.value == "function") {
if (aIgnore.funcs.indexOf(prop) != -1)
function test_functions() {
for (let prop in AddonManager) {
if (typeof AddonManager[prop] != "function")
continue;
if (IGNORE.indexOf(prop) != -1)
continue;
try {
do_print(aObjName + "." + prop + "()");
obj[prop]();
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);
}
} else {
if (typeof desc.get == "function" && aIgnore.getters.indexOf(prop) == -1) {
do_print(aObjName + "." + prop + " getter");
}
for (let prop in AddonManagerPrivate) {
if (typeof AddonManagerPrivate[prop] != "function")
continue;
if (IGNORE_PRIVATE.indexOf(prop) != -1)
continue;
try {
let temp = obj[prop];
do_print("AddonManagerPrivate." + prop);
AddonManagerPrivate[prop]();
do_throw(prop + " did not throw an exception");
}
catch (e) {
@ -52,27 +49,12 @@ function test_functions(aObjName, aIgnore) {
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);
}
}
}
}
}
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();
}

View File

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