зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset cfd695493ec7 (bug 1488417) for causing mochitest failures on test_browserElement_inproc_ExecuteScript. CLOSED TREE
This commit is contained in:
Родитель
435b3473b5
Коммит
bc5a7500cd
|
@ -91,7 +91,7 @@ function runTest() {
|
|||
ok(c(rv, 'YQ=='), `scriptId: ${scriptId++}`);
|
||||
return iframe.executeScript('window.wrappedJSObject.btoa("a")', {url})
|
||||
}, bail).then(bail, (error) => {
|
||||
is(error.message, `TypeError: window.wrappedJSObject is undefined, can't access its "btoa" property`, `scriptId: ${scriptId++}`);
|
||||
is(error.message, `TypeError: window.wrappedJSObject is undefined, can't access property "btoa" of it`, `scriptId: ${scriptId++}`);
|
||||
return iframe.executeScript('42', {})
|
||||
}).then(bail, error => {
|
||||
is(error.name, 'InvalidAccessError', `scriptId: ${scriptId++}`);
|
||||
|
|
|
@ -10,4 +10,4 @@ var e;
|
|||
try {
|
||||
f();
|
||||
} catch (error) {e = error;}
|
||||
assertEq(e.toString(), `TypeError: a[i] is undefined; can't access element at index 0`);
|
||||
assertEq(e.toString(), `TypeError: a[i] is undefined, can't access property 0 of it`);
|
||||
|
|
|
@ -18,7 +18,7 @@ function check_one(expected, f, err) {
|
|||
ieval = eval;
|
||||
function check(expr, expected=expr, testStrict=true) {
|
||||
var end, err;
|
||||
for ([end, err] of [[".random_prop", ` is undefined; can't access its "random_prop" property`], ["()", " is not a function"]]) {
|
||||
for ([end, err] of [[".random_prop", ` is undefined, can't access property \"random_prop" of it`], ["()", " is not a function"]]) {
|
||||
var statement = "o = {};" + expr + end, f;
|
||||
var cases = [
|
||||
// Global scope
|
||||
|
@ -102,7 +102,7 @@ check_one("6", (function () { 6() }), " is not a function");
|
|||
check_one("4", (function() { (4||eval)(); }), " is not a function");
|
||||
check_one("0", (function () { Array.prototype.reverse.call('123'); }), " is read-only");
|
||||
check_one("[...][Symbol.iterator](...).next(...).value",
|
||||
function () { ieval("{ let x; var [a, b, [c0, c1]] = [x, x, x]; }") }, " is undefined; can't access its Symbol.iterator property");
|
||||
function () { ieval("{ let x; var [a, b, [c0, c1]] = [x, x, x]; }") }, " is undefined, can't access property Symbol.iterator of it");
|
||||
check_one("(void 1)", function() { (void 1)(); }, " is not a function");
|
||||
check_one("(void o[1])", function() { var o = []; (void o[1])() }, " is not a function");
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ function testForOf(val) {
|
|||
for (v of [{}, Math, new Proxy({}, {})]) {
|
||||
assertThrowsMsg(() => testForOf(v), "val is not iterable");
|
||||
}
|
||||
assertThrowsMsg(() => testForOf(null), "val is null; can't access its Symbol.iterator property");
|
||||
assertThrowsMsg(() => testForOf(null), "val is null, can't access property Symbol.iterator of it");
|
||||
assertThrowsMsg(() => { for (var x of () => 1) {}}, "() => 1 is not iterable");
|
||||
|
||||
// Destructuring
|
||||
|
@ -25,7 +25,7 @@ function testDestr(val) {
|
|||
for (v of [{}, Math, new Proxy({}, {})]) {
|
||||
assertThrowsMsg(() => testDestr(v), "val is not iterable");
|
||||
}
|
||||
assertThrowsMsg(() => testDestr(null), "val is null; can't access its Symbol.iterator property");
|
||||
assertThrowsMsg(() => testDestr(null), "val is null, can't access property Symbol.iterator of it");
|
||||
assertThrowsMsg(() => { [a, b] = () => 1; }, "() => 1 is not iterable");
|
||||
|
||||
// Spread
|
||||
|
@ -35,5 +35,5 @@ function testSpread(val) {
|
|||
for (v of [{}, Math, new Proxy({}, {})]) {
|
||||
assertThrowsMsg(() => testSpread(v), "val is not iterable");
|
||||
}
|
||||
assertThrowsMsg(() => testSpread(null), "val is null; can't access its Symbol.iterator property");
|
||||
assertThrowsMsg(() => testSpread(null), "val is null, can't access property Symbol.iterator of it");
|
||||
assertThrowsMsg(() => { [...() => 1]; }, "() => 1 is not iterable");
|
||||
|
|
|
@ -6,6 +6,6 @@ function f() {
|
|||
} catch (e) {
|
||||
msg = '' + e;
|
||||
}
|
||||
assertEq(msg, `TypeError: x is undefined; can't access its "foo" property`);
|
||||
assertEq(msg, `TypeError: x is undefined, can't access property "foo" of it`);
|
||||
}
|
||||
f();
|
||||
|
|
|
@ -17,7 +17,7 @@ function check_one(expected, f, err) {
|
|||
ieval = eval
|
||||
function check(expr, expected = expr) {
|
||||
var end, err
|
||||
for ([end, err] of [[".random_prop", ` is undefined, can't access its "random_prop" property`]])
|
||||
for ([end, err] of[[".random_prop", ` is undefined, can't access property \"random_prop" of it` ]])
|
||||
statement = "o = {};" + expr + end;
|
||||
cases = [
|
||||
function() { return ieval("var undef;" + statement); },
|
||||
|
|
|
@ -15,7 +15,7 @@ for (var i = 0; i < 3; i++) {
|
|||
x.toString();
|
||||
assertEq(0, 1);
|
||||
} catch (e) {
|
||||
assertEq(e.message === `y is undefined; can't access its "length" property` ||
|
||||
assertEq(e.message === `y is undefined, can't access property "length" of it` ||
|
||||
e.message === "undefined has no properties", true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,22 +9,21 @@
|
|||
*
|
||||
* The format for each JS error message is:
|
||||
*
|
||||
* MSG_DEF(<SYMBOLIC_NAME>, <ARGUMENT_COUNT>, <EXCEPTION_NAME>,
|
||||
* <FORMAT_STRING>)
|
||||
* MSG_DEF(<SYMBOLIC_NAME>, <ARGUMENT_COUNT>, <EXCEPTION_NAME>,
|
||||
* <FORMAT_STRING>)
|
||||
*
|
||||
* where:
|
||||
* where ;
|
||||
* <SYMBOLIC_NAME> is a legal C identifer that will be used in the
|
||||
* JS engine source.
|
||||
*
|
||||
* <SYMBOLIC_NAME> is a legal C identifer that will be used in the
|
||||
* JS engine source.
|
||||
* <ARGUMENT_COUNT> is an integer literal specifying the total number of
|
||||
* replaceable arguments in the following format string.
|
||||
*
|
||||
* <ARGUMENT_COUNT> is an integer literal specifying the total number of
|
||||
* replaceable arguments in the following format string.
|
||||
* <EXCEPTION_NAME> is an enum JSExnType value, defined in jsapi.h.
|
||||
*
|
||||
* <EXCEPTION_NAME> is an enum JSExnType value, defined in jsapi.h.
|
||||
*
|
||||
* <FORMAT_STRING> is a string literal, optionally containing sequences
|
||||
* {X} where X is an integer representing the argument number that will
|
||||
* be replaced with a string value when the error is reported.
|
||||
* <FORMAT_STRING> is a string literal, optionally containing sequences
|
||||
* {X} where X is an integer representing the argument number that will
|
||||
* be replaced with a string value when the error is reported.
|
||||
*
|
||||
* e.g.
|
||||
*
|
||||
|
@ -56,8 +55,7 @@ MSG_DEF(JSMSG_TOPRIMITIVE_NOT_CALLABLE, 2, JSEXN_TYPEERR, "can't convert {0} to
|
|||
MSG_DEF(JSMSG_TOPRIMITIVE_RETURNED_OBJECT, 2, JSEXN_TYPEERR, "can't convert {0} to {1}: its [Symbol.toPrimitive] method returned an object")
|
||||
MSG_DEF(JSMSG_NO_PROPERTIES, 1, JSEXN_TYPEERR, "{0} has no properties")
|
||||
MSG_DEF(JSMSG_PROPERTY_FAIL, 2, JSEXN_TYPEERR, "can't access property {0} of {1}")
|
||||
MSG_DEF(JSMSG_PROPERTY_FAIL_EXPR, 3, JSEXN_TYPEERR, "{0} is {1}; can't access its {2} property")
|
||||
MSG_DEF(JSMSG_ELEMENT_FAIL_EXPR, 3, JSEXN_TYPEERR, "{0} is {1}; can't access element at index {2}")
|
||||
MSG_DEF(JSMSG_PROPERTY_FAIL_EXPR, 3, JSEXN_TYPEERR, "{0} is {1}, can't access property {2} of it")
|
||||
MSG_DEF(JSMSG_BAD_REGEXP_FLAG, 1, JSEXN_SYNTAXERR, "invalid regular expression flag {0}")
|
||||
MSG_DEF(JSMSG_INVALID_DATA_VIEW_LENGTH, 0, JSEXN_RANGEERR, "invalid data view length")
|
||||
MSG_DEF(JSMSG_OFFSET_LARGER_THAN_FILESIZE, 0, JSEXN_RANGEERR, "offset is larger than filesize")
|
||||
|
|
|
@ -34,25 +34,25 @@ BEGIN_TEST(testErrorInterceptor)
|
|||
{
|
||||
// Run the following snippets.
|
||||
const char* SAMPLES[] = {
|
||||
"throw new Error('I am an Error')",
|
||||
"throw new TypeError('I am a TypeError')",
|
||||
"throw new ReferenceError('I am a ReferenceError')",
|
||||
"throw new SyntaxError('I am a SyntaxError')",
|
||||
"throw 5",
|
||||
"undefined[0]",
|
||||
"foo[0]",
|
||||
"b[",
|
||||
"throw new Error('I am an Error')\0",
|
||||
"throw new TypeError('I am a TypeError')\0",
|
||||
"throw new ReferenceError('I am a ReferenceError')\0",
|
||||
"throw new SyntaxError('I am a SyntaxError')\0",
|
||||
"throw 5\0",
|
||||
"undefined[0]\0",
|
||||
"foo[0]\0",
|
||||
"b[\0",
|
||||
};
|
||||
// With the simpleInterceptor, we should end up with the following error:
|
||||
const char* TO_STRING[] = {
|
||||
"Error: I am an Error",
|
||||
"TypeError: I am a TypeError",
|
||||
"ReferenceError: I am a ReferenceError",
|
||||
"SyntaxError: I am a SyntaxError",
|
||||
"5",
|
||||
"TypeError: can't access property 0 of undefined",
|
||||
"ReferenceError: foo is not defined",
|
||||
"SyntaxError: expected expression, got end of script",
|
||||
"Error: I am an Error\0",
|
||||
"TypeError: I am a TypeError\0",
|
||||
"ReferenceError: I am a ReferenceError\0",
|
||||
"SyntaxError: I am a SyntaxError\0",
|
||||
"5\0",
|
||||
"TypeError: can't access property 0 of undefined\0",
|
||||
"ReferenceError: foo is not defined\0",
|
||||
"SyntaxError: expected expression, got end of script\0",
|
||||
};
|
||||
MOZ_ASSERT(mozilla::ArrayLength(SAMPLES) == mozilla::ArrayLength(TO_STRING));
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ function test()
|
|||
}
|
||||
reportCompare(expect, actual, summary);
|
||||
|
||||
expect = `TypeError: x is undefined; can't access its "y" property`;
|
||||
expect = `TypeError: x is undefined, can't access property "y" of it`;
|
||||
actual = 'No Error';
|
||||
|
||||
try
|
||||
|
@ -59,7 +59,7 @@ function test()
|
|||
}
|
||||
reportCompare(expect, actual, summary);
|
||||
|
||||
expect = `TypeError: x is null; can't access its "y" property`;
|
||||
expect = `TypeError: x is null, can't access property "y" of it`;
|
||||
actual = 'No Error';
|
||||
|
||||
try
|
||||
|
|
|
@ -25,7 +25,7 @@ function test()
|
|||
var [a, b, [c0, c1]] = [x, x, x];
|
||||
}
|
||||
|
||||
expect = `TypeError: [...][Symbol.iterator](...).next(...).value is null; can't access its Symbol.iterator property`;
|
||||
expect = `TypeError: [...][Symbol.iterator](...).next(...).value is null, can't access property Symbol.iterator of it`;
|
||||
actual = 'No Error';
|
||||
try
|
||||
{
|
||||
|
|
|
@ -9,6 +9,6 @@ try {
|
|||
err = e;
|
||||
}
|
||||
assertEq(err instanceof TypeError, true);
|
||||
assertEq(err.message, "[][j] is undefined; can't access element at index 2");
|
||||
assertEq(err.message, "[][j] is undefined, can't access property 2 of it");
|
||||
|
||||
reportCompare(0, 0, 'ok');
|
||||
|
|
|
@ -953,15 +953,13 @@ js::ReportIsNullOrUndefinedForPropertyAccess(JSContext* cx, HandleValue v, Handl
|
|||
if (strcmp(bytes.get(), js_undefined_str) == 0 || strcmp(bytes.get(), js_null_str) == 0) {
|
||||
JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_PROPERTY_FAIL,
|
||||
keyBytes.get(), bytes.get());
|
||||
} else if (v.isUndefined()) {
|
||||
JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_PROPERTY_FAIL_EXPR,
|
||||
bytes.get(), js_undefined_str, keyBytes.get());
|
||||
} else {
|
||||
const char* actual = v.isUndefined() ? js_undefined_str : js_null_str;
|
||||
if (JSID_IS_INT(key)) {
|
||||
JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_ELEMENT_FAIL_EXPR,
|
||||
bytes.get(), actual, keyBytes.get());
|
||||
} else {
|
||||
JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_PROPERTY_FAIL_EXPR,
|
||||
bytes.get(), actual, keyBytes.get());
|
||||
}
|
||||
MOZ_ASSERT(v.isNull());
|
||||
JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_PROPERTY_FAIL_EXPR,
|
||||
bytes.get(), js_null_str, keyBytes.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ add_task(async function test_contentscript_create_iframe() {
|
|||
Assert.ok(!manifest, "manifest should be undefined");
|
||||
|
||||
Assert.equal(String(manifestException),
|
||||
`TypeError: win.browser.runtime is undefined, can't access its "getManifest" property`,
|
||||
`TypeError: win.browser.runtime is undefined, can't access property "getManifest" of it`,
|
||||
"expected exception received");
|
||||
|
||||
let getManifestException = win.testGetManifestException();
|
||||
|
|
Загрузка…
Ссылка в новой задаче