Closed Bug 655112 Opened 13 years ago Closed 12 years ago

Object.freeze(functionProxy) does not call the function proxy handler's fix() trap

Categories

(Core :: JavaScript Engine, defect, P2)

x86
macOS
defect

Tracking

()

RESOLVED INVALID
Tracking Status
blocking2.0 --- -
status2.0 --- wanted

People

(Reporter: jdm, Assigned: jdm)

References

Details

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #600677 +++

Tom van Cutsem 2011-04-28 06:30:07 PDT

The current patch doesn't seem to fix the issue for function proxies:

Testcase:
var handler = {
  get: function(rcvr, name) {
    if (name === 'isTrapping') return true;
  },
  fix: function() {
    return {
      isTrapping: { value: false }
    };
  }
};

var p = Proxy.createFunction(handler, function(){}, function(){});
assert(p.isTrapping);
Object.preventExtensions(p);
assert(! p.isTrapping);

The call to preventExtensions still fails. It works fine for object proxies
though (replace Proxy.createFunction by Proxy.create)
Ok, this gets the the correct results for p.isTrapping for both checks in Tom's testcase.  However, I'm worried about this output from the same test:

>js> Object.preventExtensions(p)
>Function.prototype.toString called on incompatible object

Is this something I need to be investigating, or is this separate bug fodder?
Assignee: general → josh
That seems odd. It seems Function.prototype.toString is incompatible with fixed function proxies?

On non-fixed function proxies |fp| with call trap argument |ct|, |Function.prototype.toString.call(fp)| is equivalent to |Function.prototype.toString.call(ct)|

This behavior should remain the same for fixed function proxies.
No longer blocks: harmony:proxy
Marking this bug as invalid since there is no fix trap with the direct proxies design.
Feel free to change the status if I'm mistaken.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: