Closed
Bug 1450085
Opened 6 years ago
Closed 6 years ago
Use default arguments for ReportValueError instead of macros and more cleanup
Categories
(Core :: JavaScript Engine, enhancement, P3)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla62
People
(Reporter: anba, Assigned: anba)
Details
Attachments
(3 files)
7.05 KB,
patch
|
tcampbell
:
review+
|
Details | Diff | Splinter Review |
21.16 KB,
patch
|
tcampbell
:
review+
|
Details | Diff | Splinter Review |
13.35 KB,
patch
|
tcampbell
:
review+
|
Details | Diff | Splinter Review |
The |ReportValueError| macros [1] could be changed to proper C++ functions with defaults arguments. For example like so: --- extern void ReportValueError(JSContext* cx, unsigned flags, const unsigned errorNumber, int spindex, HandleValue v, HandleString fallback = nullptr, const char* arg1 = nullptr, const char* arg2 = nullptr) { mozilla::Unused << ReportValueErrorFlags(cx, JSREPORT_ERROR, errorNumber, spindex, v, fallback, arg1, arg2); } --- After that - Callers to ReportValueErrorFlags which use |flags = JSREPORT_ERROR|, like [2], could then be changed to call ReportValueError. - An explicit |nullptr| argument for the |fallback| parameter can then be removed, for example in [3]. - And completely unused functions can be deleted, like [4]. [1] https://searchfox.org/mozilla-central/rev/7e663b9fa578d425684ce2560e5fa2464f504b34/js/src/vm/JSContext.h#1091-1101 [2] https://searchfox.org/mozilla-central/rev/7e663b9fa578d425684ce2560e5fa2464f504b34/js/src/builtin/ReflectParse.cpp#291-292 [3] https://searchfox.org/mozilla-central/rev/7e663b9fa578d425684ce2560e5fa2464f504b34/js/src/builtin/Promise.cpp#900 [4] https://searchfox.org/mozilla-central/rev/7e663b9fa578d425684ce2560e5fa2464f504b34/js/src/vm/JSObject.cpp#2584-2609
Updated•6 years ago
|
Priority: -- → P3
Assignee | ||
Comment 1•6 years ago
|
||
Replaces the |ReportValueError| macros with a proper function and removes the remaining C89-bits from js::ReportValueErrorFlags(...).
Assignee: nobody → andrebargull
Status: NEW → ASSIGNED
Attachment #8981400 -
Flags: review?(tcampbell)
Assignee | ||
Comment 2•6 years ago
|
||
Replaces calls to ReportValueErrorFlags(...) with ReportValueError(...) when the error-flags arguments is JSREPORT_ERROR. This matches how the JSAPI error API "normally" works. (Except when it doesn't -> Part 3!) JSObject::report{ReadOnly,NotConfigurable,NotExtensible} are no longer used, so instead of updating them to use ReportValueError(...), we can instead remove them completely.
Attachment #8981401 -
Flags: review?(tcampbell)
Assignee | ||
Comment 3•6 years ago
|
||
Replaces call to JS_ReportErrorFlagsAndNumber{ASCII,Latin1,UTF8,UC}(...) with JS_ReportErrorNumber{ASCII,Latin1,UTF8,UC}(...) when the error-flags argument is JSREPORT_ERROR. I've also removed the unused |fallback| argument from js::ReportIsNullOrUndefined(...) and changed the function to use a void-return to match the standard error API pattern.
Attachment #8981402 -
Flags: review?(tcampbell)
Updated•6 years ago
|
Attachment #8981400 -
Flags: review?(tcampbell) → review+
Updated•6 years ago
|
Attachment #8981401 -
Flags: review?(tcampbell) → review+
Updated•6 years ago
|
Attachment #8981402 -
Flags: review?(tcampbell) → review+
Assignee | ||
Comment 4•6 years ago
|
||
Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=7e1e6b704e20decb2bdad486f5b79058ce42b422
Keywords: checkin-needed
Pushed by btara@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/3e478d973ae2 Part 1: Change ReportValueError to a proper function instead of a macro. r=tcampbell https://hg.mozilla.org/integration/mozilla-inbound/rev/9529d02de634 Part 2: Replace ReportValueErrorFlags with ReportValueError where applicable. r=tcampbell https://hg.mozilla.org/integration/mozilla-inbound/rev/a23ae192f340 Part 3: Call error-functions instead of passing JSREPORT_ERROR flag. r=tcampbell
Keywords: checkin-needed
Comment 6•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/3e478d973ae2 https://hg.mozilla.org/mozilla-central/rev/9529d02de634 https://hg.mozilla.org/mozilla-central/rev/a23ae192f340
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox62:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
Updated•6 years ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•