Changeset 49214 in webkit


Ignore:
Timestamp:
Oct 6, 2009 7:06:03 PM (15 years ago)
Author:
oliver@apple.com
Message:

It should be possible to post (clone) built-in JS objects to Workers
https://bugs.webkit.org/show_bug.cgi?id=22878

Reviewed by Gavin Barraclough.

Implement object cloning semantics for postMessage. Currently only
a partial implementation of the spec -- cloning of File, FileList,
ImageData, and RegExp were left out as they would have significantly
increased patch size.

Cloning requires multiple tree walks so we use a templated tree
walk function, allowing us to share a single implementation for
serialization, deserialization, and eventual destruction of the
serialized object tree.

Test: fast/dom/Window/window-postmessage-clone.html

Location:
trunk
Files:
4 added
41 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r49160 r49214  
     12009-10-05  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Gavin Barraclough.
     4
     5        It should be possible to post (clone) built-in JS objects to Workers
     6        https://bugs.webkit.org/show_bug.cgi?id=22878
     7
     8        Expose helpers to throw correct exceptions during object graph walk
     9        used for cloning and add a helper function to create Date instances
     10        without going through the JS Date constructor function.
     11
     12        * JavaScriptCore.exp:
     13        * JavaScriptCore.xcodeproj/project.pbxproj:
     14        * runtime/DateInstance.cpp:
     15        (JSC::DateInstance::DateInstance):
     16        * runtime/DateInstance.h:
     17        * runtime/ExceptionHelpers.cpp:
     18        (JSC::createTypeError):
     19        * runtime/ExceptionHelpers.h:
     20
    1212009-10-06  David Levin  <levin@chromium.org>
    222
  • trunk/JavaScriptCore/JavaScriptCore.exp

    r48905 r49214  
    105105__ZN3JSC11checkSyntaxEPNS_9ExecStateERKNS_10SourceCodeE
    106106__ZN3JSC12DateInstance4infoE
     107__ZN3JSC12DateInstanceC1EPNS_9ExecStateEd
    107108__ZN3JSC12JSGlobalData10ClientDataD2Ev
    108109__ZN3JSC12JSGlobalData12createLeakedEv
     
    142143__ZN3JSC14SamplingThread4stopEv
    143144__ZN3JSC14SamplingThread5startEj
     145__ZN3JSC14TimeoutChecker10didTimeOutEPNS_9ExecStateE
    144146__ZN3JSC14TimeoutChecker5resetEv
     147__ZN3JSC15createTypeErrorEPNS_9ExecStateEPKc
    145148__ZN3JSC15JSWrapperObject12markChildrenERNS_9MarkStackE
    146149__ZN3JSC15toInt32SlowCaseEdRb
     
    172175__ZN3JSC23objectProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
    173176__ZN3JSC23setUpStaticFunctionSlotEPNS_9ExecStateEPKNS_9HashEntryEPNS_8JSObjectERKNS_10IdentifierERNS_12PropertySlotE
     177__ZN3JSC24createStackOverflowErrorEPNS_9ExecStateE
    174178__ZN3JSC25evaluateInGlobalCallFrameERKNS_7UStringERNS_7JSValueEPNS_14JSGlobalObjectE
     179__ZN3JSC35createInterruptedExecutionExceptionEPNS_12JSGlobalDataE
    175180__ZN3JSC4Heap11objectCountEv
    176181__ZN3JSC4Heap14primaryHeapEndEv
     
    214219__ZN3JSC7CStringaSERKS0_
    215220__ZN3JSC7JSArray4infoE
     221__ZN3JSC7JSArray9setLengthEj
    216222__ZN3JSC7JSArrayC1EN3WTF17NonNullPassRefPtrINS_9StructureEEE
    217223__ZN3JSC7JSArrayC1EN3WTF17NonNullPassRefPtrINS_9StructureEEERKNS_7ArgListE
  • trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r48819 r49214  
    246246                BC18C3FD0E16F5CD00B34460 /* DisallowCType.h in Headers */ = {isa = PBXBuildFile; fileRef = 938C4F6B0CA06BCE00D9310A /* DisallowCType.h */; settings = {ATTRIBUTES = (Private, ); }; };
    247247                BC18C3FE0E16F5CD00B34460 /* dtoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 651F6413039D5B5F0078395C /* dtoa.h */; settings = {ATTRIBUTES = (Private, ); }; };
    248                 BC18C4000E16F5CD00B34460 /* ExceptionHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = A72701B30DADE94900E548D7 /* ExceptionHelpers.h */; };
     248                BC18C4000E16F5CD00B34460 /* ExceptionHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = A72701B30DADE94900E548D7 /* ExceptionHelpers.h */; settings = {ATTRIBUTES = (Private, ); }; };
    249249                BC18C4020E16F5CD00B34460 /* FastMalloc.h in Headers */ = {isa = PBXBuildFile; fileRef = 65E217BA08E7EECC0023E5F6 /* FastMalloc.h */; settings = {ATTRIBUTES = (Private, ); }; };
    250250                BC18C4030E16F5CD00B34460 /* Forward.h in Headers */ = {isa = PBXBuildFile; fileRef = 935AF46909E9D9DB00ACD1D8 /* Forward.h */; settings = {ATTRIBUTES = (Private, ); }; };
  • trunk/JavaScriptCore/runtime/DateInstance.cpp

    r48836 r49214  
    4444    , m_cache(0)
    4545{
     46}
     47
     48DateInstance::DateInstance(ExecState* exec, double time)
     49    : JSWrapperObject(exec->lexicalGlobalObject()->dateStructure())
     50    , m_cache(0)
     51{
     52    setInternalValue(jsNumber(exec, timeClip(time)));
    4653}
    4754
  • trunk/JavaScriptCore/runtime/DateInstance.h

    r48836 r49214  
    3232    class DateInstance : public JSWrapperObject {
    3333    public:
     34        DateInstance(ExecState*, double);
    3435        explicit DateInstance(NonNullPassRefPtr<Structure>);
    3536        virtual ~DateInstance();
  • trunk/JavaScriptCore/runtime/ExceptionHelpers.cpp

    r47412 r49214  
    6767}
    6868
     69JSValue createTypeError(ExecState* exec, const char* message)
     70{
     71    return createError(exec, TypeError, message);
     72}
     73
    6974JSValue createUndefinedVariableError(ExecState* exec, const Identifier& ident, unsigned bytecodeOffset, CodeBlock* codeBlock)
    7075{
  • trunk/JavaScriptCore/runtime/ExceptionHelpers.h

    r46598 r49214  
    4545    JSValue createInterruptedExecutionException(JSGlobalData*);
    4646    JSValue createStackOverflowError(ExecState*);
     47    JSValue createTypeError(ExecState*, const char* message);
    4748    JSValue createUndefinedVariableError(ExecState*, const Identifier&, unsigned bytecodeOffset, CodeBlock*);
    4849    JSNotAnObjectErrorStub* createNotAnObjectErrorStub(ExecState*, bool isNull);
  • trunk/LayoutTests/ChangeLog

    r49208 r49214  
     12009-10-05  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Gavin Barraclough.
     4
     5        It should be possible to post (clone) built-in JS objects to Workers
     6        https://bugs.webkit.org/show_bug.cgi?id=22878
     7
     8        Add a test for object cloning for postMessage, and update existing tests
     9        to reflect the new cloning semantics.
     10
     11        * fast/dom/Window/window-postmessage-clone-expected.txt: Added.
     12        * fast/dom/Window/window-postmessage-clone.html: Added.
     13        * fast/events/init-events-expected.txt:
     14        * fast/events/script-tests/init-events.js:
     15        * fast/workers/resources/use-machine-stack.js:
     16
    1172009-10-06  Dave Hyatt  <hyatt@apple.com>
    218
  • trunk/LayoutTests/fast/events/init-events-expected.txt

    r48025 r49214  
    4646PASS testInitEvent('Message', '"a", false, true, "b", "c", "d", window, null').cancelable is true
    4747PASS testInitEvent('Message', '"a", false, false, "b", "c", "d", window, null').data is 'b'
    48 PASS testInitEvent('Message', '"a", false, false, null, "c", "d", window, null').data is 'null'
     48PASS testInitEvent('Message', '"a", false, false, null, "c", "d", window, null').data is null
    4949PASS testInitEvent('Message', '"a", false, false, "b", "c", "d", window, null').origin is 'c'
    5050PASS testInitEvent('Message', '"a", false, false, "b", null, "d", window, null').origin is 'null'
  • trunk/LayoutTests/fast/events/script-tests/init-events.js

    r48552 r49214  
    5757shouldBe("testInitEvent('Message', '\"a\", false, true, \"b\", \"c\", \"d\", window, null').cancelable", "true");
    5858shouldBe("testInitEvent('Message', '\"a\", false, false, \"b\", \"c\", \"d\", window, null').data", "'b'");
    59 shouldBe("testInitEvent('Message', '\"a\", false, false, null, \"c\", \"d\", window, null').data", "'null'");
     59shouldBe("testInitEvent('Message', '\"a\", false, false, null, \"c\", \"d\", window, null').data", "null");
    6060shouldBe("testInitEvent('Message', '\"a\", false, false, \"b\", \"c\", \"d\", window, null').origin", "'c'");
    6161shouldBe("testInitEvent('Message', '\"a\", false, false, \"b\", null, \"d\", window, null').origin", "'null'");
  • trunk/LayoutTests/fast/workers/resources/use-machine-stack.js

    r38779 r49214  
    1717        g();
    1818    } catch (ex) {
    19         postMessage(ex);
     19        postMessage(ex.toString());
    2020    }
    2121}
  • trunk/WebCore/ChangeLog

    r49213 r49214  
     12009-10-05  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Gavin Barraclough.
     4
     5        It should be possible to post (clone) built-in JS objects to Workers
     6        https://bugs.webkit.org/show_bug.cgi?id=22878
     7
     8        Implement object cloning semantics for postMessage.  Currently only
     9        a partial implementation of the spec -- cloning of File, FileList,
     10        ImageData, and RegExp were left out as they would have significantly
     11        increased patch size.
     12
     13        Cloning requires multiple tree walks so we use a templated tree
     14        walk function, allowing us to share a single implementation for
     15        serialization, deserialization, and eventual destruction of the
     16        serialized object tree.
     17
     18        Test: fast/dom/Window/window-postmessage-clone.html
     19
     20        * WebCore.vcproj/WebCore.vcproj:
     21        * WebCore.xcodeproj/project.pbxproj:
     22        * bindings/js/JSDOMWindowCustom.cpp:
     23        (WebCore::JSDOMWindow::postMessage):
     24        * bindings/js/JSMessageEventCustom.cpp:
     25        (WebCore::JSMessageEvent::initMessageEvent):
     26        * bindings/js/JSMessagePortCustom.h:
     27        (WebCore::handlePostMessage):
     28        * bindings/js/SerializedScriptValue.cpp: Added.
     29        (WebCore::SerializedObject::set):
     30        (WebCore::SerializedObject::names):
     31        (WebCore::SerializedObject::values):
     32        (WebCore::SerializedObject::create):
     33        (WebCore::SerializedObject::clear):
     34        (WebCore::SerializedObject::SerializedObject):
     35        (WebCore::SerializedArray::setIndex):
     36        (WebCore::SerializedArray::canDoFastRead):
     37        (WebCore::SerializedArray::getIndex):
     38        (WebCore::SerializedArray::getSparseIndex):
     39        (WebCore::SerializedArray::length):
     40        (WebCore::SerializedArray::create):
     41        (WebCore::SerializedArray::clear):
     42        (WebCore::SerializedArray::SerializedArray):
     43        (WebCore::SerializedScriptValueData::SerializedScriptValueData):
     44        (WebCore::SharedSerializedData::asArray):
     45        (WebCore::SharedSerializedData::asObject):
     46        (WebCore::):
     47        (WebCore::walk):
     48        (WebCore::BaseWalker::BaseWalker):
     49        (WebCore::BaseWalker::shouldTerminate):
     50        (WebCore::BaseWalker::ticksUntilNextCheck):
     51        (WebCore::BaseWalker::didTimeOut):
     52        (WebCore::BaseWalker::throwStackOverflow):
     53        (WebCore::BaseWalker::throwInterruptedException):
     54        (WebCore::SerializingTreeWalker::SerializingTreeWalker):
     55        (WebCore::SerializingTreeWalker::null):
     56        (WebCore::SerializingTreeWalker::isArray):
     57        (WebCore::SerializingTreeWalker::isObject):
     58        (WebCore::SerializingTreeWalker::asInputArray):
     59        (WebCore::SerializingTreeWalker::asInputObject):
     60        (WebCore::SerializingTreeWalker::createOutputArray):
     61        (WebCore::SerializingTreeWalker::createOutputObject):
     62        (WebCore::SerializingTreeWalker::length):
     63        (WebCore::SerializingTreeWalker::canDoFastRead):
     64        (WebCore::SerializingTreeWalker::getIndex):
     65        (WebCore::SerializingTreeWalker::getSparseIndex):
     66        (WebCore::SerializingTreeWalker::getProperty):
     67        (WebCore::SerializingTreeWalker::convertIfTerminal):
     68        (WebCore::SerializingTreeWalker::getPropertyNames):
     69        (WebCore::SerializingTreeWalker::putIndex):
     70        (WebCore::SerializingTreeWalker::putProperty):
     71        (WebCore::SerializingTreeWalker::startArray):
     72        (WebCore::SerializingTreeWalker::endArray):
     73        (WebCore::SerializingTreeWalker::startObject):
     74        (WebCore::SerializingTreeWalker::endObject):
     75        (WebCore::SerializedScriptValueData::serialize):
     76        (WebCore::DeserializingTreeWalker::DeserializingTreeWalker):
     77        (WebCore::DeserializingTreeWalker::null):
     78        (WebCore::DeserializingTreeWalker::isArray):
     79        (WebCore::DeserializingTreeWalker::isObject):
     80        (WebCore::DeserializingTreeWalker::asInputArray):
     81        (WebCore::DeserializingTreeWalker::asInputObject):
     82        (WebCore::DeserializingTreeWalker::createOutputArray):
     83        (WebCore::DeserializingTreeWalker::createOutputObject):
     84        (WebCore::DeserializingTreeWalker::length):
     85        (WebCore::DeserializingTreeWalker::canDoFastRead):
     86        (WebCore::DeserializingTreeWalker::getIndex):
     87        (WebCore::DeserializingTreeWalker::getSparseIndex):
     88        (WebCore::DeserializingTreeWalker::getProperty):
     89        (WebCore::DeserializingTreeWalker::convertIfTerminal):
     90        (WebCore::DeserializingTreeWalker::getPropertyNames):
     91        (WebCore::DeserializingTreeWalker::putIndex):
     92        (WebCore::DeserializingTreeWalker::putProperty):
     93        (WebCore::DeserializingTreeWalker::startArray):
     94        (WebCore::DeserializingTreeWalker::endArray):
     95        (WebCore::DeserializingTreeWalker::startObject):
     96        (WebCore::DeserializingTreeWalker::endObject):
     97        (WebCore::SerializedScriptValueData::deserialize):
     98        (WebCore::TeardownTreeWalker::shouldTerminate):
     99        (WebCore::TeardownTreeWalker::ticksUntilNextCheck):
     100        (WebCore::TeardownTreeWalker::didTimeOut):
     101        (WebCore::TeardownTreeWalker::throwStackOverflow):
     102        (WebCore::TeardownTreeWalker::throwInterruptedException):
     103        (WebCore::TeardownTreeWalker::null):
     104        (WebCore::TeardownTreeWalker::isArray):
     105        (WebCore::TeardownTreeWalker::isObject):
     106        (WebCore::TeardownTreeWalker::asInputArray):
     107        (WebCore::TeardownTreeWalker::asInputObject):
     108        (WebCore::TeardownTreeWalker::createOutputArray):
     109        (WebCore::TeardownTreeWalker::createOutputObject):
     110        (WebCore::TeardownTreeWalker::length):
     111        (WebCore::TeardownTreeWalker::canDoFastRead):
     112        (WebCore::TeardownTreeWalker::getIndex):
     113        (WebCore::TeardownTreeWalker::getSparseIndex):
     114        (WebCore::TeardownTreeWalker::getProperty):
     115        (WebCore::TeardownTreeWalker::convertIfTerminal):
     116        (WebCore::TeardownTreeWalker::getPropertyNames):
     117        (WebCore::TeardownTreeWalker::putIndex):
     118        (WebCore::TeardownTreeWalker::putProperty):
     119        (WebCore::TeardownTreeWalker::startArray):
     120        (WebCore::TeardownTreeWalker::endArray):
     121        (WebCore::TeardownTreeWalker::startObject):
     122        (WebCore::TeardownTreeWalker::endObject):
     123        (WebCore::SerializedScriptValueData::tearDownSerializedData):
     124        * bindings/js/SerializedScriptValue.h: Added.
     125        (WebCore::SharedSerializedData::~SharedSerializedData):
     126        (WebCore::SerializedScriptValueData::):
     127        (WebCore::SerializedScriptValueData::type):
     128        (WebCore::SerializedScriptValueData::~SerializedScriptValueData):
     129        (WebCore::SerializedScriptValueData::SerializedScriptValueData):
     130        (WebCore::SerializedScriptValueData::asImmediate):
     131        (WebCore::SerializedScriptValueData::asDouble):
     132        (WebCore::SerializedScriptValueData::asString):
     133        (WebCore::SerializedScriptValueData::asObject):
     134        (WebCore::SerializedScriptValueData::asArray):
     135        (WebCore::SerializedScriptValueData::operator bool ):
     136        (WebCore::SerializedScriptValueData::release):
     137        (WebCore::SerializedScriptValue::create):
     138        (WebCore::SerializedScriptValue::release):
     139        (WebCore::SerializedScriptValue::toString):
     140        (WebCore::SerializedScriptValue::deserialize):
     141        (WebCore::SerializedScriptValue::~SerializedScriptValue):
     142        (WebCore::SerializedScriptValue::SerializedScriptValue):
     143        * bindings/scripts/CodeGeneratorJS.pm:
     144        * bindings/scripts/CodeGeneratorObjC.pm:
     145        * dom/MessageEvent.cpp:
     146        (WebCore::MessageEvent::MessageEvent):
     147        (WebCore::MessageEvent::initMessageEvent):
     148        * dom/MessageEvent.h:
     149        (WebCore::MessageEvent::create):
     150        (WebCore::MessageEvent::data):
     151        * dom/MessageEvent.idl:
     152        * dom/MessagePort.cpp:
     153        (WebCore::MessagePort::postMessage):
     154        * dom/MessagePort.h:
     155        * dom/MessagePortChannel.cpp:
     156        (WebCore::MessagePortChannel::EventData::create):
     157        (WebCore::MessagePortChannel::EventData::EventData):
     158        * dom/MessagePortChannel.h:
     159        (WebCore::MessagePortChannel::EventData::message):
     160        * page/DOMWindow.cpp:
     161        (WebCore::PostMessageTimer::PostMessageTimer):
     162        (WebCore::DOMWindow::postMessage):
     163        * page/DOMWindow.h:
     164        * page/DOMWindow.idl:
     165        * page/EventSource.cpp:
     166        (WebCore::EventSource::createMessageEvent):
     167        * websockets/WebSocket.cpp:
     168        (WebCore::WebSocket::didReceiveMessage):
     169        * workers/DedicatedWorkerContext.cpp:
     170        (WebCore::DedicatedWorkerContext::postMessage):
     171        * workers/DedicatedWorkerContext.h:
     172        * workers/DedicatedWorkerContext.idl:
     173        * workers/Worker.cpp:
     174        (WebCore::Worker::postMessage):
     175        * workers/Worker.h:
     176        * workers/Worker.idl:
     177        * workers/WorkerContextProxy.h:
     178        * workers/WorkerMessagingProxy.cpp:
     179        (WebCore::MessageWorkerContextTask::create):
     180        (WebCore::MessageWorkerContextTask::MessageWorkerContextTask):
     181        (WebCore::MessageWorkerTask::create):
     182        (WebCore::MessageWorkerTask::MessageWorkerTask):
     183        (WebCore::WorkerMessagingProxy::postMessageToWorkerObject):
     184        (WebCore::WorkerMessagingProxy::postMessageToWorkerContext):
     185        * workers/WorkerMessagingProxy.h:
     186        * workers/WorkerObjectProxy.h:
     187
    11882009-10-06  Adam Barth  <abarth@webkit.org>
    2189
  • trunk/WebCore/WebCore.vcproj/WebCore.vcproj

    r49113 r49214  
    2967229672                                </File>
    2967329673                                <File
     29674                                        RelativePath="..\bindings\js\SerializedScriptValue.cpp"
     29675                                        >
     29676                                </File>
     29677                                <File
     29678                                        RelativePath="..\bindings\js\SerializedScriptValue.h"
     29679                                        >
     29680                                </File>
     29681                                <File
    2967429682                                        RelativePath="..\bindings\js\StringSourceProvider.h"
    2967529683                                        >
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r49136 r49214  
    23562356                A7352C190B1BB89D00A986D0 /* RenderSVGBlock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7352C170B1BB89D00A986D0 /* RenderSVGBlock.cpp */; };
    23572357                A7352C1A0B1BB89D00A986D0 /* RenderSVGBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = A7352C180B1BB89D00A986D0 /* RenderSVGBlock.h */; };
     2358                A75E497610752ACB00C9B896 /* SerializedScriptValue.h in Headers */ = {isa = PBXBuildFile; fileRef = A75E497410752ACB00C9B896 /* SerializedScriptValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
     2359                A75E497710752ACB00C9B896 /* SerializedScriptValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A75E497510752ACB00C9B896 /* SerializedScriptValue.cpp */; };
    23582360                A75E8B880E1DE2D6007F2481 /* FEBlend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A75E8B800E1DE2D6007F2481 /* FEBlend.cpp */; };
    23592361                A75E8B890E1DE2D6007F2481 /* FEBlend.h in Headers */ = {isa = PBXBuildFile; fileRef = A75E8B810E1DE2D6007F2481 /* FEBlend.h */; };
     
    75437545                A7352C170B1BB89D00A986D0 /* RenderSVGBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGBlock.cpp; sourceTree = "<group>"; };
    75447546                A7352C180B1BB89D00A986D0 /* RenderSVGBlock.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderSVGBlock.h; sourceTree = "<group>"; };
     7547                A75E497410752ACB00C9B896 /* SerializedScriptValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SerializedScriptValue.h; sourceTree = "<group>"; };
     7548                A75E497510752ACB00C9B896 /* SerializedScriptValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SerializedScriptValue.cpp; sourceTree = "<group>"; };
    75457549                A75E8B800E1DE2D6007F2481 /* FEBlend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FEBlend.cpp; path = filters/FEBlend.cpp; sourceTree = "<group>"; };
    75467550                A75E8B810E1DE2D6007F2481 /* FEBlend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FEBlend.h; path = filters/FEBlend.h; sourceTree = "<group>"; };
     
    1422814232                                E1A643FC0EC097A000779668 /* WorkerScriptController.cpp */,
    1422914233                                E1A643F10EC0972500779668 /* WorkerScriptController.h */,
     14234                                A75E497410752ACB00C9B896 /* SerializedScriptValue.h */,
     14235                                A75E497510752ACB00C9B896 /* SerializedScriptValue.cpp */,
    1423014236                        );
    1423114237                        path = js;
     
    1795417960                                BC946348107A936600857193 /* JSBeforeLoadEvent.h in Headers */,
    1795517961                                97BC63B91076C97F002C2142 /* PolicyCheck.h in Headers */,
     17962                                A75E497610752ACB00C9B896 /* SerializedScriptValue.h in Headers */,
    1795617963                        );
    1795717964                        runOnlyForDeploymentPostprocessing = 0;
     
    2007420081                                BC946346107A934B00857193 /* JSBeforeLoadEvent.cpp in Sources */,
    2007520082                                97BC63B81076C97F002C2142 /* PolicyCheck.cpp in Sources */,
     20083                                A75E497710752ACB00C9B896 /* SerializedScriptValue.cpp in Sources */,
    2007620084                        );
    2007720085                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebCore/bindings/js/JSDOMWindowCustom.cpp

    r49196 r49214  
    8080#include "ScheduledAction.h"
    8181#include "ScriptController.h"
     82#include "SerializedScriptValue.h"
    8283#include "Settings.h"
    8384#include "SharedWorkerRepository.h"
     
    953954
    954955    DOMWindow* source = asJSDOMWindow(exec->lexicalGlobalObject())->impl();
    955     String message = args.at(0).toString(exec);
     956    PassRefPtr<SerializedScriptValue> message = SerializedScriptValue::create(exec, args.at(0));
    956957
    957958    if (exec->hadException())
  • trunk/WebCore/bindings/js/JSMessageEventCustom.cpp

    r48025 r49214  
    6060    bool canBubbleArg = args.at(1).toBoolean(exec);
    6161    bool cancelableArg = args.at(2).toBoolean(exec);
    62     const UString& dataArg = args.at(3).toString(exec);
     62    PassRefPtr<SerializedScriptValue> dataArg = SerializedScriptValue::create(exec, args.at(3));
    6363    const UString& originArg = args.at(4).toString(exec);
    6464    const UString& lastEventIdArg = args.at(5).toString(exec);
  • trunk/WebCore/bindings/js/JSMessagePortCustom.h

    r48025 r49214  
    5050    inline JSC::JSValue handlePostMessage(JSC::ExecState* exec, const JSC::ArgList& args, T* impl)
    5151    {
    52         String message = args.at(0).toString(exec);
     52        PassRefPtr<SerializedScriptValue> message = SerializedScriptValue::create(exec, args.at(0));
    5353        MessagePortArray portArray;
    5454        fillMessagePortArray(exec, args.at(1), portArray);
  • trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r48884 r49214  
    18431843    }
    18441844
     1845    if ($type eq "SerializedScriptValue") {
     1846        $implIncludes{"SerializedScriptValue.h"} = 1;
     1847        return "SerializedScriptValue::create(exec, $value)";
     1848    }
     1849
    18451850    $implIncludes{"FloatPoint.h"} = 1 if $type eq "SVGPoint";
    18461851    $implIncludes{"FloatRect.h"} = 1 if $type eq "SVGRect";
     
    19481953        $joinedName =~ s/Abs|Rel//;
    19491954        $implIncludes{"$joinedName.h"} = 1;
     1955    } elsif ($type eq "SerializedScriptValue") {
     1956        $implIncludes{"$type.h"} = 1;
     1957        return "$value->deserialize(exec)";
    19501958    } else {
    19511959        # Default, include header with same name.
  • trunk/WebCore/bindings/scripts/CodeGeneratorObjC.pm

    r48266 r49214  
    312312
    313313    # special cases
    314     return "NSString" if $codeGenerator->IsStringType($name);
     314    return "NSString" if $codeGenerator->IsStringType($name) or $name eq "SerializedScriptValue";
    315315    return "NS$name" if IsNativeObjCType($name);
    316316    return "BOOL" if $name eq "boolean";
     
    493493    return "WTF::getPtr(nativeNodeFilter)" if $type eq "NodeFilter";
    494494    return "WTF::getPtr(nativeResolver)" if $type eq "XPathNSResolver";
     495   
     496    if ($type eq "SerializedScriptValue") {
     497        $implIncludes{"SerializedScriptValue.h"} = 1;
     498        return "WebCore::SerializedScriptValue::create(WebCore::String($argName))";
     499    }
    495500    return "core($argName)";
    496501}
     
    605610        $implIncludes{"DOMCustomXPathNSResolver.h"} = 1;
    606611        $implIncludes{"XPathNSResolver.h"} = 1;
     612        return;
     613    }
     614
     615    if ($type eq "SerializedScriptValue") {
     616        $implIncludes{"SerializedScriptValue.h"} = 1;
    607617        return;
    608618    }
     
    12131223                $getterContentHead = "WebCore::nsColor($getterContentHead";
    12141224                $getterContentTail .= ")";
     1225            } elsif ($attribute->signature->type eq "SerializedScriptValue") {
     1226                $getterContentHead = "$getterContentHead";
     1227                $getterContentTail .= "->toString()";               
    12151228            } elsif (ConversionNeeded($attribute->signature->type)) {
    12161229                $getterContentHead = "kit(WTF::getPtr($getterContentHead";
     
    14471460                    push(@functionContent, "    return nil;\n");
    14481461                }
     1462            } elsif ($returnType eq "SerializedScriptValue") {
     1463                $content = "foo";
    14491464            } else {
    14501465                if (ConversionNeeded($function->signature->type)) {
  • trunk/WebCore/dom/MessageEvent.cpp

    r48395 r49214  
    3535
    3636MessageEvent::MessageEvent()
     37    : m_data(SerializedScriptValue::create())
    3738{
    3839}
    3940
    40 MessageEvent::MessageEvent(const String& data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray> ports)
     41MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray> ports)
    4142    : Event(eventNames().messageEvent, false, false)
    4243    , m_data(data)
     
    5253}
    5354
    54 void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray> ports)
     55void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray> ports)
    5556{
    5657    if (dispatched())
     
    7576}
    7677
    77 void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& data, const String& origin, const String& lastEventId, DOMWindow* source, MessagePort* port)
     78void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, MessagePort* port)
    7879{
    7980    MessagePortArray* ports = 0;
  • trunk/WebCore/dom/MessageEvent.h

    r48701 r49214  
    3232#include "Event.h"
    3333#include "MessagePort.h"
     34#include "SerializedScriptValue.h"
    3435
    3536namespace WebCore {
     
    4344            return adoptRef(new MessageEvent);
    4445        }
    45         static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, const String& data = "", const String& origin = "", const String& lastEventId = "", PassRefPtr<DOMWindow> source = 0)
     46        static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, PassRefPtr<SerializedScriptValue> data = 0, const String& origin = "", const String& lastEventId = "", PassRefPtr<DOMWindow> source = 0)
    4647        {
    4748            return adoptRef(new MessageEvent(data, origin, lastEventId, source, ports));
     
    4950        virtual ~MessageEvent();
    5051
    51         void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray>);
     52        void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray>);
    5253
    53         const String& data() const { return m_data; }
     54        SerializedScriptValue* data() const { return m_data.get(); }
    5455        const String& origin() const { return m_origin; }
    5556        const String& lastEventId() const { return m_lastEventId; }
     
    6061        MessagePort* messagePort();
    6162        // FIXME: remove this when we update the ObjC bindings (bug #28774).
    62         void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& data, const String& origin, const String& lastEventId, DOMWindow* source, MessagePort*);
     63        void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, MessagePort*);
    6364
    6465        virtual bool isMessageEvent() const;
     
    6667    private:
    6768        MessageEvent();
    68         MessageEvent(const String& data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray>);
     69        MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray>);
    6970
    70         String m_data;
     71        RefPtr<SerializedScriptValue> m_data;
    7172        String m_origin;
    7273        String m_lastEventId;
  • trunk/WebCore/dom/MessageEvent.idl

    r48025 r49214  
    3131        NoStaticTables
    3232    ] MessageEvent : Event {
     33        readonly attribute SerializedScriptValue data;
    3334
    34         readonly attribute DOMString data;
    3535        readonly attribute DOMString origin;
    3636        readonly attribute DOMString lastEventId;
     
    3939        readonly attribute [CustomGetter] Array ports;
    4040
    41         [Custom] void initMessageEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString dataArg, in DOMString originArg, in DOMString lastEventIdArg, in DOMWindow sourceArg, in Array messagePorts);
     41        [Custom] void initMessageEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in SerializedScriptValue dataArg, in DOMString originArg, in DOMString lastEventIdArg, in DOMWindow sourceArg, in Array messagePorts);
    4242#else
    4343        // There's no good way to expose an array via the ObjC bindings, so for now just expose a single port.
    4444        readonly attribute MessagePort messagePort;
    4545
    46         void initMessageEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString dataArg, in DOMString originArg, in DOMString lastEventIdArg, in DOMWindow sourceArg, in MessagePort messagePort);
     46        void initMessageEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in SerializedScriptValue dataArg, in DOMString originArg, in DOMString lastEventIdArg, in DOMWindow sourceArg, in MessagePort messagePort);
    4747#endif
    4848
  • trunk/WebCore/dom/MessagePort.cpp

    r48701 r49214  
    5757
    5858// FIXME: remove this when we update the ObjC bindings (bug #28774).
    59 void MessagePort::postMessage(const String& message, MessagePort* port, ExceptionCode& ec)
     59void MessagePort::postMessage(PassRefPtr<SerializedScriptValue> message, MessagePort* port, ExceptionCode& ec)
    6060{
    6161    MessagePortArray ports;
     
    6565}
    6666
    67 void MessagePort::postMessage(const String& message, ExceptionCode& ec)
     67void MessagePort::postMessage(PassRefPtr<SerializedScriptValue> message, ExceptionCode& ec)
    6868{
    6969    postMessage(message, static_cast<MessagePortArray*>(0), ec);
    7070}
    7171
    72 void MessagePort::postMessage(const String& message, const MessagePortArray* ports, ExceptionCode& ec)
     72void MessagePort::postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray* ports, ExceptionCode& ec)
    7373{
    7474    if (!m_entangledChannel)
  • trunk/WebCore/dom/MessagePort.h

    r48701 r49214  
    5757        ~MessagePort();
    5858
    59         void postMessage(const String& message, ExceptionCode&);
    60         void postMessage(const String& message, const MessagePortArray*, ExceptionCode&);
     59        void postMessage(PassRefPtr<SerializedScriptValue> message, ExceptionCode&);
     60        void postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray*, ExceptionCode&);
    6161        // FIXME: remove this when we update the ObjC bindings (bug #28774).
    62         void postMessage(const String& message, MessagePort*, ExceptionCode&);
     62        void postMessage(PassRefPtr<SerializedScriptValue> message, MessagePort*, ExceptionCode&);
    6363
    6464        void start();
  • trunk/WebCore/dom/MessagePortChannel.cpp

    r49160 r49214  
    3434
    3535
    36 PassOwnPtr<MessagePortChannel::EventData> MessagePortChannel::EventData::create(const String& message, PassOwnPtr<MessagePortChannelArray> channels)
     36PassOwnPtr<MessagePortChannel::EventData> MessagePortChannel::EventData::create(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
    3737{
    3838    return new EventData(message, channels);
    3939}
    4040
    41 MessagePortChannel::EventData::EventData(const String& message, PassOwnPtr<MessagePortChannelArray> channels)
    42     : m_message(message.crossThreadString())
     41MessagePortChannel::EventData::EventData(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
     42    : m_message(message->release())
    4343    , m_channels(channels)
    4444{
  • trunk/WebCore/dom/MessagePortChannel.h

    r47791 r49214  
    3434#include "PlatformString.h"
    3535
     36#include "SerializedScriptValue.h"
     37
    3638#include <wtf/OwnPtr.h>
    3739#include <wtf/PassOwnPtr.h>
     
    4648    class PlatformMessagePortChannel;
    4749    class ScriptExecutionContext;
     50    class SerializedScriptValue;
    4851    class String;
    4952
     
    7881        class EventData {
    7982        public:
    80             static PassOwnPtr<EventData> create(const String&, PassOwnPtr<MessagePortChannelArray>);
     83            static PassOwnPtr<EventData> create(PassRefPtr<SerializedScriptValue>, PassOwnPtr<MessagePortChannelArray>);
    8184
    82             const String& message() { return m_message; }
     85            SerializedScriptValue* message() { return m_message.get(); }
    8386            PassOwnPtr<MessagePortChannelArray> channels() { return m_channels.release(); }
    8487
    8588        private:
    86             EventData(const String& message, PassOwnPtr<MessagePortChannelArray>);
    87             String m_message;
     89            EventData(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray>);
     90            RefPtr<SerializedScriptValue> m_message;
    8891            OwnPtr<MessagePortChannelArray> m_channels;
    8992        };
  • trunk/WebCore/page/DOMWindow.cpp

    r49196 r49214  
    6565#include "Screen.h"
    6666#include "SecurityOrigin.h"
     67#include "SerializedScriptValue.h"
    6768#include "Settings.h"
    6869#include "Storage.h"
     
    8182class PostMessageTimer : public TimerBase {
    8283public:
    83     PostMessageTimer(DOMWindow* window, const String& message, const String& sourceOrigin, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortChannelArray> channels, SecurityOrigin* targetOrigin)
     84    PostMessageTimer(DOMWindow* window, PassRefPtr<SerializedScriptValue> message, const String& sourceOrigin, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortChannelArray> channels, SecurityOrigin* targetOrigin)
    8485        : m_window(window)
    8586        , m_message(message)
     
    105106
    106107    RefPtr<DOMWindow> m_window;
    107     String m_message;
     108    RefPtr<SerializedScriptValue> m_message;
    108109    String m_origin;
    109110    RefPtr<DOMWindow> m_source;
     
    636637#endif
    637638
    638 void DOMWindow::postMessage(const String& message, MessagePort* port, const String& targetOrigin, DOMWindow* source, ExceptionCode& ec)
     639void DOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message, MessagePort* port, const String& targetOrigin, DOMWindow* source, ExceptionCode& ec)
    639640{
    640641    MessagePortArray ports;
     
    644645}
    645646
    646 void DOMWindow::postMessage(const String& message, const MessagePortArray* ports, const String& targetOrigin, DOMWindow* source, ExceptionCode& ec)
     647void DOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray* ports, const String& targetOrigin, DOMWindow* source, ExceptionCode& ec)
    647648{
    648649    if (!m_frame)
  • trunk/WebCore/page/DOMWindow.h

    r48701 r49214  
    6060    class PostMessageTimer;
    6161    class ScheduledAction;
     62    class SerializedScriptValue;
    6263    class Screen;
    6364    class WebKitPoint;
     
    215216#endif
    216217
    217         void postMessage(const String& message, const MessagePortArray*, const String& targetOrigin, DOMWindow* source, ExceptionCode&);
     218        void postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray*, const String& targetOrigin, DOMWindow* source, ExceptionCode&);
    218219        // FIXME: remove this when we update the ObjC bindings (bug #28774).
    219         void postMessage(const String& message, MessagePort*, const String& targetOrigin, DOMWindow* source, ExceptionCode&);
     220        void postMessage(PassRefPtr<SerializedScriptValue> message, MessagePort*, const String& targetOrigin, DOMWindow* source, ExceptionCode&);
    220221        void postMessageTimerFired(PostMessageTimer*);
    221222
  • trunk/WebCore/page/DOMWindow.idl

    r49113 r49214  
    183183        // cross-document messaging
    184184#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
    185         [DoNotCheckDomainSecurity, Custom] void postMessage(in DOMString message, in [Optional] Array messagePorts, in DOMString targetOrigin)
     185        [DoNotCheckDomainSecurity, Custom] void postMessage(in SerializedScriptValue message, in [Optional] Array messagePorts, in DOMString targetOrigin)
    186186            raises(DOMException);
    187187#else
    188188        // There's no good way to expose an array via the ObjC bindings, so for now just allow passing in a single port.
    189         [DoNotCheckDomainSecurity, Custom] void postMessage(in DOMString message, in [Optional] MessagePort messagePort, in DOMString targetOrigin)
     189        [DoNotCheckDomainSecurity, Custom] void postMessage(in SerializedScriptValue message, in [Optional] MessagePort messagePort, in DOMString targetOrigin)
    190190            raises(DOMException);
    191191#endif
  • trunk/WebCore/page/EventSource.cpp

    r48701 r49214  
    4646#include "ResourceResponse.h"
    4747#include "ScriptExecutionContext.h"
     48#include "SerializedScriptValue.h"
    4849#include "TextResourceDecoder.h"
    4950#include "ThreadableLoader.h"
     
    295296{
    296297    RefPtr<MessageEvent> event = MessageEvent::create();
    297     event->initMessageEvent(m_eventName.isEmpty() ? eventNames().messageEvent : AtomicString(m_eventName), false, false, String::adopt(m_data), m_origin, m_lastEventId, 0, 0);
     298    event->initMessageEvent(m_eventName.isEmpty() ? eventNames().messageEvent : AtomicString(m_eventName), false, false, SerializedScriptValue::create(String::adopt(m_data)), m_origin, m_lastEventId, 0, 0);
    298299    return event.release();
    299300}
  • trunk/WebCore/websockets/WebSocket.cpp

    r48701 r49214  
    190190    RefPtr<MessageEvent> evt = MessageEvent::create();
    191191    // FIXME: origin, lastEventId, source, messagePort.
    192     evt->initMessageEvent(eventNames().messageEvent, false, false, msg, "", "", 0, 0);
     192    evt->initMessageEvent(eventNames().messageEvent, false, false, SerializedScriptValue::create(msg), "", "", 0, 0);
    193193    scriptExecutionContext()->postTask(ProcessWebSocketEventTask::create(this, evt));
    194194}
  • trunk/WebCore/workers/DedicatedWorkerContext.cpp

    r48701 r49214  
    4848
    4949// FIXME: remove this when we update the ObjC bindings (bug #28774).
    50 void DedicatedWorkerContext::postMessage(const String& message, MessagePort* port, ExceptionCode& ec)
     50void DedicatedWorkerContext::postMessage(PassRefPtr<SerializedScriptValue> message, MessagePort* port, ExceptionCode& ec)
    5151{
    5252    MessagePortArray ports;
     
    5656}
    5757
    58 void DedicatedWorkerContext::postMessage(const String& message, ExceptionCode& ec)
     58void DedicatedWorkerContext::postMessage(PassRefPtr<SerializedScriptValue> message, ExceptionCode& ec)
    5959{
    6060    postMessage(message, static_cast<MessagePortArray*>(0), ec);
    6161}
    6262
    63 void DedicatedWorkerContext::postMessage(const String& message, const MessagePortArray* ports, ExceptionCode& ec)
     63void DedicatedWorkerContext::postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray* ports, ExceptionCode& ec)
    6464{
    6565    if (isClosing())
  • trunk/WebCore/workers/DedicatedWorkerContext.h

    r48701 r49214  
    5656        // EventTarget
    5757        virtual DedicatedWorkerContext* toDedicatedWorkerContext() { return this; }
    58         void postMessage(const String&, ExceptionCode&);
    59         void postMessage(const String&, const MessagePortArray*, ExceptionCode&);
     58        void postMessage(PassRefPtr<SerializedScriptValue>, ExceptionCode&);
     59        void postMessage(PassRefPtr<SerializedScriptValue>, const MessagePortArray*, ExceptionCode&);
    6060        // FIXME: remove this when we update the ObjC bindings (bug #28774).
    61         void postMessage(const String&, MessagePort*, ExceptionCode&);
     61        void postMessage(PassRefPtr<SerializedScriptValue>, MessagePort*, ExceptionCode&);
    6262
    6363        DEFINE_ATTRIBUTE_EVENT_LISTENER(message);
  • trunk/WebCore/workers/DedicatedWorkerContext.idl

    r48701 r49214  
    4040
    4141#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
    42         [Custom] void postMessage(in DOMString message, in [Optional] Array messagePorts)
     42        [Custom] void postMessage(in any message, in [Optional] Array messagePorts)
    4343            raises(DOMException);
    4444#else
  • trunk/WebCore/workers/Worker.cpp

    r48701 r49214  
    7171
    7272// FIXME: remove this when we update the ObjC bindings (bug #28774).
    73 void Worker::postMessage(const String& message, MessagePort* port, ExceptionCode& ec)
     73void Worker::postMessage(PassRefPtr<SerializedScriptValue> message, MessagePort* port, ExceptionCode& ec)
    7474{
    7575    MessagePortArray ports;
     
    7979}
    8080
    81 void Worker::postMessage(const String& message, ExceptionCode& ec)
     81void Worker::postMessage(PassRefPtr<SerializedScriptValue> message, ExceptionCode& ec)
    8282{
    8383    postMessage(message, static_cast<MessagePortArray*>(0), ec);
    8484}
    8585
    86 void Worker::postMessage(const String& message, const MessagePortArray* ports, ExceptionCode& ec)
     86void Worker::postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray* ports, ExceptionCode& ec)
    8787{
    8888    // Disentangle the port in preparation for sending it to the remote context.
  • trunk/WebCore/workers/Worker.h

    r48701 r49214  
    5959        virtual Worker* toWorker() { return this; }
    6060
    61         void postMessage(const String&, ExceptionCode&);
    62         void postMessage(const String&, const MessagePortArray*, ExceptionCode&);
     61        void postMessage(PassRefPtr<SerializedScriptValue>, ExceptionCode&);
     62        void postMessage(PassRefPtr<SerializedScriptValue>, const MessagePortArray*, ExceptionCode&);
    6363        // FIXME: remove this when we update the ObjC bindings (bug #28774).
    64         void postMessage(const String& message, MessagePort*, ExceptionCode&);
     64        void postMessage(PassRefPtr<SerializedScriptValue> message, MessagePort*, ExceptionCode&);
    6565
    6666        void terminate();
  • trunk/WebCore/workers/Worker.idl

    r48701 r49214  
    3636
    3737#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
    38         [Custom] void postMessage(in DOMString message, in [Optional] Array messagePorts)
     38        [Custom] void postMessage(in SerialisedScriptValue message, in [Optional] Array messagePorts)
    3939            raises(DOMException);
    4040#else
    4141        // There's no good way to expose an array via the ObjC bindings, so for now just allow passing in a single port.
    42         void postMessage(in DOMString message, in [Optional] MessagePort messagePort)
     42        void postMessage(in SerializedScriptValue message, in [Optional] MessagePort messagePort)
    4343            raises(DOMException);
    4444#endif
  • trunk/WebCore/workers/WorkerContextProxy.h

    r47791 r49214  
    5454        virtual void terminateWorkerContext() = 0;
    5555
    56         virtual void postMessageToWorkerContext(const String&, PassOwnPtr<MessagePortChannelArray>) = 0;
     56        virtual void postMessageToWorkerContext(PassRefPtr<SerializedScriptValue>, PassOwnPtr<MessagePortChannelArray>) = 0;
    5757
    5858        virtual bool hasPendingActivity() const = 0;
  • trunk/WebCore/workers/WorkerMessagingProxy.cpp

    r49160 r49214  
    4747class MessageWorkerContextTask : public ScriptExecutionContext::Task {
    4848public:
    49     static PassRefPtr<MessageWorkerContextTask> create(const String& message, PassOwnPtr<MessagePortChannelArray> channels)
     49    static PassRefPtr<MessageWorkerContextTask> create(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
    5050    {
    5151        return adoptRef(new MessageWorkerContextTask(message, channels));
     
    5353
    5454private:
    55     MessageWorkerContextTask(const String& message, PassOwnPtr<MessagePortChannelArray> channels)
    56         : m_message(message.crossThreadString())
     55    MessageWorkerContextTask(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
     56        : m_message(message->release())
    5757        , m_channels(channels)
    5858    {
     
    6969
    7070private:
    71     String m_message;
     71    RefPtr<SerializedScriptValue> m_message;
    7272    OwnPtr<MessagePortChannelArray> m_channels;
    7373};
     
    7575class MessageWorkerTask : public ScriptExecutionContext::Task {
    7676public:
    77     static PassRefPtr<MessageWorkerTask> create(const String& message, PassOwnPtr<MessagePortChannelArray> channels, WorkerMessagingProxy* messagingProxy)
     77    static PassRefPtr<MessageWorkerTask> create(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels, WorkerMessagingProxy* messagingProxy)
    7878    {
    7979        return adoptRef(new MessageWorkerTask(message, channels, messagingProxy));
     
    8181
    8282private:
    83     MessageWorkerTask(const String& message, PassOwnPtr<MessagePortChannelArray> channels, WorkerMessagingProxy* messagingProxy)
    84         : m_message(message.crossThreadString())
     83    MessageWorkerTask(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels, WorkerMessagingProxy* messagingProxy)
     84        : m_message(message->release())
    8585        , m_channels(channels)
    8686        , m_messagingProxy(messagingProxy)
     
    9999
    100100private:
    101     String m_message;
     101    RefPtr<SerializedScriptValue> m_message;
    102102    OwnPtr<MessagePortChannelArray> m_channels;
    103103    WorkerMessagingProxy* m_messagingProxy;
     
    241241}
    242242
    243 void WorkerMessagingProxy::postMessageToWorkerObject(const String& message, PassOwnPtr<MessagePortChannelArray> channels)
     243void WorkerMessagingProxy::postMessageToWorkerObject(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
    244244{
    245245    m_scriptExecutionContext->postTask(MessageWorkerTask::create(message, channels.release(), this));
    246246}
    247247
    248 void WorkerMessagingProxy::postMessageToWorkerContext(const String& message, PassOwnPtr<MessagePortChannelArray> channels)
     248void WorkerMessagingProxy::postMessageToWorkerContext(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
    249249{
    250250    if (m_askedToTerminate)
  • trunk/WebCore/workers/WorkerMessagingProxy.h

    r47914 r49214  
    5555        virtual void startWorkerContext(const KURL& scriptURL, const String& userAgent, const String& sourceCode);
    5656        virtual void terminateWorkerContext();
    57         virtual void postMessageToWorkerContext(const String&, PassOwnPtr<MessagePortChannelArray>);
     57        virtual void postMessageToWorkerContext(PassRefPtr<SerializedScriptValue>, PassOwnPtr<MessagePortChannelArray>);
    5858        virtual bool hasPendingActivity() const;
    5959        virtual void workerObjectDestroyed();
     
    6161        // Implementations of WorkerObjectProxy.
    6262        // (Only use these methods in the worker context thread.)
    63         virtual void postMessageToWorkerObject(const String&, PassOwnPtr<MessagePortChannelArray>);
     63        virtual void postMessageToWorkerObject(PassRefPtr<SerializedScriptValue>, PassOwnPtr<MessagePortChannelArray>);
    6464        virtual void postExceptionToWorkerObject(const String& errorMessage, int lineNumber, const String& sourceURL);
    6565        virtual void postConsoleMessageToWorkerObject(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, int lineNumber, const String& sourceURL);
  • trunk/WebCore/workers/WorkerObjectProxy.h

    r47791 r49214  
    4545    class WorkerObjectProxy : public WorkerReportingProxy {
    4646    public:
    47         virtual void postMessageToWorkerObject(const String&, PassOwnPtr<MessagePortChannelArray>) = 0;
     47        virtual void postMessageToWorkerObject(PassRefPtr<SerializedScriptValue>, PassOwnPtr<MessagePortChannelArray>) = 0;
    4848
    4949        virtual void confirmMessageFromWorkerObject(bool hasPendingActivity) = 0;
Note: See TracChangeset for help on using the changeset viewer.