Bug 22878 - It should be possible to post (clone) built-in JS objects to Workers
: It should be possible to post (clone) built-in JS objects to Workers
Status: RESOLVED FIXED
: WebKit
WebCore JavaScript
: 528+ (Nightly build)
: All All
: P2 Enhancement
Assigned To:
:
: InRadar
:
:
  Show dependency treegraph
 
Reported: 2008-12-16 05:42 PST by
Modified: 2009-10-06 22:03 PST (History)


Attachments
It should be possible to post (clone) built-in JS objects to Workers (97.90 KB, patch)
2009-10-05 23:16 PST, Oliver Hunt
no flags Review Patch | Details | Formatted Diff | Diff
It should be possible to post (clone) built-in JS objects to Workers (98.21 KB, patch)
2009-10-06 00:21 PST, Oliver Hunt
barraclough: review+
Review Patch | Details | Formatted Diff | Diff


Note

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


Description From 2008-12-16 05:42:22 PST
Worker.postMessage only takes strings now, but the spec has been recently changed to allow arbitrary JS objects, such as Arrays and Objects. We need to support this.

This is similar to JSON, but not quite the same.
------- Comment #1 From 2008-12-16 05:43:07 PST -------
<rdar://problem/6448422>
------- Comment #2 From 2009-10-05 23:16:21 PST -------
Created an attachment (id=40694) [details]
It should be possible to post (clone) built-in JS objects to Workers
------- Comment #3 From 2009-10-06 00:21:09 PST -------
Created an attachment (id=40699) [details]
It should be possible to post (clone) built-in JS objects to Workers
------- Comment #4 From 2009-10-06 15:36:29 PST -------
(From update of attachment 40699 [details])
In the test case, I'd suggest renaming 'equal' to something more descriptive (I initially wondered, "why not just use ==" :-) ).  Maybe 'isCloneOf'?

In SerializedArray, all index values should be less than 'm_length'.

In SerializedScriptValueData, I think 'operator bool ()' should be 'operator bool()' – a quick grep of JSC would seem to agree with this.

r+
------- Comment #5 From 2009-10-06 21:58:31 PST -------
Landed r49214
------- Comment #6 From 2009-10-06 22:03:08 PST -------
(In reply to comment #5)
> Landed r49214

This expected.txt contains this line:

> CONSOLE MESSAGE: line 54: RangeError: Maximum call stack size exceeded.

Is this OK?

Also... it is very nice if you modify the test so that the results don't contain "PST" . Maybe we can use the value of getTime like

    if (equal(actualValue, expectedValue)) {
        if (expectedValue && expectedValue.getTime) {
            expectedValue = expectedValue.getTime() + " (the value of getTime)
        }
        console.innerHTML += "PASS: " + actual + " is " + expectedValue + " of type " + typeof actualValue + "<br>";
    } else

?