optional sequence values not handled correctly by binding generator
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 3 Dec 2016 20:22:43 +0000 (20:22 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 3 Dec 2016 20:22:43 +0000 (20:22 +0000)
commitbd3514b80cde3ecee59cb9c56ed053f0f92155da
tree32c7c3c2e016109d18fbb5240711359e4f42f6c8
parentfc161eac03ad891e649b5599cdb53d5b00c58a83
optional sequence values not handled correctly by binding generator
https://bugs.webkit.org/show_bug.cgi?id=142562

Source/WebCore:

Also fixes:
    Remove non-standard postMessage overload
    https://bugs.webkit.org/show_bug.cgi?id=161911
and
    Wrong argument order in window.postMessage
    https://bugs.webkit.org/show_bug.cgi?id=63141

Reviewed by Darin Adler.

* WebCore.xcodeproj/project.pbxproj:
Remove no longer needed files.

* bindings/generic/IDLTypes.h:
* bindings/js/JSDOMConvert.h:
(WebCore::Converter<IDLObject>::convert):
Add support for the WebIDL object type.

* bindings/js/JSDOMBinding.cpp:
(WebCore::createDOMException):
Add support for throwing stack overflow errors.

* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::handlePostMessage): Deleted.
(WebCore::JSDOMWindow::postMessage): Deleted.
* bindings/js/JSDedicatedWorkerGlobalScopeCustom.cpp: Removed.
* bindings/js/JSMessagePortCustom.cpp:
(WebCore::JSMessagePort::postMessage): Deleted.
(WebCore::extractTransferables): Deleted.
* bindings/js/JSMessagePortCustom.h: Removed.
* bindings/js/JSWorkerCustom.cpp:
(WebCore::JSWorker::postMessage): Deleted.
Remove custom bindings for postMessage.

* bindings/js/SerializedScriptValue.h:
Switch to using enum class.

* bindings/js/SerializedScriptValue.cpp:
(WebCore::SerializedScriptValue::transferArrayBuffers):
(WebCore::SerializedScriptValue::create):
Add new create function that takes the transfer list, processes it, and returns
MessagePorts and SerializedScriptValue / exception.

(WebCore::CloneBase::throwStackOverflow): Deleted.
(WebCore::CloneDeserializer::throwValidationError): Deleted.
Remove uncalled functions.

* bindings/scripts/CodeGenerator.pm:
(IsRefPtrType):
(IsBuiltinType):
* bindings/scripts/CodeGeneratorJS.pm:
(AddToIncludesForIDLType):
(GetBaseIDLType):
Add support for the WebIDL 'object' type.

* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/TestObj.idl:
Add tests for 'object'.

* dom/ExceptionCode.h:
Add two new ExceptionCodes:
  - ExistingExceptionError, to indicate that implementation code threw a JS exception.
  - StackOverflowError, to indicate that a stack overflow exception should be thrown.

* dom/MessagePort.cpp:
(WebCore::MessagePort::postMessage):
* dom/MessagePort.h:
* dom/MessagePort.idl:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::postMessage):
* page/DOMWindow.h:
* page/DOMWindow.idl:
* workers/DedicatedWorkerGlobalScope.cpp:
(WebCore::DedicatedWorkerGlobalScope::postMessage):
* workers/DedicatedWorkerGlobalScope.h:
* workers/DedicatedWorkerGlobalScope.idl:
* workers/Worker.cpp:
(WebCore::Worker::postMessage):
* workers/Worker.h:
* workers/Worker.idl:
Update to call new SerializedScriptValue create function.

LayoutTests:

Reviewed by Darin Adler.

* fast/canvas/webgl/resources/typed-array-worker.js:
* fast/dom/Window/window-postmessage-args-expected.txt:
* fast/dom/Window/window-postmessage-args.html:
* fast/events/message-port-deleted-document.html:
* fast/events/message-port-deleted-frame.html:
* fast/events/message-port-inactive-document.html:
* fast/events/message-port-multi-expected.txt:
* fast/events/message-port.html:
* fast/workers/worker-context-multi-port-expected.txt:
* fast/workers/worker-multi-port-expected.txt:
* webgl/1.0.2/resources/webgl_test_files/conformance/typedarrays/resources/typed-array-worker.js:
* webgl/1.0.3/resources/webgl_test_files/conformance/typedarrays/resources/typed-array-worker.js:
Update for new exceptions and stricter enforcement of the postMessage signature.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209303 268f45cc-cd09-0410-ab3c-d52691b4dbfc
44 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/canvas/webgl/resources/typed-array-worker.js
LayoutTests/fast/dom/Window/window-postmessage-args-expected.txt
LayoutTests/fast/dom/Window/window-postmessage-args.html
LayoutTests/fast/events/message-port-deleted-document.html
LayoutTests/fast/events/message-port-deleted-frame.html
LayoutTests/fast/events/message-port-inactive-document.html
LayoutTests/fast/events/message-port-multi-expected.txt
LayoutTests/fast/events/message-port.html
LayoutTests/fast/workers/worker-context-multi-port-expected.txt
LayoutTests/fast/workers/worker-multi-port-expected.txt
LayoutTests/webgl/1.0.2/resources/webgl_test_files/conformance/typedarrays/resources/typed-array-worker.js
LayoutTests/webgl/1.0.3/resources/webgl_test_files/conformance/typedarrays/resources/typed-array-worker.js
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/generic/IDLTypes.h
Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
Source/WebCore/bindings/js/JSDOMBinding.cpp
Source/WebCore/bindings/js/JSDOMConvert.h
Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
Source/WebCore/bindings/js/JSDedicatedWorkerGlobalScopeCustom.cpp [deleted file]
Source/WebCore/bindings/js/JSMessagePortCustom.cpp
Source/WebCore/bindings/js/JSMessagePortCustom.h [deleted file]
Source/WebCore/bindings/js/JSWorkerCustom.cpp
Source/WebCore/bindings/js/SerializedScriptValue.cpp
Source/WebCore/bindings/js/SerializedScriptValue.h
Source/WebCore/bindings/scripts/CodeGenerator.pm
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/bindings/scripts/test/TestObj.idl
Source/WebCore/dom/ExceptionCode.h
Source/WebCore/dom/MessagePort.cpp
Source/WebCore/dom/MessagePort.h
Source/WebCore/dom/MessagePort.idl
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/DOMWindow.h
Source/WebCore/page/DOMWindow.idl
Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp
Source/WebCore/workers/DedicatedWorkerGlobalScope.h
Source/WebCore/workers/DedicatedWorkerGlobalScope.idl
Source/WebCore/workers/Worker.cpp
Source/WebCore/workers/Worker.h
Source/WebCore/workers/Worker.idl