Closed Bug 568413 Opened 14 years ago Closed 14 years ago

TM: implement iterate trap for proxies

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: gal, Assigned: gal)

References

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file, 2 obsolete files)

This is a late but important addition to the spec.
Depends on: 568051
Attached patch patch (obsolete) — Splinter Review
Assignee: general → gal
This patch also includes an important fix. We didn't delegate to the builtin derived trap default implementations for scripted handlers.
Attached patch patch (obsolete) — Splinter Review
Attachment #447689 - Attachment is obsolete: true
Attachment #447690 - Flags: review?(brendan)
Comment on attachment 447690 [details] [diff] [review]
patch

brace on own line:

JSScriptedProxyHandler::family() {

Should the singletons returned by family() be const?

Make static bool ValueToBool also be inline.

Common ugly and verbose ((JSProxyHandler *) JSVAL_TO_PRIVATE(handler)) via static inline helper...

Why doesn't MakeNativeIterator return ni directly instead of via out param?

NewNativeIterator is confusingly named in light of MakeNativeIterator and InitNativeIterator -- the latter two seem like constructor or create functions, which are typically named "NewXXX" where "XXX" is the typename. But NewNativeIterator makes an object too, and returns it via a jsval* out param -- how about NewNativeIteratorValue? But please also clean up the Make and Init misnomers.

Nit: NewNativeIterator does not need a blank line before its final return.

FundamentalTrap, in an error report, has

JS_GetStringBytes(JSVAL_TO_STRING(ID_TO_VALUE(atom)))

which should be just js_AtomToPrintableString(cx, atom) instead.

Nit: at least this line, maybe others:

    virtual bool getPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id, JSPropertyDescriptor *desc);

go over 100 columns.

/be
So,

s/NewNativeIterator(/NewNativeIteratorValue(/g
s/InitNativeIterator/NewEnumeratingNativeIterator/g
s/MakeNativeIterator/NewNativeIterator/g

where Enumerating means the snapshot including unshadowed enumerable proto props.

/be
Recurrent spacey final return nit, this time in MakeNativeIterator:

    *nip = ni;

    return true;

No need for such icy distance between such lines. ;-)

/be
Attached patch patchSplinter Review
Attachment #447690 - Attachment is obsolete: true
Attachment #447690 - Flags: review?(brendan)
Attachment #447791 - Flags: review?(brendan)
Comment on attachment 447791 [details] [diff] [review]
patch

+    virtual JS_FRIEND_API(const void) *family();

The * goes in the macro actual parameter!

r=me with that fixed, and anything like it.

/be
Attachment #447791 - Flags: review?(brendan) → review+
http://hg.mozilla.org/tracemonkey/rev/6ca8580eb84f
Whiteboard: fixed-in-tracemonkey
Bah. I stripped off a pair of () to make it < 100 lines and a burning tree is what I got for it.

http://hg.mozilla.org/tracemonkey/rev/e51e5ce934d4
http://hg.mozilla.org/mozilla-central/rev/6ca8580eb84f
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: