Closed Bug 1124890 Opened 10 years ago Closed 10 years ago

Replace LookProperty with GetOwnProperty in ObjectToSource

Categories

(Core :: JavaScript: Standard Library, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla38

People

(Reporter: evilpie, Assigned: evilpie)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

ObjectToSource only seems to only enumerate own properties.
Attachment #8553361 - Flags: review?(jwalden+bmo)
Comment on attachment 8553361 [details] [diff] [review]
v1 object-tosource

Review of attachment 8553361 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/builtin/Object.cpp
@@ -255,5 @@
> -             * undefined.
> -             */
> -            if (gsop[j] && val[j].isUndefined())
> -                continue;
> -

As I recall, this old code took effect for situations like this:

  var desc = { get: undefined, set: undefined, configurable: true, enumerable: true };
  var obj = Object.defineProperty({}, "prop", desc);
  obj.toSource();

Please add a stupid test somewhere (in an extensions/ folder if a jstest) that does this, to be sure this works.
Attachment #8553361 - Flags: review?(jwalden+bmo) → review+
Attached patch object-tosourceSplinter Review
Good catch!
Assignee: nobody → evilpies
https://hg.mozilla.org/mozilla-central/rev/42d4b2cb18b6
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: