Closed Bug 652803 Opened 13 years ago Closed 13 years ago

[Harmony proxies] recursive fixing doesn't throw

Categories

(Core :: JavaScript Engine, defect, P2)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: tomvc.be, Assigned: jdm)

References

Details

(Whiteboard: [fixed-in-tracemonkey])

Attachments

(1 file, 1 obsolete file)

Recursively fixing a Harmony proxy should be short-circuited by throwing a TypeError, to safeguard against infinite loops. For instance:

    var proxy = Proxy.create({
      fix: function() {
        Object.preventExtensions(proxy); // triggers 'fix()' recursively
        return {};
      }
    });
    Object.preventExtensions(proxy); // triggers 'fix'

Result: InternalError: too much recursion
Expected: a TypeError

We reached consensus on this behavior in a TC39 meeting last year. Admittedly,
it's well hidden on the semantics page:
<http://wiki.ecmascript.org/doku.php?id=harmony:proxies_semantics>

"Note: recursive fixing should be disallowed. If fix() is called on a proxy
handler while the same proxy is already being fixed (an earlier call to fix()
is already on the stack), a TypeError should be thrown. "
Priority: -- → P2
Attached patch Potential fix (obsolete) — Splinter Review
So it looks like the code to do this properly is already present, but in the wrong spot. I have no way of accessing tryserver or a recent tree, so this patch may not apply or be correct. If someone (gal?) could try applying it and see if it solves the problem, I would be mighty appreciative.
Attachment #528646 - Flags: feedback?(gal)
Andreas, want to own this till Josh returns?

/be
Blocks: 600677
Blocks: 655112
Tested; this works correctly.
Assignee: general → josh
Attachment #528646 - Attachment is obsolete: true
Attachment #528646 - Flags: feedback?(gal)
Attachment #530403 - Flags: review?(gal)
Comment on attachment 530403 [details] [diff] [review]
Check proxy operations before fixing object.

Nice patch. Thanks!
Attachment #530403 - Flags: review?(gal) → review+
Keywords: checkin-needed
Whiteboard: [needs push to t-m]
Keywords: checkin-needed4xp
OS: Mac OS X → All
Hardware: x86 → All
Whiteboard: [needs push to t-m] → [fixed in tracemonkey]
Keywords: 4xp
We need a regression test for this bug. http://hg.mozilla.org/tracemonkey/rev/6855db79531d does not include one.
cdleary-bot mozilla-central merge info:
http://hg.mozilla.org/mozilla-central/rev/6855db79531d
Note: not marking as fixed because fixed-in-tracemonkey is not present on the whiteboard.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Whiteboard: [fixed in tracemonkey] → [fixed-in-tracemonkey]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: