-
atwilson@chromium.org authored
WebCore: Need to update JS bindings and IDL files to support multiple message ports in postMessage() https://bugs.webkit.org/show_bug.cgi?id=28460 Reviewed by Sam Weinig. Added new toJSSequence() API which validates that a JSValue meets the WebIDL criteria for a sequence. Tests: fast/events/message-port-multi.html fast/workers/worker-context-multi-port.html fast/workers/worker-multi-port.html * GNUmakefile.am: * WebCore.gypi: * WebCore.pro: * WebCore.vcproj/WebCore.vcproj: * WebCore.xcodeproj/project.pbxproj: * WebCoreSources.bkl: Added JSMessagePortCustom.h and JSMessageEventCustom.cpp. * bindings/js/JSDOMBinding.cpp: (WebCore::toJSSequence): Added toJSSequence() API to do validation on sequence-like objects per WebIDL. * bindings/js/JSDOMBinding.h: * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::postMessage): Added custom handler for postMessage() that handles being passed MessagePortArrays. * bindings/js/JSDedicatedWorkerContextCustom.cpp: (WebCore::JSDedicatedWorkerContext::postMessage): Added custom handler for postMessage() that handles being passed MessagePortArrays. * bindings/js/JSMessageEventCustom.cpp: Added. (WebCore::JSMessageEvent::ports): Added custom ports() getter that converts from MessagePortArray to JSArray. (WebCore::JSMessageEvent::initMessageEvent): Added support for passing a MessagePortArray. * bindings/js/JSMessagePortCustom.cpp: (WebCore::JSMessagePort::postMessage): Added custom handler for postMessage() that handles being passed MessagePortArray. (WebCore::fillMessagePortArray): New helper routine that validates/converts from a JS sequence o a WebCore::MessagePortArray. * bindings/js/JSMessagePortCustom.h: Added. * bindings/js/JSWorkerCustom.cpp: (WebCore::JSWorker::postMessage): Added custom handler for postMessage() that handles being passed MessagePortArray. * dom/MessageEvent.cpp: * dom/MessageEvent.h: (WebCore::MessageEvent::ports): Changed ports() to return a MessagePortArray* since this value can be null. * dom/MessageEvent.idl: Updated IDL to match HTML5 spec (now accepts MessagePortArrays instead of a solitary MessagePort). * dom/MessagePort.cpp: * dom/MessagePort.h: * dom/MessagePort.idl: Updated IDL to match HTML5 spec (postMessage() now accepts MessagePortArrays instead of a solitary MessagePort). * page/DOMWindow.h: * page/DOMWindow.idl: Updated IDL to match HTML5 spec (postMessage() now accepts MessagePortArrays instead of a solitary MessagePort). * workers/DedicatedWorkerContext.cpp: * workers/DedicatedWorkerContext.h: * workers/DedicatedWorkerContext.idl: Updated IDL to match HTML5 spec (postMessage() now accepts MessagePortArrays instead of a solitary MessagePort). * workers/Worker.cpp: * workers/Worker.h: * workers/Worker.idl: Updated IDL to match HTML5 spec (postMessage() now accepts MessagePortArrays instead of a solitary MessagePort). LayoutTests: Need to update JS bindings and IDL files to support multiple message ports in postMessage() https://bugs.webkit.org/show_bug.cgi?id=28460 Reviewed by Sam Weinig. Updated layout tests to match new postMessage() and MessageEvent APIs. Added new layout tests to test sending/receiving multiple ports. * fast/dom/Window/window-postmessage-args-expected.txt: * fast/dom/Window/window-postmessage-args.html: Updated to match new postMessage API. * fast/events/init-events-expected.txt: * fast/events/message-channel-gc-4.html: Updated to match new postMessage API. * fast/events/message-port-clone.html: Updated to match new postMessage API. * fast/events/message-port-deleted-document.html: Updated to match new postMessage API. * fast/events/message-port-deleted-frame.html: Updated to match new postMessage API. * fast/events/message-port-inactive-document.html: Updated to match new postMessage API. * fast/events/message-port-multi-expected.txt: Added. * fast/events/message-port-multi.html: Added. Added tests for various cases of sending multiple ports. * fast/events/message-port.html: Updated to match new postMessage API. * fast/events/resources/init-events.js: Added tests for sending ports to initMessageEvent() * fast/events/resources/message-port-iframe.html: * fast/events/resources/message-port-multi.js: Added. Added tests for various cases of sending multiple ports. * fast/workers/resources/shared-worker-common.js: (onconnect): Updated to reflect new MessageEvent API. * fast/workers/resources/shared-worker-script-error.js: (onconnect): Updated to reflect new MessageEvent API. * fast/workers/resources/worker-cloneport.js: (onmessage): Updated to reflect new MessageEvent API. * fast/workers/resources/worker-context-multi-port.js: Added. (worker.onmessage): Added tests for various cases of sending multiple ports. * fast/workers/resources/worker-context-thread-multi-port.js: Added. Added tests for various cases of sending multiple ports. * fast/workers/resources/worker-messageport.js: (onmessage): Updated to reflect new MessageEvent API. * fast/workers/resources/worker-multi-port.js: Added. (worker.onmessage): Added tests for various cases of sending multiple ports. * fast/workers/resources/worker-thread-multi-port.js: Added. (onmessage): Worker-thread side of multiple port layout test. (testPassed): (testFailed): * fast/workers/worker-cloneport.html: * fast/workers/worker-context-multi-port-expected.txt: Added. * fast/workers/worker-context-multi-port.html: Added. Added tests for sending multiple ports from the worker thread. * fast/workers/worker-messageport-expected.txt: * fast/workers/worker-messageport-gc.html: * fast/workers/worker-messageport.html: * fast/workers/worker-multi-port-expected.txt: Added. * fast/workers/worker-multi-port.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48025 268f45cc-cd09-0410-ab3c-d52691b4dbfc
271695b2