Commit e08f85fc authored by vabr's avatar vabr Committed by Commit bot

Unify TypeError messages

This CL fixes some nits in TypeError messages, unifying the form of
kDefineDisallowed and kObjectNotExtensible to match what is used by the
majority of the other messages:
  * "Cannot" vs. "Can't" -> choose "Cannot"
  * "property:%" -> "property %"
  * omit the full-stop at the end of the message

BUG=v8:5673

Review-Url: https://codereview.chromium.org/2686233008
Cr-Commit-Position: refs/heads/master@{#43150}
parent 6ee0b6ce
......@@ -296,7 +296,7 @@ class ErrorUtils : public AllStatic {
T(DebuggerFrame, "Debugger: Invalid frame index.") \
T(DebuggerType, "Debugger: Parameters have wrong types.") \
T(DeclarationMissingInitializer, "Missing initializer in % declaration") \
T(DefineDisallowed, "Cannot define property:%, object is not extensible.") \
T(DefineDisallowed, "Cannot define property %, object is not extensible") \
T(DetachedOperation, "Cannot perform % on a detached ArrayBuffer") \
T(DuplicateTemplateProperty, "Object template has duplicate property '%'") \
T(ExtendsValueNotConstructor, \
......@@ -352,7 +352,7 @@ class ErrorUtils : public AllStatic {
T(ObjectGetterExpectingFunction, \
"Object.prototype.__defineGetter__: Expecting function") \
T(ObjectGetterCallable, "Getter must be a function: %") \
T(ObjectNotExtensible, "Can't add property %, object is not extensible") \
T(ObjectNotExtensible, "Cannot add property %, object is not extensible") \
T(ObjectSetterExpectingFunction, \
"Object.prototype.__defineSetter__: Expecting function") \
T(ObjectSetterCallable, "Setter must be a function: %") \
......
......@@ -115,7 +115,7 @@ test(function() {
var o = {};
Object.preventExtensions(o);
Object.defineProperty(o, "x", { value: 1 });
}, "Cannot define property:x, object is not extensible.", TypeError);
}, "Cannot define property x, object is not extensible", TypeError);
// kFirstArgumentNotRegExp
test(function() {
......@@ -242,7 +242,7 @@ test(function() {
var o = {};
Object.freeze(o);
o.a = 1;
}, "Can't add property a, object is not extensible", TypeError);
}, "Cannot add property a, object is not extensible", TypeError);
// kObjectSetterExpectingFunction
test(function() {
......
......@@ -39,7 +39,7 @@ PASS "use strict"; var o = {}; Object.preventExtensions(o); o.__proto__ = { newP
PASS Object.preventExtensions(Math); Math.sqrt(4) is 2
PASS var arr = Object.preventExtensions([]); arr[0] = 42; arr[0] is undefined.
PASS var arr = Object.preventExtensions([]); arr[0] = 42; arr.length is 0
PASS "use strict"; var arr = Object.preventExtensions([]); arr[0] = 42; arr[0] threw exception TypeError: Can't add property 0, object is not extensible.
PASS "use strict"; var arr = Object.preventExtensions([]); arr[0] = 42; arr[0] threw exception TypeError: Cannot add property 0, object is not extensible.
PASS obj.foo is 1
PASS Object.isFrozen(func) is true
PASS func.prototype === 42 is false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment