Fix error message for Object.observe accept argument
BUG=chromium:464695 LOG=n Review URL: https://codereview.chromium.org/1005553003 Cr-Commit-Position: refs/heads/master@{#27171}
This commit is contained in:
parent
a1a2046274
commit
0c305e0b1b
@ -81,7 +81,7 @@ var kMessages = {
|
||||
observe_non_object: ["Object.", "%0", " cannot ", "%0", " non-object"],
|
||||
observe_non_function: ["Object.", "%0", " cannot deliver to non-function"],
|
||||
observe_callback_frozen: ["Object.observe cannot deliver to a frozen function object"],
|
||||
observe_invalid_accept: ["Object.observe accept must be an array of strings."],
|
||||
observe_invalid_accept: ["Third argument to Object.observe must be an array of strings."],
|
||||
observe_type_non_string: ["Invalid changeRecord with non-string 'type' property"],
|
||||
observe_perform_non_string: ["Invalid non-string changeType"],
|
||||
observe_perform_non_function: ["Cannot perform non-function"],
|
||||
|
@ -271,7 +271,7 @@ function ConvertAcceptListToTypeMap(arg) {
|
||||
return arg;
|
||||
|
||||
if (!IS_SPEC_OBJECT(arg))
|
||||
throw MakeTypeError("observe_accept_invalid");
|
||||
throw MakeTypeError("observe_invalid_accept");
|
||||
|
||||
var len = ToInteger(arg.length);
|
||||
if (len < 0) len = 0;
|
||||
|
@ -1824,3 +1824,16 @@ for (var b1 = 0; b1 < 2; ++b1)
|
||||
{ object: fun, type: 'add', name: 'name' },
|
||||
]);
|
||||
})();
|
||||
|
||||
|
||||
(function TestObserveInvalidAcceptMessage() {
|
||||
var ex;
|
||||
try {
|
||||
Object.observe({}, function(){}, "not an object");
|
||||
} catch (e) {
|
||||
ex = e;
|
||||
}
|
||||
assertInstanceof(ex, TypeError);
|
||||
assertEquals("Third argument to Object.observe must be an array of strings.",
|
||||
ex.message);
|
||||
})()
|
||||
|
Loading…
Reference in New Issue
Block a user