зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1067942 - Change error message for attempted getter-only property writes to include the property name. r=terrence,ms2ger
MozReview-Commit-ID: 2IyEPyAaoNt
This commit is contained in:
Родитель
5defc5746a
Коммит
c7c5b5fa85
|
@ -308,7 +308,7 @@ exports['test button global state updated'] = function(assert) {
|
|||
// check read-only properties
|
||||
|
||||
assert.throws(() => button.id = 'another-id',
|
||||
/^setting a property that has only a getter/,
|
||||
/^setting getter-only property/,
|
||||
'id cannot be set at runtime');
|
||||
|
||||
assert.equal(button.id, 'my-button-4',
|
||||
|
|
|
@ -1050,7 +1050,7 @@ exports.testSidebarGettersAndSettersAfterDestroy = function(assert) {
|
|||
assert.equal(sidebar.id, undefined, 'sidebar after destroy has no id');
|
||||
|
||||
assert.throws(() => sidebar.id = 'foo-tang',
|
||||
/^setting a property that has only a getter/,
|
||||
/^setting getter-only property/,
|
||||
'id cannot be set at runtime');
|
||||
|
||||
assert.equal(sidebar.id, undefined, 'sidebar after destroy has no id');
|
||||
|
|
|
@ -302,7 +302,7 @@ exports['test button global state updated'] = function(assert) {
|
|||
// check read-only properties
|
||||
|
||||
assert.throws(() => button.id = 'another-id',
|
||||
/^setting a property that has only a getter/,
|
||||
/^setting getter-only property/,
|
||||
'id cannot be set at runtime');
|
||||
|
||||
assert.equal(button.id, 'my-button-4',
|
||||
|
|
|
@ -55,7 +55,7 @@ add_task(function* () {
|
|||
webconsole: hud,
|
||||
messages: [
|
||||
{
|
||||
text: "TypeError: setting a property that has only a getter",
|
||||
text: 'TypeError: setting getter-only property "p"',
|
||||
category: CATEGORY_JS,
|
||||
severity: SEVERITY_ERROR,
|
||||
},
|
||||
|
|
|
@ -1064,11 +1064,4 @@ IsDebuggerSandbox(JSObject* object)
|
|||
SimpleGlobalObject::GlobalType::WorkerDebuggerSandbox;
|
||||
}
|
||||
|
||||
bool
|
||||
GetterOnlyJSNative(JSContext* aCx, unsigned aArgc, JS::Value* aVp)
|
||||
{
|
||||
JS_ReportErrorNumberASCII(aCx, js::GetErrorMessage, nullptr, JSMSG_GETTER_ONLY);
|
||||
return false;
|
||||
}
|
||||
|
||||
END_WORKERS_NAMESPACE
|
||||
|
|
|
@ -401,14 +401,6 @@ IsDebuggerGlobal(JSObject* global);
|
|||
bool
|
||||
IsDebuggerSandbox(JSObject* object);
|
||||
|
||||
// Throws the JSMSG_GETTER_ONLY exception. This shouldn't be used going
|
||||
// forward -- getter-only properties should just use JS_PSG for the setter
|
||||
// (implying no setter at all), which will not throw when set in non-strict
|
||||
// code but will in strict code. Old code should use this only for temporary
|
||||
// compatibility reasons.
|
||||
extern bool
|
||||
GetterOnlyJSNative(JSContext* aCx, unsigned aArgc, JS::Value* aVp);
|
||||
|
||||
END_WORKERS_NAMESPACE
|
||||
|
||||
#endif // mozilla_dom_workers_workers_h__
|
||||
|
|
|
@ -64,7 +64,7 @@ MSG_DEF(JSMSG_BAD_ARRAY_LENGTH, 0, JSEXN_RANGEERR, "invalid array length"
|
|||
MSG_DEF(JSMSG_REDECLARED_PREV, 2, JSEXN_NOTE, "Previously declared at line {0}, column {1}")
|
||||
MSG_DEF(JSMSG_REDECLARED_VAR, 2, JSEXN_SYNTAXERR, "redeclaration of {0} {1}")
|
||||
MSG_DEF(JSMSG_UNDECLARED_VAR, 1, JSEXN_REFERENCEERR, "assignment to undeclared variable {0}")
|
||||
MSG_DEF(JSMSG_GETTER_ONLY, 0, JSEXN_TYPEERR, "setting a property that has only a getter")
|
||||
MSG_DEF(JSMSG_GETTER_ONLY, 1, JSEXN_TYPEERR, "setting getter-only property {0}")
|
||||
MSG_DEF(JSMSG_OVERWRITING_ACCESSOR, 1, JSEXN_TYPEERR, "can't overwrite accessor property {0}")
|
||||
MSG_DEF(JSMSG_UNDEFINED_PROP, 1, JSEXN_REFERENCEERR, "reference to undefined property {0}")
|
||||
MSG_DEF(JSMSG_INVALID_MAP_ITERABLE, 1, JSEXN_TYPEERR, "iterable for {0} should have array-like objects")
|
||||
|
|
|
@ -3323,18 +3323,6 @@ GetObjectSlotNameFunctor::operator()(JS::CallbackTracer* trc, char* buf, size_t
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
js::ReportGetterOnlyAssignment(JSContext* cx, bool strict)
|
||||
{
|
||||
return JS_ReportErrorFlagsAndNumberASCII(cx,
|
||||
strict
|
||||
? JSREPORT_ERROR
|
||||
: JSREPORT_WARNING | JSREPORT_STRICT,
|
||||
GetErrorMessage, nullptr,
|
||||
JSMSG_GETTER_ONLY);
|
||||
}
|
||||
|
||||
|
||||
/*** Debugging routines **************************************************************************/
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -1319,9 +1319,6 @@ template<XDRMode mode>
|
|||
bool
|
||||
XDRObjectLiteral(XDRState<mode>* xdr, MutableHandleObject obj);
|
||||
|
||||
extern bool
|
||||
ReportGetterOnlyAssignment(JSContext* cx, bool strict);
|
||||
|
||||
/*
|
||||
* Report a TypeError: "so-and-so is not an object".
|
||||
* Using NotNullObject is usually less code.
|
||||
|
|
Загрузка…
Ссылка в новой задаче