Last Comment Bug 722551 - Freezing function proxies doesn't work.
: Freezing function proxies doesn't work.
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla13
Assigned To: Jim Blandy :jimb
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-01-30 16:14 PST by Jim Blandy :jimb
Modified: 2012-02-01 11:23 PST (History)
1 user (show)
jimb: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
test case: Once a function proxy has been frozen, operating on it should not cause its trap handlers to be called. (844 bytes, patch)
2012-01-30 16:14 PST, Jim Blandy :jimb
no flags Details | Diff | Review
Once a function proxy has been frozen, operating on it should not cause its trap handlers to be called. (3.78 KB, patch)
2012-01-30 21:49 PST, Jim Blandy :jimb
gal: review+
Details | Diff | Review

Description Jim Blandy :jimb 2012-01-30 16:14:04 PST
Created attachment 592911 [details] [diff] [review]
test case: Once a function proxy has been frozen, operating on it should not cause its trap handlers to be called.

Function proxies' trap handlers can get called even after they've been frozen:

    $ cat ~/moz/fproxy.js
    function x() {}
    var handler = {
        getOwnPropertyNames: function () {
            print("Hi!");
            return[];
        },
        fix:function(){ return{} }
    };
    var fp = Proxy.createFunction(handler,x,x);
    Object.freeze(fp);
    print("Frozen.");
    Object.getOwnPropertyNames(fp);
    $ obj~/js -f ~/moz/fproxy.js
    Hi!
    Frozen.
    Hi!
    $
Comment 1 Jim Blandy :jimb 2012-01-30 21:48:19 PST
Try: https://tbpl.mozilla.org/?tree=Try&rev=2ba50d492112
Comment 2 Jim Blandy :jimb 2012-01-30 21:49:17 PST
Created attachment 592986 [details] [diff] [review]
Once a function proxy has been frozen, operating on it should not cause its trap handlers to be called.
Comment 3 Andreas Gal :gal 2012-01-31 11:19:43 PST
Comment on attachment 592986 [details] [diff] [review]
Once a function proxy has been frozen, operating on it should not cause its trap handlers to be called.

Those are some pretty tests. Made my day to read them.
Comment 4 Jim Blandy :jimb 2012-01-31 12:55:09 PST
(In reply to Andreas Gal :gal from comment #3)
> Comment on attachment 592986 [details] [diff] [review]
> Once a function proxy has been frozen, operating on it should not cause its
> trap handlers to be called.
> 
> Those are some pretty tests. Made my day to read them.

For a one-line change, too. :) Thanks for the review!

https://hg.mozilla.org/integration/mozilla-inbound/rev/cface840992d
That changeset log message omits the r=gal; apologies, folks.
Comment 5 Ed Morley [:emorley] 2012-02-01 11:23:12 PST
https://hg.mozilla.org/mozilla-central/rev/cface840992d

Note You need to log in before you can comment on or make changes to this bug.