Bug 672843 part D2 - Fix the xpconnect exception code and Components.results to prefer the name NS_ERROR_ILLEGAL_VALUE over the other synonyms. Fix a few tests that rely on exception names to use exception values instead. r=bholley

This commit is contained in:
Benjamin Smedberg 2013-11-20 11:46:18 -05:00
parent f2456d8d28
commit 04357a9dd8
4 changed files with 11 additions and 7 deletions

View File

@ -73,13 +73,13 @@ XPC_MSG_DEF(NS_ERROR_ALREADY_INITIALIZED , "Component already initiali
XPC_MSG_DEF(NS_ERROR_NOT_IMPLEMENTED , "Method not implemented")
XPC_MSG_DEF(NS_NOINTERFACE , "Component does not have requested interface")
XPC_MSG_DEF(NS_ERROR_NO_INTERFACE , "Component does not have requested interface")
XPC_MSG_DEF(NS_ERROR_ILLEGAL_VALUE , "Illegal value")
XPC_MSG_DEF(NS_ERROR_INVALID_POINTER , "Invalid pointer")
XPC_MSG_DEF(NS_ERROR_NULL_POINTER , "Null pointer")
XPC_MSG_DEF(NS_ERROR_ABORT , "Abort")
XPC_MSG_DEF(NS_ERROR_FAILURE , "Failure")
XPC_MSG_DEF(NS_ERROR_UNEXPECTED , "Unexpected error")
XPC_MSG_DEF(NS_ERROR_OUT_OF_MEMORY , "Out of Memory")
XPC_MSG_DEF(NS_ERROR_ILLEGAL_VALUE , "Illegal value")
XPC_MSG_DEF(NS_ERROR_INVALID_ARG , "Invalid argument")
XPC_MSG_DEF(NS_ERROR_NO_AGGREGATION , "Component does not support aggregation")
XPC_MSG_DEF(NS_ERROR_NOT_AVAILABLE , "Component is not available")

View File

@ -20,7 +20,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=462787
/** Test for Bug 462787 **/
function do_test() {
const INVALID_POINTER = 0x80004003;
const INVALID_POINTER = SpecialPowers.Cr.NS_ERROR_INVALID_POINTER;
var utils = SpecialPowers.Cc["@mozilla.org/inspector/dom-utils;1"]
.getService(SpecialPowers.Ci.inIDOMUtils);

View File

@ -4,6 +4,8 @@ var etld = Cc["@mozilla.org/network/effective-tld-service;1"]
var idna = Cc["@mozilla.org/network/idn-service;1"]
.getService(Ci.nsIIDNService);
var Cr = Components.results;
function run_test()
{
var file = do_get_file("data/test_psl.txt");
@ -21,8 +23,8 @@ function checkPublicSuffix(host, expectedSuffix)
var actualSuffix = null;
try {
actualSuffix = etld.getBaseDomainFromHost(host);
} catch (e if e.name == "NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS" ||
e.name == "NS_ERROR_ILLEGAL_VALUE") {
} catch (e if e.result == Cr.NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS ||
e.result == Cr.NS_ERROR_ILLEGAL_VALUE) {
}
// The EffectiveTLDService always gives back punycoded labels.
// The test suite wants to get back what it put in.

View File

@ -6,6 +6,8 @@
* Test bug 489872 to make sure passing nulls to nsNavHistory doesn't crash.
*/
let Cr = Components.results;
/**
* Print some debug message to the console. All arguments will be printed,
* separated by spaces.
@ -81,18 +83,18 @@ function run_test()
_("Must have been an expected nothrow, so no need to try again");
tryAgain = false;
}
catch(ex if ex.name.match(/NS_ERROR_ILLEGAL_VALUE/)) {
catch(ex if ex.result == Cr.NS_ERROR_ILLEGAL_VALUE) {
_("Caught an expected exception:", ex.name);
_("Moving on to the next test..");
tryAgain = false;
}
catch(ex if ex.name.match(/NS_ERROR_XPC_NEED_OUT_OBJECT/)) {
catch(ex if ex.result == Cr.NS_ERROR_XPC_NEED_OUT_OBJECT) {
let pos = Number(ex.message.match(/object arg (\d+)/)[1]);
_("Function call expects an out object at", pos);
args[pos] = {};
}
catch(ex if ex.name.match(/NS_ERROR_NOT_IMPLEMENTED/)) {
catch(ex if ex.result == Cr.NS_ERROR_NOT_IMPLEMENTED) {
_("Method not implemented exception:", ex.name);
_("Moving on to the next test..");