Commit 3dc6de20 authored by weinig@apple.com's avatar weinig@apple.com

Fix for https://bugs.webkit.org/show_bug.cgi?id=40581

Auto-generate most of the JS constructors

Reviewed by Alexey Proskuryakov.

WebCore: 

- Auto-generates all the JS constructors that don't have custom
  names (eg, Not Image(), Audio() or Option())
- Fixes two typos.
    (new XSLTConstructor()).toString() [object XSLTProcessorConsructor] -> [object XSLTProcessorConstructor])
    (new EventSource()).toString() [object EventSourceContructor] -> [object EventSourceConstructor])

* Android.jscbindings.mk:
* CMakeLists.txt:
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSArrayBufferConstructor.cpp: Removed.
* bindings/js/JSArrayBufferConstructor.h: Removed.
* bindings/js/JSArrayBufferCustom.cpp: Copied from WebCore/bindings/js/JSArrayBufferConstructor.cpp.
(WebCore::JSArrayBufferConstructor::constructJSArrayBuffer):
* bindings/js/JSArrayBufferViewHelper.h:
(WebCore::constructArrayBufferView):
* bindings/js/JSBindingsAllInOne.cpp:
* bindings/js/JSDOMWindowCustom.cpp:
* bindings/js/JSEventSourceConstructor.cpp: Removed.
* bindings/js/JSEventSourceConstructor.h: Removed.
* bindings/js/JSEventSourceCustom.cpp: Copied from WebCore/bindings/js/JSEventSourceConstructor.cpp.
(WebCore::JSEventSourceConstructor::constructJSEventSource):
* bindings/js/JSFloat32ArrayConstructor.cpp: Removed.
* bindings/js/JSFloat32ArrayConstructor.h: Removed.
* bindings/js/JSFloat32ArrayCustom.cpp:
(WebCore::JSFloat32ArrayConstructor::constructJSFloat32Array):
* bindings/js/JSInt16ArrayConstructor.cpp: Removed.
* bindings/js/JSInt16ArrayConstructor.h: Removed.
* bindings/js/JSInt16ArrayCustom.cpp:
(WebCore::JSInt16ArrayConstructor::constructJSInt16Array):
* bindings/js/JSInt32ArrayConstructor.cpp: Removed.
* bindings/js/JSInt32ArrayConstructor.h: Removed.
* bindings/js/JSInt32ArrayCustom.cpp:
(WebCore::JSInt32ArrayConstructor::constructJSInt32Array):
* bindings/js/JSInt8ArrayConstructor.cpp: Removed.
* bindings/js/JSInt8ArrayConstructor.h: Removed.
* bindings/js/JSInt8ArrayCustom.cpp:
(WebCore::JSInt8ArrayConstructor::constructJSInt8Array):
* bindings/js/JSMessageChannelConstructor.cpp: Removed.
* bindings/js/JSMessageChannelConstructor.h: Removed.
* bindings/js/JSMessageChannelCustom.cpp:
(WebCore::JSMessageChannelConstructor::constructJSMessageChannel):
* bindings/js/JSSharedWorkerConstructor.cpp: Removed.
* bindings/js/JSSharedWorkerConstructor.h: Removed.
* bindings/js/JSSharedWorkerCustom.cpp:
(WebCore::JSSharedWorkerConstructor::constructJSSharedWorker):
* bindings/js/JSUint16ArrayConstructor.cpp: Removed.
* bindings/js/JSUint16ArrayConstructor.h: Removed.
* bindings/js/JSUint16ArrayCustom.cpp:
(WebCore::JSUint16ArrayConstructor::constructJSUint16Array):
* bindings/js/JSUint32ArrayConstructor.cpp: Removed.
* bindings/js/JSUint32ArrayConstructor.h: Removed.
* bindings/js/JSUint32ArrayCustom.cpp:
(WebCore::JSUint32ArrayConstructor::constructJSUint32Array):
* bindings/js/JSUint8ArrayConstructor.cpp: Removed.
* bindings/js/JSUint8ArrayConstructor.h: Removed.
* bindings/js/JSUint8ArrayCustom.cpp:
(WebCore::JSUint8ArrayConstructor::constructJSUint8Array):
* bindings/js/JSWebKitCSSMatrixConstructor.cpp: Removed.
* bindings/js/JSWebKitCSSMatrixConstructor.h: Removed.
* bindings/js/JSWebKitCSSMatrixCustom.cpp: Copied from WebCore/bindings/js/JSWebKitCSSMatrixConstructor.cpp.
(WebCore::JSWebKitCSSMatrixConstructor::constructJSWebKitCSSMatrix):
* bindings/js/JSWebKitPointConstructor.cpp: Removed.
* bindings/js/JSWebKitPointConstructor.h: Removed.
* bindings/js/JSWebKitPointCustom.cpp: Copied from WebCore/bindings/js/JSWebKitPointConstructor.cpp.
(WebCore::JSWebKitPointConstructor::constructJSWebKitPoint):
* bindings/js/JSWebSocketConstructor.cpp: Removed.
* bindings/js/JSWebSocketConstructor.h: Removed.
* bindings/js/JSWebSocketCustom.cpp:
(WebCore::JSWebSocketConstructor::constructJSWebSocket):
* bindings/js/JSWorkerConstructor.cpp: Removed.
* bindings/js/JSWorkerConstructor.h: Removed.
* bindings/js/JSWorkerContextCustom.cpp:
* bindings/js/JSWorkerCustom.cpp:
(WebCore::JSWorkerConstructor::constructJSWorker):
* bindings/js/JSXSLTProcessorConstructor.cpp: Removed.
* bindings/js/JSXSLTProcessorConstructor.h: Removed.
* bindings/js/JSXSLTProcessorCustom.cpp:
(WebCore::JSXSLTProcessorConstructor::constructJSXSLTProcessor):
* bindings/scripts/CodeGeneratorJS.pm:
* css/WebKitCSSMatrix.idl:
* dom/MessageChannel.idl:
* html/canvas/ArrayBuffer.idl:
* html/canvas/Float32Array.idl:
* html/canvas/Int16Array.idl:
* html/canvas/Int32Array.idl:
* html/canvas/Int8Array.idl:
* html/canvas/Uint16Array.idl:
* html/canvas/Uint32Array.idl:
* html/canvas/Uint8Array.idl:
* page/EventSource.idl:
* page/WebKitPoint.idl:
* websockets/WebSocket.idl:
* workers/SharedWorker.idl:
* workers/Worker.idl:
* xml/XSLTProcessor.idl:

