Closed
Bug 251742
Opened 20 years ago
Closed 20 years ago
Add JS_HasProperty(cx, obj, id) API to make it easier to find out if a property exists or not.
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
People
(Reporter: jst, Assigned: brendan)
Details
(Keywords: fixed-aviary1.0, fixed1.7.5)
Attachments
(1 file)
8.51 KB,
patch
|
shaver
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
Currently you'll need to use JS_Lookup[UC]Property() to find out if a property already exists on an object, and that means you'll need to decrypt how you can tell from the result of that if the property existed or not, and since the answer is different depending on if the object is native or not, it's less than ideal. JS_HasProperty() could hide that in a clean easy to use API...
Assignee | ||
Comment 1•20 years ago
|
||
The JS_ReportPendingException patch is a slightly better change than the patch in bug 248065. Here, JS_ReportPendingException calls js_ReportUncaughtException calls JS_ClearPendingException when it has succeeded in reporting the pending exception. This means the DOM script error reporter need not clear. /be
Assignee | ||
Updated•20 years ago
|
Attachment #153445 -
Flags: superreview?(jst)
Attachment #153445 -
Flags: review?(shaver)
Reporter | ||
Comment 2•20 years ago
|
||
Comment on attachment 153445 [details] [diff] [review] proposed fix, plus JS_ReportPendingException patch sr=jst. But *I* would rather see one single JS_HasProperty() that takes a jsval id in stead of three separate functions for for string, ucstring, and int. Not how the JS engine API generally does things, but it would be less code in the engine, and less in *my* call sites.
Attachment #153445 -
Flags: superreview?(jst) → superreview+
Comment on attachment 153445 [details] [diff] [review] proposed fix, plus JS_ReportPendingException patch I think most callers will want the str/wstr/int set, though I'm sympathetic to the desire for a slimmer API. If we had good INT_TO_ID/CSTR_TO_ID/etc. macros to indulge the other callers I channel above, I could swing the other way.
Attachment #153445 -
Flags: review?(shaver) → review+
Assignee | ||
Comment 4•20 years ago
|
||
CSTR_TO_ID can't be macroized, involving as it does fallible JS_InternString or equivalent operation. jst, it looks like JS_HasUCProperty will fit just fine into your patch in bug 248459, attachment 153433 [details] [diff] [review]. Fixed, thanks! /be
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Reporter | ||
Updated•20 years ago
|
Keywords: fixed-aviary1.0
Updated•20 years ago
|
Keywords: fixed1.7.x
Updated•19 years ago
|
Flags: testcase-
You need to log in
before you can comment on or make changes to this bug.
Description
•