diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2017-08-24 10:34:22 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-03-12 10:12:53 +0100 |
commit | c43c8f17629f2dde26f91d69f241fa7bd2165dab (patch) | |
tree | 864ca7027308ba80a30f46e085f7f1f26f51cb3f | |
parent | ea44e60b7ed5f674b6de65fad669ac43a45438cc (diff) | |
download | uxp-c43c8f17629f2dde26f91d69f241fa7bd2165dab.tar.gz |
JS - Object - "TypeError: setting a property that has only a getter" without mentioning file and property name
-rw-r--r-- | devtools/client/webconsole/test/browser_webconsole_strict_mode_errors.js | 2 | ||||
-rw-r--r-- | dom/workers/WorkerScope.cpp | 7 | ||||
-rw-r--r-- | dom/workers/Workers.h | 8 | ||||
-rw-r--r-- | js/src/js.msg | 2 | ||||
-rw-r--r-- | js/src/jsobj.cpp | 12 | ||||
-rw-r--r-- | js/src/jsobj.h | 3 |
6 files changed, 2 insertions, 32 deletions
diff --git a/devtools/client/webconsole/test/browser_webconsole_strict_mode_errors.js b/devtools/client/webconsole/test/browser_webconsole_strict_mode_errors.js index c8f2200f9f..cdaf2764e7 100644 --- a/devtools/client/webconsole/test/browser_webconsole_strict_mode_errors.js +++ b/devtools/client/webconsole/test/browser_webconsole_strict_mode_errors.js @@ -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, }, diff --git a/dom/workers/WorkerScope.cpp b/dom/workers/WorkerScope.cpp index d9a987b62f..54252e53b8 100644 --- a/dom/workers/WorkerScope.cpp +++ b/dom/workers/WorkerScope.cpp @@ -968,11 +968,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 diff --git a/dom/workers/Workers.h b/dom/workers/Workers.h index ad083d3b8e..cd15a4d7cb 100644 --- a/dom/workers/Workers.h +++ b/dom/workers/Workers.h @@ -362,14 +362,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__ diff --git a/js/src/js.msg b/js/src/js.msg index 246e363c37..cb5fc383bd 100644 --- a/js/src/js.msg +++ b/js/src/js.msg @@ -65,7 +65,7 @@ MSG_DEF(JSMSG_BAD_GETTER_OR_SETTER, 1, JSEXN_TYPEERR, "invalid {0} usage") MSG_DEF(JSMSG_BAD_ARRAY_LENGTH, 0, JSEXN_RANGEERR, "invalid array length") 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") diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index a39a4b0a04..33feb0a546 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -3298,18 +3298,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 diff --git a/js/src/jsobj.h b/js/src/jsobj.h index fbf4e47bec..af79131af7 100644 --- a/js/src/jsobj.h +++ b/js/src/jsobj.h @@ -1320,9 +1320,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. |