LayoutTests: 

* fast/dom/Window/window-lookup-precedence-expected.txt:
* fast/dom/Window/window-properties-expected.txt:
* fast/dom/constructed-objects-prototypes-expected.txt:
* fast/dom/prototype-inheritance-2-expected.txt:
* fast/js/global-constructors-expected.txt:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@61136 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6865c34f
2010-06-14 Sam Weinig <sam@webkit.org>
Reviewed by Alexey Proskuryakov.
Fix for https://bugs.webkit.org/show_bug.cgi?id=40581
Auto-generate most of the JS constructors
* fast/dom/Window/window-lookup-precedence-expected.txt:
* fast/dom/Window/window-properties-expected.txt:
* fast/dom/constructed-objects-prototypes-expected.txt:
* fast/dom/prototype-inheritance-2-expected.txt:
* fast/js/global-constructors-expected.txt:
2010-06-14 Antonio Gomes <tonikitoo@webkit.org>
Reviewed by Simon Fraser.
......
......@@ -324,8 +324,8 @@ PASS win['XPathException'] == '[object XPathExceptionConstructor]' is true
PASS win['XPathException'] == '[object XPathExceptionConstructor]' is true
PASS win['XPathResult'] == '[object XPathResultConstructor]' is true
PASS win['XPathResult'] == '[object XPathResultConstructor]' is true
PASS win['XSLTProcessor'] == '[object XSLTProcessorConsructor]' is true
PASS win['XSLTProcessor'] == '[object XSLTProcessorConsructor]' is true
PASS win['XSLTProcessor'] == '[object XSLTProcessorConstructor]' is true
PASS win['XSLTProcessor'] == '[object XSLTProcessorConstructor]' is true
PASS win['onload'] is null
PASS win['onload'] is null
PASS win['frames'] == '[object DOMWindow]' is true
......
......@@ -898,7 +898,10 @@ window.EventException [object EventExceptionConstructor]
window.EventException.UNSPECIFIED_EVENT_TYPE_ERR [number]
window.EventException.prototype [object EventExceptionPrototype]
window.EventException.prototype.UNSPECIFIED_EVENT_TYPE_ERR [number]
window.EventSource [object EventSourceContructor]
window.EventSource [object EventSourceConstructor]
window.EventSource.CLOSED [number]
window.EventSource.CONNECTING [number]
window.EventSource.OPEN [number]
window.EventSource.prototype [object EventSourcePrototype]
window.EventSource.prototype.CLOSED [number]
window.EventSource.prototype.CONNECTING [number]
......@@ -1908,6 +1911,9 @@ window.WebKitPoint.prototype [object WebKitPointPrototype]
window.WebKitTransitionEvent [object WebKitTransitionEventConstructor]
window.WebKitTransitionEvent.prototype [printed above as window.Event.prototype]
window.WebSocket [object WebSocketConstructor]
window.WebSocket.CLOSED [number]
window.WebSocket.CONNECTING [number]
window.WebSocket.OPEN [number]
window.WebSocket.prototype [object WebSocketPrototype]
window.WebSocket.prototype.CLOSED [number]
window.WebSocket.prototype.CONNECTING [number]
......@@ -1998,7 +2004,7 @@ window.XPathResult.prototype.UNORDERED_NODE_ITERATOR_TYPE [number]
window.XPathResult.prototype.UNORDERED_NODE_SNAPSHOT_TYPE [number]
window.XPathResult.prototype.iterateNext [function]
window.XPathResult.prototype.snapshotItem [function]
window.XSLTProcessor [object XSLTProcessorConsructor]
window.XSLTProcessor [object XSLTProcessorConstructor]
window.XSLTProcessor.prototype [object XSLTProcessorPrototype]
window.XSLTProcessor.prototype.clearParameters [function]
window.XSLTProcessor.prototype.getParameter [function]
......
......@@ -27,6 +27,8 @@ PASS (new inner.XMLSerializer()).isInner is true
PASS (new inner.XMLSerializer()).constructor.isInner is true
PASS (new inner.XPathEvaluator()).isInner is true
PASS (new inner.XPathEvaluator()).constructor.isInner is true
PASS (new inner.XSLTProcessor()).isInner is true
PASS (new inner.XSLTProcessor()).constructor.isInner is true
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -78,7 +78,6 @@ PASS DOMWindow from inner
PASS DOMWindowPrototype from inner.document.forms.testForm.0.ownerDocument.defaultView.__proto__
PASS DocumentPrototype from inner.document.forms.testForm.0.ownerDocument.__proto__.__proto__
PASS ElementPrototype from inner.document.forms.testForm.0.__proto__.__proto__.__proto__
PASS EventSourceContructor from inner.document.forms.testForm.0.ownerDocument.defaultView.EventSource
FAIL Function from inner.document.location.pathname.constructor
PASS HTMLAnchorElement from inner.document.forms.testForm.0.parentNode.firstElementChild
PASS HTMLAnchorElementConstructor from inner.document.forms.testForm.0.parentNode.firstElementChild.constructor
......@@ -208,7 +207,6 @@ PASS WebKitCSSKeyframeRulePrototype from inner.document.getElementById("dummySty
PASS WebKitCSSKeyframesRule from inner.document.getElementById("dummyStyle").sheet.cssRules.6
PASS WebKitCSSKeyframesRuleConstructor from inner.document.getElementById("dummyStyle").sheet.cssRules.6.constructor
PASS WebKitCSSKeyframesRulePrototype from inner.document.getElementById("dummyStyle").sheet.cssRules.6.__proto__
PASS XSLTProcessorConsructor from inner.document.forms.testForm.0.ownerDocument.defaultView.XSLTProcessor
Never found Audio
Never found Blob
Never found CDATASection
......@@ -226,6 +224,7 @@ Never found DocumentType
Never found Element
Never found Entity
Never found EntityReference
Never found EventSource
Never found File
Never found FileList
Never found FormData
......@@ -426,6 +425,7 @@ Never found XMLHttpRequestUpload
Never found XMLSerializer
Never found XPathEvaluator
Never found XPathResult
Never found XSLTProcessor
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -44,6 +44,7 @@ PASS Entity.toString() is '[object EntityConstructor]'
PASS EntityReference.toString() is '[object EntityReferenceConstructor]'
PASS Event.toString() is '[object EventConstructor]'
PASS EventException.toString() is '[object EventExceptionConstructor]'
PASS EventSource.toString() is '[object EventSourceConstructor]'
PASS File.toString() is '[object FileConstructor]'
PASS FileList.toString() is '[object FileListConstructor]'
PASS FormData.toString() is '[object FormDataConstructor]'
......@@ -300,6 +301,7 @@ PASS XMLSerializer.toString() is '[object XMLSerializerConstructor]'
PASS XPathEvaluator.toString() is '[object XPathEvaluatorConstructor]'
PASS XPathException.toString() is '[object XPathExceptionConstructor]'
PASS XPathResult.toString() is '[object XPathResultConstructor]'
PASS XSLTProcessor.toString() is '[object XSLTProcessorConstructor]'
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -121,7 +121,6 @@ LOCAL_SRC_FILES += \
bindings/js/JSLazyEventListener.cpp \
bindings/js/JSLocationCustom.cpp \
bindings/js/JSMainThreadExecState.cpp \
bindings/js/JSMessageChannelConstructor.cpp \
bindings/js/JSMessageChannelCustom.cpp \
bindings/js/JSMessageEventCustom.cpp \
bindings/js/JSMessagePortCustom.cpp \
......@@ -144,23 +143,20 @@ LOCAL_SRC_FILES += \
bindings/js/JSSVGMatrixCustom.cpp \
bindings/js/JSSVGPathSegCustom.cpp \
bindings/js/JSSVGPathSegListCustom.cpp \
bindings/js/JSSharedWorkerConstructor.cpp \
bindings/js/JSSharedWorkerCustom.cpp \
bindings/js/JSStorageCustom.cpp \
bindings/js/JSStyleSheetCustom.cpp \
bindings/js/JSStyleSheetListCustom.cpp \
bindings/js/JSTextCustom.cpp \
bindings/js/JSTreeWalkerCustom.cpp \
bindings/js/JSWebKitCSSMatrixConstructor.cpp \
bindings/js/JSWebKitPointConstructor.cpp \
bindings/js/JSWorkerConstructor.cpp \
bindings/js/JSWebKitCSSMatrixCustom.cpp \
bindings/js/JSWebKitPointCustom.cpp \
bindings/js/JSWorkerContextBase.cpp \
bindings/js/JSWorkerContextCustom.cpp \
bindings/js/JSWorkerContextErrorHandler.cpp \
bindings/js/JSWorkerCustom.cpp \
bindings/js/JSXMLHttpRequestCustom.cpp \
bindings/js/JSXMLHttpRequestUploadCustom.cpp \
bindings/js/JSXSLTProcessorConstructor.cpp \
bindings/js/JSXSLTProcessorCustom.cpp \
bindings/js/ScheduledAction.cpp \
bindings/js/ScriptArray.cpp \
......
......@@ -583,7 +583,7 @@ SET(WebCore_SOURCES
bindings/js/JSElementCustom.cpp
bindings/js/JSEventCustom.cpp
bindings/js/JSEventListener.cpp
bindings/js/JSEventSourceConstructor.cpp
bindings/js/JSEventSourceCustom.cpp
bindings/js/JSEventTarget.cpp
bindings/js/JSExceptionBase.cpp
bindings/js/JSGeolocationCustom.cpp
......@@ -612,7 +612,6 @@ SET(WebCore_SOURCES
bindings/js/JSLazyEventListener.cpp
bindings/js/JSLocationCustom.cpp
bindings/js/JSMainThreadExecState.cpp
bindings/js/JSMessageChannelConstructor.cpp
bindings/js/JSMessageChannelCustom.cpp
bindings/js/JSMessageEventCustom.cpp
bindings/js/JSMessagePortCustom.cpp
......@@ -630,7 +629,6 @@ SET(WebCore_SOURCES
bindings/js/JSPluginElementFunctions.cpp
bindings/js/JSPopStateEventCustom.cpp
bindings/js/JSScriptProfileNodeCustom.cpp
bindings/js/JSSharedWorkerConstructor.cpp
bindings/js/JSSharedWorkerCustom.cpp
bindings/js/JSSQLResultSetRowListCustom.cpp
bindings/js/JSSQLTransactionCustom.cpp
......@@ -640,16 +638,14 @@ SET(WebCore_SOURCES
bindings/js/JSStyleSheetListCustom.cpp
bindings/js/JSTextCustom.cpp
bindings/js/JSTreeWalkerCustom.cpp
bindings/js/JSWebKitCSSMatrixConstructor.cpp
bindings/js/JSWebKitPointConstructor.cpp
bindings/js/JSWorkerConstructor.cpp
bindings/js/JSWebKitCSSMatrixCustom.cpp
bindings/js/JSWebKitPointCustom.cpp
bindings/js/JSWorkerContextBase.cpp
bindings/js/JSWorkerContextCustom.cpp
bindings/js/JSWorkerContextErrorHandler.cpp
bindings/js/JSWorkerCustom.cpp
bindings/js/JSXMLHttpRequestCustom.cpp
bindings/js/JSXMLHttpRequestUploadCustom.cpp
bindings/js/JSXSLTProcessorConstructor.cpp
bindings/js/JSXSLTProcessorCustom.cpp
bindings/js/ScheduledAction.cpp
bindings/js/ScriptArray.cpp
......
2010-06-14 Sam Weinig <sam@webkit.org>
Reviewed by Alexey Proskuryakov.
Fix for https://bugs.webkit.org/show_bug.cgi?id=40581
Auto-generate most of the JS constructors
- Auto-generates all the JS constructors that don't have custom
names (eg, Not Image(), Audio() or Option())
- Fixes two typos.
(new XSLTConstructor()).toString() [object XSLTProcessorConsructor] -> [object XSLTProcessorConstructor])
(new EventSource()).toString() [object EventSourceContructor] -> [object EventSourceConstructor])
* Android.jscbindings.mk:
* CMakeLists.txt:
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSArrayBufferConstructor.cpp: Removed.
* bindings/js/JSArrayBufferConstructor.h: Removed.
* bindings/js/JSArrayBufferCustom.cpp: Copied from WebCore/bindings/js/JSArrayBufferConstructor.cpp.
(WebCore::JSArrayBufferConstructor::constructJSArrayBuffer):
* bindings/js/JSArrayBufferViewHelper.h:
(WebCore::constructArrayBufferView):
* bindings/js/JSBindingsAllInOne.cpp:
* bindings/js/JSDOMWindowCustom.cpp:
* bindings/js/JSEventSourceConstructor.cpp: Removed.
* bindings/js/JSEventSourceConstructor.h: Removed.
* bindings/js/JSEventSourceCustom.cpp: Copied from WebCore/bindings/js/JSEventSourceConstructor.cpp.
(WebCore::JSEventSourceConstructor::constructJSEventSource):
* bindings/js/JSFloat32ArrayConstructor.cpp: Removed.
* bindings/js/JSFloat32ArrayConstructor.h: Removed.
* bindings/js/JSFloat32ArrayCustom.cpp:
(WebCore::JSFloat32ArrayConstructor::constructJSFloat32Array):
* bindings/js/JSInt16ArrayConstructor.cpp: Removed.
* bindings/js/JSInt16ArrayConstructor.h: Removed.
* bindings/js/JSInt16ArrayCustom.cpp:
(WebCore::JSInt16ArrayConstructor::constructJSInt16Array):
* bindings/js/JSInt32ArrayConstructor.cpp: Removed.
* bindings/js/JSInt32ArrayConstructor.h: Removed.
* bindings/js/JSInt32ArrayCustom.cpp:
(WebCore::JSInt32ArrayConstructor::constructJSInt32Array):
* bindings/js/JSInt8ArrayConstructor.cpp: Removed.
* bindings/js/JSInt8ArrayConstructor.h: Removed.
* bindings/js/JSInt8ArrayCustom.cpp:
(WebCore::JSInt8ArrayConstructor::constructJSInt8Array):
* bindings/js/JSMessageChannelConstructor.cpp: Removed.
* bindings/js/JSMessageChannelConstructor.h: Removed.
* bindings/js/JSMessageChannelCustom.cpp:
(WebCore::JSMessageChannelConstructor::constructJSMessageChannel):
* bindings/js/JSSharedWorkerConstructor.cpp: Removed.
* bindings/js/JSSharedWorkerConstructor.h: Removed.
* bindings/js/JSSharedWorkerCustom.cpp:
(WebCore::JSSharedWorkerConstructor::constructJSSharedWorker):
* bindings/js/JSUint16ArrayConstructor.cpp: Removed.
* bindings/js/JSUint16ArrayConstructor.h: Removed.
* bindings/js/JSUint16ArrayCustom.cpp:
(WebCore::JSUint16ArrayConstructor::constructJSUint16Array):
* bindings/js/JSUint32ArrayConstructor.cpp: Removed.
* bindings/js/JSUint32ArrayConstructor.h: Removed.
* bindings/js/JSUint32ArrayCustom.cpp:
(WebCore::JSUint32ArrayConstructor::constructJSUint32Array):
* bindings/js/JSUint8ArrayConstructor.cpp: Removed.
* bindings/js/JSUint8ArrayConstructor.h: Removed.
* bindings/js/JSUint8ArrayCustom.cpp:
(WebCore::JSUint8ArrayConstructor::constructJSUint8Array):
* bindings/js/JSWebKitCSSMatrixConstructor.cpp: Removed.
* bindings/js/JSWebKitCSSMatrixConstructor.h: Removed.
* bindings/js/JSWebKitCSSMatrixCustom.cpp: Copied from WebCore/bindings/js/JSWebKitCSSMatrixConstructor.cpp.
(WebCore::JSWebKitCSSMatrixConstructor::constructJSWebKitCSSMatrix):
* bindings/js/JSWebKitPointConstructor.cpp: Removed.
* bindings/js/JSWebKitPointConstructor.h: Removed.
* bindings/js/JSWebKitPointCustom.cpp: Copied from WebCore/bindings/js/JSWebKitPointConstructor.cpp.
(WebCore::JSWebKitPointConstructor::constructJSWebKitPoint):
* bindings/js/JSWebSocketConstructor.cpp: Removed.
* bindings/js/JSWebSocketConstructor.h: Removed.
* bindings/js/JSWebSocketCustom.cpp:
(WebCore::JSWebSocketConstructor::constructJSWebSocket):
* bindings/js/JSWorkerConstructor.cpp: Removed.
* bindings/js/JSWorkerConstructor.h: Removed.
* bindings/js/JSWorkerContextCustom.cpp:
* bindings/js/JSWorkerCustom.cpp:
(WebCore::JSWorkerConstructor::constructJSWorker):
* bindings/js/JSXSLTProcessorConstructor.cpp: Removed.
* bindings/js/JSXSLTProcessorConstructor.h: Removed.
* bindings/js/JSXSLTProcessorCustom.cpp:
(WebCore::JSXSLTProcessorConstructor::constructJSXSLTProcessor):
* bindings/scripts/CodeGeneratorJS.pm:
* css/WebKitCSSMatrix.idl:
* dom/MessageChannel.idl:
* html/canvas/ArrayBuffer.idl:
* html/canvas/Float32Array.idl:
* html/canvas/Int16Array.idl:
* html/canvas/Int32Array.idl:
* html/canvas/Int8Array.idl:
* html/canvas/Uint16Array.idl:
* html/canvas/Uint32Array.idl:
* html/canvas/Uint8Array.idl:
* page/EventSource.idl:
* page/WebKitPoint.idl:
* websockets/WebSocket.idl:
* workers/SharedWorker.idl:
* workers/Worker.idl:
* xml/XSLTProcessor.idl:
2010-05-16 Antonio Gomes <tonikitoo@webkit.org>
Unreviewed naming fixes of local variables used in Spatial Navigation methods.
......
......@@ -435,8 +435,7 @@ webcore_sources += \
WebCore/bindings/js/JSEventCustom.cpp \
WebCore/bindings/js/JSEventListener.cpp \
WebCore/bindings/js/JSEventListener.h \
WebCore/bindings/js/JSEventSourceConstructor.cpp \
WebCore/bindings/js/JSEventSourceConstructor.h \
WebCore/bindings/js/JSEventSourceCustom.cpp \
WebCore/bindings/js/JSEventTarget.cpp \
WebCore/bindings/js/JSEventTarget.h \
WebCore/bindings/js/JSExceptionBase.cpp \
......@@ -477,8 +476,6 @@ webcore_sources += \
WebCore/bindings/js/JSLocationCustom.h \
WebCore/bindings/js/JSMainThreadExecState.cpp \
WebCore/bindings/js/JSMainThreadExecState.h \
WebCore/bindings/js/JSMessageChannelConstructor.cpp \
WebCore/bindings/js/JSMessageChannelConstructor.h \
WebCore/bindings/js/JSMessageChannelCustom.cpp \
WebCore/bindings/js/JSMessageEventCustom.cpp \
WebCore/bindings/js/JSMessagePortCustom.cpp \
......@@ -506,16 +503,12 @@ webcore_sources += \
WebCore/bindings/js/JSStyleSheetListCustom.cpp \
WebCore/bindings/js/JSTextCustom.cpp \
WebCore/bindings/js/JSTreeWalkerCustom.cpp \
WebCore/bindings/js/JSWebKitCSSMatrixConstructor.cpp \
WebCore/bindings/js/JSWebKitCSSMatrixConstructor.h \
WebCore/bindings/js/JSWebKitPointConstructor.cpp \
WebCore/bindings/js/JSWebKitPointConstructor.h \
WebCore/bindings/js/JSWebKitCSSMatrixCustom.cpp \
WebCore/bindings/js/JSWebKitPointCustom.cpp \
WebCore/bindings/js/JSWorkerContextErrorHandler.cpp \
WebCore/bindings/js/JSWorkerContextErrorHandler.h \
WebCore/bindings/js/JSXMLHttpRequestCustom.cpp \
WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp \
WebCore/bindings/js/JSXSLTProcessorConstructor.cpp \
WebCore/bindings/js/JSXSLTProcessorConstructor.h \
WebCore/bindings/js/JSXSLTProcessorCustom.cpp \
WebCore/bindings/js/JavaScriptCallFrame.cpp \
WebCore/bindings/js/JavaScriptCallFrame.h \
......@@ -2834,8 +2827,6 @@ webcore_cppflags += \
webcore_sources += \
WebCore/bindings/js/JSDedicatedWorkerContextCustom.cpp \
WebCore/bindings/js/JSWorkerConstructor.cpp \
WebCore/bindings/js/JSWorkerConstructor.h \
WebCore/bindings/js/JSWorkerContextBase.cpp \
WebCore/bindings/js/JSWorkerContextBase.h \
WebCore/bindings/js/JSWorkerContextCustom.cpp \
......@@ -2881,8 +2872,6 @@ webcore_cppflags += \
-DENABLE_SHARED_WORKERS=1
webcore_sources += \
WebCore/bindings/js/JSSharedWorkerConstructor.cpp \
WebCore/bindings/js/JSSharedWorkerConstructor.h \
WebCore/bindings/js/JSSharedWorkerCustom.cpp \
WebCore/workers/DefaultSharedWorkerRepository.cpp \
WebCore/workers/DefaultSharedWorkerRepository.h \
......@@ -3733,8 +3722,6 @@ webcore_cppflags += \
-DENABLE_WEB_SOCKETS=1
webcore_sources += \
WebCore/bindings/js/JSWebSocketConstructor.cpp \
WebCore/bindings/js/JSWebSocketConstructor.h \
WebCore/bindings/js/JSWebSocketCustom.cpp \
WebCore/platform/network/SocketStreamErrorBase.cpp \
WebCore/platform/network/SocketStreamErrorBase.h \
......
......@@ -549,6 +549,7 @@
'bindings/js/JSEventCustom.cpp',
'bindings/js/JSEventListener.cpp',
'bindings/js/JSEventListener.h',
'bindings/js/JSEventSourceCustom.cpp',
'bindings/js/JSEventTarget.cpp',
'bindings/js/JSEventTarget.h',
'bindings/js/JSExceptionBase.cpp',
......@@ -589,8 +590,6 @@
'bindings/js/JSLocationCustom.h',
'bindings/js/JSMainThreadExecState.cpp',
'bindings/js/JSMainThreadExecState.h',
'bindings/js/JSMessageChannelConstructor.cpp',
'bindings/js/JSMessageChannelConstructor.h',
'bindings/js/JSMessageChannelCustom.cpp',
'bindings/js/JSMessageEventCustom.cpp',
'bindings/js/JSMessagePortCustom.cpp',
......@@ -615,8 +614,6 @@
'bindings/js/JSPluginElementFunctions.h',
'bindings/js/JSRGBColor.cpp',
'bindings/js/JSRGBColor.h',
'bindings/js/JSSharedWorkerConstructor.cpp',
'bindings/js/JSSharedWorkerConstructor.h',
'bindings/js/JSSharedWorkerCustom.cpp',
'bindings/js/JSScriptProfileNodeCustom.cpp',
'bindings/js/JSSQLResultSetRowListCustom.cpp',
......@@ -636,15 +633,9 @@
'bindings/js/JSSVGPODTypeWrapper.h',
'bindings/js/JSTextCustom.cpp',
'bindings/js/JSTreeWalkerCustom.cpp',
'bindings/js/JSWebKitCSSMatrixConstructor.cpp',
'bindings/js/JSWebKitCSSMatrixConstructor.h',
'bindings/js/JSWebKitPointConstructor.cpp',
'bindings/js/JSWebKitPointConstructor.h',
'bindings/js/JSWebSocketConstructor.cpp',
'bindings/js/JSWebSocketConsuructor.h',
'bindings/js/JSWebKitCSSMatrixCustom.cpp',
'bindings/js/JSWebKitPointCustom.cpp',
'bindings/js/JSWebSocketCustom.cpp',
'bindings/js/JSWorkerConstructor.cpp',
'bindings/js/JSWorkerConstructor.h',
'bindings/js/JSWorkerContextBase.cpp',
'bindings/js/JSWorkerContextBase.h',
'bindings/js/JSWorkerContextCustom.cpp',
......@@ -653,8 +644,6 @@
'bindings/js/JSWorkerCustom.cpp',
'bindings/js/JSXMLHttpRequestCustom.cpp',
'bindings/js/JSXMLHttpRequestUploadCustom.cpp',
'bindings/js/JSXSLTProcessorConstructor.cpp',
'bindings/js/JSXSLTProcessorConstructor.h',
'bindings/js/JSXSLTProcessorCustom.cpp',
'bindings/js/JavaScriptCallFrame.cpp',
'bindings/js/JavaScriptCallFrame.h',
......
......@@ -298,7 +298,7 @@ SOURCES += \
bindings/js/JSDOMWrapper.cpp \
bindings/js/JSElementCustom.cpp \
bindings/js/JSEventCustom.cpp \
bindings/js/JSEventSourceConstructor.cpp \
bindings/js/JSEventSourceCustom.cpp \
bindings/js/JSEventTarget.cpp \
bindings/js/JSExceptionBase.cpp \
bindings/js/JSGeolocationCustom.cpp \
......@@ -337,13 +337,12 @@ SOURCES += \
bindings/js/JSStyleSheetListCustom.cpp \
bindings/js/JSTextCustom.cpp \
bindings/js/JSTreeWalkerCustom.cpp \
bindings/js/JSWebKitCSSMatrixConstructor.cpp \
bindings/js/JSWebKitPointConstructor.cpp \
bindings/js/JSWebKitCSSMatrixCustom.cpp \
bindings/js/JSWebKitPointCustom.cpp \
bindings/js/JSXMLHttpRequestCustom.cpp \
bindings/js/JSXMLHttpRequestUploadCustom.cpp \
bindings/js/JSPluginCustom.cpp \
bindings/js/JSPluginArrayCustom.cpp \
bindings/js/JSMessageChannelConstructor.cpp \
bindings/js/JSMessageChannelCustom.cpp \
bindings/js/JSMessageEventCustom.cpp \
bindings/js/JSMessagePortCustom.cpp \
......@@ -1059,7 +1058,6 @@ HEADERS += \
bindings/js/JSDOMWindowShell.h \
bindings/js/JSDOMWrapper.h \
bindings/js/JSEventListener.h \
bindings/js/JSEventSourceConstructor.h \
bindings/js/JSEventTarget.h \
bindings/js/JSHistoryCustom.h \
bindings/js/JSHTMLAppletElementCustom.h \
......@@ -1070,19 +1068,13 @@ HEADERS += \
bindings/js/JSImageConstructor.h \
bindings/js/JSLazyEventListener.h \
bindings/js/JSLocationCustom.h \
bindings/js/JSMessageChannelConstructor.h \
bindings/js/JSNodeCustom.h \
bindings/js/JSNodeFilterCondition.h \
bindings/js/JSOptionConstructor.h \
bindings/js/JSPluginElementFunctions.h \
bindings/js/JSSharedWorkerConstructor.h \
bindings/js/JSStorageCustom.h \
bindings/js/JSWebKitCSSMatrixConstructor.h \
bindings/js/JSWebKitPointConstructor.h \
bindings/js/JSWorkerConstructor.h \
bindings/js/JSWorkerContextBase.h \
bindings/js/JSWorkerContextErrorHandler.h \
bindings/js/JSXSLTProcessorConstructor.h \
bindings/js/JavaScriptCallFrame.h \
bindings/js/ScheduledAction.h \
bindings/js/ScriptArray.h \
......@@ -2451,7 +2443,6 @@ contains(DEFINES, ENABLE_ICONDATABASE=1) {
contains(DEFINES, ENABLE_WORKERS=1) {
SOURCES += \
bindings/js/JSDedicatedWorkerContextCustom.cpp \
bindings/js/JSWorkerConstructor.cpp \
bindings/js/JSWorkerContextBase.cpp \
bindings/js/JSWorkerContextCustom.cpp \
bindings/js/JSWorkerCustom.cpp \
......@@ -2472,7 +2463,6 @@ contains(DEFINES, ENABLE_WORKERS=1) {
contains(DEFINES, ENABLE_SHARED_WORKERS=1) {
SOURCES += \
bindings/js/JSSharedWorkerConstructor.cpp \
bindings/js/JSSharedWorkerCustom.cpp \
workers/DefaultSharedWorkerRepository.cpp \
workers/SharedWorker.cpp \
......@@ -2546,7 +2536,6 @@ contains(DEFINES, ENABLE_XSLT=1) {
tobe|!tobe: QT += xmlpatterns
SOURCES += \
bindings/js/JSXSLTProcessorConstructor.cpp \
bindings/js/JSXSLTProcessorCustom.cpp \
dom/TransformSourceQt.cpp \
xml/XSLStyleSheetQt.cpp \
......@@ -2895,8 +2884,7 @@ contains(DEFINES, ENABLE_WEB_SOCKETS=1) {
platform/network/SocketStreamErrorBase.cpp \
platform/network/SocketStreamHandleBase.cpp \
platform/network/qt/SocketStreamHandleQt.cpp \
bindings/js/JSWebSocketCustom.cpp \
bindings/js/JSWebSocketConstructor.cpp
bindings/js/JSWebSocketCustom.cpp
contains(DEFINES, ENABLE_WORKERS=1) {
HEADERS += \
......@@ -2910,15 +2898,7 @@ contains(DEFINES, ENABLE_WEB_SOCKETS=1) {
contains(DEFINES, ENABLE_3D_CANVAS=1) {
tobe|!tobe: QT += opengl
HEADERS += \
bindings/js/JSArrayBufferConstructor.h \
bindings/js/JSArrayBufferViewHelper.h \
bindings/js/JSInt8ArrayConstructor.h \
bindings/js/JSFloat32ArrayConstructor.h \
bindings/js/JSInt32ArrayConstructor.h \
bindings/js/JSInt16ArrayConstructor.h \
bindings/js/JSUint8ArrayConstructor.h \
bindings/js/JSUint32ArrayConstructor.h \
bindings/js/JSUint16ArrayConstructor.h \
html/canvas/CanvasContextAttributes.h \
html/canvas/CanvasObject.h \
html/canvas/WebGLActiveInfo.h \
......@@ -2944,22 +2924,14 @@ HEADERS += \
platform/graphics/GraphicsContext3D.h
SOURCES += \
bindings/js/JSArrayBufferConstructor.cpp \
bindings/js/JSArrayBufferViewCustom.cpp \
bindings/js/JSInt8ArrayConstructor.cpp \
bindings/js/JSInt8ArrayCustom.cpp \
bindings/js/JSFloat32ArrayConstructor.cpp \
bindings/js/JSFloat32ArrayCustom.cpp \
bindings/js/JSInt32ArrayConstructor.cpp \
bindings/js/JSInt32ArrayCustom.cpp \
bindings/js/JSWebGLRenderingContextCustom.cpp \
bindings/js/JSInt16ArrayConstructor.cpp \
bindings/js/JSInt16ArrayCustom.cpp \
bindings/js/JSUint8ArrayConstructor.cpp \
bindings/js/JSUint8ArrayCustom.cpp \
bindings/js/JSUint32ArrayConstructor.cpp \
bindings/js/JSUint32ArrayCustom.cpp \
bindings/js/JSUint16ArrayConstructor.cpp \
bindings/js/JSUint16ArrayCustom.cpp \
html/canvas/CanvasContextAttributes.cpp \
html/canvas/CanvasObject.cpp \
......
This diff is collapsed.
This diff is collapsed.
/*
* Copyright (C) 2009 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef JSArrayBufferConstructor_h
#define JSArrayBufferConstructor_h
#include "JSDOMBinding.h"
#include "JSDocument.h"
#include "JSArrayBuffer.h"
#include <runtime/Error.h>
#include "ArrayBuffer.h"
namespace WebCore {
class ArrayBufferView;
// Template function used by CanvasXXXArrayConstructors
template<class C, typename T>
PassRefPtr<ArrayBufferView> construct(JSC::ExecState* exec, const JSC::ArgList& args)
{
// There are 3 constructors:
//
// 1) (in int size)
// 2) (in ArrayBuffer buffer, [Optional] in int offset, [Optional] in unsigned int length)
// 3) (in sequence<T>) - This ends up being a JS "array-like" object
//
RefPtr<C> arrayObject;
// For the 0 args case, just create an object without a buffer
if (args.size() < 1)
return C::create(0, 0, 0);
if (args.size() > 1 && !args.at(0).isObject())
// Invalid first argument
return 0;
if (args.at(0).isObject()) {
RefPtr<ArrayBuffer> buffer = toArrayBuffer(args.at(0));
if (buffer) {
unsigned offset = (args.size() > 1) ? args.at(1).toUInt32(exec) : 0;
unsigned int length = (buffer->byteLength() - offset) / sizeof(T);
if (args.size() > 2)
length = args.at(2).toUInt32(exec);
return C::create(buffer, offset, length);
}
JSC::JSObject* array = asObject(args.at(0));
unsigned length = array->get(exec, JSC::Identifier(exec, "length")).toUInt32(exec);
void* tempValues;
if (!tryFastCalloc(length, sizeof(T)).getValue(tempValues)) {
throwError(exec, createError(exec, "Error"));
return 0;
}
OwnFastMallocPtr<T> values(static_cast<T*>(tempValues));
for (unsigned i = 0; i < length; ++i) {
JSC::JSValue v = array->get(exec, i);
if (exec->hadException())
return 0;