RESOLVED FIXED 27419
Storing a reference to WorkerContext.postMessage() and calling it later yields a TypeError
https://bugs.webkit.org/show_bug.cgi?id=27419
Summary Storing a reference to WorkerContext.postMessage() and calling it later yield...
Andrew Wilson
Reported 2009-07-18 17:51:47 PDT
There are a number of functions defined at global scope in WorkerContext - for example, setTimeout() and postMessage() are both defined in the worker global context. It's perfectly valid for worker code to do this: postMessage("hello"); However, if the worker code does this instead, it gets a TypeError: var saved = postMessage; saved("hello");
Attachments
test case (1.01 KB, patch)
2009-07-20 10:50 PDT, Andrew Wilson
no flags
proposed patch (6.54 KB, patch)
2009-07-21 13:52 PDT, Andrew Wilson
abarth: review+
Andrew Wilson
Comment 1 2009-07-18 17:58:36 PDT
The test case works in Chromium, so it's somewhere in the JSC bindings.
Andrew Wilson
Comment 2 2009-07-20 10:30:23 PDT
On a related note, the following line of code from Worker Context results in a TypeError also: postMessage.call(null, "foobar");
Andrew Wilson
Comment 3 2009-07-20 10:50:44 PDT
Created attachment 33094 [details] test case test case that shows this problem (passes on FF/Chrome, fails on Safari 4)
Andrew Wilson
Comment 4 2009-07-21 13:52:48 PDT
Created attachment 33209 [details] proposed patch This is dependent on 27420 as it relies on the IsWorkerContext attribute added in that patch.
Adam Barth
Comment 5 2009-07-23 23:11:40 PDT
Comment on attachment 33209 [details] proposed patch Awesome. Thanks for the patch.
Dmitry Titov
Comment 6 2009-07-24 11:01:13 PDT
assingning to me for landing
Dmitry Titov
Comment 7 2009-07-24 12:56:49 PDT
Note You need to log in before you can comment on or make changes to this bug.