summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings/v8
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/bindings/v8')
-rw-r--r--WebCore/bindings/v8/ChildThreadDOMData.cpp48
-rw-r--r--WebCore/bindings/v8/ChildThreadDOMData.h50
-rw-r--r--WebCore/bindings/v8/DOMData.cpp64
-rw-r--r--WebCore/bindings/v8/DOMData.h114
-rw-r--r--WebCore/bindings/v8/DOMDataStore.cpp199
-rw-r--r--WebCore/bindings/v8/DOMDataStore.h279
-rw-r--r--WebCore/bindings/v8/DOMWrapperWorld.cpp51
-rw-r--r--WebCore/bindings/v8/DOMWrapperWorld.h56
-rw-r--r--WebCore/bindings/v8/DateExtension.cpp123
-rw-r--r--WebCore/bindings/v8/DateExtension.h55
-rw-r--r--WebCore/bindings/v8/DebuggerScript.js275
-rw-r--r--WebCore/bindings/v8/IDBBindingUtilities.cpp106
-rw-r--r--WebCore/bindings/v8/IDBBindingUtilities.h47
-rw-r--r--WebCore/bindings/v8/IsolatedWorld.cpp48
-rw-r--r--WebCore/bindings/v8/IsolatedWorld.h62
-rw-r--r--WebCore/bindings/v8/JavaScriptCallFrame.cpp120
-rw-r--r--WebCore/bindings/v8/JavaScriptCallFrame.h74
-rw-r--r--WebCore/bindings/v8/MainThreadDOMData.cpp68
-rw-r--r--WebCore/bindings/v8/MainThreadDOMData.h57
-rw-r--r--WebCore/bindings/v8/NPV8Object.cpp555
-rw-r--r--WebCore/bindings/v8/NPV8Object.h79
-rw-r--r--WebCore/bindings/v8/OptionsObject.cpp156
-rw-r--r--WebCore/bindings/v8/OptionsObject.h65
-rw-r--r--WebCore/bindings/v8/OwnHandle.h80
-rw-r--r--WebCore/bindings/v8/ScheduledAction.cpp146
-rw-r--r--WebCore/bindings/v8/ScheduledAction.h76
-rw-r--r--WebCore/bindings/v8/ScopedDOMDataStore.cpp57
-rw-r--r--WebCore/bindings/v8/ScopedDOMDataStore.h56
-rw-r--r--WebCore/bindings/v8/ScriptCachedFrameData.cpp74
-rw-r--r--WebCore/bindings/v8/ScriptCachedFrameData.h91
-rw-r--r--WebCore/bindings/v8/ScriptCallStackFactory.cpp117
-rw-r--r--WebCore/bindings/v8/ScriptCallStackFactory.h55
-rw-r--r--WebCore/bindings/v8/ScriptController.cpp501
-rw-r--r--WebCore/bindings/v8/ScriptController.h228
-rw-r--r--WebCore/bindings/v8/ScriptControllerQt.cpp49
-rw-r--r--WebCore/bindings/v8/ScriptDebugServer.cpp472
-rw-r--r--WebCore/bindings/v8/ScriptDebugServer.h145
-rw-r--r--WebCore/bindings/v8/ScriptEventListener.cpp136
-rw-r--r--WebCore/bindings/v8/ScriptEventListener.h53
-rw-r--r--WebCore/bindings/v8/ScriptFunctionCall.cpp211
-rw-r--r--WebCore/bindings/v8/ScriptFunctionCall.h88
-rw-r--r--WebCore/bindings/v8/ScriptGCEvent.cpp101
-rw-r--r--WebCore/bindings/v8/ScriptGCEvent.h63
-rw-r--r--WebCore/bindings/v8/ScriptHeapSnapshot.cpp79
-rw-r--r--WebCore/bindings/v8/ScriptHeapSnapshot.h73
-rw-r--r--WebCore/bindings/v8/ScriptInstance.cpp83
-rw-r--r--WebCore/bindings/v8/ScriptInstance.h64
-rw-r--r--WebCore/bindings/v8/ScriptObject.cpp103
-rw-r--r--WebCore/bindings/v8/ScriptObject.h68
-rw-r--r--WebCore/bindings/v8/ScriptProfile.cpp86
-rw-r--r--WebCore/bindings/v8/ScriptProfile.h69
-rw-r--r--WebCore/bindings/v8/ScriptProfileNode.cpp90
-rw-r--r--WebCore/bindings/v8/ScriptProfileNode.h75
-rw-r--r--WebCore/bindings/v8/ScriptProfiler.cpp68
-rw-r--r--WebCore/bindings/v8/ScriptProfiler.h55
-rw-r--r--WebCore/bindings/v8/ScriptScope.cpp57
-rw-r--r--WebCore/bindings/v8/ScriptScope.h56
-rw-r--r--WebCore/bindings/v8/ScriptSourceCode.h79
-rw-r--r--WebCore/bindings/v8/ScriptState.cpp114
-rw-r--r--WebCore/bindings/v8/ScriptState.h114
-rw-r--r--WebCore/bindings/v8/ScriptValue.cpp132
-rw-r--r--WebCore/bindings/v8/ScriptValue.h168
-rw-r--r--WebCore/bindings/v8/ScriptWrappable.h61
-rw-r--r--WebCore/bindings/v8/SerializedScriptValue.cpp1184
-rw-r--r--WebCore/bindings/v8/SerializedScriptValue.h81
-rw-r--r--WebCore/bindings/v8/SharedPersistent.h77
-rw-r--r--WebCore/bindings/v8/StaticDOMDataStore.cpp53
-rw-r--r--WebCore/bindings/v8/StaticDOMDataStore.h62
-rw-r--r--WebCore/bindings/v8/V8AbstractEventListener.cpp195
-rw-r--r--WebCore/bindings/v8/V8AbstractEventListener.h132
-rw-r--r--WebCore/bindings/v8/V8Binding.cpp581
-rw-r--r--WebCore/bindings/v8/V8Binding.h315
-rw-r--r--WebCore/bindings/v8/V8Collection.cpp62
-rw-r--r--WebCore/bindings/v8/V8Collection.h187
-rw-r--r--WebCore/bindings/v8/V8ConsoleMessage.cpp142
-rw-r--r--WebCore/bindings/v8/V8ConsoleMessage.h94
-rw-r--r--WebCore/bindings/v8/V8DOMMap.cpp179
-rw-r--r--WebCore/bindings/v8/V8DOMMap.h183
-rw-r--r--WebCore/bindings/v8/V8DOMWindowShell.cpp619
-rw-r--r--WebCore/bindings/v8/V8DOMWindowShell.h126
-rw-r--r--WebCore/bindings/v8/V8DOMWrapper.cpp480
-rw-r--r--WebCore/bindings/v8/V8DOMWrapper.h141
-rw-r--r--WebCore/bindings/v8/V8DataGridDataSource.cpp65
-rw-r--r--WebCore/bindings/v8/V8DataGridDataSource.h81
-rw-r--r--WebCore/bindings/v8/V8EventListenerList.cpp36
-rw-r--r--WebCore/bindings/v8/V8EventListenerList.h105
-rw-r--r--WebCore/bindings/v8/V8GCController.cpp584
-rw-r--r--WebCore/bindings/v8/V8GCController.h91
-rw-r--r--WebCore/bindings/v8/V8GCForContextDispose.cpp72
-rw-r--r--WebCore/bindings/v8/V8GCForContextDispose.h55
-rw-r--r--WebCore/bindings/v8/V8Helpers.cpp53
-rw-r--r--WebCore/bindings/v8/V8Helpers.h46
-rw-r--r--WebCore/bindings/v8/V8HiddenPropertyName.cpp54
-rw-r--r--WebCore/bindings/v8/V8HiddenPropertyName.h61
-rw-r--r--WebCore/bindings/v8/V8IsolatedContext.cpp91
-rw-r--r--WebCore/bindings/v8/V8IsolatedContext.h115
-rw-r--r--WebCore/bindings/v8/V8LazyEventListener.cpp157
-rw-r--r--WebCore/bindings/v8/V8LazyEventListener.h79
-rw-r--r--WebCore/bindings/v8/V8NPObject.cpp419
-rw-r--r--WebCore/bindings/v8/V8NPObject.h72
-rw-r--r--WebCore/bindings/v8/V8NPUtils.cpp170
-rw-r--r--WebCore/bindings/v8/V8NPUtils.h71
-rw-r--r--WebCore/bindings/v8/V8NodeFilterCondition.cpp98
-rw-r--r--WebCore/bindings/v8/V8NodeFilterCondition.h64
-rw-r--r--WebCore/bindings/v8/V8Proxy.cpp884
-rw-r--r--WebCore/bindings/v8/V8Proxy.h439
-rw-r--r--WebCore/bindings/v8/V8Utilities.cpp135
-rw-r--r--WebCore/bindings/v8/V8Utilities.h111
-rw-r--r--WebCore/bindings/v8/V8WorkerContextErrorHandler.cpp66
-rw-r--r--WebCore/bindings/v8/V8WorkerContextErrorHandler.h59
-rw-r--r--WebCore/bindings/v8/V8WorkerContextEventListener.cpp117
-rw-r--r--WebCore/bindings/v8/V8WorkerContextEventListener.h66
-rw-r--r--WebCore/bindings/v8/WorkerContextExecutionProxy.cpp261
-rw-r--r--WebCore/bindings/v8/WorkerContextExecutionProxy.h98
-rw-r--r--WebCore/bindings/v8/WorkerScriptController.cpp120
-rw-r--r--WebCore/bindings/v8/WorkerScriptController.h78
-rw-r--r--WebCore/bindings/v8/WorldContextHandle.cpp56
-rw-r--r--WebCore/bindings/v8/WorldContextHandle.h57
-rw-r--r--WebCore/bindings/v8/WrapperTypeInfo.h86
-rw-r--r--WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp81
-rw-r--r--WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h214
-rw-r--r--WebCore/bindings/v8/custom/V8AudioContextCustom.cpp60
-rw-r--r--WebCore/bindings/v8/custom/V8AudioNodeCustom.cpp91
-rw-r--r--WebCore/bindings/v8/custom/V8BindingMacros.h48
-rw-r--r--WebCore/bindings/v8/custom/V8CSSRuleCustom.cpp70
-rw-r--r--WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp220
-rw-r--r--WebCore/bindings/v8/custom/V8CSSStyleSheetCustom.cpp51
-rw-r--r--WebCore/bindings/v8/custom/V8CSSValueCustom.cpp64
-rw-r--r--WebCore/bindings/v8/custom/V8CanvasPixelArrayCustom.cpp50
-rw-r--r--WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp101
-rw-r--r--WebCore/bindings/v8/custom/V8ClipboardCustom.cpp128
-rw-r--r--WebCore/bindings/v8/custom/V8ConsoleCustom.cpp111
-rw-r--r--WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp75
-rw-r--r--WebCore/bindings/v8/custom/V8CustomEventListener.cpp80
-rw-r--r--WebCore/bindings/v8/custom/V8CustomEventListener.h63
-rw-r--r--WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp82
-rw-r--r--WebCore/bindings/v8/custom/V8CustomPositionCallback.h60
-rw-r--r--WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp82
-rw-r--r--WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.h60
-rw-r--r--WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp81
-rw-r--r--WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp91
-rw-r--r--WebCore/bindings/v8/custom/V8CustomVoidCallback.h68
-rw-r--r--WebCore/bindings/v8/custom/V8CustomXPathNSResolver.cpp94
-rw-r--r--WebCore/bindings/v8/custom/V8CustomXPathNSResolver.h66
-rw-r--r--WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp82
-rw-r--r--WebCore/bindings/v8/custom/V8DOMSettableTokenListCustom.cpp42
-rw-r--r--WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp113
-rw-r--r--WebCore/bindings/v8/custom/V8DOMTokenListCustom.cpp56
-rw-r--r--WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp688
-rw-r--r--WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp64
-rwxr-xr-xWebCore/bindings/v8/custom/V8DataViewCustom.cpp124
-rw-r--r--WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp65
-rw-r--r--WebCore/bindings/v8/custom/V8DeviceMotionEventCustom.cpp184
-rw-r--r--WebCore/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp91
-rw-r--r--WebCore/bindings/v8/custom/V8DirectoryEntryCustom.cpp139
-rw-r--r--WebCore/bindings/v8/custom/V8DirectoryEntrySyncCustom.cpp139
-rw-r--r--WebCore/bindings/v8/custom/V8DocumentCustom.cpp166
-rw-r--r--WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp56
-rw-r--r--WebCore/bindings/v8/custom/V8ElementCustom.cpp68
-rw-r--r--WebCore/bindings/v8/custom/V8EntryCustom.cpp61
-rw-r--r--WebCore/bindings/v8/custom/V8EntrySyncCustom.cpp61
-rw-r--r--WebCore/bindings/v8/custom/V8EventCustom.cpp184
-rw-r--r--WebCore/bindings/v8/custom/V8EventSourceConstructor.cpp79
-rwxr-xr-xWebCore/bindings/v8/custom/V8FileReaderCustom.cpp76
-rw-r--r--WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp71
-rw-r--r--WebCore/bindings/v8/custom/V8GeolocationCustom.cpp221
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp142
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp98
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.h48
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp114
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp149
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLDataGridElementCustom.cpp69
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp197
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLElementCustom.cpp45
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp83
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLFrameElementCustom.cpp55
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp63
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp109
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.h48
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp110
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp107
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.h48
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp137
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLOutputElementCustom.cpp55
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp199
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp85
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.h45
-rw-r--r--WebCore/bindings/v8/custom/V8HistoryCustom.cpp106
-rw-r--r--WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp79
-rw-r--r--WebCore/bindings/v8/custom/V8IDBKeyCustom.cpp61
-rw-r--r--WebCore/bindings/v8/custom/V8ImageDataCustom.cpp59
-rw-r--r--WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp268
-rw-r--r--WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp111
-rw-r--r--WebCore/bindings/v8/custom/V8Int16ArrayCustom.cpp71
-rw-r--r--WebCore/bindings/v8/custom/V8Int32ArrayCustom.cpp71
-rw-r--r--WebCore/bindings/v8/custom/V8Int8ArrayCustom.cpp71
-rw-r--r--WebCore/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp79
-rw-r--r--WebCore/bindings/v8/custom/V8LocationCustom.cpp367
-rw-r--r--WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp79
-rw-r--r--WebCore/bindings/v8/custom/V8MessageEventCustom.cpp92
-rw-r--r--WebCore/bindings/v8/custom/V8MessagePortCustom.cpp108
-rw-r--r--WebCore/bindings/v8/custom/V8MessagePortCustom.h48
-rw-r--r--WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp90
-rw-r--r--WebCore/bindings/v8/custom/V8NamedNodesCollection.cpp55
-rw-r--r--WebCore/bindings/v8/custom/V8NamedNodesCollection.h62
-rw-r--r--WebCore/bindings/v8/custom/V8NodeCustom.cpp172
-rw-r--r--WebCore/bindings/v8/custom/V8NodeListCustom.cpp80
-rw-r--r--WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp109
-rw-r--r--WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp52
-rw-r--r--WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp93
-rw-r--r--WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp120
-rw-r--r--WebCore/bindings/v8/custom/V8SQLTransactionSyncCustom.cpp102
-rw-r--r--WebCore/bindings/v8/custom/V8SVGDocumentCustom.cpp57
-rw-r--r--WebCore/bindings/v8/custom/V8SVGElementCustom.cpp49
-rw-r--r--WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp104
-rw-r--r--WebCore/bindings/v8/custom/V8SVGPathSegCustom.cpp110
-rw-r--r--WebCore/bindings/v8/custom/V8ScriptProfileCustom.cpp61
-rw-r--r--WebCore/bindings/v8/custom/V8ScriptProfileNodeCustom.cpp81
-rw-r--r--WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp93
-rwxr-xr-xWebCore/bindings/v8/custom/V8StorageCustom.cpp158
-rw-r--r--WebCore/bindings/v8/custom/V8StyleSheetCustom.cpp54
-rw-r--r--WebCore/bindings/v8/custom/V8StyleSheetListCustom.cpp58
-rw-r--r--WebCore/bindings/v8/custom/V8Uint16ArrayCustom.cpp71
-rw-r--r--WebCore/bindings/v8/custom/V8Uint32ArrayCustom.cpp71
-rw-r--r--WebCore/bindings/v8/custom/V8Uint8ArrayCustom.cpp71
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp768
-rw-r--r--WebCore/bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp70
-rwxr-xr-xWebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp70
-rw-r--r--WebCore/bindings/v8/custom/V8WebSocketCustom.cpp98
-rwxr-xr-xWebCore/bindings/v8/custom/V8WorkerContextCustom.cpp142
-rwxr-xr-xWebCore/bindings/v8/custom/V8WorkerCustom.cpp110
-rw-r--r--WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp64
-rw-r--r--WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp213
-rw-r--r--WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp154
-rw-r--r--WebCore/bindings/v8/npruntime.cpp455
-rw-r--r--WebCore/bindings/v8/npruntime_impl.h74
-rw-r--r--WebCore/bindings/v8/npruntime_internal.h53
-rw-r--r--WebCore/bindings/v8/npruntime_priv.h95
-rw-r--r--WebCore/bindings/v8/specialization/V8BindingDOMWindow.h59
-rw-r--r--WebCore/bindings/v8/specialization/V8BindingState.cpp97
-rw-r--r--WebCore/bindings/v8/specialization/V8BindingState.h72
241 files changed, 0 insertions, 30673 deletions
diff --git a/WebCore/bindings/v8/ChildThreadDOMData.cpp b/WebCore/bindings/v8/ChildThreadDOMData.cpp
deleted file mode 100644
index 77ce0f4..0000000
--- a/WebCore/bindings/v8/ChildThreadDOMData.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "ChildThreadDOMData.h"
-
-namespace WebCore {
-
-ChildThreadDOMData::ChildThreadDOMData()
- : m_defaultStore(this)
-{
-}
-
-DOMDataStore& ChildThreadDOMData::getStore()
-{
- ASSERT(!WTF::isMainThread());
- // Currently, child threads have only one world.
- return m_defaultStore;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/ChildThreadDOMData.h b/WebCore/bindings/v8/ChildThreadDOMData.h
deleted file mode 100644
index 5097c86..0000000
--- a/WebCore/bindings/v8/ChildThreadDOMData.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 ChildThreadDOMData_h
-#define ChildThreadDOMData_h
-
-#include "DOMData.h"
-#include "ScopedDOMDataStore.h"
-
-namespace WebCore {
-
- class ChildThreadDOMData : public DOMData {
- public:
- ChildThreadDOMData();
- DOMDataStore& getStore();
-
- private:
- ScopedDOMDataStore m_defaultStore;
- };
-
-} // namespace WebCore
-
-#endif // ChildThreadDOMData_h
diff --git a/WebCore/bindings/v8/DOMData.cpp b/WebCore/bindings/v8/DOMData.cpp
deleted file mode 100644
index 568fc2c..0000000
--- a/WebCore/bindings/v8/DOMData.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "DOMData.h"
-
-#include "ChildThreadDOMData.h"
-#include "MainThreadDOMData.h"
-#include "WebGLContextAttributes.h"
-#include "WebGLUniformLocation.h"
-
-namespace WebCore {
-
-DOMData::DOMData()
- : m_owningThread(WTF::currentThread())
-{
-}
-
-DOMData::~DOMData()
-{
-}
-
-DOMData* DOMData::getCurrent()
-{
- if (WTF::isMainThread())
- return MainThreadDOMData::getCurrent();
-
- DEFINE_STATIC_LOCAL(WTF::ThreadSpecific<ChildThreadDOMData>, childThreadDOMData, ());
- return childThreadDOMData;
-}
-
-void DOMData::derefObject(WrapperTypeInfo* type, void* domObject)
-{
- type->derefObject(domObject);
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/DOMData.h b/WebCore/bindings/v8/DOMData.h
deleted file mode 100644
index 78edf92..0000000
--- a/WebCore/bindings/v8/DOMData.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 DOMData_h
-#define DOMData_h
-
-#include "DOMDataStore.h"
-#include "V8DOMWrapper.h"
-
-namespace WebCore {
-
- // DOMData
- //
- // DOMData represents the all the DOM wrappers for a given thread. In
- // particular, DOMData holds wrappers for all the isolated worlds in the
- // thread. The DOMData for the main thread and the DOMData for child threads
- // use different subclasses.
- //
- class DOMData : public Noncopyable {
- public:
- DOMData();
- virtual ~DOMData();
-
- static DOMData* getCurrent();
- virtual DOMDataStore& getStore() = 0;
-
- template<typename T>
- static void handleWeakObject(DOMDataStore::DOMWrapperMapType, v8::Persistent<v8::Object>, T* domObject);
-
- template<typename T>
- static void removeObjectsFromWrapperMap(DOMDataStore* store, AbstractWeakReferenceMap<T, v8::Object>& domMap);
-
- ThreadIdentifier owningThread() const { return m_owningThread; }
-
- private:
- static void derefObject(WrapperTypeInfo* type, void* domObject);
-
- template<typename T>
- class WrapperMapObjectRemover : public WeakReferenceMap<T, v8::Object>::Visitor {
- public:
- virtual void visitDOMWrapper(DOMDataStore* store, T* domObject, v8::Persistent<v8::Object> v8Object)
- {
- WrapperTypeInfo* type = V8DOMWrapper::domWrapperType(v8Object);
- derefObject(type, domObject);
- v8Object.Dispose();
- }
- };
-
- ThreadIdentifier m_owningThread;
- };
-
- template<typename T>
- void DOMData::handleWeakObject(DOMDataStore::DOMWrapperMapType mapType, v8::Persistent<v8::Object> v8Object, T* domObject)
- {
- WrapperTypeInfo* type = V8DOMWrapper::domWrapperType(v8Object);
- DOMDataList& list = DOMDataStore::allStores();
- bool found = false;
- for (size_t i = 0; i < list.size(); ++i) {
- DOMDataStore* store = list[i];
- ASSERT(store->domData()->owningThread() == WTF::currentThread());
-
- DOMWrapperMap<T>* domMap = static_cast<DOMWrapperMap<T>*>(store->getDOMWrapperMap(mapType));
- if (domMap->removeIfPresent(domObject, v8Object)) {
- derefObject(type, domObject);
- found = true;
- }
- }
-
- // If not found, it means map for the wrapper has been already destroyed, just dispose the
- // handle and deref the object to fight memory leak.
- if (!found) {
- v8Object.Dispose();
- derefObject(type, domObject);
- }
- }
-
- template<typename T>
- void DOMData::removeObjectsFromWrapperMap(DOMDataStore* store, AbstractWeakReferenceMap<T, v8::Object>& domMap)
- {
- WrapperMapObjectRemover<T> remover;
- domMap.visit(store, &remover);
- domMap.clear();
- }
-
-} // namespace WebCore
-
-#endif // DOMData_h
diff --git a/WebCore/bindings/v8/DOMDataStore.cpp b/WebCore/bindings/v8/DOMDataStore.cpp
deleted file mode 100644
index 0d37dc0..0000000
--- a/WebCore/bindings/v8/DOMDataStore.cpp
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "DOMDataStore.h"
-
-#include "DOMData.h"
-
-namespace WebCore {
-
-// DOM binding algorithm:
-//
-// There are two kinds of DOM objects:
-// 1. DOM tree nodes, such as Document, HTMLElement, ...
-// there classes implement TreeShared<T> interface;
-// 2. Non-node DOM objects, such as CSSRule, Location, etc.
-// these classes implement a ref-counted scheme.
-//
-// A DOM object may have a JS wrapper object. If a tree node
-// is alive, its JS wrapper must be kept alive even it is not
-// reachable from JS roots.
-// However, JS wrappers of non-node objects can go away if
-// not reachable from other JS objects. It works like a cache.
-//
-// DOM objects are ref-counted, and JS objects are traced from
-// a set of root objects. They can create a cycle. To break
-// cycles, we do following:
-// Handles from DOM objects to JS wrappers are always weak,
-// so JS wrappers of non-node object cannot create a cycle.
-// Before starting a global GC, we create a virtual connection
-// between nodes in the same tree in the JS heap. If the wrapper
-// of one node in a tree is alive, wrappers of all nodes in
-// the same tree are considered alive. This is done by creating
-// object groups in GC prologue callbacks. The mark-compact
-// collector will remove these groups after each GC.
-//
-// DOM objects should be deref-ed from the owning thread, not the GC thread
-// that does not own them. In V8, GC can kick in from any thread. To ensure
-// that DOM objects are always deref-ed from the owning thread when running
-// V8 in multi-threading environment, we do following:
-// 1. Maintain a thread specific DOM wrapper map for each object map.
-// (We're using TLS support from WTF instead of base since V8Bindings
-// does not depend on base. We further assume that all child threads
-// running V8 instances are created by WTF and thus a destructor will
-// be called to clean up all thread specific data.)
-// 2. When GC happens:
-// 2.1. If the dead object is in GC thread's map, remove the JS reference
-// and deref the DOM object.
-// 2.2. Otherwise, go through all thread maps to find the owning thread.
-// Remove the JS reference from the owning thread's map and move the
-// DOM object to a delayed queue. Post a task to the owning thread
-// to have it deref-ed from the owning thread at later time.
-// 3. When a thread is tearing down, invoke a cleanup routine to go through
-// all objects in the delayed queue and the thread map and deref all of
-// them.
-
-
-DOMDataStore::DOMDataStore(DOMData* domData)
- : m_domNodeMap(0)
- , m_domObjectMap(0)
- , m_activeDomObjectMap(0)
-#if ENABLE(SVG)
- , m_domSvgElementInstanceMap(0)
-#endif
- , m_domData(domData)
-{
- WTF::MutexLocker locker(DOMDataStore::allStoresMutex());
- DOMDataStore::allStores().append(this);
-}
-
-DOMDataStore::~DOMDataStore()
-{
- WTF::MutexLocker locker(DOMDataStore::allStoresMutex());
- DOMDataStore::allStores().remove(DOMDataStore::allStores().find(this));
-}
-
-DOMDataList& DOMDataStore::allStores()
-{
- DEFINE_STATIC_LOCAL(DOMDataList, staticDOMDataList, ());
- return staticDOMDataList;
-}
-
-WTF::Mutex& DOMDataStore::allStoresMutex()
-{
- DEFINE_STATIC_LOCAL(WTF::Mutex, staticDOMDataListMutex, ());
- return staticDOMDataListMutex;
-}
-
-void* DOMDataStore::getDOMWrapperMap(DOMWrapperMapType type)
-{
- switch (type) {
- case DOMNodeMap:
- return m_domNodeMap;
- case DOMObjectMap:
- return m_domObjectMap;
- case ActiveDOMObjectMap:
- return m_activeDomObjectMap;
-#if ENABLE(SVG)
- case DOMSVGElementInstanceMap:
- return m_domSvgElementInstanceMap;
-#endif
- }
-
- ASSERT_NOT_REACHED();
- return 0;
-}
-
-// Called when the object is near death (not reachable from JS roots).
-// It is time to remove the entry from the table and dispose the handle.
-void DOMDataStore::weakDOMObjectCallback(v8::Persistent<v8::Value> v8Object, void* domObject)
-{
- v8::HandleScope scope;
- ASSERT(v8Object->IsObject());
- DOMData::handleWeakObject(DOMDataStore::DOMObjectMap, v8::Persistent<v8::Object>::Cast(v8Object), domObject);
-}
-
-void DOMDataStore::weakActiveDOMObjectCallback(v8::Persistent<v8::Value> v8Object, void* domObject)
-{
- v8::HandleScope scope;
- ASSERT(v8Object->IsObject());
- DOMData::handleWeakObject(DOMDataStore::ActiveDOMObjectMap, v8::Persistent<v8::Object>::Cast(v8Object), domObject);
-}
-
-void DOMDataStore::weakNodeCallback(v8::Persistent<v8::Value> v8Object, void* domObject)
-{
- ASSERT(WTF::isMainThread());
-
- Node* node = static_cast<Node*>(domObject);
-
- WTF::MutexLocker locker(DOMDataStore::allStoresMutex());
- DOMDataList& list = DOMDataStore::allStores();
- for (size_t i = 0; i < list.size(); ++i) {
- DOMDataStore* store = list[i];
- if (store->domNodeMap().removeIfPresent(node, v8Object)) {
- ASSERT(store->domData()->owningThread() == WTF::currentThread());
- node->deref(); // Nobody overrides Node::deref so it's safe
- return; // There might be at most one wrapper for the node in world's maps
- }
- }
-
- // If not found, it means map for the wrapper has been already destroyed, just dispose the
- // handle and deref the object to fight memory leak.
- v8Object.Dispose();
- node->deref(); // Nobody overrides Node::deref so it's safe
-}
-
-bool DOMDataStore::IntrusiveDOMWrapperMap::removeIfPresent(Node* obj, v8::Persistent<v8::Data> value)
-{
- ASSERT(obj);
- v8::Persistent<v8::Object>* entry = obj->wrapper();
- if (!entry)
- return false;
- if (*entry != value)
- return false;
- obj->clearWrapper();
- m_table.remove(entry);
- value.Dispose();
- return true;
-}
-
-#if ENABLE(SVG)
-
-void DOMDataStore::weakSVGElementInstanceCallback(v8::Persistent<v8::Value> v8Object, void* domObject)
-{
- v8::HandleScope scope;
- ASSERT(v8Object->IsObject());
- DOMData::handleWeakObject(DOMDataStore::DOMSVGElementInstanceMap, v8::Persistent<v8::Object>::Cast(v8Object), static_cast<SVGElementInstance*>(domObject));
-}
-
-#endif // ENABLE(SVG)
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/DOMDataStore.h b/WebCore/bindings/v8/DOMDataStore.h
deleted file mode 100644
index a1051dd..0000000
--- a/WebCore/bindings/v8/DOMDataStore.h
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 DOMDataStore_h
-#define DOMDataStore_h
-
-#include "V8DOMMap.h"
-#include "V8Node.h"
-
-#include <v8.h>
-#include <wtf/HashMap.h>
-#include <wtf/MainThread.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/StdLibExtras.h>
-#include <wtf/Threading.h>
-#include <wtf/ThreadSpecific.h>
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
- class DOMData;
- class DOMDataStore;
-
- typedef WTF::Vector<DOMDataStore*> DOMDataList;
-
- template <class T, int CHUNK_SIZE, class Traits>
- class ChunkedTable {
- public:
- ChunkedTable() : m_chunks(0), m_current(0), m_last(0) { }
-
- T* add(T element)
- {
- if (m_current == m_last) {
- m_chunks = new Chunk(m_chunks);
- m_current = m_chunks->m_entries;
- m_last = m_current + CHUNK_SIZE;
- }
- ASSERT((m_chunks->m_entries <= m_current) && (m_current < m_last));
- T* p = m_current++;
- *p = element;
- return p;
- }
-
- void remove(T* element)
- {
- ASSERT(element);
- ASSERT(m_current > m_chunks->m_entries);
- m_current--;
- if (element != m_current)
- Traits::move(element, m_current);
- if (m_current == m_chunks->m_entries) {
- Chunk* toDelete = m_chunks;
- m_chunks = toDelete->m_previous;
- m_current = m_last = m_chunks ? m_chunks->m_entries + CHUNK_SIZE : 0;
- delete toDelete;
- }
- ASSERT(!m_chunks || ((m_chunks->m_entries < m_current) && (m_current <= m_last)));
- }
-
- void clear()
- {
- if (!m_chunks)
- return;
-
- clearEntries(m_chunks->m_entries, m_current);
- Chunk* last = m_chunks;
- while (true) {
- Chunk* previous = last->m_previous;
- if (!previous)
- break;
- delete last;
- clearEntries(previous->m_entries, previous->m_entries + CHUNK_SIZE);
- last = previous;
- }
-
- m_chunks = last;
- m_current = m_chunks->m_entries;
- m_last = m_current + CHUNK_SIZE;
- }
-
- void visit(DOMDataStore* store, typename Traits::Visitor* visitor)
- {
- if (!m_chunks)
- return;
-
- visitEntries(store, m_chunks->m_entries, m_current, visitor);
- for (Chunk* chunk = m_chunks->m_previous; chunk; chunk = chunk->m_previous)
- visitEntries(store, chunk->m_entries, chunk->m_entries + CHUNK_SIZE, visitor);
- }
-
- private:
- struct Chunk {
- explicit Chunk(Chunk* previous) : m_previous(previous) { }
- Chunk* const m_previous;
- T m_entries[CHUNK_SIZE];
- };
-
- static void clearEntries(T* first, T* last)
- {
- for (T* entry = first; entry < last; entry++)
- Traits::clear(entry);
- }
-
- static void visitEntries(DOMDataStore* store, T* first, T* last, typename Traits::Visitor* visitor)
- {
- for (T* entry = first; entry < last; entry++)
- Traits::visit(store, entry, visitor);
- }
-
- Chunk* m_chunks;
- T* m_current;
- T* m_last;
- };
-
- // DOMDataStore
- //
- // DOMDataStore is the backing store that holds the maps between DOM objects
- // and JavaScript objects. In general, each thread can have multiple backing
- // stores, one per isolated world.
- //
- // This class doesn't manage the lifetime of the store. The data store
- // lifetime is managed by subclasses.
- //
- class DOMDataStore : public Noncopyable {
- public:
- enum DOMWrapperMapType {
- DOMNodeMap,
- DOMObjectMap,
- ActiveDOMObjectMap,
-#if ENABLE(SVG)
- DOMSVGElementInstanceMap
-#endif
- };
-
- class IntrusiveDOMWrapperMap : public AbstractWeakReferenceMap<Node, v8::Object> {
- public:
- IntrusiveDOMWrapperMap(v8::WeakReferenceCallback callback)
- : AbstractWeakReferenceMap<Node, v8::Object>(callback) { }
-
- virtual v8::Persistent<v8::Object> get(Node* obj)
- {
- v8::Persistent<v8::Object>* wrapper = obj->wrapper();
- return wrapper ? *wrapper : v8::Persistent<v8::Object>();
- }
-
- virtual void set(Node* obj, v8::Persistent<v8::Object> wrapper)
- {
- ASSERT(obj);
- ASSERT(!obj->wrapper());
- v8::Persistent<v8::Object>* entry = m_table.add(wrapper);
- obj->setWrapper(entry);
- wrapper.MakeWeak(obj, weakReferenceCallback());
- }
-
- virtual bool contains(Node* obj)
- {
- return obj->wrapper();
- }
-
- virtual void visit(DOMDataStore* store, Visitor* visitor)
- {
- m_table.visit(store, visitor);
- }
-
- virtual bool removeIfPresent(Node* key, v8::Persistent<v8::Data> value);
-
- virtual void clear()
- {
- m_table.clear();
- }
-
- private:
- static int const numberOfEntries = (1 << 10) - 1;
-
- struct ChunkedTableTraits {
- typedef IntrusiveDOMWrapperMap::Visitor Visitor;
-
- static void move(v8::Persistent<v8::Object>* target, v8::Persistent<v8::Object>* source)
- {
- *target = *source;
- Node* node = V8Node::toNative(*target);
- ASSERT(node);
- node->setWrapper(target);
- }
-
- static void clear(v8::Persistent<v8::Object>* entry)
- {
- Node* node = V8Node::toNative(*entry);
- ASSERT(node->wrapper() == entry);
-
- node->clearWrapper();
- entry->Dispose();
- }
-
- static void visit(DOMDataStore* store, v8::Persistent<v8::Object>* entry, Visitor* visitor)
- {
- Node* node = V8Node::toNative(*entry);
- ASSERT(node->wrapper() == entry);
-
- visitor->visitDOMWrapper(store, node, *entry);
- }
- };
-
- typedef ChunkedTable<v8::Persistent<v8::Object>, numberOfEntries, ChunkedTableTraits> Table;
- Table m_table;
- };
-
- DOMDataStore(DOMData*);
- virtual ~DOMDataStore();
-
- // A list of all DOMDataStore objects in the current V8 instance (thread). Normally, each World has a DOMDataStore.
- static DOMDataList& allStores();
- // Mutex to protect against concurrent access of DOMDataList.
- static WTF::Mutex& allStoresMutex();
-
- DOMData* domData() const { return m_domData; }
-
- void* getDOMWrapperMap(DOMWrapperMapType);
-
- DOMNodeMapping& domNodeMap() { return *m_domNodeMap; }
- DOMWrapperMap<void>& domObjectMap() { return *m_domObjectMap; }
- DOMWrapperMap<void>& activeDomObjectMap() { return *m_activeDomObjectMap; }
-#if ENABLE(SVG)
- DOMWrapperMap<SVGElementInstance>& domSvgElementInstanceMap() { return *m_domSvgElementInstanceMap; }
-#endif
-
- // Need by V8GCController.
- static void weakActiveDOMObjectCallback(v8::Persistent<v8::Value> v8Object, void* domObject);
-
- protected:
- static void weakNodeCallback(v8::Persistent<v8::Value> v8Object, void* domObject);
- static void weakDOMObjectCallback(v8::Persistent<v8::Value> v8Object, void* domObject);
-#if ENABLE(SVG)
- static void weakSVGElementInstanceCallback(v8::Persistent<v8::Value> v8Object, void* domObject);
-#endif
-
- DOMNodeMapping* m_domNodeMap;
- DOMWrapperMap<void>* m_domObjectMap;
- DOMWrapperMap<void>* m_activeDomObjectMap;
-#if ENABLE(SVG)
- DOMWrapperMap<SVGElementInstance>* m_domSvgElementInstanceMap;
-#endif
-
- private:
- // A back-pointer to the DOMData to which we belong.
- DOMData* m_domData;
- };
-
-} // namespace WebCore
-
-#endif // DOMDataStore_h
diff --git a/WebCore/bindings/v8/DOMWrapperWorld.cpp b/WebCore/bindings/v8/DOMWrapperWorld.cpp
deleted file mode 100644
index 1e9429f..0000000
--- a/WebCore/bindings/v8/DOMWrapperWorld.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "DOMWrapperWorld.h"
-
-#include <wtf/StdLibExtras.h>
-#include <wtf/Threading.h>
-
-namespace WebCore {
-
-DOMWrapperWorld::DOMWrapperWorld()
-{
- // This class is pretty boring, huh?
-}
-
-DOMWrapperWorld* mainThreadNormalWorld()
-{
- ASSERT(isMainThread());
- DEFINE_STATIC_LOCAL(RefPtr<DOMWrapperWorld>, cachedNormalWorld, (DOMWrapperWorld::create()));
- return cachedNormalWorld.get();
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/DOMWrapperWorld.h b/WebCore/bindings/v8/DOMWrapperWorld.h
deleted file mode 100644
index 2a9df30..0000000
--- a/WebCore/bindings/v8/DOMWrapperWorld.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 DOMWrapperWorld_h
-#define DOMWrapperWorld_h
-
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-// This class represent a collection of DOM wrappers for a specific world.
-// The base class is pretty boring because the wrappers are actually stored
-// statically in V8DOMMap and garbage collected by V8 itself.
-class DOMWrapperWorld : public RefCounted<DOMWrapperWorld> {
-public:
- static PassRefPtr<DOMWrapperWorld> create() { return adoptRef(new DOMWrapperWorld()); }
- virtual ~DOMWrapperWorld() {}
-
-protected:
- DOMWrapperWorld();
-};
-
-DOMWrapperWorld* mainThreadNormalWorld();
-
-} // namespace WebCore
-
-#endif // DOMWrapperWorld_h
diff --git a/WebCore/bindings/v8/DateExtension.cpp b/WebCore/bindings/v8/DateExtension.cpp
deleted file mode 100644
index 332828b..0000000
--- a/WebCore/bindings/v8/DateExtension.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "DateExtension.h"
-
-#include "V8Proxy.h"
-#include "V8HiddenPropertyName.h"
-
-namespace WebCore {
-
-DateExtension* DateExtension::extension;
-
-static const char* dateExtensionName = "v8/DateExtension";
-static const char* dateExtensionScript =
- "(function () {"
- " var counter;"
- " var orig_getTime;"
- " function getTimeOverride() {"
- " if (++counter > 1000)"
- " OnSleepDetected();"
- " return orig_getTime.call(this);"
- " };"
- " function enableSleepDetection(enable) {"
- " if (enable) {"
- " counter = 0;"
- " orig_getTime = Date.prototype.getTime;"
- " Date.prototype.getTime = getTimeOverride;"
- " } else {"
- " Date.prototype.getTime = orig_getTime;"
- " }"
- " };"
- " native function Setup();"
- " native function OnSleepDetected();"
- " Setup(Date, enableSleepDetection);"
- "})()";
-
-DateExtension::DateExtension() : v8::Extension(dateExtensionName, dateExtensionScript)
-{
-}
-
-DateExtension* DateExtension::get()
-{
- if (!extension)
- extension = new DateExtension();
- return extension;
-}
-
-void DateExtension::setAllowSleep(bool allow)
-{
- v8::Local<v8::Value> result = V8Proxy::currentContext()->Global()->Get(v8::String::New("Date"));
- if (result.IsEmpty() || !result->IsObject())
- return;
-
- v8::Handle<v8::Object> dateObject = v8::Handle<v8::Object>::Cast(result);
- if (dateObject.IsEmpty())
- return;
-
- v8::Local<v8::Value> sleepFunctionHandle = dateObject->GetHiddenValue(V8HiddenPropertyName::sleepFunction());
- if (sleepFunctionHandle.IsEmpty() || !sleepFunctionHandle->IsFunction())
- return;
-
- v8::Handle<v8::Value> argv[1];
- argv[0] = v8::Boolean::New(!allow);
- v8::Handle<v8::Function>::Cast(sleepFunctionHandle)->Call(v8::Object::New(), 1, argv);
-}
-
-v8::Handle<v8::FunctionTemplate> DateExtension::GetNativeFunction(v8::Handle<v8::String> name)
-{
- if (name->Equals(v8::String::New("Setup")))
- return v8::FunctionTemplate::New(Setup);
- if (name->Equals(v8::String::New("OnSleepDetected")))
- return v8::FunctionTemplate::New(OnSleepDetected);
-
- return v8::Handle<v8::FunctionTemplate>();
-}
-
-v8::Handle<v8::Value> DateExtension::Setup(const v8::Arguments& args)
-{
- if (args.Length() != 2 || !args[0]->IsObject() || !args[1]->IsFunction())
- return v8::Undefined();
-
- v8::Handle<v8::Object> dateObject = v8::Handle<v8::Object>::Cast(args[0]);
- v8::Handle<v8::Function> enableSleepDetectionFunction = v8::Handle<v8::Function>::Cast(args[1]);
-
- dateObject->SetHiddenValue(V8HiddenPropertyName::sleepFunction(), enableSleepDetectionFunction);
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> DateExtension::OnSleepDetected(const v8::Arguments&)
-{
- V8Proxy::throwError(V8Proxy::GeneralError, "Too much time spent in unload handler.");
- return v8::Undefined();
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/DateExtension.h b/WebCore/bindings/v8/DateExtension.h
deleted file mode 100644
index 2bccac4..0000000
--- a/WebCore/bindings/v8/DateExtension.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 DateExtension_h
-#define DateExtension_h
-
-#include <v8.h>
-
-namespace WebCore {
-
-// Prevent "sleep" calls in unload handlers.
-class DateExtension : public v8::Extension {
-public:
- static DateExtension* get();
- void setAllowSleep(bool allow);
-
-private:
- DateExtension();
- virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction(v8::Handle<v8::String>);
- static v8::Handle<v8::Value> Setup(const v8::Arguments&);
- static v8::Handle<v8::Value> OnSleepDetected(const v8::Arguments&);
-
- static DateExtension* extension;
-};
-
-} // namespace WebCore
-
-#endif // DateExtension_h
diff --git a/WebCore/bindings/v8/DebuggerScript.js b/WebCore/bindings/v8/DebuggerScript.js
deleted file mode 100644
index 50f791d..0000000
--- a/WebCore/bindings/v8/DebuggerScript.js
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-(function () {
-
-var DebuggerScript = {};
-
-DebuggerScript.PauseOnExceptionsState = {
- DontPauseOnExceptions : 0,
- PauseOnAllExceptions : 1,
- PauseOnUncaughtExceptions: 2
-};
-
-DebuggerScript.ScriptWorldType = {
- MainWorld : 0,
- ExtensionsWorld : 1
-};
-
-DebuggerScript._pauseOnExceptionsState = DebuggerScript.PauseOnExceptionsState.DontPauseOnExceptions;
-Debug.clearBreakOnException();
-Debug.clearBreakOnUncaughtException();
-
-DebuggerScript.getAfterCompileScript = function(eventData)
-{
- return DebuggerScript._formatScript(eventData.script_.script_);
-}
-
-DebuggerScript.getScripts = function(contextData)
-{
- var result = [];
-
- if (!contextData)
- return result;
- var comma = contextData.indexOf(",");
- if (comma === -1)
- return result;
- // Context data is a string in the following format:
- // ("page"|"injected")","<page id>
- var idSuffix = contextData.substring(comma); // including the comma
-
- var scripts = Debug.scripts();
- for (var i = 0; i < scripts.length; ++i) {
- var script = scripts[i];
- if (script.context_data && script.context_data.lastIndexOf(idSuffix) != -1)
- result.push(DebuggerScript._formatScript(script));
- }
- return result;
-}
-
-DebuggerScript._formatScript = function(script)
-{
- var scriptWorldType = DebuggerScript.ScriptWorldType.MainWorld;
- if (script.context_data && script.context_data.indexOf("injected") == 0)
- scriptWorldType = DebuggerScript.ScriptWorldType.ExtensionsWorld;
- return {
- id: script.id,
- name: script.nameOrSourceURL(),
- source: script.source,
- lineOffset: DebuggerScript._v8ToWebkitLineNumber(script.line_offset),
- lineCount: script.lineCount(),
- scriptWorldType: scriptWorldType
- };
-}
-
-DebuggerScript.setBreakpoint = function(execState, args)
-{
- args.lineNumber = DebuggerScript._webkitToV8LineNumber(args.lineNumber);
- var breakId = Debug.setScriptBreakPointById(args.scriptId, args.lineNumber, 0 /* column */, args.condition);
- if (!args.enabled)
- Debug.disableScriptBreakPoint(breakId);
-
- var locations = Debug.findBreakPointActualLocations(breakId);
- if (!locations.length)
- return undefined;
- args.lineNumber = DebuggerScript._v8ToWebkitLineNumber(locations[0].line);
- return breakId.toString();
-}
-
-DebuggerScript.removeBreakpoint = function(execState, args)
-{
- Debug.findBreakPoint(args.breakpointId, true);
-}
-
-DebuggerScript.pauseOnExceptionsState = function()
-{
- return DebuggerScript._pauseOnExceptionsState;
-}
-
-DebuggerScript.setPauseOnExceptionsState = function(newState)
-{
- DebuggerScript._pauseOnExceptionsState = newState;
-
- if (DebuggerScript.PauseOnExceptionsState.PauseOnAllExceptions === newState)
- Debug.setBreakOnException();
- else
- Debug.clearBreakOnException();
-
- if (DebuggerScript.PauseOnExceptionsState.PauseOnUncaughtExceptions === newState)
- Debug.setBreakOnUncaughtException();
- else
- Debug.clearBreakOnUncaughtException();
-}
-
-DebuggerScript.currentCallFrame = function(execState, args)
-{
- var frameCount = execState.frameCount();
- if (frameCount === 0)
- return undefined;
-
- var topFrame;
- for (var i = frameCount - 1; i >= 0; i--) {
- var frameMirror = execState.frame(i);
- topFrame = DebuggerScript._frameMirrorToJSCallFrame(frameMirror, topFrame);
- }
- return topFrame;
-}
-
-DebuggerScript.stepIntoStatement = function(execState)
-{
- execState.prepareStep(Debug.StepAction.StepIn, 1);
-}
-
-DebuggerScript.stepOverStatement = function(execState)
-{
- execState.prepareStep(Debug.StepAction.StepNext, 1);
-}
-
-DebuggerScript.stepOutOfFunction = function(execState)
-{
- execState.prepareStep(Debug.StepAction.StepOut, 1);
-}
-
-DebuggerScript.editScriptSource = function(scriptId, newSource)
-{
- var scripts = Debug.scripts();
- var scriptToEdit = null;
- for (var i = 0; i < scripts.length; i++) {
- if (scripts[i].id == scriptId) {
- scriptToEdit = scripts[i];
- break;
- }
- }
- if (!scriptToEdit)
- throw("Script not found");
-
- var changeLog = [];
- Debug.LiveEdit.SetScriptSource(scriptToEdit, newSource, false, changeLog);
- return scriptToEdit.source;
-}
-
-DebuggerScript.clearBreakpoints = function(execState, args)
-{
- Debug.clearAllBreakPoints();
-}
-
-DebuggerScript.setBreakpointsActivated = function(execState, args)
-{
- Debug.debuggerFlags().breakPointsActive.setValue(args.enabled);
-}
-
-DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame)
-{
- // Get function name.
- var func;
- try {
- func = frameMirror.func();
- } catch(e) {
- }
- var functionName;
- if (func)
- functionName = func.name() || func.inferredName();
-
- // Get script ID.
- var script = func.script();
- var sourceID = script && script.id();
-
- // Get line number.
- var line = DebuggerScript._v8ToWebkitLineNumber(frameMirror.sourceLine());
-
- // Get this object.
- var thisObject = frameMirror.details_.receiver();
-
- // Get scope chain array in format: [<scope type>, <scope object>, <scope type>, <scope object>,...]
- var scopeChain = [];
- var scopeType = [];
- for (var i = 0; i < frameMirror.scopeCount(); i++) {
- var scopeMirror = frameMirror.scope(i);
- var scopeObjectMirror = scopeMirror.scopeObject();
-
- var scopeObject;
- switch (scopeMirror.scopeType()) {
- case ScopeType.Local:
- case ScopeType.Closure:
- // For transient objects we create a "persistent" copy that contains
- // the same properties.
- scopeObject = {};
- // Reset scope object prototype to null so that the proto properties
- // don't appear in the local scope section.
- scopeObject.__proto__ = null;
- var properties = scopeObjectMirror.properties();
- for (var j = 0; j < properties.length; j++) {
- var name = properties[j].name();
- if (name.charAt(0) === ".")
- continue; // Skip internal variables like ".arguments"
- scopeObject[name] = properties[j].value_;
- }
- break;
- case ScopeType.Global:
- case ScopeType.With:
- case ScopeType.Catch:
- scopeObject = scopeMirror.details_.object();
- break;
- }
-
- scopeType.push(scopeMirror.scopeType());
- scopeChain.push(scopeObject);
- }
-
- function evaluate(expression) {
- return frameMirror.evaluate(expression, false).value();
- }
-
- return {
- "sourceID": sourceID,
- "line": line,
- "functionName": functionName,
- "type": "function",
- "thisObject": thisObject,
- "scopeChain": scopeChain,
- "scopeType": scopeType,
- "evaluate": evaluate,
- "caller": callerFrame
- };
-}
-
-DebuggerScript._webkitToV8LineNumber = function(line)
-{
- return line - 1;
-};
-
-DebuggerScript._v8ToWebkitLineNumber = function(line)
-{
- return line + 1;
-};
-
-return DebuggerScript;
-
-})();
diff --git a/WebCore/bindings/v8/IDBBindingUtilities.cpp b/WebCore/bindings/v8/IDBBindingUtilities.cpp
deleted file mode 100644
index 2e8d4fe..0000000
--- a/WebCore/bindings/v8/IDBBindingUtilities.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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 AND ITS CONTRIBUTORS "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 OR ITS 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.
- */
-
-#include "config.h"
-#include "IDBBindingUtilities.h"
-
-#if ENABLE(INDEXED_DATABASE)
-
-#include "IDBDatabaseException.h"
-#include "IDBKey.h"
-#include "IDBKeyPath.h"
-#include "SerializedScriptValue.h"
-#include "V8Binding.h"
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-PassRefPtr<IDBKey> createIDBKeyFromValue(v8::Handle<v8::Value> value)
-{
- if (value->IsNull())
- return IDBKey::createNull();
- if (value->IsNumber())
- return IDBKey::createNumber(value->NumberValue());
- if (value->IsString())
- return IDBKey::createString(v8ValueToWebCoreString(value));
- if (value->IsDate())
- return IDBKey::createDate(value->NumberValue());
-
- return 0; // Signals type error.
-}
-
-template<typename T>
-bool getValueFrom(T indexOrName, v8::Handle<v8::Value>& v8Value)
-{
- v8::Local<v8::Object> object = v8Value->ToObject();
- if (!object->Has(indexOrName))
- return false;
- v8Value = object->Get(indexOrName);
- return true;
-}
-
-class LocalContext {
-public:
- LocalContext()
- : m_context(v8::Context::New())
- {
- m_context->Enter();
- }
-
- ~LocalContext()
- {
- m_context->Exit();
- m_context.Dispose();
- }
-
-private:
- v8::HandleScope m_scope;
- v8::Persistent<v8::Context> m_context;
-};
-
-PassRefPtr<IDBKey> createIDBKeyFromSerializedValueAndKeyPath(PassRefPtr<SerializedScriptValue> value, const Vector<IDBKeyPathElement>& keyPath)
-{
- LocalContext localContext;
- v8::Handle<v8::Value> v8Value(value->deserialize());
- for (size_t i = 0; i < keyPath.size(); ++i) {
- switch (keyPath[i].type) {
- case IDBKeyPathElement::IsIndexed:
- if (!v8Value->IsArray() || !getValueFrom(keyPath[i].index, v8Value))
- return 0;
- break;
- case IDBKeyPathElement::IsNamed:
- if (!v8Value->IsObject() || !getValueFrom(v8String(keyPath[i].identifier), v8Value))
- return 0;
- break;
- default:
- ASSERT_NOT_REACHED();
- }
- }
- return createIDBKeyFromValue(v8Value);
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/WebCore/bindings/v8/IDBBindingUtilities.h b/WebCore/bindings/v8/IDBBindingUtilities.h
deleted file mode 100644
index 1a794b0..0000000
--- a/WebCore/bindings/v8/IDBBindingUtilities.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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 AND ITS CONTRIBUTORS "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 OR ITS 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 IDBBindingUtilities_h
-#define IDBBindingUtilities_h
-
-#if ENABLE(INDEXED_DATABASE)
-
-#include <v8.h>
-#include <wtf/Forward.h>
-
-namespace WebCore {
-
-class IDBKey;
-class SerializedScriptValue;
-struct IDBKeyPathElement;
-
-PassRefPtr<IDBKey> createIDBKeyFromValue(v8::Handle<v8::Value>);
-PassRefPtr<IDBKey> createIDBKeyFromSerializedValueAndKeyPath(PassRefPtr<SerializedScriptValue> value, const Vector<IDBKeyPathElement, 0>& keyPath);
-
-}
-
-#endif // ENABLE(INDEXED_DATABASE)
-
-#endif // IDBBindingUtilities_h
diff --git a/WebCore/bindings/v8/IsolatedWorld.cpp b/WebCore/bindings/v8/IsolatedWorld.cpp
deleted file mode 100644
index 368683d..0000000
--- a/WebCore/bindings/v8/IsolatedWorld.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "IsolatedWorld.h"
-
-namespace WebCore {
-
-int IsolatedWorld::isolatedWorldCount = 0;
-
-IsolatedWorld::IsolatedWorld()
-{
- ++isolatedWorldCount;
-}
-
-IsolatedWorld::~IsolatedWorld()
-{
- --isolatedWorldCount;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/IsolatedWorld.h b/WebCore/bindings/v8/IsolatedWorld.h
deleted file mode 100644
index 3e86437..0000000
--- a/WebCore/bindings/v8/IsolatedWorld.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 IsolatedWorld_h
-#define IsolatedWorld_h
-
-#include "DOMWrapperWorld.h"
-#include "V8DOMMap.h"
-
-namespace WebCore {
-
-// An DOMWrapperWorld other than the thread's normal world.
-class IsolatedWorld : public DOMWrapperWorld {
-public:
- static PassRefPtr<IsolatedWorld> create() { return adoptRef(new IsolatedWorld()); }
- static int count() { return isolatedWorldCount; }
-
- DOMDataStore* domDataStore() const { return m_domDataStore.getStore(); }
-
-protected:
- IsolatedWorld();
- ~IsolatedWorld();
-
-private:
- // The backing store for the isolated world's DOM wrappers. This class
- // doesn't have visibility into the wrappers. This handle simply helps
- // manage their lifetime.
- DOMDataStoreHandle m_domDataStore;
-
- static int isolatedWorldCount;
-};
-
-} // namespace WebCore
-
-#endif // IsolatedWorld_h
diff --git a/WebCore/bindings/v8/JavaScriptCallFrame.cpp b/WebCore/bindings/v8/JavaScriptCallFrame.cpp
deleted file mode 100644
index 20bf378..0000000
--- a/WebCore/bindings/v8/JavaScriptCallFrame.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2010, Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "JavaScriptCallFrame.h"
-
-#if ENABLE(JAVASCRIPT_DEBUGGER)
-
-#include "V8Binding.h"
-
-namespace WebCore {
-
-JavaScriptCallFrame::JavaScriptCallFrame(v8::Handle<v8::Context> debuggerContext, v8::Handle<v8::Object> callFrame)
- : m_debuggerContext(debuggerContext)
- , m_callFrame(callFrame)
-{
-}
-
-JavaScriptCallFrame::~JavaScriptCallFrame()
-{
-}
-
-JavaScriptCallFrame* JavaScriptCallFrame::caller()
-{
- if (!m_caller) {
- v8::HandleScope handleScope;
- v8::Context::Scope contextScope(m_debuggerContext.get());
- v8::Handle<v8::Value> callerFrame = m_callFrame.get()->Get(v8String("caller"));
- if (!callerFrame->IsObject())
- return 0;
- m_caller = JavaScriptCallFrame::create(m_debuggerContext.get(), v8::Handle<v8::Object>::Cast(callerFrame));
- }
- return m_caller.get();
-}
-
-int JavaScriptCallFrame::sourceID() const
-{
- v8::HandleScope handleScope;
- v8::Context::Scope contextScope(m_debuggerContext.get());
- v8::Handle<v8::Value> result = m_callFrame.get()->Get(v8String("sourceID"));
- if (result->IsInt32())
- return result->Int32Value();
- return 0;
-}
-
-int JavaScriptCallFrame::line() const
-{
- v8::HandleScope handleScope;
- v8::Context::Scope contextScope(m_debuggerContext.get());
- v8::Handle<v8::Value> result = m_callFrame.get()->Get(v8String("line"));
- if (result->IsInt32())
- return result->Int32Value();
- return 0;
-}
-
-String JavaScriptCallFrame::functionName() const
-{
- v8::HandleScope handleScope;
- v8::Context::Scope contextScope(m_debuggerContext.get());
- v8::Handle<v8::Value> result = m_callFrame.get()->Get(v8String("functionName"));
- return toWebCoreStringWithNullOrUndefinedCheck(result);
-}
-
-v8::Handle<v8::Value> JavaScriptCallFrame::scopeChain() const
-{
- v8::Handle<v8::Array> scopeChain = v8::Handle<v8::Array>::Cast(m_callFrame.get()->Get(v8String("scopeChain")));
- v8::Handle<v8::Array> result = v8::Array::New(scopeChain->Length());
- for (uint32_t i = 0; i < scopeChain->Length(); i++)
- result->Set(i, scopeChain->Get(i));
- return result;
-}
-
-int JavaScriptCallFrame::scopeType(int scopeIndex) const
-{
- v8::Handle<v8::Array> scopeType = v8::Handle<v8::Array>::Cast(m_callFrame.get()->Get(v8String("scopeType")));
- return scopeType->Get(scopeIndex)->Int32Value();
-}
-
-v8::Handle<v8::Value> JavaScriptCallFrame::thisObject() const
-{
- return m_callFrame.get()->Get(v8String("thisObject"));
-}
-
-v8::Handle<v8::Value> JavaScriptCallFrame::evaluate(const String& expression)
-{
- v8::Handle<v8::Function> evalFunction = v8::Handle<v8::Function>::Cast(m_callFrame.get()->Get(v8String("evaluate")));
- v8::Handle<v8::Value> argv[] = { v8String(expression) };
- return evalFunction->Call(m_callFrame.get(), 1, argv);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(JAVASCRIPT_DEBUGGER)
diff --git a/WebCore/bindings/v8/JavaScriptCallFrame.h b/WebCore/bindings/v8/JavaScriptCallFrame.h
deleted file mode 100644
index 95a0510..0000000
--- a/WebCore/bindings/v8/JavaScriptCallFrame.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2010, Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 JavaScriptCallFrame_h
-#define JavaScriptCallFrame_h
-
-#if ENABLE(JAVASCRIPT_DEBUGGER)
-
-#include "OwnHandle.h"
-#include "PlatformString.h"
-#include <v8-debug.h>
-
-namespace WebCore {
-
-class JavaScriptCallFrame : public RefCounted<JavaScriptCallFrame> {
-public:
- static PassRefPtr<JavaScriptCallFrame> create(v8::Handle<v8::Context> debuggerContext, v8::Handle<v8::Object> callFrame)
- {
- return adoptRef(new JavaScriptCallFrame(debuggerContext, callFrame));
- }
- ~JavaScriptCallFrame();
-
- JavaScriptCallFrame* caller();
-
- int sourceID() const;
- int line() const;
- String functionName() const;
-
- v8::Handle<v8::Value> scopeChain() const;
- int scopeType(int scopeIndex) const;
- v8::Handle<v8::Value> thisObject() const;
-
- v8::Handle<v8::Value> evaluate(const String& expression);
-
-private:
- JavaScriptCallFrame(v8::Handle<v8::Context> debuggerContext, v8::Handle<v8::Object> callFrame);
-
- RefPtr<JavaScriptCallFrame> m_caller;
- OwnHandle<v8::Context> m_debuggerContext;
- OwnHandle<v8::Object> m_callFrame;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(JAVASCRIPT_DEBUGGER)
-
-#endif // JavaScriptCallFrame_h
diff --git a/WebCore/bindings/v8/MainThreadDOMData.cpp b/WebCore/bindings/v8/MainThreadDOMData.cpp
deleted file mode 100644
index d9c865c..0000000
--- a/WebCore/bindings/v8/MainThreadDOMData.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "MainThreadDOMData.h"
-
-#include "V8IsolatedContext.h"
-
-namespace WebCore {
-
-MainThreadDOMData::MainThreadDOMData()
- : m_defaultStore(this)
-{
-}
-
-MainThreadDOMData* MainThreadDOMData::getCurrent()
-{
- ASSERT(WTF::isMainThread());
- DEFINE_STATIC_LOCAL(MainThreadDOMData, mainThreadDOMData, ());
- return &mainThreadDOMData;
-}
-
-DOMDataStore& MainThreadDOMData::getMainThreadStore()
-{
- // This is broken out as a separate non-virtual method from getStore()
- // so that it can be inlined by getCurrentMainThreadStore, which is
- // a hot spot in Dromaeo DOM tests.
- ASSERT(WTF::isMainThread());
- V8IsolatedContext* context = V8IsolatedContext::getEntered();
- if (UNLIKELY(context != 0))
- return *context->world()->domDataStore();
- return m_defaultStore;
-}
-
-DOMDataStore& MainThreadDOMData::getCurrentMainThreadStore()
-{
- return getCurrent()->getMainThreadStore();
-}
-
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/MainThreadDOMData.h b/WebCore/bindings/v8/MainThreadDOMData.h
deleted file mode 100644
index e8f99c9..0000000
--- a/WebCore/bindings/v8/MainThreadDOMData.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 MainThreadDOMData_h
-#define MainThreadDOMData_h
-
-#include "DOMData.h"
-#include "StaticDOMDataStore.h"
-
-namespace WebCore {
-
- class MainThreadDOMData : public DOMData {
- public:
- static MainThreadDOMData* getCurrent(); // Caller must be on the main thread.
- static DOMDataStore& getCurrentMainThreadStore();
-
- virtual DOMDataStore& getStore() { return getMainThreadStore(); }
-
-
- private:
- MainThreadDOMData();
- DOMDataStore& getMainThreadStore();
-
- StaticDOMDataStore m_defaultStore;
- // Note: The DOMDataStores for isolated world are owned by the world object.
- };
-
-} // namespace WebCore
-
-#endif // MainThreadDOMData_h
diff --git a/WebCore/bindings/v8/NPV8Object.cpp b/WebCore/bindings/v8/NPV8Object.cpp
deleted file mode 100644
index e4be0d8..0000000
--- a/WebCore/bindings/v8/NPV8Object.cpp
+++ /dev/null
@@ -1,555 +0,0 @@
-/*
- * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
- * Copyright (C) 2007, 2008, 2009 Google, 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.
- */
-
-#include "config.h"
-
-#include "NPV8Object.h"
-
-#include "PlatformBridge.h"
-#include "DOMWindow.h"
-#include "Frame.h"
-#include "OwnArrayPtr.h"
-#include "PlatformString.h"
-#include "ScriptController.h"
-#include "UserGestureIndicator.h"
-#include "V8GCController.h"
-#include "V8Helpers.h"
-#include "V8NPUtils.h"
-#include "V8Proxy.h"
-#include "WrapperTypeInfo.h"
-#include "npruntime_impl.h"
-#include "npruntime_priv.h"
-
-#if PLATFORM(CHROMIUM)
-#include <bindings/npruntime.h>
-#else
-#include "npruntime.h"
-#endif
-
-#include <stdio.h>
-#include <wtf/StringExtras.h>
-
-using namespace WebCore;
-
-namespace WebCore {
-
-WrapperTypeInfo* npObjectTypeInfo()
-{
- static WrapperTypeInfo typeInfo = { 0, 0, 0 };
- return &typeInfo;
-}
-
-// FIXME: Comments on why use malloc and free.
-static NPObject* allocV8NPObject(NPP, NPClass*)
-{
- return static_cast<NPObject*>(malloc(sizeof(V8NPObject)));
-}
-
-static void freeV8NPObject(NPObject* npObject)
-{
- V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject);
-#ifndef NDEBUG
- V8GCController::unregisterGlobalHandle(v8NpObject, v8NpObject->v8Object);
-#endif
- v8NpObject->v8Object.Dispose();
- free(v8NpObject);
-}
-
-static v8::Handle<v8::Value>* createValueListFromVariantArgs(const NPVariant* arguments, uint32_t argumentCount, NPObject* owner)
-{
- v8::Handle<v8::Value>* argv = new v8::Handle<v8::Value>[argumentCount];
- for (uint32_t index = 0; index < argumentCount; index++) {
- const NPVariant* arg = &arguments[index];
- argv[index] = convertNPVariantToV8Object(arg, owner);
- }
- return argv;
-}
-
-// Create an identifier (null terminated utf8 char*) from the NPIdentifier.
-static v8::Local<v8::String> npIdentifierToV8Identifier(NPIdentifier name)
-{
- PrivateIdentifier* identifier = static_cast<PrivateIdentifier*>(name);
- if (identifier->isString)
- return v8::String::New(static_cast<const char*>(identifier->value.string));
-
- char buffer[32];
- snprintf(buffer, sizeof(buffer), "%d", identifier->value.number);
- return v8::String::New(buffer);
-}
-
-NPObject* v8ObjectToNPObject(v8::Handle<v8::Object> object)
-{
- return reinterpret_cast<NPObject*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex));
-}
-
-static NPClass V8NPObjectClass = { NP_CLASS_STRUCT_VERSION,
- allocV8NPObject,
- freeV8NPObject,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
-
-// NPAPI's npruntime functions.
-NPClass* npScriptObjectClass = &V8NPObjectClass;
-
-NPObject* npCreateV8ScriptObject(NPP npp, v8::Handle<v8::Object> object, DOMWindow* root)
-{
- // Check to see if this object is already wrapped.
- if (object->InternalFieldCount() == npObjectInternalFieldCount) {
- WrapperTypeInfo* typeInfo = static_cast<WrapperTypeInfo*>(object->GetPointerFromInternalField(v8DOMWrapperTypeIndex));
- if (typeInfo == npObjectTypeInfo()) {
-
- NPObject* returnValue = v8ObjectToNPObject(object);
- _NPN_RetainObject(returnValue);
- return returnValue;
- }
- }
-
- V8NPObject* v8npObject = reinterpret_cast<V8NPObject*>(_NPN_CreateObject(npp, &V8NPObjectClass));
- v8npObject->v8Object = v8::Persistent<v8::Object>::New(object);
-#ifndef NDEBUG
- V8GCController::registerGlobalHandle(NPOBJECT, v8npObject, v8npObject->v8Object);
-#endif
- v8npObject->rootObject = root;
- return reinterpret_cast<NPObject*>(v8npObject);
-}
-
-} // namespace WebCore
-
-bool _NPN_Invoke(NPP npp, NPObject* npObject, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
-{
- if (!npObject)
- return false;
-
- if (npObject->_class != npScriptObjectClass) {
- if (npObject->_class->invoke)
- return npObject->_class->invoke(npObject, methodName, arguments, argumentCount, result);
-
- VOID_TO_NPVARIANT(*result);
- return true;
- }
-
- V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject);
-
- PrivateIdentifier* identifier = static_cast<PrivateIdentifier*>(methodName);
- if (!identifier->isString)
- return false;
-
- if (!strcmp(identifier->value.string, "eval")) {
- if (argumentCount != 1)
- return false;
- if (arguments[0].type != NPVariantType_String)
- return false;
- return _NPN_Evaluate(npp, npObject, const_cast<NPString*>(&arguments[0].value.stringValue), result);
- }
-
- v8::HandleScope handleScope;
- // FIXME: should use the plugin's owner frame as the security context.
- v8::Handle<v8::Context> context = toV8Context(npp, npObject);
- if (context.IsEmpty())
- return false;
-
- v8::Context::Scope scope(context);
- ExceptionCatcher exceptionCatcher;
-
- v8::Handle<v8::Value> functionObject = v8NpObject->v8Object->Get(v8::String::New(identifier->value.string));
- if (functionObject.IsEmpty() || functionObject->IsNull()) {
- NULL_TO_NPVARIANT(*result);
- return false;
- }
- if (functionObject->IsUndefined()) {
- VOID_TO_NPVARIANT(*result);
- return false;
- }
-
- V8Proxy* proxy = toV8Proxy(npObject);
- ASSERT(proxy);
-
- // Call the function object.
- v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(functionObject);
- OwnArrayPtr<v8::Handle<v8::Value> > argv(createValueListFromVariantArgs(arguments, argumentCount, npObject));
- v8::Local<v8::Value> resultObject = proxy->callFunction(function, v8NpObject->v8Object, argumentCount, argv.get());
-
- // If we had an error, return false. The spec is a little unclear here, but says "Returns true if the method was
- // successfully invoked". If we get an error return value, was that successfully invoked?
- if (resultObject.IsEmpty())
- return false;
-
- convertV8ObjectToNPVariant(resultObject, npObject, result);
- return true;
-}
-
-// FIXME: Fix it same as _NPN_Invoke (HandleScope and such).
-bool _NPN_InvokeDefault(NPP npp, NPObject* npObject, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
-{
- if (!npObject)
- return false;
-
- if (npObject->_class != npScriptObjectClass) {
- if (npObject->_class->invokeDefault)
- return npObject->_class->invokeDefault(npObject, arguments, argumentCount, result);
-
- VOID_TO_NPVARIANT(*result);
- return true;
- }
-
- V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject);
-
- VOID_TO_NPVARIANT(*result);
-
- v8::HandleScope handleScope;
- v8::Handle<v8::Context> context = toV8Context(npp, npObject);
- if (context.IsEmpty())
- return false;
-
- v8::Context::Scope scope(context);
- ExceptionCatcher exceptionCatcher;
-
- // Lookup the function object and call it.
- v8::Handle<v8::Object> functionObject(v8NpObject->v8Object);
- if (!functionObject->IsFunction())
- return false;
-
- v8::Local<v8::Value> resultObject;
- v8::Handle<v8::Function> function(v8::Function::Cast(*functionObject));
- if (!function->IsNull()) {
- V8Proxy* proxy = toV8Proxy(npObject);
- ASSERT(proxy);
-
- OwnArrayPtr<v8::Handle<v8::Value> > argv(createValueListFromVariantArgs(arguments, argumentCount, npObject));
- resultObject = proxy->callFunction(function, functionObject, argumentCount, argv.get());
- }
- // If we had an error, return false. The spec is a little unclear here, but says "Returns true if the method was
- // successfully invoked". If we get an error return value, was that successfully invoked?
- if (resultObject.IsEmpty())
- return false;
-
- convertV8ObjectToNPVariant(resultObject, npObject, result);
- return true;
-}
-
-bool _NPN_Evaluate(NPP npp, NPObject* npObject, NPString* npScript, NPVariant* result)
-{
- bool popupsAllowed = PlatformBridge::popupsAllowed(npp);
- return _NPN_EvaluateHelper(npp, popupsAllowed, npObject, npScript, result);
-}
-
-bool _NPN_EvaluateHelper(NPP npp, bool popupsAllowed, NPObject* npObject, NPString* npScript, NPVariant* result)
-{
- VOID_TO_NPVARIANT(*result);
- if (!npObject)
- return false;
-
- if (npObject->_class != npScriptObjectClass)
- return false;
-
- v8::HandleScope handleScope;
- v8::Handle<v8::Context> context = toV8Context(npp, npObject);
- if (context.IsEmpty())
- return false;
-
- V8Proxy* proxy = toV8Proxy(npObject);
- ASSERT(proxy);
-
- v8::Context::Scope scope(context);
- ExceptionCatcher exceptionCatcher;
-
- String filename;
- if (!popupsAllowed)
- filename = "npscript";
-
- // Set popupsAllowed flag to the current execution frame, so WebKit can get
- // right gesture status for popups initiated from plugins.
- Frame* frame = proxy->frame();
- ASSERT(frame);
- bool oldAllowPopups = frame->script()->allowPopupsFromPlugin();
- frame->script()->setAllowPopupsFromPlugin(popupsAllowed);
-
- String script = String::fromUTF8(npScript->UTF8Characters, npScript->UTF8Length);
- v8::Local<v8::Value> v8result = proxy->evaluate(ScriptSourceCode(script, KURL(ParsedURLString, filename)), 0);
- // Restore the old flag.
- frame->script()->setAllowPopupsFromPlugin(oldAllowPopups);
-
- if (v8result.IsEmpty())
- return false;
-
- convertV8ObjectToNPVariant(v8result, npObject, result);
- return true;
-}
-
-bool _NPN_GetProperty(NPP npp, NPObject* npObject, NPIdentifier propertyName, NPVariant* result)
-{
- if (!npObject)
- return false;
-
- if (npObject->_class == npScriptObjectClass) {
- V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject);
-
- v8::HandleScope handleScope;
- v8::Handle<v8::Context> context = toV8Context(npp, npObject);
- if (context.IsEmpty())
- return false;
-
- v8::Context::Scope scope(context);
- ExceptionCatcher exceptionCatcher;
-
- v8::Handle<v8::Object> obj(object->v8Object);
- v8::Local<v8::Value> v8result = obj->Get(npIdentifierToV8Identifier(propertyName));
-
- if (v8result.IsEmpty())
- return false;
-
- convertV8ObjectToNPVariant(v8result, npObject, result);
- return true;
- }
-
- if (npObject->_class->hasProperty && npObject->_class->getProperty) {
- if (npObject->_class->hasProperty(npObject, propertyName))
- return npObject->_class->getProperty(npObject, propertyName, result);
- }
-
- VOID_TO_NPVARIANT(*result);
- return false;
-}
-
-bool _NPN_SetProperty(NPP npp, NPObject* npObject, NPIdentifier propertyName, const NPVariant* value)
-{
- if (!npObject)
- return false;
-
- if (npObject->_class == npScriptObjectClass) {
- V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject);
-
- v8::HandleScope handleScope;
- v8::Handle<v8::Context> context = toV8Context(npp, npObject);
- if (context.IsEmpty())
- return false;
-
- v8::Context::Scope scope(context);
- ExceptionCatcher exceptionCatcher;
-
- v8::Handle<v8::Object> obj(object->v8Object);
- obj->Set(npIdentifierToV8Identifier(propertyName),
- convertNPVariantToV8Object(value, object->rootObject->frame()->script()->windowScriptNPObject()));
- return true;
- }
-
- if (npObject->_class->setProperty)
- return npObject->_class->setProperty(npObject, propertyName, value);
-
- return false;
-}
-
-bool _NPN_RemoveProperty(NPP npp, NPObject* npObject, NPIdentifier propertyName)
-{
- if (!npObject)
- return false;
- if (npObject->_class != npScriptObjectClass)
- return false;
-
- V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject);
-
- v8::HandleScope handleScope;
- v8::Handle<v8::Context> context = toV8Context(npp, npObject);
- if (context.IsEmpty())
- return false;
- v8::Context::Scope scope(context);
- ExceptionCatcher exceptionCatcher;
-
- v8::Handle<v8::Object> obj(object->v8Object);
- // FIXME: Verify that setting to undefined is right.
- obj->Set(npIdentifierToV8Identifier(propertyName), v8::Undefined());
- return true;
-}
-
-bool _NPN_HasProperty(NPP npp, NPObject* npObject, NPIdentifier propertyName)
-{
- if (!npObject)
- return false;
-
- if (npObject->_class == npScriptObjectClass) {
- V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject);
-
- v8::HandleScope handleScope;
- v8::Handle<v8::Context> context = toV8Context(npp, npObject);
- if (context.IsEmpty())
- return false;
- v8::Context::Scope scope(context);
- ExceptionCatcher exceptionCatcher;
-
- v8::Handle<v8::Object> obj(object->v8Object);
- return obj->Has(npIdentifierToV8Identifier(propertyName));
- }
-
- if (npObject->_class->hasProperty)
- return npObject->_class->hasProperty(npObject, propertyName);
- return false;
-}
-
-bool _NPN_HasMethod(NPP npp, NPObject* npObject, NPIdentifier methodName)
-{
- if (!npObject)
- return false;
-
- if (npObject->_class == npScriptObjectClass) {
- V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject);
-
- v8::HandleScope handleScope;
- v8::Handle<v8::Context> context = toV8Context(npp, npObject);
- if (context.IsEmpty())
- return false;
- v8::Context::Scope scope(context);
- ExceptionCatcher exceptionCatcher;
-
- v8::Handle<v8::Object> obj(object->v8Object);
- v8::Handle<v8::Value> prop = obj->Get(npIdentifierToV8Identifier(methodName));
- return prop->IsFunction();
- }
-
- if (npObject->_class->hasMethod)
- return npObject->_class->hasMethod(npObject, methodName);
- return false;
-}
-
-void _NPN_SetException(NPObject* npObject, const NPUTF8 *message)
-{
- if (!npObject || npObject->_class != npScriptObjectClass) {
- // We won't be able to find a proper scope for this exception, so just throw it.
- // This is consistent with JSC, which throws a global exception all the time.
-#if PLATFORM(ANDROID)
- // However, if there isn't a v8 context, throw the error away as there really isn't anything useful to do with it.
- if (v8::Context::InContext())
- V8Proxy::throwError(V8Proxy::GeneralError, message);
-#endif
- return;
- }
- v8::HandleScope handleScope;
- v8::Handle<v8::Context> context = toV8Context(0, npObject);
- if (context.IsEmpty())
- return;
-
- v8::Context::Scope scope(context);
- ExceptionCatcher exceptionCatcher;
-
- V8Proxy::throwError(V8Proxy::GeneralError, message);
-}
-
-bool _NPN_Enumerate(NPP npp, NPObject* npObject, NPIdentifier** identifier, uint32_t* count)
-{
- if (!npObject)
- return false;
-
- if (npObject->_class == npScriptObjectClass) {
- V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject);
-
- v8::HandleScope handleScope;
- v8::Handle<v8::Context> context = toV8Context(npp, npObject);
- if (context.IsEmpty())
- return false;
- v8::Context::Scope scope(context);
- ExceptionCatcher exceptionCatcher;
-
- v8::Handle<v8::Object> obj(object->v8Object);
-
- // FIXME: http://b/issue?id=1210340: Use a v8::Object::Keys() method when it exists, instead of evaluating javascript.
-
- // FIXME: Figure out how to cache this helper function. Run a helper function that collects the properties
- // on the object into an array.
- const char enumeratorCode[] =
- "(function (obj) {"
- " var props = [];"
- " for (var prop in obj) {"
- " props[props.length] = prop;"
- " }"
- " return props;"
- "});";
- v8::Handle<v8::String> source = v8::String::New(enumeratorCode);
- v8::Handle<v8::Script> script = v8::Script::Compile(source, 0);
- v8::Handle<v8::Value> enumeratorObj = script->Run();
- v8::Handle<v8::Function> enumerator = v8::Handle<v8::Function>::Cast(enumeratorObj);
- v8::Handle<v8::Value> argv[] = { obj };
- v8::Local<v8::Value> propsObj = enumerator->Call(v8::Handle<v8::Object>::Cast(enumeratorObj), ARRAYSIZE_UNSAFE(argv), argv);
- if (propsObj.IsEmpty())
- return false;
-
- // Convert the results into an array of NPIdentifiers.
- v8::Handle<v8::Array> props = v8::Handle<v8::Array>::Cast(propsObj);
- *count = props->Length();
- *identifier = static_cast<NPIdentifier*>(malloc(sizeof(NPIdentifier*) * *count));
- for (uint32_t i = 0; i < *count; ++i) {
- v8::Local<v8::Value> name = props->Get(v8::Integer::New(i));
- (*identifier)[i] = getStringIdentifier(v8::Local<v8::String>::Cast(name));
- }
- return true;
- }
-
- if (NP_CLASS_STRUCT_VERSION_HAS_ENUM(npObject->_class) && npObject->_class->enumerate)
- return npObject->_class->enumerate(npObject, identifier, count);
-
- return false;
-}
-
-bool _NPN_Construct(NPP npp, NPObject* npObject, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
-{
- if (!npObject)
- return false;
-
- if (npObject->_class == npScriptObjectClass) {
- V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject);
-
- v8::HandleScope handleScope;
- v8::Handle<v8::Context> context = toV8Context(npp, npObject);
- if (context.IsEmpty())
- return false;
- v8::Context::Scope scope(context);
- ExceptionCatcher exceptionCatcher;
-
- // Lookup the constructor function.
- v8::Handle<v8::Object> ctorObj(object->v8Object);
- if (!ctorObj->IsFunction())
- return false;
-
- // Call the constructor.
- v8::Local<v8::Value> resultObject;
- v8::Handle<v8::Function> ctor(v8::Function::Cast(*ctorObj));
- if (!ctor->IsNull()) {
- V8Proxy* proxy = toV8Proxy(npObject);
- ASSERT(proxy);
-
- OwnArrayPtr<v8::Handle<v8::Value> > argv(createValueListFromVariantArgs(arguments, argumentCount, npObject));
- resultObject = proxy->newInstance(ctor, argumentCount, argv.get());
- }
-
- if (resultObject.IsEmpty())
- return false;
-
- convertV8ObjectToNPVariant(resultObject, npObject, result);
- return true;
- }
-
- if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class->construct)
- return npObject->_class->construct(npObject, arguments, argumentCount, result);
-
- return false;
-}
diff --git a/WebCore/bindings/v8/NPV8Object.h b/WebCore/bindings/v8/NPV8Object.h
deleted file mode 100644
index 2a81181..0000000
--- a/WebCore/bindings/v8/NPV8Object.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 NPV8Object_h
-#define NPV8Object_h
-
-#include "V8DOMWrapper.h"
-
-#if PLATFORM(CHROMIUM)
-// FIXME: Chromium uses a different npruntime.h, which is in
-// the Chromium source repository under third_party/npapi/bindings.
-// The Google-specific changes in that file should probably be
-// moved into bridge/npruntime.h, guarded by an #if PlATFORM(CHROMIUM).
-#include <bindings/npruntime.h>
-#else
-#include "npruntime.h" // Use WebCore version for Android and other ports.
-#endif
-
-#include <v8.h>
-
-namespace WebCore {
-
-class DOMWindow;
-
-static const int npObjectInternalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
-
-WrapperTypeInfo* npObjectTypeInfo();
-
-extern NPClass* npScriptObjectClass;
-
-// A V8NPObject is a NPObject which carries additional V8-specific information. It is allocated and deallocated by
-// AllocV8NPObject() and FreeV8NPObject() methods.
-struct V8NPObject {
- NPObject object;
- v8::Persistent<v8::Object> v8Object;
- DOMWindow* rootObject;
-};
-
-struct PrivateIdentifier {
- union {
- const NPUTF8* string;
- int32_t number;
- } value;
- bool isString;
-};
-
-NPObject* npCreateV8ScriptObject(NPP, v8::Handle<v8::Object>, DOMWindow*);
-
-NPObject* v8ObjectToNPObject(v8::Handle<v8::Object>);
-
-} // namespace WebCore
-
-#endif // NPV8Object_h
diff --git a/WebCore/bindings/v8/OptionsObject.cpp b/WebCore/bindings/v8/OptionsObject.cpp
deleted file mode 100644
index ce9189a..0000000
--- a/WebCore/bindings/v8/OptionsObject.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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 AND ITS CONTRIBUTORS "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 OR ITS 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.
- */
-
-#include "config.h"
-#include "OptionsObject.h"
-
-#include "DOMStringList.h"
-#include "V8Binding.h"
-#include <limits>
-
-#if ENABLE(INDEXED_DATABASE)
-#include "IDBKeyRange.h"
-#include "V8IDBKeyRange.h"
-#endif
-
-namespace WebCore {
-
-OptionsObject::OptionsObject()
-{
-}
-
-OptionsObject::OptionsObject(const v8::Local<v8::Value>& options)
- : m_options(options)
-{
-}
-
-OptionsObject::~OptionsObject()
-{
-}
-
-OptionsObject& OptionsObject::operator=(const OptionsObject& optionsObject)
-{
- m_options = optionsObject.m_options;
- return *this;
-}
-
-bool OptionsObject::isUndefinedOrNull() const
-{
- if (m_options.IsEmpty())
- return true;
- return WebCore::isUndefinedOrNull(m_options);
-}
-
-bool OptionsObject::getKeyBool(const String& key, bool& value) const
-{
- v8::Local<v8::Value> v8Value;
- if (!getKey(key, v8Value))
- return false;
-
- v8::Local<v8::Boolean> v8Bool = v8Value->ToBoolean();
- if (v8Bool.IsEmpty())
- return false;
- value = v8Bool->Value();
- return true;
-}
-
-bool OptionsObject::getKeyInt32(const String& key, int32_t& value) const
-{
- v8::Local<v8::Value> v8Value;
- if (!getKey(key, v8Value))
- return false;
-
- v8::Local<v8::Int32> v8Int32 = v8Value->ToInt32();
- if (v8Int32.IsEmpty())
- return false;
- value = v8Int32->Value();
- return true;
-}
-
-bool OptionsObject::getKeyString(const String& key, String& value) const
-{
- v8::Local<v8::Value> v8Value;
- if (!getKey(key, v8Value))
- return false;
-
- // FIXME: It is possible for this to throw in which case we'd be getting back
- // an empty string and returning true when we should be returning false.
- // See fast/dom/Geolocation/script-tests/argument-types.js for a similar
- // example.
- value = v8ValueToWebCoreString(v8Value);
- return true;
-}
-
-PassRefPtr<DOMStringList> OptionsObject::getKeyDOMStringList(const String& key) const
-{
- v8::Local<v8::Value> v8Value;
- if (!getKey(key, v8Value))
- return 0;
-
- if (!v8Value->IsArray())
- return 0;
-
- RefPtr<DOMStringList> ret = DOMStringList::create();
- v8::Local<v8::Array> v8Array = v8::Local<v8::Array>::Cast(v8Value);
- for (size_t i = 0; i < v8Array->Length(); ++i) {
- v8::Local<v8::Value> indexedValue = v8Array->Get(v8::Integer::New(i));
- ret->append(v8ValueToWebCoreString(indexedValue));
- }
- return ret.release();
-}
-
-#if ENABLE(INDEXED_DATABASE)
-
-PassRefPtr<IDBKeyRange> OptionsObject::getKeyKeyRange(const String& key) const
-{
- v8::Local<v8::Value> v8Value;
- if (!getKey(key, v8Value))
- return 0;
-
- if (!V8IDBKeyRange::HasInstance(v8Value))
- return 0;
-
- return V8IDBKeyRange::toNative(v8::Handle<v8::Object>::Cast(v8Value));
-}
-
-#endif
-
-bool OptionsObject::getKey(const String& key, v8::Local<v8::Value>& value) const
-{
- if (isUndefinedOrNull())
- return false;
- v8::Local<v8::Object> options = m_options->ToObject();
- ASSERT(!options.IsEmpty());
-
- v8::Handle<v8::String> v8Key = v8String(key);
- if (!options->Has(v8Key))
- return false;
- value = options->Get(v8Key);
- if (value.IsEmpty())
- return false;
- return !value->IsUndefined(); // FIXME: Is the undefined check necessary?
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/OptionsObject.h b/WebCore/bindings/v8/OptionsObject.h
deleted file mode 100644
index b006927..0000000
--- a/WebCore/bindings/v8/OptionsObject.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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 AND ITS CONTRIBUTORS "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 OR ITS 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 OptionsObject_h
-#define OptionsObject_h
-
-#include "PlatformString.h"
-#include <v8.h>
-
-namespace WebCore {
-
-class DOMStringList;
-class IDBKeyRange;
-
-class OptionsObject {
-public:
- OptionsObject();
- OptionsObject(const v8::Local<v8::Value>& options);
- ~OptionsObject();
-
- OptionsObject& operator=(const OptionsObject&);
-
- bool isUndefinedOrNull() const;
- bool getKeyBool(const String& key, bool& value) const;
- bool getKeyInt32(const String& key, int32_t& value) const;
- bool getKeyString(const String& key, String& value) const;
- PassRefPtr<DOMStringList> getKeyDOMStringList(const String& key) const;
- PassRefPtr<IDBKeyRange> getKeyKeyRange(const String& key) const;
-
-private:
- bool getKey(const String& key, v8::Local<v8::Value>&) const;
-
- // This object can only be used safely when stack allocated because of v8::Local.
- static void* operator new(size_t);
- static void* operator new[](size_t);
- static void operator delete(void *);
-
- v8::Local<v8::Value> m_options;
-};
-
-}
-
-#endif // OptionsObject_h
diff --git a/WebCore/bindings/v8/OwnHandle.h b/WebCore/bindings/v8/OwnHandle.h
deleted file mode 100644
index 17c551c..0000000
--- a/WebCore/bindings/v8/OwnHandle.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 OwnHandle_h
-#define OwnHandle_h
-
-#include <v8.h>
-
-namespace WebCore {
-
- template<typename T>
- class OwnHandle {
- public:
- OwnHandle() { }
- explicit OwnHandle(v8::Handle<T> handle) : m_handle(v8::Persistent<T>::New(handle)) { }
- ~OwnHandle() { clear(); }
-
- v8::Handle<T> get() const { return m_handle; }
- void set(v8::Handle<T> handle) { clear(); m_handle = v8::Persistent<T>::New(handle); }
-
- // Note: This is clear in the OwnPtr sense, not the v8::Handle sense.
- void clear()
- {
- if (m_handle.IsEmpty())
- return;
- if (m_handle.IsWeak())
- m_handle.ClearWeak();
- m_handle.Dispose();
- m_handle.Clear();
- }
-
- // Make the underlying handle weak. The client doesn't get a callback,
- // we just make the handle empty.
- void makeWeak()
- {
- if (m_handle.IsEmpty())
- return;
- m_handle.MakeWeak(this, &OwnHandle<T>::weakCallback);
- }
-
- private:
- static void weakCallback(v8::Persistent<v8::Value> object, void* ownHandle)
- {
- OwnHandle<T>* handle = static_cast<OwnHandle<T>*>(ownHandle);
- handle->clear();
- }
-
- v8::Persistent<T> m_handle;
- };
-
-} // namespace WebCore
-
-#endif // OwnHandle_h
diff --git a/WebCore/bindings/v8/ScheduledAction.cpp b/WebCore/bindings/v8/ScheduledAction.cpp
deleted file mode 100644
index 708fbe6..0000000
--- a/WebCore/bindings/v8/ScheduledAction.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (C) 2007-2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "ScheduledAction.h"
-
-#include "Document.h"
-#include "ScriptExecutionContext.h"
-#include "ScriptSourceCode.h"
-
-#include "V8Binding.h"
-#include "V8Proxy.h"
-#include "WorkerContext.h"
-#include "WorkerContextExecutionProxy.h"
-#include "WorkerThread.h"
-
-namespace WebCore {
-
-ScheduledAction::ScheduledAction(v8::Handle<v8::Context> context, v8::Handle<v8::Function> func, int argc, v8::Handle<v8::Value> argv[])
- : m_context(context)
- , m_code(String(), KURL(), TextPosition1::belowRangePosition())
-{
- m_function = v8::Persistent<v8::Function>::New(func);
-
-#ifndef NDEBUG
- V8GCController::registerGlobalHandle(SCHEDULED_ACTION, this, m_function);
-#endif
-
- m_argc = argc;
- if (argc > 0) {
- m_argv = new v8::Persistent<v8::Value>[argc];
- for (int i = 0; i < argc; i++) {
- m_argv[i] = v8::Persistent<v8::Value>::New(argv[i]);
-
-#ifndef NDEBUG
- V8GCController::registerGlobalHandle(SCHEDULED_ACTION, this, m_argv[i]);
-#endif
- }
- } else
- m_argv = 0;
-}
-
-ScheduledAction::~ScheduledAction()
-{
- if (m_function.IsEmpty())
- return;
-
-#ifndef NDEBUG
- V8GCController::unregisterGlobalHandle(this, m_function);
-#endif
- m_function.Dispose();
-
- for (int i = 0; i < m_argc; i++) {
-#ifndef NDEBUG
- V8GCController::unregisterGlobalHandle(this, m_argv[i]);
-#endif
- m_argv[i].Dispose();
- }
-
- if (m_argc > 0)
- delete[] m_argv;
-}
-
-void ScheduledAction::execute(ScriptExecutionContext* context)
-{
- V8Proxy* proxy = V8Proxy::retrieve(context);
- if (proxy)
- execute(proxy);
-#if ENABLE(WORKERS)
- else if (context->isWorkerContext())
- execute(static_cast<WorkerContext*>(context));
-#endif
- // It's possible that Javascript is disabled and that we have neither a V8Proxy
- // nor a WorkerContext. Do nothing in that case.
-}
-
-void ScheduledAction::execute(V8Proxy* proxy)
-{
- ASSERT(proxy);
-
- v8::HandleScope handleScope;
- v8::Handle<v8::Context> v8Context = v8::Local<v8::Context>::New(m_context.get());
- if (v8Context.IsEmpty())
- return; // JS may not be enabled.
-
- v8::Context::Scope scope(v8Context);
-
- proxy->setTimerCallback(true);
-
- // FIXME: Need to implement timeouts for preempting a long-running script.
- if (!m_function.IsEmpty() && m_function->IsFunction()) {
- proxy->callFunction(v8::Persistent<v8::Function>::Cast(m_function), v8Context->Global(), m_argc, m_argv);
- Document::updateStyleForAllDocuments();
- } else
- proxy->evaluate(m_code, 0);
-
- proxy->setTimerCallback(false);
-}
-
-#if ENABLE(WORKERS)
-void ScheduledAction::execute(WorkerContext* workerContext)
-{
- // In a Worker, the execution should always happen on a worker thread.
- ASSERT(workerContext->thread()->threadID() == currentThread());
-
- WorkerScriptController* scriptController = workerContext->script();
-
- if (!m_function.IsEmpty() && m_function->IsFunction()) {
- v8::HandleScope handleScope;
- v8::Handle<v8::Context> v8Context = v8::Local<v8::Context>::New(m_context.get());
- ASSERT(!v8Context.IsEmpty());
- v8::Context::Scope scope(v8Context);
- m_function->Call(v8Context->Global(), m_argc, m_argv);
- } else
- scriptController->evaluate(m_code);
-}
-#endif
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScheduledAction.h b/WebCore/bindings/v8/ScheduledAction.h
deleted file mode 100644
index aefe7ef..0000000
--- a/WebCore/bindings/v8/ScheduledAction.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2007-2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 ScheduledAction_h
-#define ScheduledAction_h
-
-#include "OwnHandle.h"
-#include "ScriptSourceCode.h"
-#include "V8GCController.h"
-#include <wtf/Forward.h>
-
-#include <v8.h>
-
-namespace WebCore {
-
- class ScriptExecutionContext;
- class V8Proxy;
- class WorkerContext;
-
- class ScheduledAction {
- public:
- ScheduledAction(v8::Handle<v8::Context>, v8::Handle<v8::Function>, int argc, v8::Handle<v8::Value> argv[]);
- explicit ScheduledAction(v8::Handle<v8::Context> context, const WTF::String& code, const KURL& url = KURL())
- : m_context(context)
- , m_argc(0)
- , m_argv(0)
- , m_code(code, url)
- {
- }
-
- virtual ~ScheduledAction();
- virtual void execute(ScriptExecutionContext*);
-
- private:
- void execute(V8Proxy*);
-#if ENABLE(WORKERS)
- void execute(WorkerContext*);
-#endif
-
- OwnHandle<v8::Context> m_context;
- v8::Persistent<v8::Function> m_function;
- int m_argc;
- v8::Persistent<v8::Value>* m_argv;
- ScriptSourceCode m_code;
- };
-
-} // namespace WebCore
-
-#endif // ScheduledAction
diff --git a/WebCore/bindings/v8/ScopedDOMDataStore.cpp b/WebCore/bindings/v8/ScopedDOMDataStore.cpp
deleted file mode 100644
index 60a6c67..0000000
--- a/WebCore/bindings/v8/ScopedDOMDataStore.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "ScopedDOMDataStore.h"
-
-namespace WebCore {
-
-ScopedDOMDataStore::ScopedDOMDataStore(DOMData* domData)
- : DOMDataStore(domData)
-{
- m_domNodeMap = new DOMWrapperMap<Node>(&DOMDataStore::weakNodeCallback);
- m_domObjectMap = new DOMWrapperMap<void>(&DOMDataStore::weakDOMObjectCallback);
- m_activeDomObjectMap = new DOMWrapperMap<void>(&DOMDataStore::weakActiveDOMObjectCallback);
-#if ENABLE(SVG)
- m_domSvgElementInstanceMap = new DOMWrapperMap<SVGElementInstance>(&DOMDataStore::weakSVGElementInstanceCallback);
-#endif
-}
-
-ScopedDOMDataStore::~ScopedDOMDataStore()
-{
- delete m_domNodeMap;
- delete m_domObjectMap;
- delete m_activeDomObjectMap;
-#if ENABLE(SVG)
- delete m_domSvgElementInstanceMap;
-#endif
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScopedDOMDataStore.h b/WebCore/bindings/v8/ScopedDOMDataStore.h
deleted file mode 100644
index c63bab0..0000000
--- a/WebCore/bindings/v8/ScopedDOMDataStore.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 ScopedDOMDataStore_h
-#define ScopedDOMDataStore_h
-
-#include "DOMDataStore.h"
-
-namespace WebCore {
-
- // ScopedDOMDataStore
- //
- // ScopedDOMDataStore is a DOMDataStore that controls limits the lifetime of
- // the store to the lifetime of the object itself. In other words, when the
- // ScopedDOMDataStore object is deallocated, the maps that belong to the store
- // are deallocated as well.
- //
- class ScopedDOMDataStore : public DOMDataStore {
- public:
- ScopedDOMDataStore(DOMData*);
-
- // This can be called when WTF thread is tearing down.
- // We assume that all child threads running V8 instances are created by WTF.
- virtual ~ScopedDOMDataStore();
- };
-
-} // namespace WebCore
-
-#endif // ScopedDOMDataStore_h
diff --git a/WebCore/bindings/v8/ScriptCachedFrameData.cpp b/WebCore/bindings/v8/ScriptCachedFrameData.cpp
deleted file mode 100644
index dc28f32..0000000
--- a/WebCore/bindings/v8/ScriptCachedFrameData.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2010, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT OWNER 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.
- */
-
-#include "config.h"
-#include "ScriptCachedFrameData.h"
-
-#include "Frame.h"
-#include "ScriptController.h"
-#include "V8DOMWindow.h"
-
-namespace WebCore {
-
-ScriptCachedFrameData::ScriptCachedFrameData(Frame* frame)
- : m_domWindow(0)
-{
- v8::HandleScope handleScope;
- // The context can only be the context of the main world.
- ASSERT(V8Proxy::mainWorldContext(frame) == V8Proxy::context(frame));
- m_context.set(V8Proxy::mainWorldContext(frame));
- // The context can be 0, e.g. if JS is disabled in the browser.
- if (m_context.get().IsEmpty())
- return;
- m_global.set(m_context.get()->Global());
- m_domWindow = frame->domWindow();
-}
-
-DOMWindow* ScriptCachedFrameData::domWindow() const
-{
- return m_domWindow;
-}
-
-void ScriptCachedFrameData::restore(Frame* frame)
-{
- if (m_context.get().IsEmpty())
- return;
-
- v8::HandleScope handleScope;
- v8::Context::Scope contextScope(m_context.get());
-
- m_context.get()->ReattachGlobal(m_global.get());
- V8Proxy* proxy = V8Proxy::retrieve(frame);
- if (proxy)
- proxy->windowShell()->setContext(m_context.get());
-}
-
-void ScriptCachedFrameData::clear()
-{
- m_context.clear();
- m_global.clear();
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptCachedFrameData.h b/WebCore/bindings/v8/ScriptCachedFrameData.h
deleted file mode 100644
index 1aa1f62..0000000
--- a/WebCore/bindings/v8/ScriptCachedFrameData.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 ScriptCachedFrameData_h
-#define ScriptCachedFrameData_h
-
-#if PLATFORM(CHROMIUM)
-// We don't use WebKit's page caching, so this implementation is just a stub.
-
-namespace WebCore {
-
-class Frame;
-class DOMWindow;
-
-class ScriptCachedFrameData {
-public:
- ScriptCachedFrameData(Frame*) { }
- ~ScriptCachedFrameData() { }
-
- void restore(Frame*) { }
- void clear() { }
- DOMWindow* domWindow() const { return 0; }
-};
-
-} // namespace WebCore
-
-#elif PLATFORM(ANDROID) || PLATFORM(QT)
-// FIXME: the right guard should be ENABLE(PAGE_CACHE). Replace with the right guard, once
-// https://bugs.webkit.org/show_bug.cgi?id=35061 is fixed.
-//
-// On Android we do use WebKit's page cache. For now we don't support isolated worlds
-// so our implementation does not take them into account.
-
-#include "OwnHandle.h"
-#include <v8.h>
-#include <wtf/Noncopyable.h>
-
-namespace WebCore {
-
-class Frame;
-class DOMWindow;
-
-class ScriptCachedFrameData : public Noncopyable {
-public:
- ScriptCachedFrameData(Frame*);
- ~ScriptCachedFrameData() { }
-
- void restore(Frame*);
- void clear();
- DOMWindow* domWindow() const;
-
-private:
- OwnHandle<v8::Object> m_global;
- OwnHandle<v8::Context> m_context;
- DOMWindow* m_domWindow;
-};
-
-} // namespace WebCore
-
-#else
-#error You need to consider whether you want Page Cache and either add a stub or a real implementation.
-#endif // PLATFORM(CHROMIUM)
-
-#endif // ScriptCachedFrameData_h
diff --git a/WebCore/bindings/v8/ScriptCallStackFactory.cpp b/WebCore/bindings/v8/ScriptCallStackFactory.cpp
deleted file mode 100644
index f417cd5..0000000
--- a/WebCore/bindings/v8/ScriptCallStackFactory.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "ScriptCallStackFactory.h"
-
-#include "InspectorValues.h"
-#include "ScriptArguments.h"
-#include "ScriptCallFrame.h"
-#include "ScriptCallStack.h"
-#include "ScriptScope.h"
-#include "ScriptValue.h"
-#include "V8Binding.h"
-
-#include <v8-debug.h>
-
-namespace WebCore {
-
-static ScriptCallFrame toScriptCallFrame(v8::Handle<v8::StackFrame> frame)
-{
- String sourceName;
- v8::Local<v8::String> sourceNameValue(frame->GetScriptNameOrSourceURL());
- if (!sourceNameValue.IsEmpty())
- sourceName = toWebCoreString(sourceNameValue);
-
- String functionName;
- v8::Local<v8::String> functionNameValue(frame->GetFunctionName());
- if (!functionNameValue.IsEmpty())
- functionName = toWebCoreString(functionNameValue);
-
- int sourceLineNumber = frame->GetLineNumber();
- int sourceColumn = frame->GetColumn();
- return ScriptCallFrame(functionName, sourceName, sourceLineNumber, sourceColumn);
-}
-
-static void toScriptCallFramesVector(v8::Handle<v8::StackTrace> stackTrace, Vector<ScriptCallFrame>& scriptCallFrames, size_t maxStackSize, bool emptyStackIsAllowed)
-{
- ASSERT(v8::Context::InContext());
- int frameCount = stackTrace->GetFrameCount();
- if (frameCount > static_cast<int>(maxStackSize))
- frameCount = maxStackSize;
- for (int i = 0; i < frameCount; i++) {
- v8::Local<v8::StackFrame> stackFrame = stackTrace->GetFrame(i);
- scriptCallFrames.append(toScriptCallFrame(stackFrame));
- }
- if (!frameCount && !emptyStackIsAllowed) {
- // Successfully grabbed stack trace, but there are no frames. It may happen in case
- // when a bound function is called from native code for example.
- // Fallback to setting lineNumber to 0, and source and function name to "undefined".
- scriptCallFrames.append(ScriptCallFrame("undefined", "undefined", 0));
- }
-}
-
-static PassRefPtr<ScriptCallStack> createScriptCallStack(v8::Handle<v8::StackTrace> stackTrace, size_t maxStackSize, bool emptyStackIsAllowed)
-{
- ASSERT(v8::Context::InContext());
- v8::HandleScope scope;
- Vector<ScriptCallFrame> scriptCallFrames;
- toScriptCallFramesVector(stackTrace, scriptCallFrames, maxStackSize, emptyStackIsAllowed);
- return ScriptCallStack::create(scriptCallFrames);
-}
-
-PassRefPtr<ScriptCallStack> createScriptCallStack(v8::Handle<v8::StackTrace> stackTrace, size_t maxStackSize)
-{
- return createScriptCallStack(stackTrace, maxStackSize, true);
-}
-
-PassRefPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize, bool emptyStackIsAllowed)
-{
- if (!v8::Context::InContext())
- return 0;
- v8::HandleScope handleScope;
- v8::Handle<v8::StackTrace> stackTrace(v8::StackTrace::CurrentStackTrace(maxStackSize, stackTraceOptions));
- return createScriptCallStack(stackTrace, maxStackSize, emptyStackIsAllowed);
-}
-
-PassRefPtr<ScriptArguments> createScriptArguments(const v8::Arguments& v8arguments, unsigned skipArgumentCount)
-{
- v8::HandleScope scope;
- v8::Local<v8::Context> context = v8::Context::GetCurrent();
- ScriptState* state = ScriptState::forContext(context);
-
- Vector<ScriptValue> arguments;
- for (int i = skipArgumentCount; i < v8arguments.Length(); ++i)
- arguments.append(ScriptValue(v8arguments[i]));
-
- return ScriptArguments::create(state, arguments);
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptCallStackFactory.h b/WebCore/bindings/v8/ScriptCallStackFactory.h
deleted file mode 100644
index 096f6bf..0000000
--- a/WebCore/bindings/v8/ScriptCallStackFactory.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 ScriptCallStackFactory_h
-#define ScriptCallStackFactory_h
-
-#include <v8.h>
-#include <wtf/Forward.h>
-
-namespace WebCore {
-
-class ScriptArguments;
-class ScriptCallStack;
-class ScriptState;
-
-const v8::StackTrace::StackTraceOptions stackTraceOptions = static_cast<v8::StackTrace::StackTraceOptions>(
- v8::StackTrace::kLineNumber
- | v8::StackTrace::kColumnOffset
- | v8::StackTrace::kScriptNameOrSourceURL
- | v8::StackTrace::kFunctionName);
-
-PassRefPtr<ScriptCallStack> createScriptCallStack(v8::Handle<v8::StackTrace>, size_t maxStackSize);
-PassRefPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize, bool emptyStackIsAllowed = false);
-PassRefPtr<ScriptArguments> createScriptArguments(const v8::Arguments& v8arguments, unsigned skipArgumentCount);
-
-} // namespace WebCore
-
-#endif // ScriptCallStackFactory_h
diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp
deleted file mode 100644
index 570dcbc..0000000
--- a/WebCore/bindings/v8/ScriptController.cpp
+++ /dev/null
@@ -1,501 +0,0 @@
-/*
- * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
- * 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "ScriptController.h"
-
-#include "PlatformBridge.h"
-#include "Document.h"
-#include "ScriptCallStack.h"
-#include "ScriptCallStackFactory.h"
-#include "ScriptableDocumentParser.h"
-#include "DOMWindow.h"
-#include "Event.h"
-#include "EventListener.h"
-#include "EventNames.h"
-#include "Frame.h"
-#include "FrameLoaderClient.h"
-#include "Node.h"
-#include "NotImplemented.h"
-#include "npruntime_impl.h"
-#include "npruntime_priv.h"
-#include "NPV8Object.h"
-#include "ScriptSourceCode.h"
-#include "Settings.h"
-#include "UserGestureIndicator.h"
-#include "V8Binding.h"
-#include "V8BindingState.h"
-#include "V8DOMWindow.h"
-#include "V8Event.h"
-#include "V8HiddenPropertyName.h"
-#include "V8HTMLEmbedElement.h"
-#include "V8IsolatedContext.h"
-#include "V8NPObject.h"
-#include "V8Proxy.h"
-#include "Widget.h"
-#include "XSSAuditor.h"
-#include <wtf/StdLibExtras.h>
-#include <wtf/text/CString.h>
-
-#if PLATFORM(QT)
-#include <QScriptEngine>
-#endif
-
-namespace WebCore {
-
-void ScriptController::initializeThreading()
-{
- static bool initializedThreading = false;
- if (!initializedThreading) {
- WTF::initializeThreading();
- WTF::initializeMainThread();
- initializedThreading = true;
- }
-}
-
-void ScriptController::setFlags(const char* string, int length)
-{
- v8::V8::SetFlagsFromString(string, length);
-}
-
-Frame* ScriptController::retrieveFrameForEnteredContext()
-{
- return V8Proxy::retrieveFrameForEnteredContext();
-}
-
-Frame* ScriptController::retrieveFrameForCurrentContext()
-{
- return V8Proxy::retrieveFrameForCurrentContext();
-}
-
-bool ScriptController::canAccessFromCurrentOrigin(Frame *frame)
-{
- return !v8::Context::InContext() || V8BindingSecurity::canAccessFrame(V8BindingState::Only(), frame, true);
-}
-
-bool ScriptController::isSafeScript(Frame* target)
-{
- return V8BindingSecurity::canAccessFrame(V8BindingState::Only(), target, true);
-}
-
-void ScriptController::gcProtectJSWrapper(void* domObject)
-{
- V8GCController::gcProtect(domObject);
-}
-
-void ScriptController::gcUnprotectJSWrapper(void* domObject)
-{
- V8GCController::gcUnprotect(domObject);
-}
-
-ScriptController::ScriptController(Frame* frame)
- : m_frame(frame)
- , m_sourceURL(0)
- , m_inExecuteScript(false)
- , m_processingTimerCallback(false)
- , m_paused(false)
- , m_allowPopupsFromPlugin(false)
- , m_proxy(new V8Proxy(frame))
-#if ENABLE(NETSCAPE_PLUGIN_API)
- , m_windowScriptNPObject(0)
-#endif
- , m_XSSAuditor(new XSSAuditor(frame))
-{
-}
-
-ScriptController::~ScriptController()
-{
- m_proxy->disconnectFrame();
-}
-
-void ScriptController::clearScriptObjects()
-{
- PluginObjectMap::iterator it = m_pluginObjects.begin();
- for (; it != m_pluginObjects.end(); ++it) {
- _NPN_UnregisterObject(it->second);
- _NPN_ReleaseObject(it->second);
- }
- m_pluginObjects.clear();
-
-#if ENABLE(NETSCAPE_PLUGIN_API)
- if (m_windowScriptNPObject) {
- // Call _NPN_DeallocateObject() instead of _NPN_ReleaseObject() so that we don't leak if a plugin fails to release the window
- // script object properly.
- // This shouldn't cause any problems for plugins since they should have already been stopped and destroyed at this point.
- _NPN_DeallocateObject(m_windowScriptNPObject);
- m_windowScriptNPObject = 0;
- }
-#endif
-}
-
-void ScriptController::updateSecurityOrigin()
-{
- m_proxy->windowShell()->updateSecurityOrigin();
-}
-
-void ScriptController::updatePlatformScriptObjects()
-{
- notImplemented();
-}
-
-bool ScriptController::processingUserGesture()
-{
- Frame* activeFrame = V8Proxy::retrieveFrameForEnteredContext();
- // No script is running, so it is user-initiated unless the gesture stack
- // explicitly says it is not.
- if (!activeFrame)
- return UserGestureIndicator::getUserGestureState() != DefinitelyNotProcessingUserGesture;
-
- V8Proxy* activeProxy = activeFrame->script()->proxy();
-
- v8::HandleScope handleScope;
- v8::Handle<v8::Context> v8Context = V8Proxy::mainWorldContext(activeFrame);
- // FIXME: find all cases context can be empty:
- // 1) JS is disabled;
- // 2) page is NULL;
- if (v8Context.IsEmpty())
- return true;
-
- v8::Context::Scope scope(v8Context);
-
- v8::Handle<v8::Object> global = v8Context->Global();
- v8::Handle<v8::String> eventSymbol = V8HiddenPropertyName::event();
- v8::Handle<v8::Value> jsEvent = global->GetHiddenValue(eventSymbol);
- Event* event = V8DOMWrapper::isValidDOMObject(jsEvent) ? V8Event::toNative(v8::Handle<v8::Object>::Cast(jsEvent)) : 0;
-
- // Based on code from JSC's ScriptController::processingUserGesture.
- // Note: This is more liberal than Firefox's implementation.
- if (event) {
- // Event::fromUserGesture will return false when UserGestureIndicator::processingUserGesture() returns false.
- return event->fromUserGesture();
- }
- // FIXME: We check the javascript anchor navigation from the last entered
- // frame becuase it should only be initiated on the last entered frame in
- // which execution began if it does happen.
- const String* sourceURL = activeFrame->script()->sourceURL();
- if (sourceURL && sourceURL->isNull() && !activeProxy->timerCallback()) {
- // This is the <a href="javascript:window.open('...')> case -> we let it through.
- return true;
- }
- if (activeFrame->script()->allowPopupsFromPlugin())
- return true;
- // This is the <script>window.open(...)</script> case or a timer callback -> block it.
- // Based on JSC version, use returned value of UserGestureIndicator::processingUserGesture for all other situations.
- return UserGestureIndicator::processingUserGesture();
-}
-
-bool ScriptController::anyPageIsProcessingUserGesture() const
-{
- // FIXME: is this right?
- return ScriptController::processingUserGesture();
-}
-
-void ScriptController::evaluateInIsolatedWorld(unsigned worldID, const Vector<ScriptSourceCode>& sources)
-{
- m_proxy->evaluateInIsolatedWorld(worldID, sources, 0);
-}
-
-void ScriptController::evaluateInIsolatedWorld(unsigned worldID, const Vector<ScriptSourceCode>& sources, int extensionGroup)
-{
- m_proxy->evaluateInIsolatedWorld(worldID, sources, extensionGroup);
-}
-
-// Evaluate a script file in the environment of this proxy.
-ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode, ShouldAllowXSS shouldAllowXSS)
-{
- String sourceURL = sourceCode.url();
- const String* savedSourceURL = m_sourceURL;
- m_sourceURL = &sourceURL;
-
- if (shouldAllowXSS == DoNotAllowXSS && !m_XSSAuditor->canEvaluate(sourceCode.source())) {
- // This script is not safe to be evaluated.
- return ScriptValue();
- }
-
- v8::HandleScope handleScope;
- v8::Handle<v8::Context> v8Context = V8Proxy::mainWorldContext(m_proxy->frame());
- if (v8Context.IsEmpty())
- return ScriptValue();
-
- v8::Context::Scope scope(v8Context);
-
- RefPtr<Frame> protect(m_frame);
-
- v8::Local<v8::Value> object = m_proxy->evaluate(sourceCode, 0);
-
- // Evaluating the JavaScript could cause the frame to be deallocated
- // so we start the keep alive timer here.
- m_frame->keepAlive();
-
- m_sourceURL = savedSourceURL;
-
- if (object.IsEmpty() || object->IsUndefined())
- return ScriptValue();
-
- return ScriptValue(object);
-}
-
-TextPosition0 ScriptController::eventHandlerPosition() const
-{
- ScriptableDocumentParser* parser = m_frame->document()->scriptableDocumentParser();
- if (parser)
- return parser->textPosition();
- return TextPosition0::minimumPosition();
-}
-
-void ScriptController::finishedWithEvent(Event* event)
-{
- m_proxy->finishedWithEvent(event);
-}
-
-// Create a V8 object with an interceptor of NPObjectPropertyGetter.
-void ScriptController::bindToWindowObject(Frame* frame, const String& key, NPObject* object)
-{
- v8::HandleScope handleScope;
-
- v8::Handle<v8::Context> v8Context = V8Proxy::mainWorldContext(frame);
- if (v8Context.IsEmpty())
- return;
-
- v8::Context::Scope scope(v8Context);
-
- v8::Handle<v8::Object> value = createV8ObjectForNPObject(object, 0);
-
- // Attach to the global object.
- v8::Handle<v8::Object> global = v8Context->Global();
- global->Set(v8String(key), value);
-}
-
-void ScriptController::collectGarbage()
-{
- v8::HandleScope handleScope;
-
- v8::Persistent<v8::Context> v8Context = v8::Context::New();
- if (v8Context.IsEmpty())
- return;
- {
- v8::Context::Scope scope(v8Context);
- v8::Local<v8::String> source = v8::String::New("if (gc) gc();");
- v8::Local<v8::String> name = v8::String::New("gc");
- v8::Handle<v8::Script> script = v8::Script::Compile(source, name);
- if (!script.IsEmpty())
- script->Run();
- }
- v8Context.Dispose();
-}
-
-void ScriptController::lowMemoryNotification()
-{
- v8::V8::LowMemoryNotification();
-}
-
-bool ScriptController::haveInterpreter() const
-{
- return m_proxy->windowShell()->isContextInitialized();
-}
-
-PassScriptInstance ScriptController::createScriptInstanceForWidget(Widget* widget)
-{
- ASSERT(widget);
-
- if (widget->isFrameView())
- return 0;
-
- NPObject* npObject = PlatformBridge::pluginScriptableObject(widget);
-
- if (!npObject)
- return 0;
-
- // Frame Memory Management for NPObjects
- // -------------------------------------
- // NPObjects are treated differently than other objects wrapped by JS.
- // NPObjects can be created either by the browser (e.g. the main
- // window object) or by the plugin (the main plugin object
- // for a HTMLEmbedElement). Further, unlike most DOM Objects, the frame
- // is especially careful to ensure NPObjects terminate at frame teardown because
- // if a plugin leaks a reference, it could leak its objects (or the browser's objects).
- //
- // The Frame maintains a list of plugin objects (m_pluginObjects)
- // which it can use to quickly find the wrapped embed object.
- //
- // Inside the NPRuntime, we've added a few methods for registering
- // wrapped NPObjects. The purpose of the registration is because
- // javascript garbage collection is non-deterministic, yet we need to
- // be able to tear down the plugin objects immediately. When an object
- // is registered, javascript can use it. When the object is destroyed,
- // or when the object's "owning" object is destroyed, the object will
- // be un-registered, and the javascript engine must not use it.
- //
- // Inside the javascript engine, the engine can keep a reference to the
- // NPObject as part of its wrapper. However, before accessing the object
- // it must consult the _NPN_Registry.
-
- v8::Local<v8::Object> wrapper = createV8ObjectForNPObject(npObject, 0);
-
-#ifdef ANDROID_FIX
- // TODO: this should be up streamed.
- // HTMLEmbedElement::getInstance() will call this function with its closest
- // ancestor who has the objectTag. So this "widget" may be already in the
- // HashMap. If it does, even m_pluginObjects.set() is a no-op, we do need to
- // call _NPN_ReleaseObject on the npObject to balance the reference count.
- PluginObjectMap::iterator it = m_pluginObjects.find(widget);
- if (it != m_pluginObjects.end()) {
- ASSERT(it->second == npObject);
- _NPN_ReleaseObject(it->second);
- }
-#endif
-
- // Track the plugin object. We've been given a reference to the object.
- m_pluginObjects.set(widget, npObject);
-
- return V8ScriptInstance::create(wrapper);
-}
-
-void ScriptController::cleanupScriptObjectsForPlugin(Widget* nativeHandle)
-{
- PluginObjectMap::iterator it = m_pluginObjects.find(nativeHandle);
- if (it == m_pluginObjects.end())
- return;
- _NPN_UnregisterObject(it->second);
- _NPN_ReleaseObject(it->second);
- m_pluginObjects.remove(it);
-}
-
-void ScriptController::getAllWorlds(Vector<DOMWrapperWorld*>& worlds)
-{
- worlds.append(mainThreadNormalWorld());
-}
-
-void ScriptController::evaluateInWorld(const ScriptSourceCode& source,
- DOMWrapperWorld* world)
-{
- Vector<ScriptSourceCode> sources;
- sources.append(source);
- // FIXME: Get an ID from the world param.
- evaluateInIsolatedWorld(0, sources);
-}
-
-static NPObject* createNoScriptObject()
-{
- notImplemented();
- return 0;
-}
-
-static NPObject* createScriptObject(Frame* frame)
-{
- v8::HandleScope handleScope;
- v8::Handle<v8::Context> v8Context = V8Proxy::mainWorldContext(frame);
- if (v8Context.IsEmpty())
- return createNoScriptObject();
-
- v8::Context::Scope scope(v8Context);
- DOMWindow* window = frame->domWindow();
- v8::Handle<v8::Value> global = toV8(window);
- ASSERT(global->IsObject());
- return npCreateV8ScriptObject(0, v8::Handle<v8::Object>::Cast(global), window);
-}
-
-NPObject* ScriptController::windowScriptNPObject()
-{
- if (m_windowScriptNPObject)
- return m_windowScriptNPObject;
-
- if (canExecuteScripts(NotAboutToExecuteScript)) {
- // JavaScript is enabled, so there is a JavaScript window object.
- // Return an NPObject bound to the window object.
- m_windowScriptNPObject = createScriptObject(m_frame);
- _NPN_RegisterObject(m_windowScriptNPObject, 0);
- } else {
- // JavaScript is not enabled, so we cannot bind the NPObject to the
- // JavaScript window object. Instead, we create an NPObject of a
- // different class, one which is not bound to a JavaScript object.
- m_windowScriptNPObject = createNoScriptObject();
- }
- return m_windowScriptNPObject;
-}
-
-NPObject* ScriptController::createScriptObjectForPluginElement(HTMLPlugInElement* plugin)
-{
- // Can't create NPObjects when JavaScript is disabled.
- if (!canExecuteScripts(NotAboutToExecuteScript))
- return createNoScriptObject();
-
- v8::HandleScope handleScope;
- v8::Handle<v8::Context> v8Context = V8Proxy::mainWorldContext(m_frame);
- if (v8Context.IsEmpty())
- return createNoScriptObject();
- v8::Context::Scope scope(v8Context);
-
- DOMWindow* window = m_frame->domWindow();
- v8::Handle<v8::Value> v8plugin = toV8(static_cast<HTMLEmbedElement*>(plugin));
- if (!v8plugin->IsObject())
- return createNoScriptObject();
-
- return npCreateV8ScriptObject(0, v8::Handle<v8::Object>::Cast(v8plugin), window);
-}
-
-
-void ScriptController::clearWindowShell(bool)
-{
- // V8 binding expects ScriptController::clearWindowShell only be called
- // when a frame is loading a new page. V8Proxy::clearForNavigation
- // creates a new context for the new page.
- m_proxy->clearForNavigation();
-}
-
-#if ENABLE(INSPECTOR)
-void ScriptController::setCaptureCallStackForUncaughtExceptions(bool value)
-{
- v8::V8::SetCaptureStackTraceForUncaughtExceptions(value, ScriptCallStack::maxCallStackSizeToCapture, stackTraceOptions);
-}
-#endif
-
-void ScriptController::attachDebugger(void*)
-{
- notImplemented();
-}
-
-void ScriptController::updateDocument()
-{
- m_proxy->windowShell()->updateDocument();
-}
-
-void ScriptController::namedItemAdded(HTMLDocument* doc, const AtomicString& name)
-{
- m_proxy->windowShell()->namedItemAdded(doc, name);
-}
-
-void ScriptController::namedItemRemoved(HTMLDocument* doc, const AtomicString& name)
-{
- m_proxy->windowShell()->namedItemRemoved(doc, name);
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptController.h b/WebCore/bindings/v8/ScriptController.h
deleted file mode 100644
index d093f39..0000000
--- a/WebCore/bindings/v8/ScriptController.h
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * Copyright (C) 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 ScriptController_h
-#define ScriptController_h
-
-#include "ScriptControllerBase.h"
-#include "ScriptInstance.h"
-#include "ScriptValue.h"
-
-#include "V8Proxy.h"
-
-#include <v8.h>
-
-#include <wtf/Forward.h>
-#include <wtf/HashMap.h>
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
-
-#if PLATFORM(QT)
-#include <qglobal.h>
-QT_BEGIN_NAMESPACE
-class QScriptEngine;
-QT_END_NAMESPACE
-#endif
-
-struct NPObject;
-
-namespace WebCore {
-
-class DOMWrapperWorld;
-class Event;
-class Frame;
-class HTMLPlugInElement;
-class ScriptSourceCode;
-class Widget;
-class XSSAuditor;
-
-class ScriptController {
-public:
- ScriptController(Frame*);
- ~ScriptController();
-
- // FIXME: V8Proxy should either be folded into ScriptController
- // or this accessor should be made JSProxy*
- V8Proxy* proxy() { return m_proxy.get(); }
-
- ScriptValue executeScript(const ScriptSourceCode&, ShouldAllowXSS shouldAllowXSS = DoNotAllowXSS);
- ScriptValue executeScript(const String& script, bool forceUserGesture = false, ShouldAllowXSS shouldAllowXSS = DoNotAllowXSS);
-
- // Returns true if argument is a JavaScript URL.
- bool executeIfJavaScriptURL(const KURL&, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL = ReplaceDocumentIfJavaScriptURL);
-
- // This function must be called from the main thread. It is safe to call it repeatedly.
- static void initializeThreading();
-
- // Evaluate a script file in the environment of this proxy.
- // If succeeded, 'succ' is set to true and result is returned
- // as a string.
- ScriptValue evaluate(const ScriptSourceCode&, ShouldAllowXSS shouldAllowXSS = DoNotAllowXSS);
-
- void evaluateInIsolatedWorld(unsigned worldID, const Vector<ScriptSourceCode>&);
-
- // Executes JavaScript in an isolated world. The script gets its own global scope,
- // its own prototypes for intrinsic JavaScript objects (String, Array, and so-on),
- // and its own wrappers for all DOM nodes and DOM constructors.
- //
- // If an isolated world with the specified ID already exists, it is reused.
- // Otherwise, a new world is created.
- //
- // If the worldID is 0, a new world is always created.
- //
- // FIXME: Get rid of extensionGroup here.
- void evaluateInIsolatedWorld(unsigned worldID, const Vector<ScriptSourceCode>&, int extensionGroup);
-
- // Masquerade 'this' as the windowShell.
- // This is a bit of a hack, but provides reasonable compatibility
- // with what JSC does as well.
- ScriptController* windowShell(DOMWrapperWorld*) { return this; }
- ScriptController* existingWindowShell(DOMWrapperWorld*) { return this; }
-
- XSSAuditor* xssAuditor() { return m_XSSAuditor.get(); }
-
- void collectGarbage();
-
- // Notify V8 that the system is running low on memory.
- void lowMemoryNotification();
-
- // Creates a property of the global object of a frame.
- void bindToWindowObject(Frame*, const String& key, NPObject*);
-
- PassScriptInstance createScriptInstanceForWidget(Widget*);
-
- // Check if the javascript engine has been initialized.
- bool haveInterpreter() const;
-
- static bool canAccessFromCurrentOrigin(Frame*);
-
-#if ENABLE(INSPECTOR)
- static void setCaptureCallStackForUncaughtExceptions(bool);
-#endif
-
- bool canExecuteScripts(ReasonForCallingCanExecuteScripts);
-
- // FIXME: void* is a compile hack.
- void attachDebugger(void*);
-
- // --- Static methods assume we are running VM in single thread, ---
- // --- and there is only one VM instance. ---
-
- // Returns the frame for the entered context. See comments in
- // V8Proxy::retrieveFrameForEnteredContext() for more information.
- static Frame* retrieveFrameForEnteredContext();
-
- // Returns the frame for the current context. See comments in
- // V8Proxy::retrieveFrameForEnteredContext() for more information.
- static Frame* retrieveFrameForCurrentContext();
-
- // Check whether it is safe to access a frame in another domain.
- static bool isSafeScript(Frame*);
-
- // Pass command-line flags to the JS engine.
- static void setFlags(const char* string, int length);
-
- // Protect and unprotect the JS wrapper from garbage collected.
- static void gcProtectJSWrapper(void*);
- static void gcUnprotectJSWrapper(void*);
-
- void finishedWithEvent(Event*);
-
- TextPosition0 eventHandlerPosition() const;
-
- void setProcessingTimerCallback(bool processingTimerCallback) { m_processingTimerCallback = processingTimerCallback; }
- // FIXME: Currently we don't use the parameter world at all.
- // See http://trac.webkit.org/changeset/54182
- static bool processingUserGesture();
- bool anyPageIsProcessingUserGesture() const;
-
- void setPaused(bool paused) { m_paused = paused; }
- bool isPaused() const { return m_paused; }
-
- const String* sourceURL() const { return m_sourceURL; } // 0 if we are not evaluating any script.
-
- void clearWindowShell(bool = false);
- void updateDocument();
-
- void namedItemAdded(HTMLDocument*, const AtomicString&);
- void namedItemRemoved(HTMLDocument*, const AtomicString&);
-
- void updateSecurityOrigin();
- void clearScriptObjects();
- void updatePlatformScriptObjects();
- void cleanupScriptObjectsForPlugin(Widget*);
-
-#if ENABLE(NETSCAPE_PLUGIN_API)
- NPObject* createScriptObjectForPluginElement(HTMLPlugInElement*);
- NPObject* windowScriptNPObject();
-#endif
-
-#if PLATFORM(QT)
- QScriptEngine* qtScriptEngine();
-#endif
-
- // Dummy method to avoid a bunch of ifdef's in WebCore.
- void evaluateInWorld(const ScriptSourceCode&, DOMWrapperWorld*);
- static void getAllWorlds(Vector<DOMWrapperWorld*>& worlds);
-
- void setAllowPopupsFromPlugin(bool allowPopupsFromPlugin) { m_allowPopupsFromPlugin = allowPopupsFromPlugin; }
- bool allowPopupsFromPlugin() const { return m_allowPopupsFromPlugin; }
-
-private:
- Frame* m_frame;
- const String* m_sourceURL;
-
- bool m_inExecuteScript;
-
- bool m_processingTimerCallback;
- bool m_paused;
- bool m_allowPopupsFromPlugin;
-
- OwnPtr<V8Proxy> m_proxy;
- typedef HashMap<Widget*, NPObject*> PluginObjectMap;
-#if PLATFORM(QT)
- OwnPtr<QScriptEngine> m_qtScriptEngine;
-#endif
-
- // A mapping between Widgets and their corresponding script object.
- // This list is used so that when the plugin dies, we can immediately
- // invalidate all sub-objects which are associated with that plugin.
- // The frame keeps a NPObject reference for each item on the list.
- PluginObjectMap m_pluginObjects;
-#if ENABLE(NETSCAPE_PLUGIN_API)
- NPObject* m_windowScriptNPObject;
-#endif
- // The XSSAuditor associated with this ScriptController.
- OwnPtr<XSSAuditor> m_XSSAuditor;
-};
-
-} // namespace WebCore
-
-#endif // ScriptController_h
diff --git a/WebCore/bindings/v8/ScriptControllerQt.cpp b/WebCore/bindings/v8/ScriptControllerQt.cpp
deleted file mode 100644
index 11bcb01..0000000
--- a/WebCore/bindings/v8/ScriptControllerQt.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
- *
- * 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.
- */
-
-#include "config.h"
-#include "ScriptController.h"
-
-#include <QScriptEngine>
-
-namespace WebCore {
-
-QScriptEngine* ScriptController::qtScriptEngine()
-{
- if (!m_qtScriptEngine) {
- v8::HandleScope handleScope;
- v8::Handle<v8::Context> v8Context = V8Proxy::mainWorldContext(m_frame);
- v8::Context::Scope scope(v8Context);
- if (v8Context.IsEmpty())
- return 0;
- m_qtScriptEngine = new QScriptEngine;
- }
- return m_qtScriptEngine.get();
-}
-
-}
-// vim: ts=4 sw=4 et
diff --git a/WebCore/bindings/v8/ScriptDebugServer.cpp b/WebCore/bindings/v8/ScriptDebugServer.cpp
deleted file mode 100644
index 4b4611a..0000000
--- a/WebCore/bindings/v8/ScriptDebugServer.cpp
+++ /dev/null
@@ -1,472 +0,0 @@
-/*
- * Copyright (c) 2010, Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "ScriptDebugServer.h"
-
-#if ENABLE(JAVASCRIPT_DEBUGGER)
-
-#include "Frame.h"
-#include "JavaScriptCallFrame.h"
-#include "Page.h"
-#include "ScriptDebugListener.h"
-#include "V8Binding.h"
-#include "V8DOMWindow.h"
-#include "V8Proxy.h"
-#include <wtf/StdLibExtras.h>
-
-namespace WebCore {
-
-namespace {
-
-class ClientDataImpl : public v8::Debug::ClientData {
-public:
- ClientDataImpl(PassOwnPtr<ScriptDebugServer::Task> task) : m_task(task) { }
- virtual ~ClientDataImpl() { }
- ScriptDebugServer::Task* task() const { return m_task.get(); }
-private:
- OwnPtr<ScriptDebugServer::Task> m_task;
-};
-
-}
-
-static Frame* retrieveFrame(v8::Handle<v8::Context> context)
-{
- if (context.IsEmpty())
- return 0;
-
- // Test that context has associated global dom window object.
- v8::Handle<v8::Object> global = context->Global();
- if (global.IsEmpty())
- return 0;
-
- global = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), global);
- if (global.IsEmpty())
- return 0;
-
- return V8Proxy::retrieveFrame(context);
-}
-
-ScriptDebugServer& ScriptDebugServer::shared()
-{
- DEFINE_STATIC_LOCAL(ScriptDebugServer, server, ());
- return server;
-}
-
-ScriptDebugServer::ScriptDebugServer()
- : m_pauseOnExceptionsState(DontPauseOnExceptions)
- , m_pausedPage(0)
- , m_enabled(true)
- , m_breakpointsActivated(true)
-{
-}
-
-void ScriptDebugServer::setDebuggerScriptSource(const String& scriptSource)
-{
- m_debuggerScriptSource = scriptSource;
-}
-
-void ScriptDebugServer::addListener(ScriptDebugListener* listener, Page* page)
-{
- if (!m_enabled)
- return;
-
- V8Proxy* proxy = V8Proxy::retrieve(page->mainFrame());
- if (!proxy)
- return;
-
- v8::HandleScope scope;
- v8::Local<v8::Context> debuggerContext = v8::Debug::GetDebugContext();
- v8::Context::Scope contextScope(debuggerContext);
-
- if (!m_listenersMap.size()) {
- ensureDebuggerScriptCompiled();
- ASSERT(!m_debuggerScript.get()->IsUndefined());
- v8::Debug::SetDebugEventListener2(&ScriptDebugServer::v8DebugEventCallback);
- }
- m_listenersMap.set(page, listener);
-
- V8DOMWindowShell* shell = proxy->windowShell();
- if (!shell->isContextInitialized())
- return;
- v8::Handle<v8::Context> context = shell->context();
- v8::Handle<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("getScripts")));
- v8::Handle<v8::Value> argv[] = { context->GetData() };
- v8::Handle<v8::Value> value = getScriptsFunction->Call(m_debuggerScript.get(), 1, argv);
- if (value.IsEmpty())
- return;
- ASSERT(!value->IsUndefined() && value->IsArray());
- v8::Handle<v8::Array> scriptsArray = v8::Handle<v8::Array>::Cast(value);
- for (unsigned i = 0; i < scriptsArray->Length(); ++i)
- dispatchDidParseSource(listener, v8::Handle<v8::Object>::Cast(scriptsArray->Get(v8::Integer::New(i))));
-}
-
-void ScriptDebugServer::removeListener(ScriptDebugListener* listener, Page* page)
-{
- if (!m_listenersMap.contains(page))
- return;
-
- if (m_pausedPage == page)
- continueProgram();
-
- m_listenersMap.remove(page);
-
- if (m_listenersMap.isEmpty())
- v8::Debug::SetDebugEventListener(0);
- // FIXME: Remove all breakpoints set by the agent.
-}
-
-String ScriptDebugServer::setBreakpoint(const String& sourceID, unsigned lineNumber, const String& condition, bool enabled, unsigned* actualLineNumber)
-{
- v8::HandleScope scope;
- v8::Local<v8::Context> debuggerContext = v8::Debug::GetDebugContext();
- v8::Context::Scope contextScope(debuggerContext);
-
- v8::Local<v8::Object> args = v8::Object::New();
- args->Set(v8::String::New("scriptId"), v8String(sourceID));
- args->Set(v8::String::New("lineNumber"), v8::Integer::New(lineNumber));
- args->Set(v8::String::New("condition"), v8String(condition));
- args->Set(v8::String::New("enabled"), v8::Boolean::New(enabled));
-
- v8::Handle<v8::Function> setBreakpointFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("setBreakpoint")));
- v8::Handle<v8::Value> breakpointId = v8::Debug::Call(setBreakpointFunction, args);
- if (!breakpointId->IsString())
- return "";
- *actualLineNumber = args->Get(v8::String::New("lineNumber"))->Int32Value();
- return v8StringToWebCoreString(breakpointId->ToString());
-}
-
-void ScriptDebugServer::removeBreakpoint(const String& breakpointId)
-{
- v8::HandleScope scope;
- v8::Local<v8::Context> debuggerContext = v8::Debug::GetDebugContext();
- v8::Context::Scope contextScope(debuggerContext);
-
- v8::Local<v8::Object> args = v8::Object::New();
- args->Set(v8::String::New("breakpointId"), v8String(breakpointId));
-
- v8::Handle<v8::Function> removeBreakpointFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("removeBreakpoint")));
- v8::Debug::Call(removeBreakpointFunction, args);
-}
-
-void ScriptDebugServer::clearBreakpoints()
-{
- ensureDebuggerScriptCompiled();
- v8::HandleScope scope;
- v8::Local<v8::Context> debuggerContext = v8::Debug::GetDebugContext();
- v8::Context::Scope contextScope(debuggerContext);
-
- v8::Handle<v8::Function> clearBreakpoints = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("clearBreakpoints")));
- v8::Debug::Call(clearBreakpoints);
-}
-
-void ScriptDebugServer::setBreakpointsActivated(bool activated)
-{
- ensureDebuggerScriptCompiled();
- v8::HandleScope scope;
- v8::Local<v8::Context> debuggerContext = v8::Debug::GetDebugContext();
- v8::Context::Scope contextScope(debuggerContext);
-
- v8::Local<v8::Object> args = v8::Object::New();
- args->Set(v8::String::New("enabled"), v8::Boolean::New(activated));
- v8::Handle<v8::Function> setBreakpointsActivated = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("setBreakpointsActivated")));
- v8::Debug::Call(setBreakpointsActivated, args);
-
- m_breakpointsActivated = activated;
-}
-
-ScriptDebugServer::PauseOnExceptionsState ScriptDebugServer::pauseOnExceptionsState()
-{
- ensureDebuggerScriptCompiled();
- v8::HandleScope scope;
- v8::Context::Scope contextScope(v8::Debug::GetDebugContext());
-
- v8::Handle<v8::Function> function = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("pauseOnExceptionsState")));
- v8::Handle<v8::Value> argv[] = { v8::Handle<v8::Value>() };
- v8::Handle<v8::Value> result = function->Call(m_debuggerScript.get(), 0, argv);
- return static_cast<ScriptDebugServer::PauseOnExceptionsState>(result->Int32Value());
-}
-
-void ScriptDebugServer::setPauseOnExceptionsState(PauseOnExceptionsState pauseOnExceptionsState)
-{
- ensureDebuggerScriptCompiled();
- v8::HandleScope scope;
- v8::Context::Scope contextScope(v8::Debug::GetDebugContext());
-
- v8::Handle<v8::Function> setPauseOnExceptionsFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("setPauseOnExceptionsState")));
- v8::Handle<v8::Value> argv[] = { v8::Int32::New(pauseOnExceptionsState) };
- setPauseOnExceptionsFunction->Call(m_debuggerScript.get(), 1, argv);
-}
-
-void ScriptDebugServer::setPauseOnNextStatement(bool pause)
-{
- if (m_pausedPage)
- return;
- if (pause)
- v8::Debug::DebugBreak();
- else
- v8::Debug::CancelDebugBreak();
-}
-
-void ScriptDebugServer::breakProgram()
-{
- DEFINE_STATIC_LOCAL(v8::Persistent<v8::FunctionTemplate>, callbackTemplate, ());
-
- if (!m_breakpointsActivated)
- return;
-
- if (!v8::Context::InContext())
- return;
-
- if (callbackTemplate.IsEmpty()) {
- callbackTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New());
- callbackTemplate->SetCallHandler(&ScriptDebugServer::breakProgramCallback);
- }
-
- v8::Handle<v8::Context> context = v8::Context::GetCurrent();
- if (context.IsEmpty())
- return;
-
- m_pausedPageContext = *context;
- v8::Handle<v8::Function> breakProgramFunction = callbackTemplate->GetFunction();
- v8::Debug::Call(breakProgramFunction);
- m_pausedPageContext.Clear();
-}
-
-void ScriptDebugServer::continueProgram()
-{
- if (m_pausedPage)
- m_clientMessageLoop->quitNow();
- didResume();
-}
-
-void ScriptDebugServer::stepIntoStatement()
-{
- ASSERT(m_pausedPage);
- v8::Handle<v8::Function> function = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("stepIntoStatement")));
- v8::Handle<v8::Value> argv[] = { m_executionState.get() };
- function->Call(m_debuggerScript.get(), 1, argv);
- continueProgram();
-}
-
-void ScriptDebugServer::stepOverStatement()
-{
- ASSERT(m_pausedPage);
- v8::Handle<v8::Function> function = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("stepOverStatement")));
- v8::Handle<v8::Value> argv[] = { m_executionState.get() };
- function->Call(m_debuggerScript.get(), 1, argv);
- continueProgram();
-}
-
-void ScriptDebugServer::stepOutOfFunction()
-{
- ASSERT(m_pausedPage);
- v8::Handle<v8::Function> function = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("stepOutOfFunction")));
- v8::Handle<v8::Value> argv[] = { m_executionState.get() };
- function->Call(m_debuggerScript.get(), 1, argv);
- continueProgram();
-}
-
-bool ScriptDebugServer::editScriptSource(const String& sourceID, const String& newContent, String& newSourceOrErrorMessage)
-{
- ensureDebuggerScriptCompiled();
- v8::HandleScope scope;
-
- OwnPtr<v8::Context::Scope> contextScope;
- if (!m_pausedPage)
- contextScope.set(new v8::Context::Scope(v8::Debug::GetDebugContext()));
-
- v8::Handle<v8::Function> function = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("editScriptSource")));
- v8::Handle<v8::Value> argv[] = { v8String(sourceID), v8String(newContent) };
-
- v8::TryCatch tryCatch;
- tryCatch.SetVerbose(false);
- v8::Handle<v8::Value> result = function->Call(m_debuggerScript.get(), 2, argv);
- if (tryCatch.HasCaught()) {
- v8::Local<v8::Message> message = tryCatch.Message();
- if (!message.IsEmpty())
- newSourceOrErrorMessage = toWebCoreStringWithNullOrUndefinedCheck(message->Get());
- return false;
- }
- ASSERT(!result.IsEmpty());
- newSourceOrErrorMessage = toWebCoreStringWithNullOrUndefinedCheck(result);
-
- // Call stack may have changed after if the edited function was on the stack.
- if (m_currentCallFrame)
- m_currentCallFrame.clear();
- return true;
-}
-
-PassRefPtr<JavaScriptCallFrame> ScriptDebugServer::currentCallFrame()
-{
- if (!m_currentCallFrame) {
- v8::Handle<v8::Function> currentCallFrameFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("currentCallFrame")));
- v8::Handle<v8::Value> argv[] = { m_executionState.get() };
- v8::Handle<v8::Value> currentCallFrameV8 = currentCallFrameFunction->Call(m_debuggerScript.get(), 1, argv);
- m_currentCallFrame = JavaScriptCallFrame::create(v8::Debug::GetDebugContext(), v8::Handle<v8::Object>::Cast(currentCallFrameV8));
- }
- return m_currentCallFrame;
-}
-
-void ScriptDebugServer::setEnabled(bool value)
-{
- m_enabled = value;
-}
-
-bool ScriptDebugServer::isDebuggerAlwaysEnabled()
-{
- return m_enabled;
-}
-
-void ScriptDebugServer::interruptAndRun(PassOwnPtr<Task> task)
-{
- v8::Debug::DebugBreakForCommand(new ClientDataImpl(task));
-}
-
-void ScriptDebugServer::runPendingTasks()
-{
- v8::Debug::ProcessDebugMessages();
-}
-
-v8::Handle<v8::Value> ScriptDebugServer::breakProgramCallback(const v8::Arguments& args)
-{
- ASSERT(2 == args.Length());
- ScriptDebugServer::shared().breakProgram(v8::Handle<v8::Object>::Cast(args[0]));
- return v8::Undefined();
-}
-
-void ScriptDebugServer::breakProgram(v8::Handle<v8::Object> executionState)
-{
- // Don't allow nested breaks.
- if (m_pausedPage)
- return;
-
- Frame* frame = retrieveFrame(m_pausedPageContext);
- if (!frame)
- return;
-
- ScriptDebugListener* listener = m_listenersMap.get(frame->page());
- if (!listener)
- return;
-
- m_executionState.set(executionState);
- m_pausedPage = frame->page();
- ScriptState* currentCallFrameState = ScriptState::forContext(m_pausedPageContext);
- listener->didPause(currentCallFrameState);
-
- // Wait for continue or step command.
- m_clientMessageLoop->run(m_pausedPage);
- ASSERT(!m_pausedPage);
-
- // The listener may have been removed in the nested loop.
- if (ScriptDebugListener* listener = m_listenersMap.get(frame->page()))
- listener->didContinue();
-}
-
-void ScriptDebugServer::v8DebugEventCallback(const v8::Debug::EventDetails& eventDetails)
-{
- ScriptDebugServer::shared().handleV8DebugEvent(eventDetails);
-}
-
-void ScriptDebugServer::handleV8DebugEvent(const v8::Debug::EventDetails& eventDetails)
-{
- v8::DebugEvent event = eventDetails.GetEvent();
-
- if (event == v8::BreakForCommand) {
- ClientDataImpl* data = static_cast<ClientDataImpl*>(eventDetails.GetClientData());
- data->task()->run();
- return;
- }
-
- if (event != v8::Break && event != v8::Exception && event != v8::AfterCompile)
- return;
-
- v8::Handle<v8::Context> eventContext = eventDetails.GetEventContext();
- ASSERT(!eventContext.IsEmpty());
-
- Frame* frame = retrieveFrame(eventContext);
- if (frame) {
- ScriptDebugListener* listener = m_listenersMap.get(frame->page());
- if (listener) {
- v8::HandleScope scope;
- if (event == v8::AfterCompile) {
- v8::Context::Scope contextScope(v8::Debug::GetDebugContext());
- v8::Handle<v8::Function> onAfterCompileFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("getAfterCompileScript")));
- v8::Handle<v8::Value> argv[] = { eventDetails.GetEventData() };
- v8::Handle<v8::Value> value = onAfterCompileFunction->Call(m_debuggerScript.get(), 1, argv);
- ASSERT(value->IsObject());
- v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(value);
- dispatchDidParseSource(listener, object);
- } else if (event == v8::Break || event == v8::Exception) {
- if (event == v8::Exception) {
- v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(1);
- // Stack trace is empty in case of syntax error. Silently continue execution in such cases.
- if (!stackTrace->GetFrameCount())
- return;
- }
-
- m_pausedPageContext = *eventContext;
- breakProgram(eventDetails.GetExecutionState());
- m_pausedPageContext.Clear();
- }
- }
- }
-}
-
-void ScriptDebugServer::dispatchDidParseSource(ScriptDebugListener* listener, v8::Handle<v8::Object> object)
-{
- listener->didParseSource(
- toWebCoreStringWithNullOrUndefinedCheck(object->Get(v8::String::New("id"))),
- toWebCoreStringWithNullOrUndefinedCheck(object->Get(v8::String::New("name"))),
- toWebCoreStringWithNullOrUndefinedCheck(object->Get(v8::String::New("source"))),
- object->Get(v8::String::New("lineOffset"))->ToInteger()->Value(),
- static_cast<ScriptWorldType>(object->Get(v8::String::New("scriptWorldType"))->Int32Value()));
-}
-
-void ScriptDebugServer::ensureDebuggerScriptCompiled()
-{
- if (m_debuggerScript.get().IsEmpty()) {
- v8::HandleScope scope;
- v8::Local<v8::Context> debuggerContext = v8::Debug::GetDebugContext();
- v8::Context::Scope contextScope(debuggerContext);
- m_debuggerScript.set(v8::Handle<v8::Object>::Cast(v8::Script::Compile(v8String(m_debuggerScriptSource))->Run()));
- }
-}
-
-void ScriptDebugServer::didResume()
-{
- m_currentCallFrame.clear();
- m_executionState.clear();
- m_pausedPage = 0;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(JAVASCRIPT_DEBUGGER)
diff --git a/WebCore/bindings/v8/ScriptDebugServer.h b/WebCore/bindings/v8/ScriptDebugServer.h
deleted file mode 100644
index 40dd5fc..0000000
--- a/WebCore/bindings/v8/ScriptDebugServer.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2010, Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 ScriptDebugServer_h
-#define ScriptDebugServer_h
-
-#if ENABLE(JAVASCRIPT_DEBUGGER)
-
-#include "JavaScriptCallFrame.h"
-#include "PlatformString.h"
-#include "ScriptBreakpoint.h"
-#include "Timer.h"
-#include <v8-debug.h>
-#include <wtf/HashMap.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/text/StringHash.h>
-
-namespace WebCore {
-
-class Page;
-class ScriptDebugListener;
-
-class ScriptDebugServer : public Noncopyable {
-public:
- static ScriptDebugServer& shared();
-
- void addListener(ScriptDebugListener*, Page*);
- void removeListener(ScriptDebugListener*, Page*);
-
- String setBreakpoint(const String& sourceID, unsigned lineNumber, const String& condition, bool enabled, unsigned* actualLineNumber);
- void removeBreakpoint(const String& breakpointId);
- void clearBreakpoints();
- void setBreakpointsActivated(bool activated);
- void activateBreakpoints() { setBreakpointsActivated(true); }
- void deactivateBreakpoints() { setBreakpointsActivated(false); }
-
- enum PauseOnExceptionsState {
- DontPauseOnExceptions,
- PauseOnAllExceptions,
- PauseOnUncaughtExceptions
- };
- PauseOnExceptionsState pauseOnExceptionsState();
- void setPauseOnExceptionsState(PauseOnExceptionsState pauseOnExceptionsState);
-
- void setPauseOnNextStatement(bool pause);
- void breakProgram();
- void continueProgram();
- void stepIntoStatement();
- void stepOverStatement();
- void stepOutOfFunction();
-
- bool editScriptSource(const String& sourceID, const String& newContent, String& newSourceOrErrorMessage);
-
- void recompileAllJSFunctionsSoon() { }
- void recompileAllJSFunctions(Timer<ScriptDebugServer>* = 0) { }
-
- void pageCreated(Page*) { }
-
- // v8-specific methods.
- void setDebuggerScriptSource(const String& scriptSource);
-
- class ClientMessageLoop {
- public:
- virtual ~ClientMessageLoop() { }
- virtual void run(Page*) = 0;
- virtual void quitNow() = 0;
- };
- void setClientMessageLoop(PassOwnPtr<ClientMessageLoop> clientMessageLoop) { m_clientMessageLoop = clientMessageLoop; }
-
- PassRefPtr<JavaScriptCallFrame> currentCallFrame();
-
- void setEnabled(bool);
- bool isDebuggerAlwaysEnabled();
-
- class Task {
- public:
- virtual ~Task() { }
- virtual void run() = 0;
- };
- static void interruptAndRun(PassOwnPtr<Task>);
- void runPendingTasks();
-
-private:
- ScriptDebugServer();
- ~ScriptDebugServer() { }
-
- static v8::Handle<v8::Value> breakProgramCallback(const v8::Arguments& args);
- void breakProgram(v8::Handle<v8::Object> executionState);
-
- static void v8DebugEventCallback(const v8::Debug::EventDetails& eventDetails);
- void handleV8DebugEvent(const v8::Debug::EventDetails& eventDetails);
-
- void dispatchDidParseSource(ScriptDebugListener* listener, v8::Handle<v8::Object> sourceObject);
-
- void ensureDebuggerScriptCompiled();
- void didResume();
-
- typedef HashMap<Page*, ScriptDebugListener*> ListenersMap;
- ListenersMap m_listenersMap;
- String m_debuggerScriptSource;
- PauseOnExceptionsState m_pauseOnExceptionsState;
- OwnHandle<v8::Object> m_debuggerScript;
- RefPtr<JavaScriptCallFrame> m_currentCallFrame;
- OwnHandle<v8::Object> m_executionState;
- OwnPtr<ClientMessageLoop> m_clientMessageLoop;
- Page* m_pausedPage;
- v8::Local<v8::Context> m_pausedPageContext;
- bool m_enabled;
-
- bool m_breakpointsActivated;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(JAVASCRIPT_DEBUGGER)
-
-#endif // ScriptDebugServer_h
diff --git a/WebCore/bindings/v8/ScriptEventListener.cpp b/WebCore/bindings/v8/ScriptEventListener.cpp
deleted file mode 100644
index b46fc5a..0000000
--- a/WebCore/bindings/v8/ScriptEventListener.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "ScriptEventListener.h"
-
-#include "Attribute.h"
-#include "Document.h"
-#include "EventListener.h"
-#include "Frame.h"
-#include "ScriptScope.h"
-#include "DocumentParser.h"
-#include "V8AbstractEventListener.h"
-#include "V8Binding.h"
-#include "XSSAuditor.h"
-
-namespace WebCore {
-
-PassRefPtr<V8LazyEventListener> createAttributeEventListener(Node* node, Attribute* attr)
-{
- ASSERT(node);
- ASSERT(attr);
- if (attr->isNull())
- return 0;
-
- // FIXME: Very strange: we initialize zero-based number with '1'.
- TextPosition0 position(WTF::ZeroBasedNumber::fromZeroBasedInt(1), WTF::ZeroBasedNumber::base());
- String sourceURL;
-
- if (Frame* frame = node->document()->frame()) {
- ScriptController* scriptController = frame->script();
- if (!scriptController->canExecuteScripts(AboutToExecuteScript))
- return 0;
-
- if (!scriptController->xssAuditor()->canCreateInlineEventListener(attr->localName().string(), attr->value())) {
- // This script is not safe to execute.
- return 0;
- }
-
- position = scriptController->eventHandlerPosition();
- sourceURL = node->document()->url().string();
- }
-
- return V8LazyEventListener::create(attr->localName().string(), node->isSVGElement(), attr->value(), sourceURL, position, WorldContextHandle(UseMainWorld));
-}
-
-PassRefPtr<V8LazyEventListener> createAttributeEventListener(Frame* frame, Attribute* attr)
-{
- if (!frame)
- return 0;
-
- ASSERT(attr);
- if (attr->isNull())
- return 0;
-
- ScriptController* scriptController = frame->script();
- if (!scriptController->canExecuteScripts(AboutToExecuteScript))
- return 0;
-
- if (!scriptController->xssAuditor()->canCreateInlineEventListener(attr->localName().string(), attr->value())) {
- // This script is not safe to execute.
- return 0;
- }
-
- TextPosition0 position = scriptController->eventHandlerPosition();
- String sourceURL = frame->document()->url().string();
- return V8LazyEventListener::create(attr->localName().string(), frame->document()->isSVGDocument(), attr->value(), sourceURL, position, WorldContextHandle(UseMainWorld));
-}
-
-String eventListenerHandlerBody(Document* document, EventListener* listener)
-{
- if (listener->type() != EventListener::JSEventListenerType)
- return "";
-
- v8::HandleScope scope;
- V8AbstractEventListener* v8Listener = static_cast<V8AbstractEventListener*>(listener);
- v8::Handle<v8::Context> context = toV8Context(document, v8Listener->worldContext());
- v8::Context::Scope contextScope(context);
- v8::Handle<v8::Object> function = v8Listener->getListenerObject(document);
- if (function.IsEmpty())
- return "";
-
- return toWebCoreStringWithNullCheck(function);
-}
-
-bool eventListenerHandlerLocation(Document* document, EventListener* listener, String& sourceName, int& lineNumber)
-{
- if (listener->type() != EventListener::JSEventListenerType)
- return false;
-
- v8::HandleScope scope;
- V8AbstractEventListener* v8Listener = static_cast<V8AbstractEventListener*>(listener);
- v8::Handle<v8::Context> context = toV8Context(document, v8Listener->worldContext());
- v8::Context::Scope contextScope(context);
- v8::Handle<v8::Object> object = v8Listener->getListenerObject(document);
- if (object.IsEmpty() || !object->IsFunction())
- return false;
-
- v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(object);
- v8::ScriptOrigin origin = function->GetScriptOrigin();
- if (!origin.ResourceName().IsEmpty()) {
- sourceName = toWebCoreString(origin.ResourceName());
- lineNumber = function->GetScriptLineNumber() + 1;
- return true;
- }
- return false;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptEventListener.h b/WebCore/bindings/v8/ScriptEventListener.h
deleted file mode 100644
index 0fce088..0000000
--- a/WebCore/bindings/v8/ScriptEventListener.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 ScriptEventListener_h
-#define ScriptEventListener_h
-
-#include "V8LazyEventListener.h"
-
-#include <wtf/PassRefPtr.h>
-
-namespace WebCore {
-
- class Attribute;
- class Document;
- class EventListener;
- class Frame;
- class Node;
-
- PassRefPtr<V8LazyEventListener> createAttributeEventListener(Node*, Attribute*);
- PassRefPtr<V8LazyEventListener> createAttributeEventListener(Frame*, Attribute*);
- String eventListenerHandlerBody(Document*, EventListener*);
- bool eventListenerHandlerLocation(Document*, EventListener*, String& sourceName, int& lineNumber);
-
-} // namespace WebCore
-
-#endif // ScriptEventListener_h
diff --git a/WebCore/bindings/v8/ScriptFunctionCall.cpp b/WebCore/bindings/v8/ScriptFunctionCall.cpp
deleted file mode 100644
index 3ea536e..0000000
--- a/WebCore/bindings/v8/ScriptFunctionCall.cpp
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "ScriptFunctionCall.h"
-
-#include "ScriptScope.h"
-#include "ScriptState.h"
-#include "ScriptValue.h"
-
-#include "V8Binding.h"
-#include "V8Proxy.h"
-#include "V8Utilities.h"
-
-#include <v8.h>
-#include <wtf/OwnArrayPtr.h>
-
-namespace WebCore {
-
-void ScriptCallArgumentHandler::appendArgument(const ScriptObject& argument)
-{
- if (argument.scriptState() != m_scriptState) {
- ASSERT_NOT_REACHED();
- return;
- }
- m_arguments.append(argument);
-}
-
-void ScriptCallArgumentHandler::appendArgument(const ScriptValue& argument)
-{
- m_arguments.append(argument);
-}
-
-void ScriptCallArgumentHandler::appendArgument(const String& argument)
-{
- ScriptScope scope(m_scriptState);
- m_arguments.append(v8String(argument));
-}
-
-void ScriptCallArgumentHandler::appendArgument(const char* argument)
-{
- ScriptScope scope(m_scriptState);
- m_arguments.append(v8String(argument));
-}
-
-void ScriptCallArgumentHandler::appendArgument(long argument)
-{
- ScriptScope scope(m_scriptState);
- m_arguments.append(v8::Number::New(argument));
-}
-
-void ScriptCallArgumentHandler::appendArgument(long long argument)
-{
- ScriptScope scope(m_scriptState);
- m_arguments.append(v8::Number::New(argument));
-}
-
-void ScriptCallArgumentHandler::appendArgument(unsigned int argument)
-{
- ScriptScope scope(m_scriptState);
- m_arguments.append(v8::Number::New(argument));
-}
-
-void ScriptCallArgumentHandler::appendArgument(unsigned long argument)
-{
- ScriptScope scope(m_scriptState);
- m_arguments.append(v8::Number::New(argument));
-}
-
-void ScriptCallArgumentHandler::appendArgument(int argument)
-{
- ScriptScope scope(m_scriptState);
- m_arguments.append(v8::Number::New(argument));
-}
-
-void ScriptCallArgumentHandler::appendArgument(bool argument)
-{
- m_arguments.append(v8Boolean(argument));
-}
-
-ScriptFunctionCall::ScriptFunctionCall(const ScriptObject& thisObject, const String& name)
- : ScriptCallArgumentHandler(thisObject.scriptState())
- , m_thisObject(thisObject)
- , m_name(name)
-{
-}
-
-ScriptValue ScriptFunctionCall::call(bool& hadException, bool reportExceptions)
-{
- ScriptScope scope(m_scriptState, reportExceptions);
-
- v8::Local<v8::Object> thisObject = m_thisObject.v8Object();
- v8::Local<v8::Value> value = thisObject->Get(v8String(m_name));
- if (!scope.success()) {
- hadException = true;
- return ScriptValue();
- }
-
- ASSERT(value->IsFunction());
-
- v8::Local<v8::Function> function(v8::Function::Cast(*value));
- OwnArrayPtr<v8::Handle<v8::Value> > args(new v8::Handle<v8::Value>[m_arguments.size()]);
- for (size_t i = 0; i < m_arguments.size(); ++i)
- args[i] = m_arguments[i].v8Value();
-
- v8::Local<v8::Value> result = function->Call(thisObject, m_arguments.size(), args.get());
- if (!scope.success()) {
- hadException = true;
- return ScriptValue();
- }
-
- return ScriptValue(result);
-}
-
-ScriptValue ScriptFunctionCall::call()
-{
- bool hadException = false;
- return call(hadException);
-}
-
-ScriptObject ScriptFunctionCall::construct(bool& hadException, bool reportExceptions)
-{
- ScriptScope scope(m_scriptState, reportExceptions);
-
- v8::Local<v8::Object> thisObject = m_thisObject.v8Object();
- v8::Local<v8::Value> value = thisObject->Get(v8String(m_name));
- if (!scope.success()) {
- hadException = true;
- return ScriptObject();
- }
-
- ASSERT(value->IsFunction());
-
- v8::Local<v8::Function> constructor(v8::Function::Cast(*value));
- OwnArrayPtr<v8::Handle<v8::Value> > args(new v8::Handle<v8::Value>[m_arguments.size()]);
- for (size_t i = 0; i < m_arguments.size(); ++i)
- args[i] = m_arguments[i].v8Value();
-
- v8::Local<v8::Object> result = SafeAllocation::newInstance(constructor, m_arguments.size(), args.get());
- if (!scope.success()) {
- hadException = true;
- return ScriptObject();
- }
-
- return ScriptObject(m_scriptState, result);
-}
-
-ScriptCallback::ScriptCallback(ScriptState* state, ScriptValue function)
- : ScriptCallArgumentHandler(state)
- , m_function(function)
-{
-}
-
-ScriptValue ScriptCallback::call()
-{
- bool hadException = false;
- return call(hadException);
-}
-
-ScriptValue ScriptCallback::call(bool& hadException)
-{
- ASSERT(v8::Context::InContext());
- ASSERT(m_function.v8Value()->IsFunction());
-
- v8::TryCatch exceptionCatcher;
- v8::Handle<v8::Object> object = v8::Context::GetCurrent()->Global();
- v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(m_function.v8Value());
-
- OwnArrayPtr<v8::Handle<v8::Value> > args(new v8::Handle<v8::Value>[m_arguments.size()]);
- for (size_t i = 0; i < m_arguments.size(); ++i)
- args[i] = m_arguments[i].v8Value();
-
- v8::Handle<v8::Value> result = V8Proxy::callFunctionWithoutFrame(function, object, m_arguments.size(), args.get());
-
- if (exceptionCatcher.HasCaught()) {
- hadException = true;
- m_scriptState->setException(exceptionCatcher.Exception());
- return ScriptValue();
- }
-
- return ScriptValue(result);
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptFunctionCall.h b/WebCore/bindings/v8/ScriptFunctionCall.h
deleted file mode 100644
index d4f63ac..0000000
--- a/WebCore/bindings/v8/ScriptFunctionCall.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 ScriptFunctionCall_h
-#define ScriptFunctionCall_h
-
-#include "PlatformString.h"
-#include "ScriptObject.h"
-
-#include <wtf/Vector.h>
-
-namespace WebCore {
- class ScriptValue;
- class ScriptState;
-
- class ScriptCallArgumentHandler {
- public:
- ScriptCallArgumentHandler(ScriptState* scriptState) : m_scriptState(scriptState) { }
-
- void appendArgument(const ScriptObject&);
- void appendArgument(const ScriptValue&);
- void appendArgument(const String&);
- void appendArgument(const char*);
- void appendArgument(long);
- void appendArgument(long long);
- void appendArgument(unsigned int);
- void appendArgument(unsigned long);
- void appendArgument(int);
- void appendArgument(bool);
-
- protected:
- ScriptState* m_scriptState;
- Vector<ScriptValue> m_arguments;
- };
-
- class ScriptFunctionCall : public ScriptCallArgumentHandler {
- public:
- ScriptFunctionCall(const ScriptObject& thisObject, const String& name);
- ScriptValue call(bool& hadException, bool reportExceptions = true);
- ScriptValue call();
- ScriptObject construct(bool& hadException, bool reportExceptions = true);
-
- protected:
- ScriptObject m_thisObject;
- String m_name;
- };
-
- class ScriptCallback : public ScriptCallArgumentHandler {
- public:
- ScriptCallback(ScriptState*, ScriptValue);
-
- ScriptValue call();
- ScriptValue call(bool& hadException);
-
- private:
- ScriptValue m_function;
- };
-
-} // namespace WebCore
-
-#endif // ScriptFunctionCall
diff --git a/WebCore/bindings/v8/ScriptGCEvent.cpp b/WebCore/bindings/v8/ScriptGCEvent.cpp
deleted file mode 100644
index a58a0cd..0000000
--- a/WebCore/bindings/v8/ScriptGCEvent.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
-* Copyright (C) 2010 Google 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:
-*
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * 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.
-* * Neither the name of Google Inc. nor the names of its
-* contributors may be used to endorse or promote products derived from
-* this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "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 THE COPYRIGHT
-* OWNER 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.
-*/
-
-#include "config.h"
-
-#if ENABLE(INSPECTOR)
-
-#include "ScriptGCEvent.h"
-#include "ScriptGCEventListener.h"
-
-#include <wtf/CurrentTime.h>
-
-namespace WebCore {
-
-ScriptGCEvent::GCEventListeners ScriptGCEvent::s_eventListeners;
-double ScriptGCEvent::s_startTime = 0.0;
-size_t ScriptGCEvent::s_usedHeapSize = 0;
-
-void ScriptGCEvent::addEventListener(ScriptGCEventListener* eventListener)
-{
- ASSERT(eventListener);
- if (s_eventListeners.isEmpty()) {
- v8::V8::AddGCPrologueCallback(ScriptGCEvent::gcPrologueCallback);
- v8::V8::AddGCEpilogueCallback(ScriptGCEvent::gcEpilogueCallback);
- }
- s_eventListeners.append(eventListener);
-}
-
-void ScriptGCEvent::removeEventListener(ScriptGCEventListener* eventListener)
-{
- ASSERT(eventListener);
- ASSERT(!s_eventListeners.isEmpty());
- size_t i = s_eventListeners.find(eventListener);
- ASSERT(i != notFound);
- s_eventListeners.remove(i);
- if (s_eventListeners.isEmpty()) {
- v8::V8::RemoveGCPrologueCallback(ScriptGCEvent::gcPrologueCallback);
- v8::V8::RemoveGCEpilogueCallback(ScriptGCEvent::gcEpilogueCallback);
- }
-}
-
-void ScriptGCEvent::getHeapSize(size_t& usedHeapSize, size_t& totalHeapSize)
-{
- v8::HeapStatistics heapStatistics;
- v8::V8::GetHeapStatistics(&heapStatistics);
- usedHeapSize = heapStatistics.used_heap_size();
- totalHeapSize = heapStatistics.total_heap_size();
-}
-
-size_t ScriptGCEvent::getUsedHeapSize()
-{
- v8::HeapStatistics heapStatistics;
- v8::V8::GetHeapStatistics(&heapStatistics);
- return heapStatistics.used_heap_size();
-}
-
-void ScriptGCEvent::gcPrologueCallback(v8::GCType type, v8::GCCallbackFlags flags)
-{
- s_startTime = WTF::currentTimeMS();
- s_usedHeapSize = getUsedHeapSize();
-}
-
-void ScriptGCEvent::gcEpilogueCallback(v8::GCType type, v8::GCCallbackFlags flags)
-{
- double endTime = WTF::currentTimeMS();
- size_t collectedBytes = s_usedHeapSize - getUsedHeapSize();
- GCEventListeners listeners(s_eventListeners);
- for (GCEventListeners::iterator i = listeners.begin(); i != listeners.end(); ++i)
- (*i)->didGC(s_startTime, endTime, collectedBytes);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(INSPECTOR)
diff --git a/WebCore/bindings/v8/ScriptGCEvent.h b/WebCore/bindings/v8/ScriptGCEvent.h
deleted file mode 100644
index 80a5a38..0000000
--- a/WebCore/bindings/v8/ScriptGCEvent.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-* Copyright (C) 2010 Google 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:
-*
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * 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.
-* * Neither the name of Google Inc. nor the names of its
-* contributors may be used to endorse or promote products derived from
-* this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "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 THE COPYRIGHT
-* OWNER 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 ScriptGCEvent_h
-#define ScriptGCEvent_h
-
-#if ENABLE(INSPECTOR)
-
-#include "v8.h"
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-class ScriptGCEventListener;
-
-class ScriptGCEvent
-{
-public:
- static void addEventListener(ScriptGCEventListener*);
- static void removeEventListener(ScriptGCEventListener*);
- static void getHeapSize(size_t&, size_t&);
-private:
- typedef Vector<ScriptGCEventListener*> GCEventListeners;
- static GCEventListeners s_eventListeners;
- static double s_startTime;
- static size_t s_usedHeapSize;
-
- static void gcEpilogueCallback(v8::GCType type, v8::GCCallbackFlags flags);
- static void gcPrologueCallback(v8::GCType type, v8::GCCallbackFlags flags);
- static size_t getUsedHeapSize();
-};
-
-} // namespace WebCore
-
-#endif // !ENABLE(INSPECTOR)
-#endif // !defined(ScriptGCEvent_h)
diff --git a/WebCore/bindings/v8/ScriptHeapSnapshot.cpp b/WebCore/bindings/v8/ScriptHeapSnapshot.cpp
deleted file mode 100644
index c35d508..0000000
--- a/WebCore/bindings/v8/ScriptHeapSnapshot.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2010, Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "ScriptHeapSnapshot.h"
-
-#include "InspectorValues.h"
-#include "V8Binding.h"
-#include <v8.h>
-#include <v8-profiler.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-String ScriptHeapSnapshot::title() const
-{
- v8::HandleScope scope;
- return toWebCoreString(m_snapshot->GetTitle());
-}
-
-unsigned int ScriptHeapSnapshot::uid() const
-{
- return m_snapshot->GetUid();
-}
-
-namespace {
-
-class OutputStreamAdapter : public v8::OutputStream {
-public:
- OutputStreamAdapter(ScriptHeapSnapshot::OutputStream* output)
- : m_output(output) { }
- void EndOfStream() { m_output->Close(); }
- int GetChunkSize() { return 10240; }
- WriteResult WriteAsciiChunk(char* data, int size)
- {
- m_output->Write(String(data, size));
- return kContinue;
- }
-private:
- ScriptHeapSnapshot::OutputStream* m_output;
-};
-
-} // namespace
-
-void ScriptHeapSnapshot::writeJSON(ScriptHeapSnapshot::OutputStream* stream)
-{
- OutputStreamAdapter outputStream(stream);
- m_snapshot->Serialize(&outputStream, v8::HeapSnapshot::kJSON);
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptHeapSnapshot.h b/WebCore/bindings/v8/ScriptHeapSnapshot.h
deleted file mode 100644
index d3ae022..0000000
--- a/WebCore/bindings/v8/ScriptHeapSnapshot.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2010, Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 ScriptHeapSnapshot_h
-#define ScriptHeapSnapshot_h
-
-#include "PlatformString.h"
-
-namespace v8 {
-class HeapSnapshot;
-}
-
-namespace WebCore {
-
-class InspectorObject;
-
-class ScriptHeapSnapshot : public RefCounted<ScriptHeapSnapshot> {
-public:
- class OutputStream {
- public:
- virtual ~OutputStream() { }
- virtual void Write(const String& chunk) = 0;
- virtual void Close() = 0;
- };
-
- static PassRefPtr<ScriptHeapSnapshot> create(const v8::HeapSnapshot* snapshot)
- {
- return adoptRef(new ScriptHeapSnapshot(snapshot));
- }
- virtual ~ScriptHeapSnapshot() {}
-
- String title() const;
- unsigned int uid() const;
- void writeJSON(OutputStream* stream);
-
-private:
- ScriptHeapSnapshot(const v8::HeapSnapshot* snapshot)
- : m_snapshot(snapshot)
- {}
-
- const v8::HeapSnapshot* m_snapshot;
-};
-
-} // namespace WebCore
-
-#endif // ScriptHeapSnapshot_h
diff --git a/WebCore/bindings/v8/ScriptInstance.cpp b/WebCore/bindings/v8/ScriptInstance.cpp
deleted file mode 100644
index 645b1da..0000000
--- a/WebCore/bindings/v8/ScriptInstance.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "ScriptInstance.h"
-
-#ifndef NDEBUG
-#include "V8Proxy.h"
-#endif
-#include <wtf/Assertions.h>
-
-namespace WebCore {
-
-V8ScriptInstance::V8ScriptInstance()
-{
-}
-
-V8ScriptInstance::V8ScriptInstance(v8::Handle<v8::Object> instance)
-{
- set(instance);
-}
-
-V8ScriptInstance::~V8ScriptInstance()
-{
- clear();
-}
-
-v8::Persistent<v8::Object> V8ScriptInstance::instance()
-{
- return m_instance;
-}
-
-void V8ScriptInstance::clear()
-{
- if (m_instance.IsEmpty())
- return;
-#ifndef NDEBUG
- V8GCController::unregisterGlobalHandle(this, m_instance);
-#endif
- m_instance.Dispose();
- m_instance.Clear();
-}
-
-void V8ScriptInstance::set(v8::Handle<v8::Object> instance)
-{
- clear();
- if (instance.IsEmpty())
- return;
-
- m_instance = v8::Persistent<v8::Object>::New(instance);
-#ifndef NDEBUG
- V8GCController::registerGlobalHandle(SCRIPTINSTANCE, this, m_instance);
-#endif
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptInstance.h b/WebCore/bindings/v8/ScriptInstance.h
deleted file mode 100644
index 2fe3736..0000000
--- a/WebCore/bindings/v8/ScriptInstance.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 ScriptInstance_h
-#define ScriptInstance_h
-
-#include <v8.h>
-
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-class V8ScriptInstance : public RefCounted<V8ScriptInstance> {
-public:
- static PassRefPtr<V8ScriptInstance> create(v8::Handle<v8::Object> instance)
- {
- return adoptRef(new V8ScriptInstance(instance));
- }
- V8ScriptInstance();
- V8ScriptInstance(v8::Handle<v8::Object>);
- ~V8ScriptInstance();
- v8::Persistent<v8::Object> instance();
-
-private:
- void clear();
- void set(v8::Handle<v8::Object>);
- mutable v8::Persistent<v8::Object> m_instance;
-};
-
-typedef RefPtr<V8ScriptInstance> ScriptInstance;
-typedef PassRefPtr<V8ScriptInstance> PassScriptInstance;
-
-} // namespace WebCore
-
-#endif // ScriptInstance_h
diff --git a/WebCore/bindings/v8/ScriptObject.cpp b/WebCore/bindings/v8/ScriptObject.cpp
deleted file mode 100644
index 3d38a9e..0000000
--- a/WebCore/bindings/v8/ScriptObject.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "ScriptObject.h"
-
-#include "ScriptScope.h"
-#include "ScriptState.h"
-
-#include "Document.h"
-#include "Frame.h"
-#include "V8Binding.h"
-#include "V8InjectedScriptHost.h"
-#include "V8InspectorFrontendHost.h"
-#include "V8Proxy.h"
-
-#include <v8.h>
-
-namespace WebCore {
-
-ScriptObject::ScriptObject(ScriptState* scriptState, v8::Handle<v8::Object> v8Object)
- : ScriptValue(v8Object)
- , m_scriptState(scriptState)
-{
-}
-
-v8::Local<v8::Object> ScriptObject::v8Object() const
-{
- ASSERT(v8Value()->IsObject());
- return v8::Local<v8::Object>(v8::Object::Cast(*v8Value()));
-}
-
-bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, const ScriptObject& value)
-{
- ScriptScope scope(scriptState);
- scope.global()->Set(v8::String::New(name), value.v8Value());
- return scope.success();
-}
-
-#if ENABLE(INSPECTOR)
-bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, InspectorFrontendHost* value)
-{
- ScriptScope scope(scriptState);
- scope.global()->Set(v8::String::New(name), toV8(value));
- return scope.success();
-}
-
-bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, InjectedScriptHost* value)
-{
- ScriptScope scope(scriptState);
- scope.global()->Set(v8::String::New(name), toV8(value));
- return scope.success();
-}
-#endif
-
-bool ScriptGlobalObject::get(ScriptState* scriptState, const char* name, ScriptObject& value)
-{
- ScriptScope scope(scriptState);
- v8::Local<v8::Value> v8Value = scope.global()->Get(v8::String::New(name));
- if (v8Value.IsEmpty())
- return false;
-
- if (!v8Value->IsObject())
- return false;
-
- value = ScriptObject(scriptState, v8::Handle<v8::Object>(v8::Object::Cast(*v8Value)));
- return true;
-}
-
-bool ScriptGlobalObject::remove(ScriptState* scriptState, const char* name)
-{
- ScriptScope scope(scriptState);
- return scope.global()->Delete(v8::String::New(name));
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptObject.h b/WebCore/bindings/v8/ScriptObject.h
deleted file mode 100644
index 6b78cfc..0000000
--- a/WebCore/bindings/v8/ScriptObject.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 ScriptObject_h
-#define ScriptObject_h
-
-#include "ScriptValue.h"
-
-#include <v8.h>
-
-namespace WebCore {
- class InjectedScriptHost;
- class InspectorFrontendHost;
- class ScriptState;
-
- class ScriptObject : public ScriptValue {
- public:
- ScriptObject(ScriptState*, v8::Handle<v8::Object>);
- ScriptObject() {};
- virtual ~ScriptObject() {}
-
- v8::Local<v8::Object> v8Object() const;
- ScriptState* scriptState() const { return m_scriptState; }
- protected:
- ScriptState* m_scriptState;
- };
-
- class ScriptGlobalObject {
- public:
- static bool set(ScriptState*, const char* name, const ScriptObject&);
- static bool set(ScriptState*, const char* name, InspectorFrontendHost*);
- static bool set(ScriptState*, const char* name, InjectedScriptHost*);
- static bool get(ScriptState*, const char* name, ScriptObject&);
- static bool remove(ScriptState*, const char* name);
- private:
- ScriptGlobalObject() { }
- };
-
-}
-
-#endif // ScriptObject_h
diff --git a/WebCore/bindings/v8/ScriptProfile.cpp b/WebCore/bindings/v8/ScriptProfile.cpp
deleted file mode 100644
index c5a6dbf..0000000
--- a/WebCore/bindings/v8/ScriptProfile.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2010, Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "ScriptProfile.h"
-
-#include "InspectorValues.h"
-#include "V8Binding.h"
-#include <v8-profiler.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-String ScriptProfile::title() const
-{
- v8::HandleScope scope;
- return toWebCoreString(m_profile->GetTitle());
-}
-
-unsigned int ScriptProfile::uid() const
-{
- return m_profile->GetUid();
-}
-
-PassRefPtr<ScriptProfileNode> ScriptProfile::head() const
-{
- return ScriptProfileNode::create(m_profile->GetTopDownRoot());
-}
-
-static PassRefPtr<InspectorObject> buildInspectorObjectFor(const v8::CpuProfileNode* node)
-{
- v8::HandleScope handleScope;
- RefPtr<InspectorObject> result = InspectorObject::create();
- result->setString("functionName", toWebCoreString(node->GetFunctionName()));
- result->setString("url", toWebCoreString(node->GetScriptResourceName()));
- result->setNumber("lineNumber", node->GetLineNumber());
- result->setNumber("totalTime", node->GetTotalTime());
- result->setNumber("selfTime", node->GetSelfTime());
- result->setNumber("numberOfCalls", 0);
- result->setBoolean("visible", true);
- result->setNumber("callUID", node->GetCallUid());
-
- RefPtr<InspectorArray> children = InspectorArray::create();
- const int childrenCount = node->GetChildrenCount();
- for (int i = 0; i < childrenCount; i++) {
- const v8::CpuProfileNode* child = node->GetChild(i);
- children->pushObject(buildInspectorObjectFor(child));
- }
- result->setArray("children", children);
- return result.release();
-}
-
-PassRefPtr<InspectorObject> ScriptProfile::buildInspectorObjectForHead() const
-{
- return buildInspectorObjectFor(m_profile->GetTopDownRoot());
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptProfile.h b/WebCore/bindings/v8/ScriptProfile.h
deleted file mode 100644
index 0182669..0000000
--- a/WebCore/bindings/v8/ScriptProfile.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2010, Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 ScriptProfile_h
-#define ScriptProfile_h
-
-#include "PlatformString.h"
-#include "ScriptProfileNode.h"
-
-namespace v8 {
-class CpuProfile;
-}
-
-namespace WebCore {
-
-class InspectorObject;
-
-class ScriptProfile : public RefCounted<ScriptProfile> {
-public:
- static PassRefPtr<ScriptProfile> create(const v8::CpuProfile* profile)
- {
- return adoptRef(new ScriptProfile(profile));
- }
- virtual ~ScriptProfile() {}
-
- String title() const;
- unsigned int uid() const;
- PassRefPtr<ScriptProfileNode> head() const;
-
- PassRefPtr<InspectorObject> buildInspectorObjectForHead() const;
-
-private:
- ScriptProfile(const v8::CpuProfile* profile)
- : m_profile(profile)
- {}
-
- const v8::CpuProfile* m_profile;
-};
-
-} // namespace WebCore
-
-#endif // ScriptProfile_h
diff --git a/WebCore/bindings/v8/ScriptProfileNode.cpp b/WebCore/bindings/v8/ScriptProfileNode.cpp
deleted file mode 100644
index 7266c29..0000000
--- a/WebCore/bindings/v8/ScriptProfileNode.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2010, Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#include "ScriptProfile.h"
-
-#include "V8Binding.h"
-
-#include <v8-profiler.h>
-
-namespace WebCore {
-
-String ScriptProfileNode::functionName() const
-{
- return toWebCoreString(m_profileNode->GetFunctionName());
-}
-
-String ScriptProfileNode::url() const
-{
- return toWebCoreString(m_profileNode->GetScriptResourceName());
-}
-
-unsigned long ScriptProfileNode::lineNumber() const
-{
- return m_profileNode->GetLineNumber();
-}
-
-double ScriptProfileNode::totalTime() const
-{
- return m_profileNode->GetTotalTime();
-}
-
-double ScriptProfileNode::selfTime() const
-{
- return m_profileNode->GetSelfTime();
-}
-
-unsigned long ScriptProfileNode::numberOfCalls() const
-{
- return 0;
-}
-
-ProfileNodesList ScriptProfileNode::children() const
-{
- const int childrenCount = m_profileNode->GetChildrenCount();
- ProfileNodesList result(childrenCount);
- for (int i = 0; i < childrenCount; ++i)
- result[i] = ScriptProfileNode::create(m_profileNode->GetChild(i));
- return result;
-}
-
-bool ScriptProfileNode::visible() const
-{
- return true;
-}
-
-unsigned long ScriptProfileNode::callUID() const
-{
- return m_profileNode->GetCallUid();
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptProfileNode.h b/WebCore/bindings/v8/ScriptProfileNode.h
deleted file mode 100644
index 5acf319..0000000
--- a/WebCore/bindings/v8/ScriptProfileNode.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2010, Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 ScriptProfileNode_h
-#define ScriptProfileNode_h
-
-#include "PlatformString.h"
-
-namespace v8 {
-class CpuProfileNode;
-}
-
-namespace WebCore {
-
-class ScriptProfileNode;
-
-typedef Vector<RefPtr<ScriptProfileNode> > ProfileNodesList;
-
-class ScriptProfileNode : public RefCounted<ScriptProfileNode> {
-public:
- static PassRefPtr<ScriptProfileNode> create(const v8::CpuProfileNode* profileNode)
- {
- return adoptRef(new ScriptProfileNode(profileNode));
- }
- virtual ~ScriptProfileNode() {}
-
- String functionName() const;
- String url() const;
- unsigned long lineNumber() const;
- double totalTime() const;
- double selfTime() const;
- unsigned long numberOfCalls() const;
- ProfileNodesList children() const;
- bool visible() const;
- unsigned long callUID() const;
-
-protected:
- ScriptProfileNode(const v8::CpuProfileNode* profileNode)
- : m_profileNode(profileNode)
- {}
-
-private:
- const v8::CpuProfileNode* m_profileNode;
-};
-
-} // namespace WebCore
-
-#endif // ScriptProfileNode_h
diff --git a/WebCore/bindings/v8/ScriptProfiler.cpp b/WebCore/bindings/v8/ScriptProfiler.cpp
deleted file mode 100644
index 02dea14..0000000
--- a/WebCore/bindings/v8/ScriptProfiler.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2010, Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "ScriptProfiler.h"
-
-#include "InspectorValues.h"
-
-#include <v8-profiler.h>
-#include <V8Binding.h>
-
-namespace WebCore {
-
-void ScriptProfiler::start(ScriptState* state, const String& title)
-{
- v8::HandleScope hs;
- v8::CpuProfiler::StartProfiling(v8String(title));
-}
-
-PassRefPtr<ScriptProfile> ScriptProfiler::stop(ScriptState* state, const String& title)
-{
- v8::HandleScope hs;
- const v8::CpuProfile* profile = state ?
- v8::CpuProfiler::StopProfiling(v8String(title), state->context()->GetSecurityToken()) :
- v8::CpuProfiler::StopProfiling(v8String(title));
- return profile ? ScriptProfile::create(profile) : 0;
-}
-
-PassRefPtr<ScriptHeapSnapshot> ScriptProfiler::takeHeapSnapshot(const String& title)
-{
- v8::HandleScope hs;
- const v8::HeapSnapshot* snapshot = v8::HeapProfiler::TakeSnapshot(v8String(title), v8::HeapSnapshot::kAggregated);
- return snapshot ? ScriptHeapSnapshot::create(snapshot) : 0;
-}
-
-bool ScriptProfiler::isProfilerAlwaysEnabled()
-{
- return true;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptProfiler.h b/WebCore/bindings/v8/ScriptProfiler.h
deleted file mode 100644
index b75a054..0000000
--- a/WebCore/bindings/v8/ScriptProfiler.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2010, Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 ScriptProfiler_h
-#define ScriptProfiler_h
-
-#include "PlatformString.h"
-#include "ScriptHeapSnapshot.h"
-#include "ScriptProfile.h"
-#include "ScriptState.h"
-
-#include <wtf/Noncopyable.h>
-
-namespace WebCore {
-
-class InspectorObject;
-
-class ScriptProfiler : public Noncopyable {
-public:
- static void start(ScriptState* state, const String& title);
- static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title);
- static PassRefPtr<ScriptHeapSnapshot> takeHeapSnapshot(const String& title);
- static bool isProfilerAlwaysEnabled();
-};
-
-} // namespace WebCore
-
-#endif // ScriptProfiler_h
diff --git a/WebCore/bindings/v8/ScriptScope.cpp b/WebCore/bindings/v8/ScriptScope.cpp
deleted file mode 100644
index a1b13a1..0000000
--- a/WebCore/bindings/v8/ScriptScope.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "ScriptScope.h"
-
-#include "ScriptState.h"
-
-#include <v8.h>
-
-namespace WebCore {
-
-ScriptScope::ScriptScope(ScriptState* scriptState, bool reportExceptions)
- : m_context(scriptState->context())
- , m_scope(m_context)
- , m_scriptState(scriptState)
-{
- m_exceptionCatcher.SetVerbose(reportExceptions);
- ASSERT(!m_context.IsEmpty());
-}
-
-bool ScriptScope::success()
-{
- if (!m_exceptionCatcher.HasCaught())
- return true;
- m_exceptionCatcher.Reset();
- return false;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptScope.h b/WebCore/bindings/v8/ScriptScope.h
deleted file mode 100644
index 3f9a332..0000000
--- a/WebCore/bindings/v8/ScriptScope.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 ScriptScope_h
-#define ScriptScope_h
-
-#include <v8.h>
-
-namespace WebCore {
- class ScriptState;
-
- class ScriptScope {
- public:
- ScriptScope(ScriptState* scriptState, bool reportExceptions = true);
- bool success();
-
- v8::Local<v8::Object> global() const { return m_context->Global(); }
-
- private:
- v8::HandleScope m_handleScope;
- v8::Local<v8::Context> m_context;
- v8::Context::Scope m_scope;
- v8::TryCatch m_exceptionCatcher;
- ScriptState* m_scriptState;
- };
-
-}
-
-#endif // ScriptScope_h
diff --git a/WebCore/bindings/v8/ScriptSourceCode.h b/WebCore/bindings/v8/ScriptSourceCode.h
deleted file mode 100644
index 2478151..0000000
--- a/WebCore/bindings/v8/ScriptSourceCode.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 ScriptSourceCode_h
-#define ScriptSourceCode_h
-
-#include "CachedResourceHandle.h"
-#include "CachedScript.h"
-#include "KURL.h"
-#include "PlatformString.h"
-#include <wtf/text/TextPosition.h>
-
-namespace WebCore {
-
-class ScriptSourceCode {
-public:
- ScriptSourceCode(const String& source, const KURL& url = KURL(), const TextPosition1& startPosition = TextPosition1::minimumPosition())
- : m_source(source)
- , m_cachedScript(0)
- , m_url(url)
- , m_startPosition(startPosition)
- {
- }
-
- // We lose the encoding information from CachedScript.
- // Not sure if that matters.
- ScriptSourceCode(CachedScript* cs)
- : m_source(cs->script())
- , m_cachedScript(cs)
- , m_url(ParsedURLString, cs->url())
- , m_startPosition(TextPosition1::minimumPosition())
- {
- }
-
- bool isEmpty() const { return m_source.isEmpty(); }
-
- const String& source() const { return m_source; }
- CachedScript* cachedScript() const { return m_cachedScript.get(); }
- const KURL& url() const { return m_url; }
- int startLine() const { return m_startPosition.m_line.oneBasedInt(); }
- const TextPosition1& startPosition() const { return m_startPosition; }
-
-private:
- String m_source;
- CachedResourceHandle<CachedScript> m_cachedScript;
- KURL m_url;
- TextPosition1 m_startPosition;
-};
-
-} // namespace WebCore
-
-#endif // ScriptSourceCode_h
diff --git a/WebCore/bindings/v8/ScriptState.cpp b/WebCore/bindings/v8/ScriptState.cpp
deleted file mode 100644
index fac1d26..0000000
--- a/WebCore/bindings/v8/ScriptState.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "ScriptState.h"
-
-#include "Frame.h"
-#include "Node.h"
-#include "Page.h"
-#include "ScriptController.h"
-#include "V8HiddenPropertyName.h"
-
-#include <v8.h>
-#include <wtf/Assertions.h>
-
-namespace WebCore {
-
-ScriptState::ScriptState(v8::Handle<v8::Context> context)
- : m_context(v8::Persistent<v8::Context>::New(context))
-{
- m_context.MakeWeak(this, &ScriptState::weakReferenceCallback);
-}
-
-ScriptState::~ScriptState()
-{
- m_context.Dispose();
- m_context.Clear();
-}
-
-ScriptState* ScriptState::forContext(v8::Local<v8::Context> context)
-{
- v8::Context::Scope contextScope(context);
-
- v8::Local<v8::Object> global = context->Global();
- // Skip proxy object. The proxy object will survive page navigation while we need
- // an object whose lifetime consides with that of the inspected context.
- global = v8::Local<v8::Object>::Cast(global->GetPrototype());
-
- v8::Handle<v8::String> key = V8HiddenPropertyName::scriptState();
- v8::Local<v8::Value> val = global->GetHiddenValue(key);
- if (!val.IsEmpty() && val->IsExternal())
- return static_cast<ScriptState*>(v8::External::Cast(*val)->Value());
-
- ScriptState* state = new ScriptState(context);
- global->SetHiddenValue(key, v8::External::New(state));
- return state;
-}
-
-ScriptState* ScriptState::current()
-{
- v8::HandleScope handleScope;
- v8::Local<v8::Context> context = v8::Context::GetCurrent();
- if (context.IsEmpty()) {
- ASSERT_NOT_REACHED();
- return 0;
- }
- return ScriptState::forContext(context);
-}
-
-void ScriptState::weakReferenceCallback(v8::Persistent<v8::Value> object, void* parameter)
-{
- ScriptState* scriptState = static_cast<ScriptState*>(parameter);
- delete scriptState;
-}
-
-ScriptState* mainWorldScriptState(Frame* frame)
-{
- v8::HandleScope handleScope;
- V8Proxy* proxy = frame->script()->proxy();
- return ScriptState::forContext(proxy->mainWorldContext());
-}
-
-ScriptState* scriptStateFromNode(DOMWrapperWorld*, Node* node)
-{
- // This should be never reached with V8 bindings (WebKit only uses it
- // for non-JS bindings)
- ASSERT_NOT_REACHED();
- return 0;
-}
-
-ScriptState* scriptStateFromPage(DOMWrapperWorld*, Page* page)
-{
- // This should be only reached with V8 bindings from single process layout tests.
- return mainWorldScriptState(page->mainFrame());
-}
-
-}
diff --git a/WebCore/bindings/v8/ScriptState.h b/WebCore/bindings/v8/ScriptState.h
deleted file mode 100644
index 11813b0..0000000
--- a/WebCore/bindings/v8/ScriptState.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (C) 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 ScriptState_h
-#define ScriptState_h
-
-#include "DOMWrapperWorld.h"
-#include <v8.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/RefCounted.h>
-
-namespace WebCore {
-class DOMWrapperWorld;
-class Frame;
-class Node;
-class Page;
-
-class ScriptState : public Noncopyable {
-public:
- bool hadException() { return !m_exception.IsEmpty(); }
- void setException(v8::Local<v8::Value> exception)
- {
- m_exception = exception;
- }
- v8::Local<v8::Value> exception() { return m_exception; }
-
- v8::Local<v8::Context> context() const
- {
- return v8::Local<v8::Context>::New(m_context);
- }
-
- static ScriptState* forContext(v8::Local<v8::Context>);
- static ScriptState* current();
-
-protected:
- ScriptState() { }
- ~ScriptState();
-
-private:
- friend ScriptState* mainWorldScriptState(Frame*);
- explicit ScriptState(v8::Handle<v8::Context>);
-
- static void weakReferenceCallback(v8::Persistent<v8::Value> object, void* parameter);
-
- v8::Local<v8::Value> m_exception;
- v8::Persistent<v8::Context> m_context;
-};
-
-class EmptyScriptState : public ScriptState {
-public:
- EmptyScriptState() : ScriptState() { }
- ~EmptyScriptState() { }
-};
-
-class ScriptStateProtectedPtr : public Noncopyable {
-public:
- ScriptStateProtectedPtr() : m_scriptState(0) { }
- ScriptStateProtectedPtr(ScriptState* scriptState) : m_scriptState(scriptState)
- {
- v8::HandleScope handleScope;
- // Keep the context from being GC'ed. ScriptState is guaranteed to be live while the context is live.
- m_context = v8::Persistent<v8::Context>::New(scriptState->context());
- }
- ~ScriptStateProtectedPtr()
- {
- if (!m_context.IsEmpty()) {
- m_context.Dispose();
- m_context.Clear();
- }
- }
- ScriptState* get() const { return m_scriptState; }
-private:
- ScriptState* m_scriptState;
- v8::Persistent<v8::Context> m_context;
-};
-
-ScriptState* mainWorldScriptState(Frame*);
-
-ScriptState* scriptStateFromNode(DOMWrapperWorld*, Node*);
-ScriptState* scriptStateFromPage(DOMWrapperWorld*, Page*);
-
-inline DOMWrapperWorld* debuggerWorld() { return mainThreadNormalWorld(); }
-inline DOMWrapperWorld* pluginWorld() { return mainThreadNormalWorld(); }
-
-}
-
-#endif // ScriptState_h
diff --git a/WebCore/bindings/v8/ScriptValue.cpp b/WebCore/bindings/v8/ScriptValue.cpp
deleted file mode 100644
index ebe9ccc..0000000
--- a/WebCore/bindings/v8/ScriptValue.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (C) 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "ScriptValue.h"
-
-#include "InspectorValues.h"
-#include "ScriptScope.h"
-#include "SerializedScriptValue.h"
-#include "V8Binding.h"
-
-namespace WebCore {
-
-PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptState)
-{
- ScriptScope scope(scriptState);
- return SerializedScriptValue::create(v8Value());
-}
-
-ScriptValue ScriptValue::deserialize(ScriptState* scriptState, SerializedScriptValue* value)
-{
- ScriptScope scope(scriptState);
- return ScriptValue(value->deserialize());
-}
-
-bool ScriptValue::getString(String& result) const
-{
- if (m_value.IsEmpty())
- return false;
-
- if (!m_value->IsString())
- return false;
-
- result = toWebCoreString(m_value);
- return true;
-}
-
-String ScriptValue::toString(ScriptState*) const
-{
- return toWebCoreString(m_value);
-}
-
-#if ENABLE(INSPECTOR)
-static PassRefPtr<InspectorValue> v8ToInspectorValue(v8::Handle<v8::Value> value)
-{
- if (value.IsEmpty()) {
- ASSERT_NOT_REACHED();
- return 0;
- }
- if (value->IsNull() || value->IsUndefined())
- return InspectorValue::null();
- if (value->IsBoolean())
- return InspectorBasicValue::create(value->BooleanValue());
- if (value->IsNumber())
- return InspectorBasicValue::create(value->NumberValue());
- if (value->IsString())
- return InspectorString::create(toWebCoreString(value));
- if (value->IsArray()) {
- v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(value);
- RefPtr<InspectorArray> inspectorArray = InspectorArray::create();
- uint32_t length = array->Length();
- for (uint32_t i = 0; i < length; i++) {
- v8::Local<v8::Value> value = array->Get(v8::Int32::New(i));
- RefPtr<InspectorValue> element = v8ToInspectorValue(value);
- if (!element) {
- ASSERT_NOT_REACHED();
- element = InspectorValue::null();
- }
- inspectorArray->pushValue(element);
- }
- return inspectorArray;
- }
- if (value->IsObject()) {
- RefPtr<InspectorObject> inspectorObject = InspectorObject::create();
- v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(value);
- v8::Local<v8::Array> propertyNames = object->GetPropertyNames();
- uint32_t length = propertyNames->Length();
- for (uint32_t i = 0; i < length; i++) {
- v8::Local<v8::Value> name = propertyNames->Get(v8::Int32::New(i));
- // FIXME(yurys): v8::Object should support GetOwnPropertyNames
- if (name->IsString() && !object->HasRealNamedProperty(v8::Handle<v8::String>::Cast(name)))
- continue;
- RefPtr<InspectorValue> propertyValue = v8ToInspectorValue(object->Get(name));
- if (!propertyValue) {
- ASSERT_NOT_REACHED();
- continue;
- }
- inspectorObject->setValue(toWebCoreStringWithNullCheck(name), propertyValue);
- }
- return inspectorObject;
- }
- ASSERT_NOT_REACHED();
- return 0;
-}
-
-PassRefPtr<InspectorValue> ScriptValue::toInspectorValue(ScriptState* scriptState) const
-{
- v8::HandleScope handleScope;
- // v8::Object::GetPropertyNames() expects current context to be not null.
- v8::Context::Scope contextScope(scriptState->context());
- return v8ToInspectorValue(m_value);
-}
-#endif
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptValue.h b/WebCore/bindings/v8/ScriptValue.h
deleted file mode 100644
index d412901..0000000
--- a/WebCore/bindings/v8/ScriptValue.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 ScriptValue_h
-#define ScriptValue_h
-
-#include "PlatformString.h"
-#include "ScriptState.h"
-
-#include <v8.h>
-#include <wtf/PassRefPtr.h>
-
-#ifndef NDEBUG
-#include "V8Proxy.h" // for register and unregister global handles.
-#endif
-
-namespace WebCore {
-
-class InspectorValue;
-class SerializedScriptValue;
-
-class ScriptValue {
-public:
- ScriptValue() {}
-
- ScriptValue(v8::Handle<v8::Value> value)
- {
- if (value.IsEmpty())
- return;
-
- m_value = v8::Persistent<v8::Value>::New(value);
-#ifndef NDEBUG
- V8GCController::registerGlobalHandle(SCRIPTVALUE, this, m_value);
-#endif
- }
-
- ScriptValue(const ScriptValue& value)
- {
- if (value.m_value.IsEmpty())
- return;
-
- m_value = v8::Persistent<v8::Value>::New(value.m_value);
-#ifndef NDEBUG
- V8GCController::registerGlobalHandle(SCRIPTVALUE, this, m_value);
-#endif
- }
-
- ScriptValue& operator=(const ScriptValue& value)
- {
- if (this == &value)
- return *this;
-
- clear();
-
- if (value.m_value.IsEmpty())
- return *this;
-
- m_value = v8::Persistent<v8::Value>::New(value.m_value);
-#ifndef NDEBUG
- V8GCController::registerGlobalHandle(SCRIPTVALUE, this, m_value);
-#endif
-
- return *this;
- }
-
- bool operator==(const ScriptValue value) const
- {
- return m_value == value.m_value;
- }
-
- bool isEqual(ScriptState*, const ScriptValue& value) const
- {
- return m_value == value.m_value;
- }
-
- bool isFunction() const
- {
- return m_value->IsFunction();
- }
-
- bool operator!=(const ScriptValue value) const
- {
- return !operator==(value);
- }
-
- bool isNull() const
- {
- return m_value->IsNull();
- }
-
- bool isUndefined() const
- {
- return m_value->IsUndefined();
- }
-
- bool isObject() const
- {
- return m_value->IsObject();
- }
-
- bool hasNoValue() const
- {
- return m_value.IsEmpty();
- }
-
- PassRefPtr<SerializedScriptValue> serialize(ScriptState*);
- static ScriptValue deserialize(ScriptState*, SerializedScriptValue*);
-
- static ScriptValue undefined() { return ScriptValue(v8::Undefined()); }
-
- void clear()
- {
- if (m_value.IsEmpty())
- return;
-
-#ifndef NDEBUG
- V8GCController::unregisterGlobalHandle(this, m_value);
-#endif
- m_value.Dispose();
- m_value.Clear();
- }
-
- virtual ~ScriptValue()
- {
- clear();
- }
-
- v8::Handle<v8::Value> v8Value() const { return m_value; }
- bool getString(ScriptState*, String& result) const { return getString(result); }
- bool getString(String& result) const;
- String toString(ScriptState*) const;
-
- PassRefPtr<InspectorValue> toInspectorValue(ScriptState*) const;
-
-private:
- mutable v8::Persistent<v8::Value> m_value;
-};
-
-} // namespace WebCore
-
-#endif // ScriptValue_h
diff --git a/WebCore/bindings/v8/ScriptWrappable.h b/WebCore/bindings/v8/ScriptWrappable.h
deleted file mode 100644
index 850994a..0000000
--- a/WebCore/bindings/v8/ScriptWrappable.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 ScriptWrappable_h
-#define ScriptWrappable_h
-
-#include <v8.h>
-
-namespace WebCore {
-
-class ScriptWrappable {
-public:
- ScriptWrappable() : m_wrapper(0) { }
-
- v8::Persistent<v8::Object>* wrapper() const
- {
- return m_wrapper;
- }
-
- void setWrapper(v8::Persistent<v8::Object>* wrapper)
- {
- ASSERT(wrapper);
- m_wrapper = wrapper;
- }
-
- void clearWrapper() { m_wrapper = 0; }
-
-private:
- v8::Persistent<v8::Object>* m_wrapper;
-};
-
-} // namespace WebCore
-
-#endif // ScriptWrappable_h
diff --git a/WebCore/bindings/v8/SerializedScriptValue.cpp b/WebCore/bindings/v8/SerializedScriptValue.cpp
deleted file mode 100644
index 5a89e1b..0000000
--- a/WebCore/bindings/v8/SerializedScriptValue.cpp
+++ /dev/null
@@ -1,1184 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "SerializedScriptValue.h"
-
-#include "Blob.h"
-#include "ByteArray.h"
-#include "CanvasPixelArray.h"
-#include "ExceptionCode.h"
-#include "File.h"
-#include "FileList.h"
-#include "ImageData.h"
-#include "SharedBuffer.h"
-#include "V8Binding.h"
-#include "V8Blob.h"
-#include "V8File.h"
-#include "V8FileList.h"
-#include "V8ImageData.h"
-#include "V8Proxy.h"
-#include "V8Utilities.h"
-
-#include <wtf/Assertions.h>
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
-
-// FIXME:
-// - catch V8 exceptions
-// - consider crashing in debug mode on deserialization errors
-
-namespace WebCore {
-
-namespace {
-
-typedef UChar BufferValueType;
-
-// Serialization format is a sequence of (tag, optional data)
-// pairs. Tag always takes exactly one byte.
-enum SerializationTag {
- InvalidTag = '!',
- PaddingTag = '\0',
- UndefinedTag = '_',
- NullTag = '0',
- TrueTag = 'T',
- FalseTag = 'F',
- StringTag = 'S',
- Int32Tag = 'I',
- Uint32Tag = 'U',
- DateTag = 'D',
- NumberTag = 'N',
- BlobTag = 'b',
- FileTag = 'f',
- FileListTag = 'l',
- ImageDataTag = '#',
- ArrayTag = '[',
- ObjectTag = '{',
- SparseArrayTag = '@',
- RegExpTag = 'R',
-};
-
-static bool shouldCheckForCycles(int depth)
-{
- ASSERT(depth >= 0);
- // Since we are not required to spot the cycle as soon as it
- // happens we can check for cycles only when the current depth
- // is a power of two.
- return !(depth & (depth - 1));
-}
-
-static const int maxDepth = 20000;
-
-// VarInt encoding constants.
-static const int varIntShift = 7;
-static const int varIntMask = (1 << varIntShift) - 1;
-
-// ZigZag encoding helps VarInt encoding stay small for negative
-// numbers with small absolute values.
-class ZigZag {
-public:
- static uint32_t encode(uint32_t value)
- {
- if (value & (1U << 31))
- value = ((~value) << 1) + 1;
- else
- value <<= 1;
- return value;
- }
-
- static uint32_t decode(uint32_t value)
- {
- if (value & 1)
- value = ~(value >> 1);
- else
- value >>= 1;
- return value;
- }
-
-private:
- ZigZag();
-};
-
-// Writer is responsible for serializing primitive types and storing
-// information used to reconstruct composite types.
-class Writer : Noncopyable {
-public:
- Writer()
- : m_position(0)
- {
- }
-
- // Write functions for primitive types.
-
- void writeUndefined() { append(UndefinedTag); }
-
- void writeNull() { append(NullTag); }
-
- void writeTrue() { append(TrueTag); }
-
- void writeFalse() { append(FalseTag); }
-
- void writeString(const char* data, int length)
- {
- ASSERT(length >= 0);
- append(StringTag);
- doWriteString(data, length);
- }
-
- void writeWebCoreString(const String& string)
- {
- // Uses UTF8 encoding so we can read it back as either V8 or
- // WebCore string.
- append(StringTag);
- doWriteWebCoreString(string);
- }
-
- void writeInt32(int32_t value)
- {
- append(Int32Tag);
- doWriteUint32(ZigZag::encode(static_cast<uint32_t>(value)));
- }
-
- void writeUint32(uint32_t value)
- {
- append(Uint32Tag);
- doWriteUint32(value);
- }
-
- void writeDate(double numberValue)
- {
- append(DateTag);
- doWriteNumber(numberValue);
- }
-
- void writeNumber(double number)
- {
- append(NumberTag);
- doWriteNumber(number);
- }
-
- void writeBlob(const String& url, const String& type, unsigned long long size)
- {
- append(BlobTag);
- doWriteWebCoreString(url);
- doWriteWebCoreString(type);
- doWriteUint64(size);
- }
-
- void writeFile(const String& path, const String& url, const String& type)
- {
- append(FileTag);
- doWriteWebCoreString(path);
- doWriteWebCoreString(url);
- doWriteWebCoreString(type);
- }
-
- void writeFileList(const FileList& fileList)
- {
- append(FileListTag);
- uint32_t length = fileList.length();
- doWriteUint32(length);
- for (unsigned i = 0; i < length; ++i) {
- doWriteWebCoreString(fileList.item(i)->path());
- doWriteWebCoreString(fileList.item(i)->url().string());
- doWriteWebCoreString(fileList.item(i)->type());
- }
- }
-
- void writeImageData(uint32_t width, uint32_t height, const uint8_t* pixelData, uint32_t pixelDataLength)
- {
- append(ImageDataTag);
- doWriteUint32(width);
- doWriteUint32(height);
- doWriteUint32(pixelDataLength);
- append(pixelData, pixelDataLength);
- }
-
- void writeRegExp(v8::Local<v8::String> pattern, v8::RegExp::Flags flags)
- {
- append(RegExpTag);
- v8::String::Utf8Value patternUtf8Value(pattern);
- doWriteString(*patternUtf8Value, patternUtf8Value.length());
- doWriteUint32(static_cast<uint32_t>(flags));
- }
-
- void writeArray(uint32_t length)
- {
- append(ArrayTag);
- doWriteUint32(length);
- }
-
- void writeObject(uint32_t numProperties)
- {
- append(ObjectTag);
- doWriteUint32(numProperties);
- }
-
- void writeSparseArray(uint32_t numProperties, uint32_t length)
- {
- append(SparseArrayTag);
- doWriteUint32(numProperties);
- doWriteUint32(length);
- }
-
- Vector<BufferValueType>& data()
- {
- fillHole();
- return m_buffer;
- }
-
-private:
- void doWriteString(const char* data, int length)
- {
- doWriteUint32(static_cast<uint32_t>(length));
- append(reinterpret_cast<const uint8_t*>(data), length);
- }
-
- void doWriteWebCoreString(const String& string)
- {
- RefPtr<SharedBuffer> buffer = utf8Buffer(string);
- doWriteString(buffer->data(), buffer->size());
- }
-
- template<class T>
- void doWriteUintHelper(T value)
- {
- while (true) {
- uint8_t b = (value & varIntMask);
- value >>= varIntShift;
- if (!value) {
- append(b);
- break;
- }
- append(b | (1 << varIntShift));
- }
- }
-
- void doWriteUint32(uint32_t value)
- {
- doWriteUintHelper(value);
- }
-
- void doWriteUint64(uint64_t value)
- {
- doWriteUintHelper(value);
- }
-
- void doWriteNumber(double number)
- {
- append(reinterpret_cast<uint8_t*>(&number), sizeof(number));
- }
-
- void append(SerializationTag tag)
- {
- append(static_cast<uint8_t>(tag));
- }
-
- void append(uint8_t b)
- {
- ensureSpace(1);
- *byteAt(m_position++) = b;
- }
-
- void append(const uint8_t* data, int length)
- {
- ensureSpace(length);
- memcpy(byteAt(m_position), data, length);
- m_position += length;
- }
-
- void ensureSpace(int extra)
- {
- COMPILE_ASSERT(sizeof(BufferValueType) == 2, BufferValueTypeIsTwoBytes);
- m_buffer.grow((m_position + extra + 1) / 2); // "+ 1" to round up.
- }
-
- void fillHole()
- {
- COMPILE_ASSERT(sizeof(BufferValueType) == 2, BufferValueTypeIsTwoBytes);
- // If the writer is at odd position in the buffer, then one of
- // the bytes in the last UChar is not initialized.
- if (m_position % 2)
- *byteAt(m_position) = static_cast<uint8_t>(PaddingTag);
- }
-
- uint8_t* byteAt(int position) { return reinterpret_cast<uint8_t*>(m_buffer.data()) + position; }
-
- Vector<BufferValueType> m_buffer;
- unsigned m_position;
-};
-
-class Serializer {
- class StateBase;
-public:
- explicit Serializer(Writer& writer)
- : m_writer(writer)
- , m_depth(0)
- , m_hasError(false)
- {
- }
-
- bool serialize(v8::Handle<v8::Value> value)
- {
- v8::HandleScope scope;
- StateBase* state = doSerialize(value, 0);
- while (state)
- state = state->advance(*this);
- return !m_hasError;
- }
-
- // Functions used by serialization states.
-
- StateBase* doSerialize(v8::Handle<v8::Value> value, StateBase* next);
-
- StateBase* writeArray(uint32_t length, StateBase* state)
- {
- m_writer.writeArray(length);
- return pop(state);
- }
-
- StateBase* writeObject(uint32_t numProperties, StateBase* state)
- {
- m_writer.writeObject(numProperties);
- return pop(state);
- }
-
- StateBase* writeSparseArray(uint32_t numProperties, uint32_t length, StateBase* state)
- {
- m_writer.writeSparseArray(numProperties, length);
- return pop(state);
- }
-
-private:
- class StateBase : public Noncopyable {
- public:
- virtual ~StateBase() { }
-
- // Link to the next state to form a stack.
- StateBase* nextState() { return m_next; }
-
- // Composite object we're processing in this state.
- v8::Handle<v8::Value> composite() { return m_composite; }
-
- // Serializes (a part of) the current composite and returns
- // the next state to process or null when this is the final
- // state.
- virtual StateBase* advance(Serializer&) = 0;
-
- protected:
- StateBase(v8::Handle<v8::Value> composite, StateBase* next)
- : m_composite(composite)
- , m_next(next)
- {
- }
-
- private:
- v8::Handle<v8::Value> m_composite;
- StateBase* m_next;
- };
-
- // Dummy state that is used to signal serialization errors.
- class ErrorState : public StateBase {
- public:
- ErrorState()
- : StateBase(v8::Handle<v8::Value>(), 0)
- {
- }
-
- virtual StateBase* advance(Serializer&)
- {
- delete this;
- return 0;
- }
- };
-
- template <typename T>
- class State : public StateBase {
- public:
- v8::Handle<T> composite() { return v8::Handle<T>::Cast(StateBase::composite()); }
-
- protected:
- State(v8::Handle<T> composite, StateBase* next)
- : StateBase(composite, next)
- {
- }
- };
-
-#if 0
- // Currently unused, see comment in newArrayState.
- class ArrayState : public State<v8::Array> {
- public:
- ArrayState(v8::Handle<v8::Array> array, StateBase* next)
- : State<v8::Array>(array, next)
- , m_index(-1)
- {
- }
-
- virtual StateBase* advance(Serializer& serializer)
- {
- ++m_index;
- for (; m_index < composite()->Length(); ++m_index) {
- if (StateBase* newState = serializer.doSerialize(composite()->Get(m_index), this))
- return newState;
- }
- return serializer.writeArray(composite()->Length(), this);
- }
-
- private:
- unsigned m_index;
- };
-#endif
-
- class AbstractObjectState : public State<v8::Object> {
- public:
- AbstractObjectState(v8::Handle<v8::Object> object, StateBase* next)
- : State<v8::Object>(object, next)
- , m_propertyNames(object->GetPropertyNames())
- , m_index(-1)
- , m_numSerializedProperties(0)
- , m_nameDone(false)
- {
- }
-
- virtual StateBase* advance(Serializer& serializer)
- {
- ++m_index;
- for (; m_index < m_propertyNames->Length(); ++m_index) {
- if (m_propertyName.IsEmpty()) {
- v8::Local<v8::Value> propertyName = m_propertyNames->Get(m_index);
- if ((propertyName->IsString() && composite()->HasRealNamedProperty(propertyName.As<v8::String>()))
- || (propertyName->IsUint32() && composite()->HasRealIndexedProperty(propertyName->Uint32Value()))) {
- m_propertyName = propertyName;
- } else
- continue;
- }
- ASSERT(!m_propertyName.IsEmpty());
- if (!m_nameDone) {
- m_nameDone = true;
- if (StateBase* newState = serializer.doSerialize(m_propertyName, this))
- return newState;
- }
- v8::Local<v8::Value> value = composite()->Get(m_propertyName);
- m_nameDone = false;
- m_propertyName.Clear();
- ++m_numSerializedProperties;
- if (StateBase* newState = serializer.doSerialize(value, this))
- return newState;
- }
- return objectDone(m_numSerializedProperties, serializer);
- }
-
- protected:
- virtual StateBase* objectDone(unsigned numProperties, Serializer&) = 0;
-
- private:
- v8::Local<v8::Array> m_propertyNames;
- v8::Local<v8::Value> m_propertyName;
- unsigned m_index;
- unsigned m_numSerializedProperties;
- bool m_nameDone;
- };
-
- class ObjectState : public AbstractObjectState {
- public:
- ObjectState(v8::Handle<v8::Object> object, StateBase* next)
- : AbstractObjectState(object, next)
- {
- }
-
- protected:
- virtual StateBase* objectDone(unsigned numProperties, Serializer& serializer)
- {
- return serializer.writeObject(numProperties, this);
- }
- };
-
- class SparseArrayState : public AbstractObjectState {
- public:
- SparseArrayState(v8::Handle<v8::Array> array, StateBase* next)
- : AbstractObjectState(array, next)
- {
- }
-
- protected:
- virtual StateBase* objectDone(unsigned numProperties, Serializer& serializer)
- {
- return serializer.writeSparseArray(numProperties, composite().As<v8::Array>()->Length(), this);
- }
- };
-
- StateBase* push(StateBase* state)
- {
- ASSERT(state);
- ++m_depth;
- return checkComposite(state) ? state : handleError(state);
- }
-
- StateBase* pop(StateBase* state)
- {
- ASSERT(state);
- --m_depth;
- StateBase* next = state->nextState();
- delete state;
- return next;
- }
-
- StateBase* handleError(StateBase* state)
- {
- m_hasError = true;
- while (state) {
- StateBase* tmp = state->nextState();
- delete state;
- state = tmp;
- }
- return new ErrorState;
- }
-
- bool checkComposite(StateBase* top)
- {
- ASSERT(top);
- if (m_depth > maxDepth)
- return false;
- if (!shouldCheckForCycles(m_depth))
- return true;
- v8::Handle<v8::Value> composite = top->composite();
- for (StateBase* state = top->nextState(); state; state = state->nextState()) {
- if (state->composite() == composite)
- return false;
- }
- return true;
- }
-
- void writeString(v8::Handle<v8::Value> value)
- {
- v8::String::Utf8Value stringValue(value);
- m_writer.writeString(*stringValue, stringValue.length());
- }
-
- void writeBlob(v8::Handle<v8::Value> value)
- {
- Blob* blob = V8Blob::toNative(value.As<v8::Object>());
- if (!blob)
- return;
- m_writer.writeBlob(blob->url().string(), blob->type(), blob->size());
- }
-
- void writeFile(v8::Handle<v8::Value> value)
- {
- File* file = V8File::toNative(value.As<v8::Object>());
- if (!file)
- return;
- m_writer.writeFile(file->path(), file->url().string(), file->type());
- }
-
- void writeFileList(v8::Handle<v8::Value> value)
- {
- FileList* fileList = V8FileList::toNative(value.As<v8::Object>());
- if (!fileList)
- return;
- m_writer.writeFileList(*fileList);
- }
-
- void writeImageData(v8::Handle<v8::Value> value)
- {
- ImageData* imageData = V8ImageData::toNative(value.As<v8::Object>());
- if (!imageData)
- return;
- WTF::ByteArray* pixelArray = imageData->data()->data();
- m_writer.writeImageData(imageData->width(), imageData->height(), pixelArray->data(), pixelArray->length());
- }
-
- void writeRegExp(v8::Handle<v8::Value> value)
- {
- v8::Handle<v8::RegExp> regExp = value.As<v8::RegExp>();
- m_writer.writeRegExp(regExp->GetSource(), regExp->GetFlags());
- }
-
- static StateBase* newArrayState(v8::Handle<v8::Array> array, StateBase* next)
- {
- // FIXME: use plain Array state when we can quickly check that
- // an array is not sparse and has only indexed properties.
- return new SparseArrayState(array, next);
- }
-
- static StateBase* newObjectState(v8::Handle<v8::Object> object, StateBase* next)
- {
- // FIXME:
- // - check not a wrapper
- // - support File, etc.
- return new ObjectState(object, next);
- }
-
- Writer& m_writer;
- int m_depth;
- bool m_hasError;
-};
-
-Serializer::StateBase* Serializer::doSerialize(v8::Handle<v8::Value> value, StateBase* next)
-{
- if (value->IsUndefined())
- m_writer.writeUndefined();
- else if (value->IsNull())
- m_writer.writeNull();
- else if (value->IsTrue())
- m_writer.writeTrue();
- else if (value->IsFalse())
- m_writer.writeFalse();
- else if (value->IsInt32())
- m_writer.writeInt32(value->Int32Value());
- else if (value->IsUint32())
- m_writer.writeUint32(value->Uint32Value());
- else if (value->IsDate())
- m_writer.writeDate(value->NumberValue());
- else if (value->IsNumber())
- m_writer.writeNumber(value.As<v8::Number>()->Value());
- else if (value->IsString())
- writeString(value);
- else if (value->IsArray())
- return push(newArrayState(value.As<v8::Array>(), next));
- else if (V8File::HasInstance(value))
- writeFile(value);
- else if (V8Blob::HasInstance(value))
- writeBlob(value);
- else if (V8FileList::HasInstance(value))
- writeFileList(value);
- else if (V8ImageData::HasInstance(value))
- writeImageData(value);
- else if (value->IsRegExp())
- writeRegExp(value);
- else if (value->IsObject())
- return push(newObjectState(value.As<v8::Object>(), next));
- return 0;
-}
-
-// Interface used by Reader to create objects of composite types.
-class CompositeCreator {
-public:
- virtual ~CompositeCreator() { }
-
- virtual bool createArray(uint32_t length, v8::Handle<v8::Value>* value) = 0;
- virtual bool createObject(uint32_t numProperties, v8::Handle<v8::Value>* value) = 0;
- virtual bool createSparseArray(uint32_t numProperties, uint32_t length, v8::Handle<v8::Value>* value) = 0;
-};
-
-// Reader is responsible for deserializing primitive types and
-// restoring information about saved objects of composite types.
-class Reader {
-public:
- Reader(const uint8_t* buffer, int length)
- : m_buffer(buffer)
- , m_length(length)
- , m_position(0)
- {
- ASSERT(length >= 0);
- }
-
- bool isEof() const { return m_position >= m_length; }
-
- bool read(v8::Handle<v8::Value>* value, CompositeCreator& creator)
- {
- SerializationTag tag;
- if (!readTag(&tag))
- return false;
- switch (tag) {
- case InvalidTag:
- return false;
- case PaddingTag:
- return true;
- case UndefinedTag:
- *value = v8::Undefined();
- break;
- case NullTag:
- *value = v8::Null();
- break;
- case TrueTag:
- *value = v8::True();
- break;
- case FalseTag:
- *value = v8::False();
- break;
- case StringTag:
- if (!readString(value))
- return false;
- break;
- case Int32Tag:
- if (!readInt32(value))
- return false;
- break;
- case Uint32Tag:
- if (!readUint32(value))
- return false;
- break;
- case DateTag:
- if (!readDate(value))
- return false;
- break;
- case NumberTag:
- if (!readNumber(value))
- return false;
- break;
- case BlobTag:
- if (!readBlob(value))
- return false;
- break;
- case FileTag:
- if (!readFile(value))
- return false;
- break;
- case FileListTag:
- if (!readFileList(value))
- return false;
- break;
- case ImageDataTag:
- if (!readImageData(value))
- return false;
- break;
- case ArrayTag: {
- uint32_t length;
- if (!doReadUint32(&length))
- return false;
- if (!creator.createArray(length, value))
- return false;
- break;
- }
- case RegExpTag:
- if (!readRegExp(value))
- return false;
- break;
- case ObjectTag: {
- uint32_t numProperties;
- if (!doReadUint32(&numProperties))
- return false;
- if (!creator.createObject(numProperties, value))
- return false;
- break;
- }
- case SparseArrayTag: {
- uint32_t numProperties;
- uint32_t length;
- if (!doReadUint32(&numProperties))
- return false;
- if (!doReadUint32(&length))
- return false;
- if (!creator.createSparseArray(numProperties, length, value))
- return false;
- break;
- }
- default:
- return false;
- }
- return !value->IsEmpty();
- }
-
-private:
- bool readTag(SerializationTag* tag)
- {
- if (m_position >= m_length)
- return false;
- *tag = static_cast<SerializationTag>(m_buffer[m_position++]);
- return true;
- }
-
- bool readString(v8::Handle<v8::Value>* value)
- {
- uint32_t length;
- if (!doReadUint32(&length))
- return false;
- if (m_position + length > m_length)
- return false;
- *value = v8::String::New(reinterpret_cast<const char*>(m_buffer + m_position), length);
- m_position += length;
- return true;
- }
-
- bool readWebCoreString(String* string)
- {
- uint32_t length;
- if (!doReadUint32(&length))
- return false;
- if (m_position + length > m_length)
- return false;
- *string = String::fromUTF8(reinterpret_cast<const char*>(m_buffer + m_position), length);
- m_position += length;
- return true;
- }
-
- bool readInt32(v8::Handle<v8::Value>* value)
- {
- uint32_t rawValue;
- if (!doReadUint32(&rawValue))
- return false;
- *value = v8::Integer::New(static_cast<int32_t>(ZigZag::decode(rawValue)));
- return true;
- }
-
- bool readUint32(v8::Handle<v8::Value>* value)
- {
- uint32_t rawValue;
- if (!doReadUint32(&rawValue))
- return false;
- *value = v8::Integer::NewFromUnsigned(rawValue);
- return true;
- }
-
- bool readDate(v8::Handle<v8::Value>* value)
- {
- double numberValue;
- if (!doReadNumber(&numberValue))
- return false;
- *value = v8::Date::New(numberValue);
- return true;
- }
-
- bool readNumber(v8::Handle<v8::Value>* value)
- {
- double number;
- if (!doReadNumber(&number))
- return false;
- *value = v8::Number::New(number);
- return true;
- }
-
- bool readImageData(v8::Handle<v8::Value>* value)
- {
- uint32_t width;
- uint32_t height;
- uint32_t pixelDataLength;
- if (!doReadUint32(&width))
- return false;
- if (!doReadUint32(&height))
- return false;
- if (!doReadUint32(&pixelDataLength))
- return false;
- if (m_position + pixelDataLength > m_length)
- return false;
- PassRefPtr<ImageData> imageData = ImageData::create(width, height);
- WTF::ByteArray* pixelArray = imageData->data()->data();
- ASSERT(pixelArray);
- ASSERT(pixelArray->length() >= pixelDataLength);
- memcpy(pixelArray->data(), m_buffer + m_position, pixelDataLength);
- m_position += pixelDataLength;
- *value = toV8(imageData);
- return true;
- }
-
- bool readRegExp(v8::Handle<v8::Value>* value)
- {
- v8::Handle<v8::Value> pattern;
- if (!readString(&pattern))
- return false;
- uint32_t flags;
- if (!doReadUint32(&flags))
- return false;
- *value = v8::RegExp::New(pattern.As<v8::String>(), static_cast<v8::RegExp::Flags>(flags));
- return true;
- }
-
- bool readBlob(v8::Handle<v8::Value>* value)
- {
- String url;
- String type;
- uint64_t size;
- if (!readWebCoreString(&url))
- return false;
- if (!readWebCoreString(&type))
- return false;
- if (!doReadUint64(&size))
- return false;
- PassRefPtr<Blob> blob = Blob::create(KURL(ParsedURLString, url), type, size);
- *value = toV8(blob);
- return true;
- }
-
- bool readFile(v8::Handle<v8::Value>* value)
- {
- String path;
- String url;
- String type;
- if (!readWebCoreString(&path))
- return false;
- if (!readWebCoreString(&url))
- return false;
- if (!readWebCoreString(&type))
- return false;
- PassRefPtr<File> file = File::create(path, KURL(ParsedURLString, url), type);
- *value = toV8(file);
- return true;
- }
-
- bool readFileList(v8::Handle<v8::Value>* value)
- {
- uint32_t length;
- if (!doReadUint32(&length))
- return false;
- PassRefPtr<FileList> fileList = FileList::create();
- for (unsigned i = 0; i < length; ++i) {
- String path;
- String urlString;
- String type;
- if (!readWebCoreString(&path))
- return false;
- if (!readWebCoreString(&urlString))
- return false;
- if (!readWebCoreString(&type))
- return false;
- fileList->append(File::create(path, KURL(ParsedURLString, urlString), type));
- }
- *value = toV8(fileList);
- return true;
- }
-
- template<class T>
- bool doReadUintHelper(T* value)
- {
- *value = 0;
- uint8_t currentByte;
- int shift = 0;
- do {
- if (m_position >= m_length)
- return false;
- currentByte = m_buffer[m_position++];
- *value |= ((currentByte & varIntMask) << shift);
- shift += varIntShift;
- } while (currentByte & (1 << varIntShift));
- return true;
- }
-
- bool doReadUint32(uint32_t* value)
- {
- return doReadUintHelper(value);
- }
-
- bool doReadUint64(uint64_t* value)
- {
- return doReadUintHelper(value);
- }
-
- bool doReadNumber(double* number)
- {
- if (m_position + sizeof(double) > m_length)
- return false;
- uint8_t* numberAsByteArray = reinterpret_cast<uint8_t*>(number);
- for (unsigned i = 0; i < sizeof(double); ++i)
- numberAsByteArray[i] = m_buffer[m_position++];
- return true;
- }
-
- const uint8_t* m_buffer;
- const unsigned m_length;
- unsigned m_position;
-};
-
-class Deserializer : public CompositeCreator {
-public:
- explicit Deserializer(Reader& reader)
- : m_reader(reader)
- {
- }
-
- v8::Handle<v8::Value> deserialize()
- {
- v8::HandleScope scope;
- while (!m_reader.isEof()) {
- if (!doDeserialize())
- return v8::Null();
- }
- if (stackDepth() != 1)
- return v8::Null();
- return scope.Close(element(0));
- }
-
- virtual bool createArray(uint32_t length, v8::Handle<v8::Value>* value)
- {
- if (length > stackDepth())
- return false;
- v8::Local<v8::Array> array = v8::Array::New(length);
- if (array.IsEmpty())
- return false;
- const int depth = stackDepth() - length;
- for (unsigned i = 0; i < length; ++i)
- array->Set(i, element(depth + i));
- pop(length);
- *value = array;
- return true;
- }
-
- virtual bool createObject(uint32_t numProperties, v8::Handle<v8::Value>* value)
- {
- v8::Local<v8::Object> object = v8::Object::New();
- if (object.IsEmpty())
- return false;
- return initializeObject(object, numProperties, value);
- }
-
- virtual bool createSparseArray(uint32_t numProperties, uint32_t length, v8::Handle<v8::Value>* value)
- {
- v8::Local<v8::Array> array = v8::Array::New(length);
- if (array.IsEmpty())
- return false;
- return initializeObject(array, numProperties, value);
- }
-
-private:
- bool initializeObject(v8::Handle<v8::Object> object, uint32_t numProperties, v8::Handle<v8::Value>* value)
- {
- unsigned length = 2 * numProperties;
- if (length > stackDepth())
- return false;
- for (unsigned i = stackDepth() - length; i < stackDepth(); i += 2) {
- v8::Local<v8::Value> propertyName = element(i);
- v8::Local<v8::Value> propertyValue = element(i + 1);
- object->Set(propertyName, propertyValue);
- }
- pop(length);
- *value = object;
- return true;
- }
-
- bool doDeserialize()
- {
- v8::Local<v8::Value> value;
- if (!m_reader.read(&value, *this))
- return false;
- if (!value.IsEmpty())
- push(value);
- return true;
- }
-
- void push(v8::Local<v8::Value> value) { m_stack.append(value); }
-
- void pop(unsigned length)
- {
- ASSERT(length <= m_stack.size());
- m_stack.shrink(m_stack.size() - length);
- }
-
- unsigned stackDepth() const { return m_stack.size(); }
-
- v8::Local<v8::Value> element(unsigned index)
- {
- ASSERT(index < m_stack.size());
- return m_stack[index];
- }
-
- Reader& m_reader;
- Vector<v8::Local<v8::Value> > m_stack;
-};
-
-} // namespace
-
-void SerializedScriptValue::deserializeAndSetProperty(v8::Handle<v8::Object> object, const char* propertyName,
- v8::PropertyAttribute attribute, SerializedScriptValue* value)
-{
- if (!value)
- return;
- v8::Handle<v8::Value> deserialized = value->deserialize();
- object->ForceSet(v8::String::NewSymbol(propertyName), deserialized, attribute);
-}
-
-PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(v8::Handle<v8::Value> value, bool& didThrow)
-{
- return adoptRef(new SerializedScriptValue(value, didThrow));
-}
-
-PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(v8::Handle<v8::Value> value)
-{
- bool didThrow;
- return adoptRef(new SerializedScriptValue(value, didThrow));
-}
-
-PassRefPtr<SerializedScriptValue> SerializedScriptValue::createFromWire(String data)
-{
- return adoptRef(new SerializedScriptValue(data, WireData));
-}
-
-PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(String data)
-{
- return adoptRef(new SerializedScriptValue(data, StringValue));
-}
-
-PassRefPtr<SerializedScriptValue> SerializedScriptValue::create()
-{
- return adoptRef(new SerializedScriptValue());
-}
-
-SerializedScriptValue* SerializedScriptValue::nullValue()
-{
- DEFINE_STATIC_LOCAL(RefPtr<SerializedScriptValue>, nullValue, (SerializedScriptValue::create()));
- return nullValue.get();
-}
-
-PassRefPtr<SerializedScriptValue> SerializedScriptValue::release()
-{
- RefPtr<SerializedScriptValue> result = adoptRef(new SerializedScriptValue(m_data, WireData));
- m_data = String().crossThreadString();
- return result.release();
-}
-
-SerializedScriptValue::SerializedScriptValue()
-{
-}
-
-SerializedScriptValue::SerializedScriptValue(v8::Handle<v8::Value> value, bool& didThrow)
-{
- didThrow = false;
- Writer writer;
- Serializer serializer(writer);
- if (!serializer.serialize(value)) {
- throwError(NOT_SUPPORTED_ERR);
- didThrow = true;
- return;
- }
- m_data = String(StringImpl::adopt(writer.data())).crossThreadString();
-}
-
-SerializedScriptValue::SerializedScriptValue(String data, StringDataMode mode)
-{
- if (mode == WireData)
- m_data = data.crossThreadString();
- else {
- ASSERT(mode == StringValue);
- Writer writer;
- writer.writeWebCoreString(data);
- m_data = String(StringImpl::adopt(writer.data())).crossThreadString();
- }
-}
-
-v8::Handle<v8::Value> SerializedScriptValue::deserialize()
-{
- if (!m_data.impl())
- return v8::Null();
- COMPILE_ASSERT(sizeof(BufferValueType) == 2, BufferValueTypeIsTwoBytes);
- Reader reader(reinterpret_cast<const uint8_t*>(m_data.impl()->characters()), 2 * m_data.length());
- Deserializer deserializer(reader);
- return deserializer.deserialize();
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/SerializedScriptValue.h b/WebCore/bindings/v8/SerializedScriptValue.h
deleted file mode 100644
index b534a57..0000000
--- a/WebCore/bindings/v8/SerializedScriptValue.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2009, 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 SerializedScriptValue_h
-#define SerializedScriptValue_h
-
-#include "ScriptValue.h"
-#include <v8.h>
-#include <wtf/Threading.h>
-
-namespace WebCore {
-
-class SerializedScriptValue : public ThreadSafeShared<SerializedScriptValue> {
-public:
- static void deserializeAndSetProperty(v8::Handle<v8::Object> object, const char* propertyName,
- v8::PropertyAttribute, SerializedScriptValue*);
-
- // If a serialization error occurs (e.g., cyclic input value) this
- // function returns an empty representation, schedules a V8 exception to
- // be thrown using v8::ThrowException(), and sets |didThrow|. In this case
- // the caller must not invoke any V8 operations until control returns to
- // V8. When serialization is successful, |didThrow| is false.
- static PassRefPtr<SerializedScriptValue> create(v8::Handle<v8::Value> value, bool& didThrow);
- static PassRefPtr<SerializedScriptValue> create(v8::Handle<v8::Value>);
- static PassRefPtr<SerializedScriptValue> createFromWire(String data);
- static PassRefPtr<SerializedScriptValue> create(String data);
- static PassRefPtr<SerializedScriptValue> create();
-
- static SerializedScriptValue* nullValue();
-
- PassRefPtr<SerializedScriptValue> release();
-
- String toWireString() const { return m_data; }
-
- // Deserializes the value (in the current context). Returns a null value in
- // case of failure.
- v8::Handle<v8::Value> deserialize();
-
-private:
- enum StringDataMode {
- StringValue,
- WireData
- };
-
- SerializedScriptValue();
- SerializedScriptValue(v8::Handle<v8::Value>, bool& didThrow);
- SerializedScriptValue(String data, StringDataMode mode);
-
- String m_data;
-};
-
-} // namespace WebCore
-
-#endif // SerializedScriptValue_h
diff --git a/WebCore/bindings/v8/SharedPersistent.h b/WebCore/bindings/v8/SharedPersistent.h
deleted file mode 100644
index 8825bd5..0000000
--- a/WebCore/bindings/v8/SharedPersistent.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 SharedPersistent_h
-#define SharedPersistent_h
-
-#include <v8.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-
-namespace WebCore {
-
- // A shareable reference to a v8 persistent handle. Using a shared
- // persistent any number of objects can share a reference to a v8
- // object and when it should no longer be accessible the object's
- // owner can clear it.
- template <typename T>
- class SharedPersistent : public RefCounted<SharedPersistent<T> > {
- public:
- void set(v8::Persistent<T> value)
- {
- m_value = value;
- }
- v8::Persistent<T> get()
- {
- return m_value;
- }
- void disposeHandle()
- {
- if (!m_value.IsEmpty()) {
- m_value.Dispose();
- m_value.Clear();
- }
- }
- static PassRefPtr<SharedPersistent<T> > create(v8::Persistent<T> value)
- {
- return adoptRef(new SharedPersistent<T>(value));
- }
- static PassRefPtr<SharedPersistent<T> > create()
- {
- return create(v8::Persistent<T>());
- }
- private:
- explicit SharedPersistent(v8::Persistent<T> value) : m_value(value) { }
- v8::Persistent<T> m_value;
- };
-
-} // namespace WebCore
-
-#endif // SharedPersistent_h
diff --git a/WebCore/bindings/v8/StaticDOMDataStore.cpp b/WebCore/bindings/v8/StaticDOMDataStore.cpp
deleted file mode 100644
index b4c36b9..0000000
--- a/WebCore/bindings/v8/StaticDOMDataStore.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "StaticDOMDataStore.h"
-
-namespace WebCore {
-
-StaticDOMDataStore::StaticDOMDataStore(DOMData* domData)
- : DOMDataStore(domData)
- , m_staticDomNodeMap(&DOMDataStore::weakNodeCallback)
- , m_staticDomObjectMap(&DOMDataStore::weakDOMObjectCallback)
- , m_staticActiveDomObjectMap(&DOMDataStore::weakActiveDOMObjectCallback)
-#if ENABLE(SVG)
- , m_staticDomSvgElementInstanceMap(&DOMDataStore::weakSVGElementInstanceCallback)
-#endif
-{
- m_domNodeMap = &m_staticDomNodeMap;
- m_domObjectMap = &m_staticDomObjectMap;
- m_activeDomObjectMap = &m_staticActiveDomObjectMap;
-#if ENABLE(SVG)
- m_domSvgElementInstanceMap = &m_staticDomSvgElementInstanceMap;
-#endif
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/StaticDOMDataStore.h b/WebCore/bindings/v8/StaticDOMDataStore.h
deleted file mode 100644
index fb6aa42..0000000
--- a/WebCore/bindings/v8/StaticDOMDataStore.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 StaticDOMDataStore_h
-#define StaticDOMDataStore_h
-
-#include "DOMDataStore.h"
-
-namespace WebCore {
-
-// StaticDOMDataStore
-//
-// StaticDOMDataStore is a DOMDataStore that manages the lifetime of the store
-// statically. This encapsulates thread-specific DOM data for the main
-// thread. All the maps in it are static. This is because we are unable to
-// rely on WTF::ThreadSpecificThreadExit to do the cleanup since the place that
-// tears down the main thread can not call any WTF functions.
-//
-class StaticDOMDataStore : public DOMDataStore {
-public:
- StaticDOMDataStore(DOMData*);
-
-private:
- IntrusiveDOMWrapperMap m_staticDomNodeMap;
- DOMWrapperMap<void> m_staticDomObjectMap;
- DOMWrapperMap<void> m_staticActiveDomObjectMap;
-#if ENABLE(SVG)
- DOMWrapperMap<SVGElementInstance> m_staticDomSvgElementInstanceMap;
-#endif
-};
-
-} // namespace WebCore
-
-#endif // StaticDOMDataStore_h
-
diff --git a/WebCore/bindings/v8/V8AbstractEventListener.cpp b/WebCore/bindings/v8/V8AbstractEventListener.cpp
deleted file mode 100644
index bda4345..0000000
--- a/WebCore/bindings/v8/V8AbstractEventListener.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8AbstractEventListener.h"
-
-#include "DateExtension.h"
-#include "Document.h"
-#include "Event.h"
-#include "Frame.h"
-#include "V8Binding.h"
-#include "V8Event.h"
-#include "V8EventListenerList.h"
-#include "V8HiddenPropertyName.h"
-#include "V8Proxy.h"
-#include "V8Utilities.h"
-#include "WorkerContext.h"
-#include "WorkerContextExecutionProxy.h"
-
-namespace WebCore {
-
-static void weakEventListenerCallback(v8::Persistent<v8::Value>, void* parameter)
-{
- V8AbstractEventListener* listener = static_cast<V8AbstractEventListener*>(parameter);
- listener->disposeListenerObject();
-}
-
-V8AbstractEventListener::V8AbstractEventListener(bool isAttribute, const WorldContextHandle& worldContext)
- : EventListener(JSEventListenerType)
- , m_isWeak(true)
- , m_isAttribute(isAttribute)
- , m_worldContext(worldContext)
-{
-}
-
-V8AbstractEventListener::~V8AbstractEventListener()
-{
- if (!m_listener.IsEmpty()) {
- v8::HandleScope scope;
- v8::Local<v8::Object> listener = v8::Local<v8::Object>::New(m_listener);
- V8EventListenerList::clearWrapper(listener, m_isAttribute);
- }
- disposeListenerObject();
-}
-
-void V8AbstractEventListener::handleEvent(ScriptExecutionContext* context, Event* event)
-{
- ASSERT(event);
-
- // The callback function on XMLHttpRequest can clear the event listener and destroys 'this' object. Keep a local reference to it.
- // See issue 889829.
- RefPtr<V8AbstractEventListener> protect(this);
-
- v8::HandleScope handleScope;
-
- v8::Local<v8::Context> v8Context = toV8Context(context, worldContext());
- if (v8Context.IsEmpty())
- return;
-
- // Enter the V8 context in which to perform the event handling.
- v8::Context::Scope scope(v8Context);
-
- // Get the V8 wrapper for the event object.
- v8::Handle<v8::Value> jsEvent = toV8(event);
- ASSERT(!jsEvent.IsEmpty());
-
- invokeEventHandler(context, event, jsEvent);
-}
-
-void V8AbstractEventListener::disposeListenerObject()
-{
- if (!m_listener.IsEmpty()) {
-#ifndef NDEBUG
- V8GCController::unregisterGlobalHandle(this, m_listener);
-#endif
- m_listener.Dispose();
- m_listener.Clear();
- }
-}
-
-void V8AbstractEventListener::setListenerObject(v8::Handle<v8::Object> listener)
-{
- disposeListenerObject();
- m_listener = v8::Persistent<v8::Object>::New(listener);
-#ifndef NDEBUG
- V8GCController::registerGlobalHandle(EVENT_LISTENER, this, m_listener);
-#endif
- if (m_isWeak)
- m_listener.MakeWeak(this, &weakEventListenerCallback);
-}
-
-void V8AbstractEventListener::invokeEventHandler(ScriptExecutionContext* context, Event* event, v8::Handle<v8::Value> jsEvent)
-{
- // If jsEvent is empty, attempt to set it as a hidden value would crash v8.
- if (jsEvent.IsEmpty())
- return;
-
- v8::Local<v8::Context> v8Context = toV8Context(context, worldContext());
- if (v8Context.IsEmpty())
- return;
-
- // We push the event being processed into the global object, so that it can be exposed by DOMWindow's bindings.
- v8::Handle<v8::String> eventSymbol = V8HiddenPropertyName::event();
- v8::Local<v8::Value> returnValue;
-
- // In beforeunload/unload handlers, we want to avoid sleeps which do tight loops of calling Date.getTime().
- if (event->type() == "beforeunload" || event->type() == "unload")
- DateExtension::get()->setAllowSleep(false);
-
- {
- // Catch exceptions thrown in the event handler so they do not propagate to javascript code that caused the event to fire.
- v8::TryCatch tryCatch;
- tryCatch.SetVerbose(true);
-
- // Save the old 'event' property so we can restore it later.
- v8::Local<v8::Value> savedEvent = v8Context->Global()->GetHiddenValue(eventSymbol);
- tryCatch.Reset();
-
- // Make the event available in the global object, so DOMWindow can expose it.
- v8Context->Global()->SetHiddenValue(eventSymbol, jsEvent);
- tryCatch.Reset();
-
- // Call the event handler.
- returnValue = callListenerFunction(context, jsEvent, event);
- if (!tryCatch.CanContinue())
- return;
-
- // If an error occurs while handling the event, it should be reported in a regular way.
- tryCatch.Reset();
-
- // Restore the old event. This must be done for all exit paths through this method.
- if (savedEvent.IsEmpty())
- v8Context->Global()->SetHiddenValue(eventSymbol, v8::Undefined());
- else
- v8Context->Global()->SetHiddenValue(eventSymbol, savedEvent);
- tryCatch.Reset();
- }
-
- if (event->type() == "beforeunload" || event->type() == "unload")
- DateExtension::get()->setAllowSleep(true);
-
- ASSERT(!V8Proxy::handleOutOfMemory() || returnValue.IsEmpty());
-
- if (returnValue.IsEmpty())
- return;
-
- if (!returnValue->IsNull() && !returnValue->IsUndefined() && event->storesResultAsString())
- event->storeResult(toWebCoreString(returnValue));
-
- // Prevent default action if the return value is false;
- // FIXME: Add example, and reference to bug entry.
- if (m_isAttribute && returnValue->IsBoolean() && !returnValue->BooleanValue())
- event->preventDefault();
-}
-
-v8::Local<v8::Object> V8AbstractEventListener::getReceiverObject(Event* event)
-{
- if (!m_listener.IsEmpty() && !m_listener->IsFunction())
- return v8::Local<v8::Object>::New(m_listener);
-
- EventTarget* target = event->currentTarget();
- v8::Handle<v8::Value> value = V8DOMWrapper::convertEventTargetToV8Object(target);
- if (value.IsEmpty())
- return v8::Local<v8::Object>();
- return v8::Local<v8::Object>::New(v8::Handle<v8::Object>::Cast(value));
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/V8AbstractEventListener.h b/WebCore/bindings/v8/V8AbstractEventListener.h
deleted file mode 100644
index 4b36ffb..0000000
--- a/WebCore/bindings/v8/V8AbstractEventListener.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8AbstractEventListener_h
-#define V8AbstractEventListener_h
-
-#include "EventListener.h"
-#include "WorldContextHandle.h"
-
-#include <v8.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-
-namespace WebCore {
-
- class Event;
- class Frame;
- class V8Proxy;
-
- // There are two kinds of event listeners: HTML or non-HMTL. onload,
- // onfocus, etc (attributes) are always HTML event handler type; Event
- // listeners added by Window.addEventListener or
- // EventTargetNode::addEventListener are non-HTML type.
- //
- // Why does this matter?
- // WebKit does not allow duplicated HTML event handlers of the same type,
- // but ALLOWs duplicated non-HTML event handlers.
- class V8AbstractEventListener : public EventListener {
- public:
- virtual ~V8AbstractEventListener();
-
- static const V8AbstractEventListener* cast(const EventListener* listener)
- {
- return listener->type() == JSEventListenerType
- ? static_cast<const V8AbstractEventListener*>(listener)
- : 0;
- }
-
- static V8AbstractEventListener* cast(EventListener* listener)
- {
- return const_cast<V8AbstractEventListener*>(cast(const_cast<const EventListener*>(listener)));
- }
-
- // Implementation of EventListener interface.
-
- virtual bool operator==(const EventListener& other) { return this == &other; }
-
- virtual void handleEvent(ScriptExecutionContext*, Event*);
-
- virtual bool isLazy() const { return false; }
-
- // Returns the listener object, either a function or an object.
- v8::Local<v8::Object> getListenerObject(ScriptExecutionContext* context)
- {
- prepareListenerObject(context);
- return v8::Local<v8::Object>::New(m_listener);
- }
-
- v8::Local<v8::Object> getExistingListenerObject()
- {
- return v8::Local<v8::Object>::New(m_listener);
- }
-
- bool hasExistingListenerObject()
- {
- return !m_listener.IsEmpty();
- }
-
- // Dispose listener object and clear the handle.
- void disposeListenerObject();
-
- const WorldContextHandle& worldContext() const { return m_worldContext; }
-
- protected:
- V8AbstractEventListener(bool isAttribute, const WorldContextHandle& worldContext);
-
- virtual void prepareListenerObject(ScriptExecutionContext*) { }
-
- void setListenerObject(v8::Handle<v8::Object> listener);
-
- void invokeEventHandler(ScriptExecutionContext*, Event*, v8::Handle<v8::Value> jsEvent);
-
- // Get the receiver object to use for event listener call.
- v8::Local<v8::Object> getReceiverObject(Event*);
-
- private:
- // Implementation of EventListener function.
- virtual bool virtualisAttribute() const { return m_isAttribute; }
-
- virtual v8::Local<v8::Value> callListenerFunction(ScriptExecutionContext*, v8::Handle<v8::Value> jsevent, Event*) = 0;
-
- v8::Persistent<v8::Object> m_listener;
-
- // Indicates if the above handle is weak.
- bool m_isWeak;
-
- // Indicates if this is an HTML type listener.
- bool m_isAttribute;
-
- WorldContextHandle m_worldContext;
- };
-
-} // namespace WebCore
-
-#endif // V8AbstractEventListener_h
diff --git a/WebCore/bindings/v8/V8Binding.cpp b/WebCore/bindings/v8/V8Binding.cpp
deleted file mode 100644
index 52b23bd..0000000
--- a/WebCore/bindings/v8/V8Binding.cpp
+++ /dev/null
@@ -1,581 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8Binding.h"
-
-#include "Element.h"
-#include "MathExtras.h"
-#include "PlatformString.h"
-#include "QualifiedName.h"
-#include "StdLibExtras.h"
-#include "Threading.h"
-#include "V8Element.h"
-#include "V8Proxy.h"
-#include <wtf/text/AtomicString.h>
-#include <wtf/text/CString.h>
-#include <wtf/text/StringBuffer.h>
-#include <wtf/text/StringHash.h>
-
-namespace WebCore {
-
-// WebCoreStringResource is a helper class for v8ExternalString. It is used
-// to manage the life-cycle of the underlying buffer of the external string.
-class WebCoreStringResource : public v8::String::ExternalStringResource {
-public:
- explicit WebCoreStringResource(const String& string)
- : m_plainString(string)
- {
-#ifndef NDEBUG
- m_threadId = WTF::currentThread();
-#endif
- ASSERT(!string.isNull());
- v8::V8::AdjustAmountOfExternalAllocatedMemory(2 * string.length());
- }
-
- explicit WebCoreStringResource(const AtomicString& string)
- : m_plainString(string.string())
- , m_atomicString(string)
- {
-#ifndef NDEBUG
- m_threadId = WTF::currentThread();
-#endif
- ASSERT(!string.isNull());
- v8::V8::AdjustAmountOfExternalAllocatedMemory(2 * string.length());
- }
-
- virtual ~WebCoreStringResource()
- {
-#ifndef NDEBUG
- ASSERT(m_threadId == WTF::currentThread());
-#endif
- int reducedExternalMemory = -2 * m_plainString.length();
- if (m_plainString.impl() != m_atomicString.impl() && !m_atomicString.isNull())
- reducedExternalMemory *= 2;
- v8::V8::AdjustAmountOfExternalAllocatedMemory(reducedExternalMemory);
- }
-
- virtual const uint16_t* data() const
- {
- return reinterpret_cast<const uint16_t*>(m_plainString.impl()->characters());
- }
-
- virtual size_t length() const { return m_plainString.impl()->length(); }
-
- String webcoreString() { return m_plainString; }
-
- AtomicString atomicString()
- {
-#ifndef NDEBUG
- ASSERT(m_threadId == WTF::currentThread());
-#endif
- if (m_atomicString.isNull()) {
- m_atomicString = AtomicString(m_plainString);
- ASSERT(!m_atomicString.isNull());
- if (m_plainString.impl() != m_atomicString.impl())
- v8::V8::AdjustAmountOfExternalAllocatedMemory(2 * m_atomicString.length());
- }
- return m_atomicString;
- }
-
- static WebCoreStringResource* toStringResource(v8::Handle<v8::String> v8String)
- {
- return static_cast<WebCoreStringResource*>(v8String->GetExternalStringResource());
- }
-
-private:
- // A shallow copy of the string. Keeps the string buffer alive until the V8 engine garbage collects it.
- String m_plainString;
- // If this string is atomic or has been made atomic earlier the
- // atomic string is held here. In the case where the string starts
- // off non-atomic and becomes atomic later it is necessary to keep
- // the original string alive because v8 may keep derived pointers
- // into that string.
- AtomicString m_atomicString;
-
-#ifndef NDEBUG
- WTF::ThreadIdentifier m_threadId;
-#endif
-};
-
-String v8ValueToWebCoreString(v8::Handle<v8::Value> value)
-{
- if (value->IsString())
- return v8StringToWebCoreString(v8::Handle<v8::String>::Cast(value));
- return v8NonStringValueToWebCoreString(value);
-}
-
-AtomicString v8ValueToAtomicWebCoreString(v8::Handle<v8::Value> value)
-{
- if (value->IsString())
- return v8StringToAtomicWebCoreString(v8::Handle<v8::String>::Cast(value));
- return v8NonStringValueToAtomicWebCoreString(value);
-}
-
-int toInt32(v8::Handle<v8::Value> value, bool& ok)
-{
- ok = true;
-
- // Fast case. The value is already a 32-bit integer.
- if (value->IsInt32())
- return value->Int32Value();
-
- // Can the value be converted to a number?
- v8::Local<v8::Number> numberObject = value->ToNumber();
- if (numberObject.IsEmpty()) {
- ok = false;
- return 0;
- }
-
- // Does the value convert to nan or to an infinity?
- double numberValue = numberObject->Value();
- if (isnan(numberValue) || isinf(numberValue)) {
- ok = false;
- return 0;
- }
-
- // Can the value be converted to a 32-bit integer?
- v8::Local<v8::Int32> intValue = value->ToInt32();
- if (intValue.IsEmpty()) {
- ok = false;
- return 0;
- }
-
- // Return the result of the int32 conversion.
- return intValue->Value();
-}
-
-uint32_t toUInt32(v8::Handle<v8::Value> value, bool& ok)
-{
- ok = true;
-
- // FIXME: there is currently no Value::IsUint32(). This code does
- // some contortions to avoid silently converting out-of-range
- // values to uint32_t.
-
- // Fast case. The value is already a 32-bit positive integer.
- if (value->IsInt32()) {
- int32_t result = value->Int32Value();
- if (result >= 0)
- return result;
- }
-
- // Can the value be converted to a number?
- v8::Local<v8::Number> numberObject = value->ToNumber();
- if (numberObject.IsEmpty()) {
- ok = false;
- return 0;
- }
-
- // Does the value convert to nan or to an infinity?
- double numberValue = numberObject->Value();
- if (isnan(numberValue) || isinf(numberValue)) {
- ok = false;
- return 0;
- }
-
- // Can the value be converted to a 32-bit unsigned integer?
- v8::Local<v8::Uint32> uintValue = value->ToUint32();
- if (uintValue.IsEmpty()) {
- ok = false;
- return 0;
- }
-
- // FIXME: v8::Uint32::Value is not defined!
- // http://code.google.com/p/v8/issues/detail?id=624
- v8::Local<v8::Int32> intValue = value->ToInt32();
- if (intValue.IsEmpty()) {
- ok = false;
- return 0;
- }
-
- return static_cast<uint32_t>(intValue->Value());
-}
-
-String toWebCoreString(const v8::Arguments& args, int index) {
- return v8ValueToWebCoreString(args[index]);
-}
-
-
-String toWebCoreStringWithNullCheck(v8::Handle<v8::Value> value)
-{
- if (value->IsNull())
- return String();
- return v8ValueToWebCoreString(value);
-}
-
-AtomicString toAtomicWebCoreStringWithNullCheck(v8::Handle<v8::Value> value)
-{
- if (value->IsNull())
- return AtomicString();
- return v8ValueToAtomicWebCoreString(value);
-}
-
-String toWebCoreStringWithNullOrUndefinedCheck(v8::Handle<v8::Value> value)
-{
- if (value->IsNull() || value->IsUndefined())
- return String();
- return toWebCoreString(value);
-}
-
-bool isUndefinedOrNull(v8::Handle<v8::Value> value)
-{
- return value->IsNull() || value->IsUndefined();
-}
-
-v8::Handle<v8::Boolean> v8Boolean(bool value)
-{
- return value ? v8::True() : v8::False();
-}
-
-v8::Handle<v8::String> v8UndetectableString(const String& str)
-{
- return v8::String::NewUndetectable(fromWebCoreString(str), str.length());
-}
-
-v8::Handle<v8::Value> v8StringOrNull(const String& str)
-{
- return str.isNull() ? v8::Handle<v8::Value>(v8::Null()) : v8::Handle<v8::Value>(v8String(str));
-}
-
-v8::Handle<v8::Value> v8StringOrUndefined(const String& str)
-{
- return str.isNull() ? v8::Handle<v8::Value>(v8::Undefined()) : v8::Handle<v8::Value>(v8String(str));
-}
-
-v8::Handle<v8::Value> v8StringOrFalse(const String& str)
-{
- return str.isNull() ? v8::Handle<v8::Value>(v8::False()) : v8::Handle<v8::Value>(v8String(str));
-}
-
-double toWebCoreDate(v8::Handle<v8::Value> object)
-{
- return (object->IsDate() || object->IsNumber()) ? object->NumberValue() : std::numeric_limits<double>::quiet_NaN();
-}
-
-v8::Handle<v8::Value> v8DateOrNull(double value)
-{
- if (isfinite(value))
- return v8::Date::New(value);
- return v8::Null();
-}
-
-template <class S> struct StringTraits
-{
- static S fromStringResource(WebCoreStringResource* resource);
-
- static S fromV8String(v8::Handle<v8::String> v8String, int length);
-};
-
-template<>
-struct StringTraits<String>
-{
- static String fromStringResource(WebCoreStringResource* resource)
- {
- return resource->webcoreString();
- }
-
- static String fromV8String(v8::Handle<v8::String> v8String, int length)
- {
- ASSERT(v8String->Length() == length);
- // NOTE: as of now, String(const UChar*, int) performs String::createUninitialized
- // anyway, so no need to optimize like we do for AtomicString below.
- UChar* buffer;
- String result = String::createUninitialized(length, buffer);
- v8String->Write(reinterpret_cast<uint16_t*>(buffer), 0, length);
- return result;
- }
-};
-
-template<>
-struct StringTraits<AtomicString>
-{
- static AtomicString fromStringResource(WebCoreStringResource* resource)
- {
- return resource->atomicString();
- }
-
- static AtomicString fromV8String(v8::Handle<v8::String> v8String, int length)
- {
- ASSERT(v8String->Length() == length);
- static const int inlineBufferSize = 16;
- if (length <= inlineBufferSize) {
- UChar inlineBuffer[inlineBufferSize];
- v8String->Write(reinterpret_cast<uint16_t*>(inlineBuffer), 0, length);
- return AtomicString(inlineBuffer, length);
- }
- UChar* buffer;
- String tmp = String::createUninitialized(length, buffer);
- v8String->Write(reinterpret_cast<uint16_t*>(buffer), 0, length);
- return AtomicString(tmp);
- }
-};
-
-template <typename StringType>
-StringType v8StringToWebCoreString(v8::Handle<v8::String> v8String, ExternalMode external)
-{
- WebCoreStringResource* stringResource = WebCoreStringResource::toStringResource(v8String);
- if (stringResource)
- return StringTraits<StringType>::fromStringResource(stringResource);
-
- int length = v8String->Length();
- if (!length) {
- // Avoid trying to morph empty strings, as they do not have enough room to contain the external reference.
- return StringImpl::empty();
- }
-
- StringType result(StringTraits<StringType>::fromV8String(v8String, length));
-
- if (external == Externalize && v8String->CanMakeExternal()) {
- stringResource = new WebCoreStringResource(result);
- if (!v8String->MakeExternal(stringResource)) {
- // In case of a failure delete the external resource as it was not used.
- delete stringResource;
- }
- }
- return result;
-}
-
-// Explicitly instantiate the above template with the expected parameterizations,
-// to ensure the compiler generates the code; otherwise link errors can result in GCC 4.4.
-template String v8StringToWebCoreString<String>(v8::Handle<v8::String>, ExternalMode);
-template AtomicString v8StringToWebCoreString<AtomicString>(v8::Handle<v8::String>, ExternalMode);
-
-// Fast but non thread-safe version.
-String int32ToWebCoreStringFast(int value)
-{
- // Caching of small strings below is not thread safe: newly constructed AtomicString
- // are not safely published.
- ASSERT(WTF::isMainThread());
-
- // Most numbers used are <= 100. Even if they aren't used there's very little cost in using the space.
- const int kLowNumbers = 100;
- DEFINE_STATIC_LOCAL(Vector<AtomicString>, lowNumbers, (kLowNumbers + 1));
- String webCoreString;
- if (0 <= value && value <= kLowNumbers) {
- webCoreString = lowNumbers[value];
- if (!webCoreString) {
- AtomicString valueString = AtomicString(String::number(value));
- lowNumbers[value] = valueString;
- webCoreString = valueString;
- }
- } else
- webCoreString = String::number(value);
- return webCoreString;
-}
-
-String int32ToWebCoreString(int value)
-{
- // If we are on the main thread (this should always true for non-workers), call the faster one.
- if (WTF::isMainThread())
- return int32ToWebCoreStringFast(value);
- return String::number(value);
-}
-
-String v8NonStringValueToWebCoreString(v8::Handle<v8::Value> object)
-{
- ASSERT(!object->IsString());
- if (object->IsInt32())
- return int32ToWebCoreString(object->Int32Value());
-
- v8::TryCatch block;
- v8::Handle<v8::String> v8String = object->ToString();
- // Handle the case where an exception is thrown as part of invoking toString on the object.
- if (block.HasCaught()) {
- throwError(block.Exception());
- return StringImpl::empty();
- }
- return v8StringToWebCoreString<String>(v8String, DoNotExternalize);
-}
-
-AtomicString v8NonStringValueToAtomicWebCoreString(v8::Handle<v8::Value> object)
-{
- ASSERT(!object->IsString());
- return AtomicString(v8NonStringValueToWebCoreString(object));
-}
-
-static bool stringImplCacheEnabled = false;
-
-void enableStringImplCache()
-{
- stringImplCacheEnabled = true;
-}
-
-static v8::Local<v8::String> makeExternalString(const String& string)
-{
- WebCoreStringResource* stringResource = new WebCoreStringResource(string);
- v8::Local<v8::String> newString = v8::String::NewExternal(stringResource);
- if (newString.IsEmpty())
- delete stringResource;
-
- return newString;
-}
-
-typedef HashMap<StringImpl*, v8::String*> StringCache;
-
-static StringCache& getStringCache()
-{
- ASSERT(WTF::isMainThread());
- DEFINE_STATIC_LOCAL(StringCache, mainThreadStringCache, ());
- return mainThreadStringCache;
-}
-
-static void cachedStringCallback(v8::Persistent<v8::Value> wrapper, void* parameter)
-{
- ASSERT(WTF::isMainThread());
- StringImpl* stringImpl = static_cast<StringImpl*>(parameter);
- ASSERT(getStringCache().contains(stringImpl));
- getStringCache().remove(stringImpl);
- wrapper.Dispose();
- stringImpl->deref();
-}
-
-RefPtr<StringImpl> lastStringImpl = 0;
-v8::Persistent<v8::String> lastV8String;
-
-v8::Local<v8::String> v8ExternalStringSlow(StringImpl* stringImpl)
-{
- if (!stringImpl->length())
- return v8::String::Empty();
-
- if (!stringImplCacheEnabled)
- return makeExternalString(String(stringImpl));
-
- StringCache& stringCache = getStringCache();
- v8::String* cachedV8String = stringCache.get(stringImpl);
- if (cachedV8String) {
- v8::Persistent<v8::String> handle(cachedV8String);
- if (!handle.IsNearDeath() && !handle.IsEmpty()) {
- lastStringImpl = stringImpl;
- lastV8String = handle;
- return v8::Local<v8::String>::New(handle);
- }
- }
-
- v8::Local<v8::String> newString = makeExternalString(String(stringImpl));
- if (newString.IsEmpty())
- return newString;
-
- v8::Persistent<v8::String> wrapper = v8::Persistent<v8::String>::New(newString);
- if (wrapper.IsEmpty())
- return newString;
-
- stringImpl->ref();
- wrapper.MakeWeak(stringImpl, cachedStringCallback);
- stringCache.set(stringImpl, *wrapper);
-
- lastStringImpl = stringImpl;
- lastV8String = wrapper;
-
- return newString;
-}
-
-v8::Persistent<v8::FunctionTemplate> createRawTemplate()
-{
- v8::HandleScope scope;
- v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(V8Proxy::checkNewLegal);
- return v8::Persistent<v8::FunctionTemplate>::New(result);
-}
-
-v8::Local<v8::Signature> configureTemplate(v8::Persistent<v8::FunctionTemplate> desc,
- const char *interfaceName,
- v8::Persistent<v8::FunctionTemplate> parentClass,
- int fieldCount,
- const BatchedAttribute* attributes,
- size_t attributeCount,
- const BatchedCallback* callbacks,
- size_t callbackCount)
-{
- desc->SetClassName(v8::String::New(interfaceName));
- v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
- instance->SetInternalFieldCount(fieldCount);
- if (!parentClass.IsEmpty())
- desc->Inherit(parentClass);
- if (attributeCount)
- batchConfigureAttributes(instance, desc->PrototypeTemplate(),
- attributes, attributeCount);
- v8::Local<v8::Signature> defaultSignature = v8::Signature::New(desc);
- if (callbackCount)
- batchConfigureCallbacks(desc->PrototypeTemplate(),
- defaultSignature,
- static_cast<v8::PropertyAttribute>(v8::DontDelete),
- callbacks, callbackCount);
- return defaultSignature;
-}
-
-v8::Persistent<v8::String> getToStringName()
-{
- DEFINE_STATIC_LOCAL(v8::Persistent<v8::String>, value, ());
- if (value.IsEmpty())
- value = v8::Persistent<v8::String>::New(v8::String::New("toString"));
- return value;
-}
-
-static v8::Handle<v8::Value> constructorToString(const v8::Arguments& args)
-{
- // The DOM constructors' toString functions grab the current toString
- // for Functions by taking the toString function of itself and then
- // calling it with the constructor as its receiver. This means that
- // changes to the Function prototype chain or toString function are
- // reflected when printing DOM constructors. The only wart is that
- // changes to a DOM constructor's toString's toString will cause the
- // toString of the DOM constructor itself to change. This is extremely
- // obscure and unlikely to be a problem.
- v8::Handle<v8::Value> value = args.Callee()->Get(getToStringName());
- if (!value->IsFunction())
- return v8::String::New("");
- return v8::Handle<v8::Function>::Cast(value)->Call(args.This(), 0, 0);
-}
-
-v8::Persistent<v8::FunctionTemplate> getToStringTemplate()
-{
- DEFINE_STATIC_LOCAL(v8::Persistent<v8::FunctionTemplate>, toStringTemplate, ());
- if (toStringTemplate.IsEmpty())
- toStringTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(constructorToString));
- return toStringTemplate;
-}
-
-v8::Handle<v8::Value> getElementStringAttr(const v8::AccessorInfo& info,
- const QualifiedName& name)
-{
- Element* imp = V8Element::toNative(info.Holder());
- return v8ExternalString(imp->getAttribute(name));
-}
-
-void setElementStringAttr(const v8::AccessorInfo& info,
- const QualifiedName& name,
- v8::Local<v8::Value> value)
-{
- Element* imp = V8Element::toNative(info.Holder());
- AtomicString v = toAtomicWebCoreStringWithNullCheck(value);
- imp->setAttribute(name, v);
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/V8Binding.h b/WebCore/bindings/v8/V8Binding.h
deleted file mode 100644
index 566e8ac..0000000
--- a/WebCore/bindings/v8/V8Binding.h
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
-* Copyright (C) 2009 Google 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:
-*
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * 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.
-* * Neither the name of Google Inc. nor the names of its
-* contributors may be used to endorse or promote products derived from
-* this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "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 THE COPYRIGHT
-* OWNER 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 V8Binding_h
-#define V8Binding_h
-
-#include "BindingFrame.h"
-#include "BindingLocation.h"
-#include "BindingSecurity.h"
-#include "MathExtras.h"
-#include "PlatformString.h"
-#include "V8DOMWrapper.h"
-#include <wtf/text/AtomicString.h>
-
-#include <v8.h>
-
-namespace WebCore {
-
- class EventListener;
- class EventTarget;
- class V8BindingDOMWindow;
-
- // Instantiate binding template classes for V8.
- class V8Binding {
- public:
- typedef v8::Handle<v8::Value> Value;
- typedef V8BindingDOMWindow DOMWindow;
- typedef BindingFrame<V8Binding> Frame;
- typedef BindingLocation<V8Binding> Location;
-
- static Value emptyScriptValue() { return v8::Local<v8::Value>(); }
- };
- typedef BindingSecurity<V8Binding> V8BindingSecurity;
-
- enum ExternalMode {
- Externalize,
- DoNotExternalize
- };
-
- template <typename StringType>
- StringType v8StringToWebCoreString(v8::Handle<v8::String> v8String, ExternalMode external);
-
- // Convert v8 types to a WTF::String. If the V8 string is not already
- // an external string then it is transformed into an external string at this
- // point to avoid repeated conversions.
- inline String v8StringToWebCoreString(v8::Handle<v8::String> v8String)
- {
- return v8StringToWebCoreString<String>(v8String, Externalize);
- }
- String v8NonStringValueToWebCoreString(v8::Handle<v8::Value>);
- String v8ValueToWebCoreString(v8::Handle<v8::Value> value);
-
- // Convert v8 types to a WTF::AtomicString.
- inline AtomicString v8StringToAtomicWebCoreString(v8::Handle<v8::String> v8String)
- {
- return v8StringToWebCoreString<AtomicString>(v8String, Externalize);
- }
- AtomicString v8NonStringValueToAtomicWebCoreString(v8::Handle<v8::Value>);
- AtomicString v8ValueToAtomicWebCoreString(v8::Handle<v8::Value> value);
-
- // Note: RefPtr is a must as we cache by StringImpl* equality, not identity
- // hence lastStringImpl might be not a key of the cache (in sense of identity)
- // and hence it's not refed on addition.
- extern RefPtr<StringImpl> lastStringImpl;
- extern v8::Persistent<v8::String> lastV8String;
- v8::Local<v8::String> v8ExternalStringSlow(StringImpl* stringImpl);
-
- // Return a V8 external string that shares the underlying buffer with the given
- // WebCore string. The reference counting mechanism is used to keep the
- // underlying buffer alive while the string is still live in the V8 engine.
- inline v8::Local<v8::String> v8ExternalString(const String& string)
- {
- StringImpl* stringImpl = string.impl();
- if (!stringImpl)
- return v8::String::Empty();
-
- if (lastStringImpl.get() == stringImpl) {
- ASSERT(!lastV8String.IsNearDeath());
- ASSERT(!lastV8String.IsEmpty());
- return v8::Local<v8::String>::New(lastV8String);
- }
-
- return v8ExternalStringSlow(stringImpl);
- }
-
- // Convert a string to a V8 string.
- inline v8::Handle<v8::String> v8String(const String& string)
- {
- return v8ExternalString(string);
- }
-
- // Enables caching v8 wrappers created for WTF::StringImpl. Currently this cache requires
- // all the calls (both to convert WTF::String to v8::String and to GC the handle)
- // to be performed on the main thread.
- void enableStringImplCache();
-
- // Convert a value to a 32-bit integer. The conversion fails if the
- // value cannot be converted to an integer or converts to nan or to an infinity.
- int toInt32(v8::Handle<v8::Value> value, bool& ok);
-
- // Convert a value to a 32-bit integer assuming the conversion cannot fail.
- inline int toInt32(v8::Handle<v8::Value> value)
- {
- bool ok;
- return toInt32(value, ok);
- }
-
- // Convert a value to a 32-bit unsigned integer. The conversion fails if the
- // value cannot be converted to an unsigned integer or converts to nan or to an infinity.
- uint32_t toUInt32(v8::Handle<v8::Value> value, bool& ok);
-
- // Convert a value to a 32-bit unsigned integer assuming the conversion cannot fail.
- inline uint32_t toUInt32(v8::Handle<v8::Value> value)
- {
- bool ok;
- return toUInt32(value, ok);
- }
-
- inline float toFloat(v8::Local<v8::Value> value)
- {
- return static_cast<float>(value->NumberValue());
- }
-
- inline long long toInt64(v8::Local<v8::Value> value)
- {
- return static_cast<long long>(value->IntegerValue());
- }
-
- // FIXME: Drop this in favor of the type specific v8ValueToWebCoreString when we rework the code generation.
- inline String toWebCoreString(v8::Handle<v8::Value> object)
- {
- return v8ValueToWebCoreString(object);
- }
-
- String toWebCoreString(const v8::Arguments&, int index);
-
- // The string returned by this function is still owned by the argument
- // and will be deallocated when the argument is deallocated.
- inline const uint16_t* fromWebCoreString(const String& str)
- {
- return reinterpret_cast<const uint16_t*>(str.characters());
- }
-
- bool isUndefinedOrNull(v8::Handle<v8::Value> value);
-
- v8::Handle<v8::Boolean> v8Boolean(bool value);
-
- String toWebCoreStringWithNullCheck(v8::Handle<v8::Value> value);
-
- AtomicString toAtomicWebCoreStringWithNullCheck(v8::Handle<v8::Value> value);
-
- String toWebCoreStringWithNullOrUndefinedCheck(v8::Handle<v8::Value> value);
-
- v8::Handle<v8::String> v8UndetectableString(const String& str);
-
- v8::Handle<v8::Value> v8StringOrNull(const String& str);
-
- v8::Handle<v8::Value> v8StringOrUndefined(const String& str);
-
- v8::Handle<v8::Value> v8StringOrFalse(const String& str);
-
- double toWebCoreDate(v8::Handle<v8::Value> object);
-
- v8::Handle<v8::Value> v8DateOrNull(double value);
-
- v8::Persistent<v8::FunctionTemplate> createRawTemplate();
-
- struct BatchedAttribute;
- struct BatchedCallback;
-
- v8::Local<v8::Signature> configureTemplate(v8::Persistent<v8::FunctionTemplate>,
- const char* interfaceName,
- v8::Persistent<v8::FunctionTemplate> parentClass,
- int fieldCount,
- const BatchedAttribute*,
- size_t attributeCount,
- const BatchedCallback*,
- size_t callbackCount);
-
- v8::Handle<v8::Value> getElementStringAttr(const v8::AccessorInfo&,
- const QualifiedName&);
- void setElementStringAttr(const v8::AccessorInfo&,
- const QualifiedName&,
- v8::Local<v8::Value>);
-
-
- v8::Persistent<v8::String> getToStringName();
- v8::Persistent<v8::FunctionTemplate> getToStringTemplate();
-
- String int32ToWebCoreString(int value);
-
- class V8ParameterBase {
- public:
- operator String() { return toString<String>(); }
- operator AtomicString() { return toString<AtomicString>(); }
-
- protected:
- V8ParameterBase(v8::Local<v8::Value> object) : m_v8Object(object), m_mode(Externalize), m_string() { }
-
- bool prepareBase()
- {
- if (LIKELY(m_v8Object->IsString()))
- return true;
-
- if (LIKELY(m_v8Object->IsInt32())) {
- setString(int32ToWebCoreString(m_v8Object->Int32Value()));
- return true;
- }
-
- m_mode = DoNotExternalize;
- v8::TryCatch block;
- m_v8Object = m_v8Object->ToString();
- // Handle the case where an exception is thrown as part of invoking toString on the object.
- if (block.HasCaught()) {
- block.ReThrow();
- return false;
- }
-
- return true;
- }
-
- v8::Local<v8::Value> object() { return m_v8Object; }
-
- void setString(String string)
- {
- m_string = string;
- m_v8Object.Clear(); // To signal that String is ready.
- }
-
- private:
- v8::Local<v8::Value> m_v8Object;
- ExternalMode m_mode;
- String m_string;
-
- template <class StringType>
- StringType toString()
- {
- if (LIKELY(!m_v8Object.IsEmpty()))
- return v8StringToWebCoreString<StringType>(m_v8Object.As<v8::String>(), m_mode);
-
- return StringType(m_string);
- }
- };
-
- // V8Parameter is an adapter class that converts V8 values to Strings
- // or AtomicStrings as appropriate, using multiple typecast operators.
- enum V8ParameterMode {
- DefaultMode,
- WithNullCheck,
- WithUndefinedOrNullCheck
- };
- template <V8ParameterMode MODE = DefaultMode>
- class V8Parameter: public V8ParameterBase {
- public:
- V8Parameter(v8::Local<v8::Value> object) : V8ParameterBase(object) { }
- V8Parameter(v8::Local<v8::Value> object, bool) : V8ParameterBase(object) { prepare(); }
-
- bool prepare();
- };
-
- template<> inline bool V8Parameter<DefaultMode>::prepare()
- {
- return V8ParameterBase::prepareBase();
- }
-
- template<> inline bool V8Parameter<WithNullCheck>::prepare()
- {
- if (object()->IsNull()) {
- setString(String());
- return true;
- }
-
- return V8ParameterBase::prepareBase();
- }
-
- template<> inline bool V8Parameter<WithUndefinedOrNullCheck>::prepare()
- {
- if (object()->IsNull() || object()->IsUndefined()) {
- setString(String());
- return true;
- }
-
- return V8ParameterBase::prepareBase();
- }
-
-} // namespace WebCore
-
-#endif // V8Binding_h
diff --git a/WebCore/bindings/v8/V8Collection.cpp b/WebCore/bindings/v8/V8Collection.cpp
deleted file mode 100644
index 2ff5c88..0000000
--- a/WebCore/bindings/v8/V8Collection.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8Collection.h"
-
-#include "ExceptionCode.h"
-#include "HTMLOptionElement.h"
-#include "V8HTMLOptionElement.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> toOptionsCollectionSetter(uint32_t index, v8::Handle<v8::Value> value, HTMLSelectElement* base)
-{
- if (value->IsNull() || value->IsUndefined()) {
- base->remove(index);
- return value;
- }
-
- ExceptionCode ec = 0;
-
- // Check that the value is an HTMLOptionElement. If not, throw a TYPE_MISMATCH_ERR DOMException.
- if (!V8HTMLOptionElement::HasInstance(value)) {
- V8Proxy::setDOMException(TYPE_MISMATCH_ERR);
- return value;
- }
-
- HTMLOptionElement* element = V8HTMLOptionElement::toNative(v8::Handle<v8::Object>::Cast(value));
- base->setOption(index, element, ec);
-
- V8Proxy::setDOMException(ec);
- return value;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/V8Collection.h b/WebCore/bindings/v8/V8Collection.h
deleted file mode 100644
index 1757c85..0000000
--- a/WebCore/bindings/v8/V8Collection.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8Collection_h
-#define V8Collection_h
-
-#include "HTMLFormElement.h"
-#include "HTMLSelectElement.h"
-#include "V8Binding.h"
-#include "V8Node.h"
-#include "V8Proxy.h"
-#include <v8.h>
-
-namespace WebCore {
-// FIXME: These functions should be named using to* since they return the item (get* is used for method that take a ref param).
-// See https://bugs.webkit.org/show_bug.cgi?id=24664.
-
-template<class T> static v8::Handle<v8::Value> getV8Object(T* implementation)
-{
- if (!implementation)
- return v8::Handle<v8::Value>();
- return toV8(implementation);
-}
-
-template<class Collection> static Collection* toNativeCollection(v8::Local<v8::Object> object)
-{
- return reinterpret_cast<Collection*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex));
-}
-
-template<class T> static v8::Handle<v8::Value> getV8Object(PassRefPtr<T> implementation)
-{
- return getV8Object(implementation.get());
-}
-
-// Returns named property of a collection.
-template<class Collection, class ItemType> static v8::Handle<v8::Value> getNamedPropertyOfCollection(v8::Local<v8::String> name, v8::Local<v8::Object> object)
-{
- // FIXME: assert object is a collection type
- ASSERT(V8DOMWrapper::maybeDOMWrapper(object));
- ASSERT(V8DOMWrapper::domWrapperType(object) != &V8Node::info);
- Collection* collection = toNativeCollection<Collection>(object);
- AtomicString propertyName = toAtomicWebCoreStringWithNullCheck(name);
- return getV8Object<ItemType>(collection->namedItem(propertyName));
-}
-
-// A template of named property accessor of collections.
-template<class Collection, class ItemType> static v8::Handle<v8::Value> collectionNamedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototypeChain(name);
-
- if (!value.IsEmpty())
- return value;
-
- // Search local callback properties next to find IDL defined
- // properties.
- if (info.Holder()->HasRealNamedCallbackProperty(name))
- return notHandledByInterceptor();
- return getNamedPropertyOfCollection<Collection, ItemType>(name, info.Holder());
-}
-
-// Returns the property at the index of a collection.
-template<class Collection, class ItemType> static v8::Handle<v8::Value> getIndexedPropertyOfCollection(uint32_t index, v8::Local<v8::Object> object)
-{
- // FIXME: Assert that object must be a collection type.
- ASSERT(V8DOMWrapper::maybeDOMWrapper(object));
- ASSERT(V8DOMWrapper::domWrapperType(object) != &V8Node::info);
- Collection* collection = toNativeCollection<Collection>(object);
- return getV8Object<ItemType>(collection->item(index));
-}
-
-// A template of index interceptor of collections.
-template<class Collection, class ItemType> static v8::Handle<v8::Value> collectionIndexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
-{
- return getIndexedPropertyOfCollection<Collection, ItemType>(index, info.Holder());
-}
-
-// Get an array containing the names of indexed properties of HTMLSelectElement and HTMLFormElement.
-template<class Collection> static v8::Handle<v8::Array> nodeCollectionIndexedPropertyEnumerator(const v8::AccessorInfo& info)
-{
- ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));
- Collection* collection = toNativeCollection<Collection>(info.Holder());
- int length = collection->length();
- v8::Handle<v8::Array> properties = v8::Array::New(length);
- for (int i = 0; i < length; ++i) {
- // FIXME: Do we need to check that the item function returns a non-null value for this index?
- v8::Handle<v8::Integer> integer = v8::Integer::New(i);
- properties->Set(integer, integer);
- }
- return properties;
-}
-
-// Get an array containing the names of indexed properties in a collection.
-template<class Collection> static v8::Handle<v8::Array> collectionIndexedPropertyEnumerator(const v8::AccessorInfo& info)
-{
- ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));
- Collection* collection = toNativeCollection<Collection>(info.Holder());
- int length = collection->length();
- v8::Handle<v8::Array> properties = v8::Array::New(length);
- for (int i = 0; i < length; ++i) {
- // FIXME: Do we need to check that the item function returns a non-null value for this index?
- v8::Handle<v8::Integer> integer = v8::Integer::New(i);
- properties->Set(integer, integer);
- }
- return properties;
-}
-
-
-// A template for indexed getters on collections of strings that should return null if the resulting string is a null string.
-template<class Collection> static v8::Handle<v8::Value> collectionStringOrNullIndexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
-{
- // FIXME: assert that object must be a collection type
- ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));
- Collection* collection = toNativeCollection<Collection>(info.Holder());
- String result = collection->item(index);
- return v8StringOrNull(result);
-}
-
-
-// A template for indexed getters on collections of strings.
-template<class Collection> static v8::Handle<v8::Value> collectionStringIndexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
-{
- // FIXME: assert that object must be a collection type
- ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));
- Collection* collection = toNativeCollection<Collection>(info.Holder());
- String result = collection->item(index);
- return v8String(result);
-}
-
-
-// Add indexed getter to the function template for a collection.
-template<class Collection, class ItemType> static void setCollectionIndexedGetter(v8::Handle<v8::FunctionTemplate> desc)
-{
- desc->InstanceTemplate()->SetIndexedPropertyHandler(collectionIndexedPropertyGetter<Collection, ItemType>, 0, 0, 0, collectionIndexedPropertyEnumerator<Collection>);
-}
-
-
-// Add named getter to the function template for a collection.
-template<class Collection, class ItemType> static void setCollectionNamedGetter(v8::Handle<v8::FunctionTemplate> desc)
-{
- desc->InstanceTemplate()->SetNamedPropertyHandler(collectionNamedPropertyGetter<Collection, ItemType>, 0, 0, 0, 0);
-}
-
-// Add indexed getter returning a string or null to a function template for a collection.
-template<class Collection> static void setCollectionStringOrNullIndexedGetter(v8::Handle<v8::FunctionTemplate> desc)
-{
- desc->InstanceTemplate()->SetIndexedPropertyHandler(collectionStringOrNullIndexedPropertyGetter<Collection>, 0, 0, 0, collectionIndexedPropertyEnumerator<Collection>);
-}
-
-
-// Add indexed getter returning a string to a function template for a collection.
-template<class Collection> static void setCollectionStringIndexedGetter(v8::Handle<v8::FunctionTemplate> desc)
-{
- desc->InstanceTemplate()->SetIndexedPropertyHandler(collectionStringIndexedPropertyGetter<Collection>, 0, 0, 0, collectionIndexedPropertyEnumerator<Collection>);
-}
-
-v8::Handle<v8::Value> toOptionsCollectionSetter(uint32_t index, v8::Handle<v8::Value>, HTMLSelectElement*);
-
-} // namespace WebCore
-
-#endif // V8Collection_h
diff --git a/WebCore/bindings/v8/V8ConsoleMessage.cpp b/WebCore/bindings/v8/V8ConsoleMessage.cpp
deleted file mode 100644
index e6871fd..0000000
--- a/WebCore/bindings/v8/V8ConsoleMessage.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8ConsoleMessage.h"
-
-#include "Console.h"
-#include "DOMWindow.h"
-#include "Frame.h"
-#include "OwnPtr.h"
-#include "Page.h"
-#include "ScriptCallStack.h"
-#include "ScriptCallStackFactory.h"
-#include "V8Binding.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-Vector<V8ConsoleMessage>* V8ConsoleMessage::m_delayedMessages = 0;
-
-V8ConsoleMessage::V8ConsoleMessage(const String& string, const String& sourceID, unsigned lineNumber)
- : m_string(string)
- , m_sourceID(sourceID)
- , m_lineNumber(lineNumber)
-{
-}
-
-void V8ConsoleMessage::dispatchNow(Page* page)
-{
- dispatchNow(page, 0);
-}
-
-void V8ConsoleMessage::dispatchLater()
-{
- if (!m_delayedMessages) {
- // Allocate a vector for the delayed messages. Will be
- // deallocated when the delayed messages are processed
- // in processDelayed().
- m_delayedMessages = new Vector<V8ConsoleMessage>();
- }
-
- m_delayedMessages->append(*this);
-}
-
-void V8ConsoleMessage::processDelayed()
-{
- if (!m_delayedMessages)
- return;
-
- // Take ownership of the delayed vector to avoid re-entrancy issues.
- OwnPtr<Vector<V8ConsoleMessage> > delayedMessages(m_delayedMessages);
- m_delayedMessages = 0;
-
- // If we have a delayed vector it cannot be empty.
- ASSERT(!delayedMessages->isEmpty());
-
- // Add the delayed messages to the page of the active
- // context. If that for some bizarre reason does not
- // exist, we clear the list of delayed messages to avoid
- // posting messages. We still deallocate the vector.
- Frame* frame = V8Proxy::retrieveFrameForEnteredContext();
- if (!frame)
- return;
- Page* page = frame->page();
- if (!page)
- return;
-
- // Iterate through all the delayed messages and add them
- // to the console.
- const int size = delayedMessages->size();
- for (int i = 0; i < size; ++i)
- delayedMessages->at(i).dispatchNow(page);
-}
-
-void V8ConsoleMessage::handler(v8::Handle<v8::Message> message, v8::Handle<v8::Value> data)
-{
- // Use the frame where JavaScript is called from.
- Frame* frame = V8Proxy::retrieveFrameForEnteredContext();
- if (!frame)
- return;
- Page* page = frame->page();
- if (!page)
- return;
-
- v8::Handle<v8::String> errorMessageString = message->Get();
- ASSERT(!errorMessageString.IsEmpty());
- String errorMessage = toWebCoreString(errorMessageString);
-
- v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace();
- RefPtr<ScriptCallStack> callStack;
- // Currently stack trace is only collected when inspector is open.
- if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0)
- callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallStackSizeToCapture);
-
- v8::Handle<v8::Value> resourceName = message->GetScriptResourceName();
- bool useURL = resourceName.IsEmpty() || !resourceName->IsString();
- String resourceNameString = useURL ? frame->document()->url() : toWebCoreString(resourceName);
- V8ConsoleMessage consoleMessage(errorMessage, resourceNameString, message->GetLineNumber());
- consoleMessage.dispatchNow(page, callStack);
-}
-
-void V8ConsoleMessage::dispatchNow(Page* page, PassRefPtr<ScriptCallStack> callStack)
-{
- ASSERT(page);
-
- // Process any delayed messages to make sure that messages
- // appear in the right order in the console.
- processDelayed();
-
- Console* console = page->mainFrame()->domWindow()->console();
- MessageType messageType = callStack ? UncaughtExceptionMessageType : LogMessageType;
- console->addMessage(JSMessageSource, messageType, ErrorMessageLevel, m_string, m_lineNumber, m_sourceID, callStack);
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/V8ConsoleMessage.h b/WebCore/bindings/v8/V8ConsoleMessage.h
deleted file mode 100644
index 97de24f..0000000
--- a/WebCore/bindings/v8/V8ConsoleMessage.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8ConsoleMessage_h
-#define V8ConsoleMessage_h
-
-#include "PlatformString.h"
-#include <v8.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
- class Page;
- class ScriptCallStack;
-
- // V8ConsoleMessage encapsulates everything needed to
- // log messages originating from JavaScript to the console.
- class V8ConsoleMessage {
- public:
- V8ConsoleMessage(const String& string, const String& sourceID, unsigned lineNumber);
-
- // Add a message to the console. May end up calling JavaScript code
- // indirectly through the inspector so only call this function when
- // it is safe to do allocations.
- void dispatchNow(Page*);
-
- // Add a message to the console but delay the reporting until it
- // is safe to do so: Either when we leave JavaScript execution or
- // when adding other console messages. The primary purpose of this
- // method is to avoid calling into V8 to handle console messages
- // when the VM is in a state that does not support GCs or allocations.
- // Delayed messages are always reported in the page corresponding
- // to the active context.
- void dispatchLater();
-
- // Process any delayed messages. May end up calling JavaScript code
- // indirectly through the inspector so only call this function when
- // it is safe to do allocations.
- static void processDelayed();
-
- // Convenience class for ensuring that delayed messages in the
- // ConsoleMessageManager are processed quickly.
- class Scope {
- public:
- Scope() { V8ConsoleMessage::processDelayed(); }
- ~Scope() { V8ConsoleMessage::processDelayed(); }
- };
-
- // Callback from V8.
- static void handler(v8::Handle<v8::Message>, v8::Handle<v8::Value> data);
-
- private:
- const String m_string;
- const String m_sourceID;
- const unsigned m_lineNumber;
-
- void dispatchNow(Page*, PassRefPtr<ScriptCallStack>);
-
- // All delayed messages are stored in this vector. If the vector
- // is 0, there are no delayed messages.
- static Vector<V8ConsoleMessage>* m_delayedMessages;
- };
-
-} // namespace WebCore
-
-#endif // V8ConsoleMessage_h
diff --git a/WebCore/bindings/v8/V8DOMMap.cpp b/WebCore/bindings/v8/V8DOMMap.cpp
deleted file mode 100644
index 40d1dc3..0000000
--- a/WebCore/bindings/v8/V8DOMMap.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8DOMMap.h"
-
-#include "DOMData.h"
-#include "DOMDataStore.h"
-#include "MainThreadDOMData.h"
-#include "ScopedDOMDataStore.h"
-
-namespace WebCore {
-
-DOMDataStoreHandle::DOMDataStoreHandle()
- : m_store(new ScopedDOMDataStore(DOMData::getCurrent()))
-{
-}
-
-DOMDataStoreHandle::~DOMDataStoreHandle()
-{
-}
-
-static bool fasterDOMStoreAccess = false;
-
-static inline DOMDataStore& getDOMDataStore()
-{
- if (LIKELY(fasterDOMStoreAccess)) {
- ASSERT(WTF::isMainThread());
- return MainThreadDOMData::getCurrentMainThreadStore();
- }
-
- return DOMData::getCurrent()->getStore();
-}
-
-void enableFasterDOMStoreAccess()
-{
- fasterDOMStoreAccess = true;
-}
-
-DOMNodeMapping& getDOMNodeMap()
-{
- return getDOMDataStore().domNodeMap();
-}
-
-DOMWrapperMap<void>& getDOMObjectMap()
-{
- return getDOMDataStore().domObjectMap();
-}
-
-DOMWrapperMap<void>& getActiveDOMObjectMap()
-{
- return getDOMDataStore().activeDomObjectMap();
-}
-
-#if ENABLE(SVG)
-
-DOMWrapperMap<SVGElementInstance>& getDOMSVGElementInstanceMap()
-{
- return getDOMDataStore().domSvgElementInstanceMap();
-}
-
-#endif // ENABLE(SVG)
-
-void removeAllDOMObjectsInCurrentThread()
-{
- DOMDataStore& store = getDOMDataStore();
-
- v8::HandleScope scope;
-
- // The DOM objects with the following types only exist on the main thread.
- if (WTF::isMainThread()) {
- // Remove all DOM nodes.
- DOMData::removeObjectsFromWrapperMap<Node>(&store, store.domNodeMap());
-
-#if ENABLE(SVG)
- // Remove all SVG element instances in the wrapper map.
- DOMData::removeObjectsFromWrapperMap<SVGElementInstance>(&store, store.domSvgElementInstanceMap());
-#endif
- }
-
- // Remove all DOM objects in the wrapper map.
- DOMData::removeObjectsFromWrapperMap<void>(&store, store.domObjectMap());
-
- // Remove all active DOM objects in the wrapper map.
- DOMData::removeObjectsFromWrapperMap<void>(&store, store.activeDomObjectMap());
-}
-
-void visitDOMNodesInCurrentThread(DOMWrapperMap<Node>::Visitor* visitor)
-{
- v8::HandleScope scope;
-
- WTF::MutexLocker locker(DOMDataStore::allStoresMutex());
- DOMDataList& list = DOMDataStore::allStores();
- for (size_t i = 0; i < list.size(); ++i) {
- DOMDataStore* store = list[i];
- if (!store->domData()->owningThread() == WTF::currentThread())
- continue;
-
- store->domNodeMap().visit(store, visitor);
- }
-}
-
-void visitDOMObjectsInCurrentThread(DOMWrapperMap<void>::Visitor* visitor)
-{
- v8::HandleScope scope;
-
- WTF::MutexLocker locker(DOMDataStore::allStoresMutex());
- DOMDataList& list = DOMDataStore::allStores();
- for (size_t i = 0; i < list.size(); ++i) {
- DOMDataStore* store = list[i];
- if (!store->domData()->owningThread() == WTF::currentThread())
- continue;
-
- store->domObjectMap().visit(store, visitor);
- }
-}
-
-void visitActiveDOMObjectsInCurrentThread(DOMWrapperMap<void>::Visitor* visitor)
-{
- v8::HandleScope scope;
-
- WTF::MutexLocker locker(DOMDataStore::allStoresMutex());
- DOMDataList& list = DOMDataStore::allStores();
- for (size_t i = 0; i < list.size(); ++i) {
- DOMDataStore* store = list[i];
- if (!store->domData()->owningThread() == WTF::currentThread())
- continue;
-
- store->activeDomObjectMap().visit(store, visitor);
- }
-}
-
-#if ENABLE(SVG)
-
-void visitDOMSVGElementInstancesInCurrentThread(DOMWrapperMap<SVGElementInstance>::Visitor* visitor)
-{
- v8::HandleScope scope;
-
- WTF::MutexLocker locker(DOMDataStore::allStoresMutex());
- DOMDataList& list = DOMDataStore::allStores();
- for (size_t i = 0; i < list.size(); ++i) {
- DOMDataStore* store = list[i];
- if (!store->domData()->owningThread() == WTF::currentThread())
- continue;
-
- store->domSvgElementInstanceMap().visit(store, visitor);
- }
-}
-
-#endif
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/V8DOMMap.h b/WebCore/bindings/v8/V8DOMMap.h
deleted file mode 100644
index c2b5a9d..0000000
--- a/WebCore/bindings/v8/V8DOMMap.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8DOMMap_h
-#define V8DOMMap_h
-
-#include <wtf/HashMap.h>
-#include <wtf/OwnPtr.h>
-#include <v8.h>
-
-namespace WebCore {
- class DOMDataStore;
- class Node;
-#if ENABLE(SVG)
- class SVGElementInstance;
-#endif
-
- template <class KeyType, class ValueType> class AbstractWeakReferenceMap {
- public:
- AbstractWeakReferenceMap(v8::WeakReferenceCallback callback) : m_weakReferenceCallback(callback) { }
- virtual ~AbstractWeakReferenceMap() { }
-
- class Visitor {
- public:
- virtual void startMap() { }
- virtual void endMap() { }
- virtual void visitDOMWrapper(DOMDataStore* store, KeyType* key, v8::Persistent<ValueType> object) = 0;
- protected:
- virtual ~Visitor() { }
- };
-
- virtual v8::Persistent<ValueType> get(KeyType* obj) = 0;
- virtual void set(KeyType* obj, v8::Persistent<ValueType> wrapper) = 0;
- virtual bool contains(KeyType* obj) = 0;
- virtual void visit(DOMDataStore* store, Visitor* visitor) = 0;
- virtual bool removeIfPresent(KeyType* key, v8::Persistent<v8::Data> value) = 0;
- virtual void clear() = 0;
-
- v8::WeakReferenceCallback weakReferenceCallback() { return m_weakReferenceCallback; }
- private:
- v8::WeakReferenceCallback m_weakReferenceCallback;
- };
-
- typedef AbstractWeakReferenceMap<Node, v8::Object> DOMNodeMapping;
-
- // A table of wrappers with weak pointers.
- // This table allows us to avoid track wrapped objects for debugging
- // and for ensuring that we don't double wrap the same object.
- template<class KeyType, class ValueType> class WeakReferenceMap : public AbstractWeakReferenceMap<KeyType, ValueType> {
- public:
- typedef AbstractWeakReferenceMap<KeyType, ValueType> Parent;
- WeakReferenceMap(v8::WeakReferenceCallback callback) : Parent(callback) { }
- virtual ~WeakReferenceMap() { }
-
- // Get the JS wrapper object of an object.
- virtual v8::Persistent<ValueType> get(KeyType* obj)
- {
- ValueType* wrapper = m_map.get(obj);
- return wrapper ? v8::Persistent<ValueType>(wrapper) : v8::Persistent<ValueType>();
- }
-
- virtual void set(KeyType* obj, v8::Persistent<ValueType> wrapper)
- {
- ASSERT(!m_map.contains(obj));
- wrapper.MakeWeak(obj, Parent::weakReferenceCallback());
- m_map.set(obj, *wrapper);
- }
-
- virtual void forget(KeyType* obj)
- {
- ASSERT(obj);
- ValueType* wrapper = m_map.take(obj);
- if (!wrapper)
- return;
-
- v8::Persistent<ValueType> handle(wrapper);
- handle.Dispose();
- handle.Clear();
- }
-
- bool removeIfPresent(KeyType* key, v8::Persistent<v8::Data> value)
- {
- typename HashMap<KeyType*, ValueType*>::iterator it = m_map.find(key);
- if (it == m_map.end() || it->second != *value)
- return false;
-
- m_map.remove(it);
- value.Dispose();
- return true;
- }
-
- void clear()
- {
- m_map.clear();
- }
-
- bool contains(KeyType* obj) { return m_map.contains(obj); }
-
- virtual void visit(DOMDataStore* store, typename Parent::Visitor* visitor)
- {
- visitor->startMap();
- typename HashMap<KeyType*, ValueType*>::iterator it = m_map.begin();
- for (; it != m_map.end(); ++it)
- visitor->visitDOMWrapper(store, it->first, v8::Persistent<ValueType>(it->second));
- visitor->endMap();
- }
-
- protected:
- HashMap<KeyType*, ValueType*> m_map;
- };
-
- template <class KeyType> class DOMWrapperMap : public WeakReferenceMap<KeyType, v8::Object> {
- public:
- DOMWrapperMap(v8::WeakReferenceCallback callback) : WeakReferenceMap<KeyType, v8::Object>(callback) { }
- };
-
- // An opaque class that represents a set of DOM wrappers.
- class DOMDataStore;
-
- // A utility class to manage the lifetime of set of DOM wrappers.
- class DOMDataStoreHandle {
- public:
- DOMDataStoreHandle();
- ~DOMDataStoreHandle();
-
- DOMDataStore* getStore() const { return m_store.get(); }
-
- private:
- OwnPtr<DOMDataStore> m_store;
- };
-
- // A map from DOM node to its JS wrapper.
- DOMNodeMapping& getDOMNodeMap();
- void visitDOMNodesInCurrentThread(DOMWrapperMap<Node>::Visitor*);
-
- // A map from a DOM object (non-node) to its JS wrapper. This map does not contain the DOM objects which can have pending activity (active dom objects).
- DOMWrapperMap<void>& getDOMObjectMap();
- void visitDOMObjectsInCurrentThread(DOMWrapperMap<void>::Visitor*);
-
- // A map from a DOM object to its JS wrapper for DOM objects which can have pending activity.
- DOMWrapperMap<void>& getActiveDOMObjectMap();
- void visitActiveDOMObjectsInCurrentThread(DOMWrapperMap<void>::Visitor*);
-
- // This should be called to remove all DOM objects associated with the current thread when it is tearing down.
- void removeAllDOMObjectsInCurrentThread();
-
-#if ENABLE(SVG)
- // A map for SVGElementInstances to its JS wrapper.
- DOMWrapperMap<SVGElementInstance>& getDOMSVGElementInstanceMap();
- void visitSVGElementInstancesInCurrentThread(DOMWrapperMap<SVGElementInstance>::Visitor*);
-#endif
-
- void enableFasterDOMStoreAccess();
-} // namespace WebCore
-
-#endif // V8DOMMap_h
diff --git a/WebCore/bindings/v8/V8DOMWindowShell.cpp b/WebCore/bindings/v8/V8DOMWindowShell.cpp
deleted file mode 100644
index 1a39a15..0000000
--- a/WebCore/bindings/v8/V8DOMWindowShell.cpp
+++ /dev/null
@@ -1,619 +0,0 @@
-/*
- * Copyright (C) 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8DOMWindowShell.h"
-
-#include "PlatformBridge.h"
-#include "CSSMutableStyleDeclaration.h"
-#include "DateExtension.h"
-#include "DocumentLoader.h"
-#include "Frame.h"
-#include "FrameLoaderClient.h"
-#include "Page.h"
-#include "PageGroup.h"
-#include "ScriptController.h"
-#include "StorageNamespace.h"
-#include "V8Binding.h"
-#include "V8BindingState.h"
-#include "V8Collection.h"
-#include "V8ConsoleMessage.h"
-#include "V8DOMMap.h"
-#include "V8DOMWindow.h"
-#include "V8Document.h"
-#include "V8GCForContextDispose.h"
-#include "V8HTMLDocument.h"
-#include "V8HiddenPropertyName.h"
-#include "V8History.h"
-#include "V8Location.h"
-#include "V8Proxy.h"
-#include "WorkerContextExecutionProxy.h"
-
-#include <algorithm>
-#include <stdio.h>
-#include <utility>
-#include <v8-debug.h>
-#include <v8.h>
-#include <wtf/Assertions.h>
-#include <wtf/OwnArrayPtr.h>
-#include <wtf/StdLibExtras.h>
-#include <wtf/StringExtras.h>
-#include <wtf/UnusedParam.h>
-#include <wtf/text/CString.h>
-
-#ifdef ANDROID_INSTRUMENT
-#include "TimeCounter.h"
-#endif
-
-namespace WebCore {
-
-static void handleFatalErrorInV8()
-{
- // FIXME: We temporarily deal with V8 internal error situations
- // such as out-of-memory by crashing the renderer.
- CRASH();
-}
-
-static void reportFatalErrorInV8(const char* location, const char* message)
-{
- // V8 is shutdown, we cannot use V8 api.
- // The only thing we can do is to disable JavaScript.
- // FIXME: clean up V8Proxy and disable JavaScript.
- int memoryUsageMB = -1;
-#if PLATFORM(CHROMIUM)
- memoryUsageMB = ChromiumBridge::actualMemoryUsageMB();
-#endif
- printf("V8 error: %s (%s). Current memory usage: %d MB\n", message, location, memoryUsageMB);
- handleFatalErrorInV8();
-}
-
-// Returns the owner frame pointer of a DOM wrapper object. It only works for
-// these DOM objects requiring cross-domain access check.
-static Frame* getTargetFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> data)
-{
- Frame* target = 0;
- WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data);
- if (V8DOMWindow::info.equals(type)) {
- v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), host);
- if (window.IsEmpty())
- return target;
-
- DOMWindow* targetWindow = V8DOMWindow::toNative(window);
- target = targetWindow->frame();
- } else if (V8History::info.equals(type)) {
- History* history = V8History::toNative(host);
- target = history->frame();
- } else if (V8Location::info.equals(type)) {
- Location* location = V8Location::toNative(host);
- target = location->frame();
- }
- return target;
-}
-
-static void reportUnsafeJavaScriptAccess(v8::Local<v8::Object> host, v8::AccessType type, v8::Local<v8::Value> data)
-{
- Frame* target = getTargetFrame(host, data);
- if (target)
- V8Proxy::reportUnsafeAccessTo(target, V8Proxy::ReportLater);
-}
-
-PassRefPtr<V8DOMWindowShell> V8DOMWindowShell::create(Frame* frame)
-{
- return adoptRef(new V8DOMWindowShell(frame));
-}
-
-V8DOMWindowShell::V8DOMWindowShell(Frame* frame)
- : m_frame(frame)
-{
-}
-
-bool V8DOMWindowShell::isContextInitialized()
-{
- // m_context, m_global, and m_wrapperBoilerplates should
- // all be non-empty if if m_context is non-empty.
- ASSERT(m_context.IsEmpty() || !m_global.IsEmpty());
- return !m_context.IsEmpty();
-}
-
-void V8DOMWindowShell::disposeContextHandles()
-{
- if (!m_context.IsEmpty()) {
- m_frame->loader()->client()->didDestroyScriptContextForFrame();
- m_context.Dispose();
- m_context.Clear();
-
- // It's likely that disposing the context has created a lot of
- // garbage. Notify V8 about this so it'll have a chance of cleaning
- // it up when idle.
- V8GCForContextDispose::instance().notifyContextDisposed();
- }
-
- WrapperBoilerplateMap::iterator it = m_wrapperBoilerplates.begin();
- for (; it != m_wrapperBoilerplates.end(); ++it) {
- v8::Persistent<v8::Object> wrapper = it->second;
- wrapper.Dispose();
- wrapper.Clear();
- }
- m_wrapperBoilerplates.clear();
-}
-
-void V8DOMWindowShell::destroyGlobal()
-{
- if (!m_global.IsEmpty()) {
-#ifndef NDEBUG
- V8GCController::unregisterGlobalHandle(this, m_global);
-#endif
- m_global.Dispose();
- m_global.Clear();
- }
-}
-
-void V8DOMWindowShell::clearForClose()
-{
- if (!m_context.IsEmpty()) {
- v8::HandleScope handleScope;
-
- clearDocumentWrapper();
- disposeContextHandles();
- }
-}
-
-void V8DOMWindowShell::clearForNavigation()
-{
- if (!m_context.IsEmpty()) {
- v8::HandleScope handle;
- clearDocumentWrapper();
-
- v8::Context::Scope contextScope(m_context);
-
- // Clear the document wrapper cache before turning on access checks on
- // the old DOMWindow wrapper. This way, access to the document wrapper
- // will be protected by the security checks on the DOMWindow wrapper.
- clearDocumentWrapperCache();
-
- // Turn on access check on the old DOMWindow wrapper.
- v8::Handle<v8::Object> wrapper = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), m_global);
- ASSERT(!wrapper.IsEmpty());
- wrapper->TurnOnAccessCheck();
-
- // Separate the context from its global object.
- m_context->DetachGlobal();
-
- disposeContextHandles();
- }
-}
-
-// Create a new environment and setup the global object.
-//
-// The global object corresponds to a DOMWindow instance. However, to
-// allow properties of the JS DOMWindow instance to be shadowed, we
-// use a shadow object as the global object and use the JS DOMWindow
-// instance as the prototype for that shadow object. The JS DOMWindow
-// instance is undetectable from javascript code because the __proto__
-// accessors skip that object.
-//
-// The shadow object and the DOMWindow instance are seen as one object
-// from javascript. The javascript object that corresponds to a
-// DOMWindow instance is the shadow object. When mapping a DOMWindow
-// instance to a V8 object, we return the shadow object.
-//
-// To implement split-window, see
-// 1) https://bugs.webkit.org/show_bug.cgi?id=17249
-// 2) https://wiki.mozilla.org/Gecko:SplitWindow
-// 3) https://bugzilla.mozilla.org/show_bug.cgi?id=296639
-// we need to split the shadow object further into two objects:
-// an outer window and an inner window. The inner window is the hidden
-// prototype of the outer window. The inner window is the default
-// global object of the context. A variable declared in the global
-// scope is a property of the inner window.
-//
-// The outer window sticks to a Frame, it is exposed to JavaScript
-// via window.window, window.self, window.parent, etc. The outer window
-// has a security token which is the domain. The outer window cannot
-// have its own properties. window.foo = 'x' is delegated to the
-// inner window.
-//
-// When a frame navigates to a new page, the inner window is cut off
-// the outer window, and the outer window identify is preserved for
-// the frame. However, a new inner window is created for the new page.
-// If there are JS code holds a closure to the old inner window,
-// it won't be able to reach the outer window via its global object.
-bool V8DOMWindowShell::initContextIfNeeded()
-{
- // Bail out if the context has already been initialized.
- if (!m_context.IsEmpty())
- return false;
-
-#ifdef ANDROID_INSTRUMENT
- android::TimeCounter::start(android::TimeCounter::JavaScriptInitTimeCounter);
-#endif
-
- // Create a handle scope for all local handles.
- v8::HandleScope handleScope;
-
- // Setup the security handlers and message listener. This only has
- // to be done once.
- static bool isV8Initialized = false;
- if (!isV8Initialized) {
- // Tells V8 not to call the default OOM handler, binding code
- // will handle it.
- v8::V8::IgnoreOutOfMemoryException();
- v8::V8::SetFatalErrorHandler(reportFatalErrorInV8);
-
- v8::V8::SetGlobalGCPrologueCallback(&V8GCController::gcPrologue);
- v8::V8::SetGlobalGCEpilogueCallback(&V8GCController::gcEpilogue);
-
- v8::V8::AddMessageListener(&V8ConsoleMessage::handler);
-
- v8::V8::SetFailedAccessCheckCallbackFunction(reportUnsafeJavaScriptAccess);
-
- isV8Initialized = true;
- }
-
-
- m_context = createNewContext(m_global, 0);
- if (m_context.IsEmpty())
- return false;
-
- v8::Local<v8::Context> v8Context = v8::Local<v8::Context>::New(m_context);
- v8::Context::Scope contextScope(v8Context);
-
- // Store the first global object created so we can reuse it.
- if (m_global.IsEmpty()) {
- m_global = v8::Persistent<v8::Object>::New(v8Context->Global());
- // Bail out if allocation of the first global objects fails.
- if (m_global.IsEmpty()) {
- disposeContextHandles();
- return false;
- }
-#ifndef NDEBUG
- V8GCController::registerGlobalHandle(PROXY, this, m_global);
-#endif
- }
-
- if (!installHiddenObjectPrototype(v8Context)) {
- disposeContextHandles();
- return false;
- }
-
- if (!installDOMWindow(v8Context, m_frame->domWindow())) {
- disposeContextHandles();
- return false;
- }
-
- updateDocument();
-
- setSecurityToken();
-
- m_frame->loader()->client()->didCreateScriptContextForFrame();
-
- // FIXME: This is wrong. We should actually do this for the proper world once
- // we do isolated worlds the WebCore way.
- m_frame->loader()->dispatchDidClearWindowObjectInWorld(0);
-
-#ifdef ANDROID_INSTRUMENT
- android::TimeCounter::record(android::TimeCounter::JavaScriptInitTimeCounter, __FUNCTION__);
-#endif
-
- return true;
-}
-
-v8::Persistent<v8::Context> V8DOMWindowShell::createNewContext(v8::Handle<v8::Object> global, int extensionGroup)
-{
- v8::Persistent<v8::Context> result;
-
- // The activeDocumentLoader pointer could be 0 during frame shutdown.
- if (!m_frame->loader()->activeDocumentLoader())
- return result;
-
- // Create a new environment using an empty template for the shadow
- // object. Reuse the global object if one has been created earlier.
- v8::Persistent<v8::ObjectTemplate> globalTemplate = V8DOMWindow::GetShadowObjectTemplate();
- if (globalTemplate.IsEmpty())
- return result;
-
- // Used to avoid sleep calls in unload handlers.
- if (!V8Proxy::registeredExtensionWithV8(DateExtension::get()))
- V8Proxy::registerExtension(DateExtension::get());
-
- // Dynamically tell v8 about our extensions now.
- const V8Extensions& extensions = V8Proxy::extensions();
- OwnArrayPtr<const char*> extensionNames(new const char*[extensions.size()]);
- int index = 0;
- for (size_t i = 0; i < extensions.size(); ++i) {
- // Ensure our date extension is always allowed.
- if (extensions[i] != DateExtension::get()
- && !m_frame->loader()->client()->allowScriptExtension(extensions[i]->name(), extensionGroup))
- continue;
-
- extensionNames[index++] = extensions[i]->name();
- }
- v8::ExtensionConfiguration extensionConfiguration(index, extensionNames.get());
- result = v8::Context::New(&extensionConfiguration, globalTemplate, global);
-
- return result;
-}
-
-void V8DOMWindowShell::setContext(v8::Handle<v8::Context> context)
-{
- // if we already have a context, clear it before setting the new one.
- if (!m_context.IsEmpty()) {
- m_context.Dispose();
- m_context.Clear();
- }
- m_context = v8::Persistent<v8::Context>::New(context);
-}
-
-bool V8DOMWindowShell::installDOMWindow(v8::Handle<v8::Context> context, DOMWindow* window)
-{
- // Create a new JS window object and use it as the prototype for the shadow global object.
- v8::Handle<v8::Function> windowConstructor = V8DOMWrapper::getConstructor(&V8DOMWindow::info, getHiddenObjectPrototype(context));
- v8::Local<v8::Object> jsWindow = SafeAllocation::newInstance(windowConstructor);
- // Bail out if allocation failed.
- if (jsWindow.IsEmpty())
- return false;
-
- // Wrap the window.
- V8DOMWrapper::setDOMWrapper(jsWindow, &V8DOMWindow::info, window);
- V8DOMWrapper::setDOMWrapper(v8::Handle<v8::Object>::Cast(jsWindow->GetPrototype()), &V8DOMWindow::info, window);
-
- window->ref();
- V8DOMWrapper::setJSWrapperForDOMObject(window, v8::Persistent<v8::Object>::New(jsWindow));
-
- // Insert the window instance as the prototype of the shadow object.
- v8::Handle<v8::Object> v8RealGlobal = v8::Handle<v8::Object>::Cast(context->Global()->GetPrototype());
- V8DOMWrapper::setDOMWrapper(v8RealGlobal, &V8DOMWindow::info, window);
- v8RealGlobal->SetPrototype(jsWindow);
- return true;
-}
-
-void V8DOMWindowShell::updateDocumentWrapper(v8::Handle<v8::Object> wrapper)
-{
- clearDocumentWrapper();
-
- ASSERT(m_document.IsEmpty());
- m_document = v8::Persistent<v8::Object>::New(wrapper);
-#ifndef NDEBUG
- V8GCController::registerGlobalHandle(PROXY, this, m_document);
-#endif
-}
-
-void V8DOMWindowShell::clearDocumentWrapper()
-{
- if (!m_document.IsEmpty()) {
-#ifndef NDEBUG
- V8GCController::unregisterGlobalHandle(this, m_document);
-#endif
- m_document.Dispose();
- m_document.Clear();
- }
-}
-
-static void checkDocumentWrapper(v8::Handle<v8::Object> wrapper, Document* document)
-{
- ASSERT(V8Document::toNative(wrapper) == document);
- ASSERT(!document->isHTMLDocument() || (V8Document::toNative(v8::Handle<v8::Object>::Cast(wrapper->GetPrototype())) == document));
-}
-
-void V8DOMWindowShell::updateDocumentWrapperCache()
-{
- v8::HandleScope handleScope;
- v8::Context::Scope contextScope(m_context);
-
- // If the document has no frame, NodeToV8Object might get the
- // document wrapper for a document that is about to be deleted.
- // If the ForceSet below causes a garbage collection, the document
- // might get deleted and the global handle for the document
- // wrapper cleared. Using the cleared global handle will lead to
- // crashes. In this case we clear the cache and let the DOMWindow
- // accessor handle access to the document.
- if (!m_frame->document()->frame()) {
- clearDocumentWrapperCache();
- return;
- }
-
- v8::Handle<v8::Value> documentWrapper = toV8(m_frame->document());
- ASSERT(documentWrapper == m_document || m_document.IsEmpty());
- if (m_document.IsEmpty())
- updateDocumentWrapper(v8::Handle<v8::Object>::Cast(documentWrapper));
- checkDocumentWrapper(m_document, m_frame->document());
-
- // If instantiation of the document wrapper fails, clear the cache
- // and let the DOMWindow accessor handle access to the document.
- if (documentWrapper.IsEmpty()) {
- clearDocumentWrapperCache();
- return;
- }
- ASSERT(documentWrapper->IsObject());
- m_context->Global()->ForceSet(v8::String::New("document"), documentWrapper, static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete));
-}
-
-void V8DOMWindowShell::clearDocumentWrapperCache()
-{
- ASSERT(!m_context.IsEmpty());
- m_context->Global()->ForceDelete(v8::String::New("document"));
-}
-
-void V8DOMWindowShell::setSecurityToken()
-{
- Document* document = m_frame->document();
- // Setup security origin and security token.
- if (!document) {
- m_context->UseDefaultSecurityToken();
- return;
- }
-
- // Ask the document's SecurityOrigin to generate a security token.
- // If two tokens are equal, then the SecurityOrigins canAccess each other.
- // If two tokens are not equal, then we have to call canAccess.
- // Note: we can't use the HTTPOrigin if it was set from the DOM.
- SecurityOrigin* origin = document->securityOrigin();
- String token;
- if (!origin->domainWasSetInDOM())
- token = document->securityOrigin()->toString();
-
- // An empty or "null" token means we always have to call
- // canAccess. The toString method on securityOrigins returns the
- // string "null" for empty security origins and for security
- // origins that should only allow access to themselves. In this
- // case, we use the global object as the security token to avoid
- // calling canAccess when a script accesses its own objects.
- if (token.isEmpty() || token == "null") {
- m_context->UseDefaultSecurityToken();
- return;
- }
-
- CString utf8Token = token.utf8();
- // NOTE: V8 does identity comparison in fast path, must use a symbol
- // as the security token.
- m_context->SetSecurityToken(v8::String::NewSymbol(utf8Token.data(), utf8Token.length()));
-}
-
-void V8DOMWindowShell::updateDocument()
-{
- if (!m_frame->document())
- return;
-
- if (m_global.IsEmpty())
- return;
-
- // There is an existing JavaScript wrapper for the global object
- // of this frame. JavaScript code in other frames might hold a
- // reference to this wrapper. We eagerly initialize the JavaScript
- // context for the new document to make property access on the
- // global object wrapper succeed.
- initContextIfNeeded();
-
- // Bail out if context initialization failed.
- if (m_context.IsEmpty())
- return;
-
- // We have a new document and we need to update the cache.
- updateDocumentWrapperCache();
-
- updateSecurityOrigin();
-}
-
-v8::Handle<v8::Value> getter(v8::Local<v8::String> property, const v8::AccessorInfo& info)
-{
- // FIXME(antonm): consider passing AtomicStringImpl directly.
- AtomicString name = v8StringToAtomicWebCoreString(property);
- HTMLDocument* htmlDocument = V8HTMLDocument::toNative(info.Holder());
- ASSERT(htmlDocument);
- v8::Handle<v8::Value> result = V8HTMLDocument::GetNamedProperty(htmlDocument, name);
- if (!result.IsEmpty())
- return result;
- v8::Handle<v8::Value> prototype = info.Holder()->GetPrototype();
- if (prototype->IsObject())
- return prototype.As<v8::Object>()->Get(property);
- return v8::Undefined();
-}
-
-void V8DOMWindowShell::namedItemAdded(HTMLDocument* doc, const AtomicString& name)
-{
- initContextIfNeeded();
-
- v8::HandleScope handleScope;
- v8::Context::Scope contextScope(m_context);
-
- ASSERT(!m_document.IsEmpty());
- checkDocumentWrapper(m_document, doc);
- m_document->SetAccessor(v8String(name), getter);
-}
-
-void V8DOMWindowShell::namedItemRemoved(HTMLDocument* doc, const AtomicString& name)
-{
-}
-
-void V8DOMWindowShell::updateSecurityOrigin()
-{
- v8::HandleScope scope;
- setSecurityToken();
-}
-
-v8::Handle<v8::Value> V8DOMWindowShell::getHiddenObjectPrototype(v8::Handle<v8::Context> context)
-{
- return context->Global()->GetHiddenValue(V8HiddenPropertyName::objectPrototype());
-}
-
-bool V8DOMWindowShell::installHiddenObjectPrototype(v8::Handle<v8::Context> context)
-{
- v8::Handle<v8::String> objectString = v8::String::New("Object");
- v8::Handle<v8::String> prototypeString = v8::String::New("prototype");
- v8::Handle<v8::String> hiddenObjectPrototypeString = V8HiddenPropertyName::objectPrototype();
- // Bail out if allocation failed.
- if (objectString.IsEmpty() || prototypeString.IsEmpty() || hiddenObjectPrototypeString.IsEmpty())
- return false;
-
- v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(context->Global()->Get(objectString));
- // Bail out if fetching failed.
- if (object.IsEmpty())
- return false;
- v8::Handle<v8::Value> objectPrototype = object->Get(prototypeString);
- // Bail out if fetching failed.
- if (objectPrototype.IsEmpty())
- return false;
-
- context->Global()->SetHiddenValue(hiddenObjectPrototypeString, objectPrototype);
-
- return true;
-}
-
-v8::Local<v8::Object> V8DOMWindowShell::createWrapperFromCacheSlowCase(WrapperTypeInfo* type)
-{
- // Not in cache.
- initContextIfNeeded();
- v8::Context::Scope scope(m_context);
- v8::Local<v8::Function> function = V8DOMWrapper::getConstructor(type, getHiddenObjectPrototype(m_context));
- v8::Local<v8::Object> instance = SafeAllocation::newInstance(function);
- if (!instance.IsEmpty()) {
- m_wrapperBoilerplates.set(type, v8::Persistent<v8::Object>::New(instance));
- return instance->Clone();
- }
- return notHandledByInterceptor();
-}
-
-void V8DOMWindowShell::setLocation(DOMWindow* window, const String& relativeURL)
-{
- Frame* frame = window->frame();
- if (!frame)
- return;
-
- KURL url = completeURL(relativeURL);
- if (url.isNull())
- return;
-
- if (!shouldAllowNavigation(frame))
- return;
-
- navigateIfAllowed(frame, url, false, false);
-}
-
-} // WebCore
diff --git a/WebCore/bindings/v8/V8DOMWindowShell.h b/WebCore/bindings/v8/V8DOMWindowShell.h
deleted file mode 100644
index 76c27af..0000000
--- a/WebCore/bindings/v8/V8DOMWindowShell.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8DOMWindowShell_h
-#define V8DOMWindowShell_h
-
-#include "WrapperTypeInfo.h"
-#include <wtf/Forward.h>
-#include <wtf/HashMap.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-#include <wtf/text/AtomicString.h>
-
-namespace WebCore {
-
-class DOMWindow;
-class Frame;
-class HTMLDocument;
-
-// V8WindowShell represents all the per-global object state for a Frame that
-// persist between navigations.
-class V8DOMWindowShell : public RefCounted<V8DOMWindowShell> {
-public:
- static PassRefPtr<V8DOMWindowShell> create(Frame*);
-
- v8::Handle<v8::Context> context() const { return m_context; }
-
- // Update document object of the frame.
- void updateDocument();
-
- void namedItemAdded(HTMLDocument*, const AtomicString&);
- void namedItemRemoved(HTMLDocument*, const AtomicString&);
-
- // Update the security origin of a document
- // (e.g., after setting docoument.domain).
- void updateSecurityOrigin();
-
- bool isContextInitialized();
-
- v8::Persistent<v8::Context> createNewContext(v8::Handle<v8::Object> global, int extensionGroup);
- void setContext(v8::Handle<v8::Context>);
- static bool installDOMWindow(v8::Handle<v8::Context> context, DOMWindow*);
-
- bool initContextIfNeeded();
- void updateDocumentWrapper(v8::Handle<v8::Object> wrapper);
-
- void clearForNavigation();
- void clearForClose();
-
- void destroyGlobal();
-
- static v8::Handle<v8::Value> getHiddenObjectPrototype(v8::Handle<v8::Context>);
- // WARNING: Call |installHiddenObjectPrototype| only on fresh contexts!
- static bool installHiddenObjectPrototype(v8::Handle<v8::Context>);
-
- // To create JS Wrapper objects, we create a cache of a 'boiler plate'
- // object, and then simply Clone that object each time we need a new one.
- // This is faster than going through the full object creation process.
- v8::Local<v8::Object> createWrapperFromCache(WrapperTypeInfo* type)
- {
- v8::Persistent<v8::Object> boilerplate = m_wrapperBoilerplates.get(type);
- return boilerplate.IsEmpty() ? createWrapperFromCacheSlowCase(type) : boilerplate->Clone();
- }
-
- static void setLocation(DOMWindow*, const String& relativeURL);
-
-private:
- V8DOMWindowShell(Frame*);
-
- void disposeContextHandles();
-
- void setSecurityToken();
- void clearDocumentWrapper();
-
- // The JavaScript wrapper for the document object is cached on the global
- // object for fast access. UpdateDocumentWrapperCache sets the wrapper
- // for the current document on the global object. ClearDocumentWrapperCache
- // deletes the document wrapper from the global object.
- void updateDocumentWrapperCache();
- void clearDocumentWrapperCache();
-
- v8::Local<v8::Object> createWrapperFromCacheSlowCase(WrapperTypeInfo*);
-
- Frame* m_frame;
-
- // For each possible type of wrapper, we keep a boilerplate object.
- // The boilerplate is used to create additional wrappers of the same type.
- typedef WTF::HashMap<WrapperTypeInfo*, v8::Persistent<v8::Object> > WrapperBoilerplateMap;
- WrapperBoilerplateMap m_wrapperBoilerplates;
-
- v8::Persistent<v8::Context> m_context;
- v8::Persistent<v8::Object> m_global;
- v8::Persistent<v8::Object> m_document;
-};
-
-} // namespace WebCore
-
-#endif // V8DOMWindowShell_h
diff --git a/WebCore/bindings/v8/V8DOMWrapper.cpp b/WebCore/bindings/v8/V8DOMWrapper.cpp
deleted file mode 100644
index 72f6bdc..0000000
--- a/WebCore/bindings/v8/V8DOMWrapper.cpp
+++ /dev/null
@@ -1,480 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8DOMWrapper.h"
-
-#include "CSSMutableStyleDeclaration.h"
-#include "DOMDataStore.h"
-#include "DocumentLoader.h"
-#include "FrameLoaderClient.h"
-#include "Notification.h"
-#include "ScriptController.h"
-#include "V8AbstractEventListener.h"
-#include "V8Binding.h"
-#include "V8Collection.h"
-#include "V8CustomEventListener.h"
-#include "V8DedicatedWorkerContext.h"
-#include "V8DOMApplicationCache.h"
-#include "V8DOMMap.h"
-#include "V8DOMWindow.h"
-#include "V8EventListenerList.h"
-#include "V8EventSource.h"
-#include "V8FileReader.h"
-#include "V8FileWriter.h"
-#include "V8HTMLCollection.h"
-#include "V8HTMLDocument.h"
-#include "V8IDBRequest.h"
-#include "V8IDBTransaction.h"
-#include "V8IsolatedContext.h"
-#include "V8Location.h"
-#include "V8MessageChannel.h"
-#include "V8NamedNodeMap.h"
-#include "V8Node.h"
-#include "V8NodeFilterCondition.h"
-#include "V8NodeList.h"
-#include "V8Notification.h"
-#include "V8Proxy.h"
-#include "V8SharedWorker.h"
-#include "V8SharedWorkerContext.h"
-#include "V8StyleSheet.h"
-#include "V8WebSocket.h"
-#include "V8Worker.h"
-#include "V8WorkerContext.h"
-#include "V8WorkerContextEventListener.h"
-#include "V8XMLHttpRequest.h"
-#include "ArrayBufferView.h"
-#include "WebGLContextAttributes.h"
-#include "WebGLUniformLocation.h"
-#include "WorkerContextExecutionProxy.h"
-#include "WrapperTypeInfo.h"
-
-#if ENABLE(SVG)
-#include "SVGElementInstance.h"
-#include "SVGPathSeg.h"
-#include "V8SVGElementInstance.h"
-#endif
-
-#if ENABLE(WEB_AUDIO)
-#include "V8JavaScriptAudioNode.h"
-#endif
-
-#include <algorithm>
-#include <utility>
-#include <v8-debug.h>
-#include <wtf/Assertions.h>
-#include <wtf/OwnArrayPtr.h>
-#include <wtf/StdLibExtras.h>
-#include <wtf/UnusedParam.h>
-
-namespace WebCore {
-
-typedef HashMap<Node*, v8::Object*> DOMNodeMap;
-typedef HashMap<void*, v8::Object*> DOMObjectMap;
-
-// The caller must have increased obj's ref count.
-void V8DOMWrapper::setJSWrapperForDOMObject(void* object, v8::Persistent<v8::Object> wrapper)
-{
- ASSERT(V8DOMWrapper::maybeDOMWrapper(wrapper));
- ASSERT(!domWrapperType(wrapper)->toActiveDOMObjectFunction);
- getDOMObjectMap().set(object, wrapper);
-}
-
-// The caller must have increased obj's ref count.
-void V8DOMWrapper::setJSWrapperForActiveDOMObject(void* object, v8::Persistent<v8::Object> wrapper)
-{
- ASSERT(V8DOMWrapper::maybeDOMWrapper(wrapper));
- ASSERT(domWrapperType(wrapper)->toActiveDOMObjectFunction);
- getActiveDOMObjectMap().set(object, wrapper);
-}
-
-// The caller must have increased node's ref count.
-void V8DOMWrapper::setJSWrapperForDOMNode(Node* node, v8::Persistent<v8::Object> wrapper)
-{
- ASSERT(V8DOMWrapper::maybeDOMWrapper(wrapper));
- getDOMNodeMap().set(node, wrapper);
-}
-
-v8::Local<v8::Function> V8DOMWrapper::getConstructor(WrapperTypeInfo* type, v8::Handle<v8::Value> objectPrototype)
-{
- // A DOM constructor is a function instance created from a DOM constructor
- // template. There is one instance per context. A DOM constructor is
- // different from a normal function in two ways:
- // 1) it cannot be called as constructor (aka, used to create a DOM object)
- // 2) its __proto__ points to Object.prototype rather than
- // Function.prototype.
- // The reason for 2) is that, in Safari, a DOM constructor is a normal JS
- // object, but not a function. Hotmail relies on the fact that, in Safari,
- // HTMLElement.__proto__ == Object.prototype.
- v8::Handle<v8::FunctionTemplate> functionTemplate = type->getTemplate();
- // Getting the function might fail if we're running out of
- // stack or memory.
- v8::TryCatch tryCatch;
- v8::Local<v8::Function> value = functionTemplate->GetFunction();
- if (value.IsEmpty())
- return v8::Local<v8::Function>();
- // Hotmail fix, see comments above.
- if (!objectPrototype.IsEmpty())
- value->SetPrototype(objectPrototype);
- return value;
-}
-
-v8::Local<v8::Function> V8DOMWrapper::getConstructorForContext(WrapperTypeInfo* type, v8::Handle<v8::Context> context)
-{
- // Enter the scope for this context to get the correct constructor.
- v8::Context::Scope scope(context);
-
- return getConstructor(type, V8DOMWindowShell::getHiddenObjectPrototype(context));
-}
-
-v8::Local<v8::Function> V8DOMWrapper::getConstructor(WrapperTypeInfo* type, DOMWindow* window)
-{
- Frame* frame = window->frame();
- if (!frame)
- return v8::Local<v8::Function>();
-
- v8::Handle<v8::Context> context = V8Proxy::context(frame);
- if (context.IsEmpty())
- return v8::Local<v8::Function>();
-
- return getConstructorForContext(type, context);
-}
-
-#if ENABLE(WORKERS)
-v8::Local<v8::Function> V8DOMWrapper::getConstructor(WrapperTypeInfo* type, WorkerContext*)
-{
- WorkerScriptController* controller = WorkerScriptController::controllerForContext();
- WorkerContextExecutionProxy* proxy = controller ? controller->proxy() : 0;
- if (!proxy)
- return v8::Local<v8::Function>();
-
- v8::Handle<v8::Context> context = proxy->context();
- if (context.IsEmpty())
- return v8::Local<v8::Function>();
-
- return getConstructorForContext(type, context);
-}
-#endif
-
-void V8DOMWrapper::setHiddenReference(v8::Handle<v8::Object> parent, v8::Handle<v8::Value> child)
-{
- v8::Local<v8::Value> hiddenReferenceObject = parent->GetInternalField(v8DOMHiddenReferenceArrayIndex);
- if (hiddenReferenceObject->IsNull() || hiddenReferenceObject->IsUndefined()) {
- hiddenReferenceObject = v8::Array::New();
- parent->SetInternalField(v8DOMHiddenReferenceArrayIndex, hiddenReferenceObject);
- }
- v8::Local<v8::Array> hiddenReferenceArray = v8::Local<v8::Array>::Cast(hiddenReferenceObject);
- hiddenReferenceArray->Set(v8::Integer::New(hiddenReferenceArray->Length()), child);
-}
-
-void V8DOMWrapper::setHiddenWindowReference(Frame* frame, v8::Handle<v8::Value> jsObject)
-{
- // Get DOMWindow
- if (!frame)
- return; // Object might be detached from window
- v8::Handle<v8::Context> context = V8Proxy::context(frame);
- if (context.IsEmpty())
- return;
-
- v8::Handle<v8::Object> global = context->Global();
- // Look for real DOM wrapper.
- global = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), global);
- ASSERT(!global.IsEmpty());
-
- setHiddenReference(global, jsObject);
-}
-
-WrapperTypeInfo* V8DOMWrapper::domWrapperType(v8::Handle<v8::Object> object)
-{
- ASSERT(V8DOMWrapper::maybeDOMWrapper(object));
- return static_cast<WrapperTypeInfo*>(object->GetPointerFromInternalField(v8DOMWrapperTypeIndex));
-}
-
-PassRefPtr<NodeFilter> V8DOMWrapper::wrapNativeNodeFilter(v8::Handle<v8::Value> filter)
-{
- // A NodeFilter is used when walking through a DOM tree or iterating tree
- // nodes.
- // FIXME: we may want to cache NodeFilterCondition and NodeFilter
- // object, but it is minor.
- // NodeFilter is passed to NodeIterator that has a ref counted pointer
- // to NodeFilter. NodeFilter has a ref counted pointer to NodeFilterCondition.
- // In NodeFilterCondition, filter object is persisted in its constructor,
- // and disposed in its destructor.
- return NodeFilter::create(V8NodeFilterCondition::create(filter));
-}
-
-static bool globalObjectPrototypeIsDOMWindow(v8::Handle<v8::Object> objectPrototype)
-{
- // We can identify what type of context the global object is wrapping by looking at the
- // internal field count of its prototype. This assumes WorkerContexts and DOMWindows have different numbers
- // of internal fields, so a COMPILE_ASSERT is included to warn if this ever changes.
-#if ENABLE(WORKERS)
- COMPILE_ASSERT(V8DOMWindow::internalFieldCount != V8WorkerContext::internalFieldCount,
- DOMWindowAndWorkerContextHaveUnequalFieldCounts);
- COMPILE_ASSERT(V8DOMWindow::internalFieldCount != V8DedicatedWorkerContext::internalFieldCount,
- DOMWindowAndDedicatedWorkerContextHaveUnequalFieldCounts);
-#endif
-#if ENABLE(SHARED_WORKERS)
- COMPILE_ASSERT(V8DOMWindow::internalFieldCount != V8SharedWorkerContext::internalFieldCount,
- DOMWindowAndSharedWorkerContextHaveUnequalFieldCounts);
-#endif
- return objectPrototype->InternalFieldCount() == V8DOMWindow::internalFieldCount;
-}
-
-v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(V8Proxy* proxy, WrapperTypeInfo* type, void* impl)
-{
- WorkerContext* workerContext = 0;
- if (V8IsolatedContext::getEntered()) {
- // This effectively disables the wrapper cache for isolated worlds.
- proxy = 0;
- // FIXME: Do we need a wrapper cache for the isolated world? We should
- // see if the performance gains are worth while.
- // We'll get one once we give the isolated context a proper window shell.
- } else if (!proxy) {
- v8::Handle<v8::Context> context = v8::Context::GetCurrent();
- if (!context.IsEmpty()) {
- v8::Handle<v8::Object> globalPrototype = v8::Handle<v8::Object>::Cast(context->Global()->GetPrototype());
- if (globalObjectPrototypeIsDOMWindow(globalPrototype))
- proxy = V8Proxy::retrieve(V8DOMWindow::toNative(globalPrototype)->frame());
-#if ENABLE(WORKERS)
- else
- workerContext = V8WorkerContext::toNative(lookupDOMWrapper(V8WorkerContext::GetTemplate(), context->Global()));
-#endif
- }
- }
-
- v8::Local<v8::Object> instance;
- if (proxy)
- // FIXME: Fix this to work properly with isolated worlds (see above).
- instance = proxy->windowShell()->createWrapperFromCache(type);
- else {
- v8::Local<v8::Function> function;
-#if ENABLE(WORKERS)
- if (workerContext)
- function = getConstructor(type, workerContext);
- else
-#endif
- function = type->getTemplate()->GetFunction();
- instance = SafeAllocation::newInstance(function);
- }
- if (!instance.IsEmpty()) {
- // Avoid setting the DOM wrapper for failed allocations.
- setDOMWrapper(instance, type, impl);
- if (type == &V8HTMLDocument::info)
- instance = V8HTMLDocument::WrapInShadowObject(instance, static_cast<Node*>(impl));
- }
- return instance;
-}
-
-#ifndef NDEBUG
-bool V8DOMWrapper::maybeDOMWrapper(v8::Handle<v8::Value> value)
-{
- if (value.IsEmpty() || !value->IsObject())
- return false;
-
- v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(value);
- if (!object->InternalFieldCount())
- return false;
-
- ASSERT(object->InternalFieldCount() >= v8DefaultWrapperInternalFieldCount);
-
- v8::Handle<v8::Value> wrapper = object->GetInternalField(v8DOMWrapperObjectIndex);
- ASSERT(wrapper->IsNumber() || wrapper->IsExternal());
-
- return true;
-}
-#endif
-
-bool V8DOMWrapper::isValidDOMObject(v8::Handle<v8::Value> value)
-{
- if (value.IsEmpty() || !value->IsObject())
- return false;
- return v8::Handle<v8::Object>::Cast(value)->InternalFieldCount();
-}
-
-bool V8DOMWrapper::isWrapperOfType(v8::Handle<v8::Value> value, WrapperTypeInfo* type)
-{
- if (!isValidDOMObject(value))
- return false;
-
- v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(value);
- ASSERT(object->InternalFieldCount() >= v8DefaultWrapperInternalFieldCount);
-
- v8::Handle<v8::Value> wrapper = object->GetInternalField(v8DOMWrapperObjectIndex);
- ASSERT(wrapper->IsNumber() || wrapper->IsExternal());
-
- WrapperTypeInfo* typeInfo = static_cast<WrapperTypeInfo*>(object->GetPointerFromInternalField(v8DOMWrapperTypeIndex));
- return typeInfo == type;
-}
-
-v8::Handle<v8::Object> V8DOMWrapper::getWrapperSlow(Node* node)
-{
- V8IsolatedContext* context = V8IsolatedContext::getEntered();
- if (LIKELY(!context)) {
- v8::Persistent<v8::Object>* wrapper = node->wrapper();
- if (!wrapper)
- return v8::Handle<v8::Object>();
- return *wrapper;
- }
- DOMNodeMapping& domNodeMap = context->world()->domDataStore()->domNodeMap();
- return domNodeMap.get(node);
-}
-
-// A JS object of type EventTarget is limited to a small number of possible classes.
-// Check EventTarget.h for new type conversion methods
-v8::Handle<v8::Value> V8DOMWrapper::convertEventTargetToV8Object(EventTarget* target)
-{
- if (!target)
- return v8::Null();
-
-#if ENABLE(SVG)
- if (SVGElementInstance* instance = target->toSVGElementInstance())
- return toV8(instance);
-#endif
-
-#if ENABLE(WORKERS)
- if (Worker* worker = target->toWorker())
- return toV8(worker);
-
- if (DedicatedWorkerContext* workerContext = target->toDedicatedWorkerContext())
- return toV8(workerContext);
-#endif // WORKERS
-
-#if ENABLE(SHARED_WORKERS)
- if (SharedWorker* sharedWorker = target->toSharedWorker())
- return toV8(sharedWorker);
-
- if (SharedWorkerContext* sharedWorkerContext = target->toSharedWorkerContext())
- return toV8(sharedWorkerContext);
-#endif // SHARED_WORKERS
-
-#if ENABLE(NOTIFICATIONS)
- if (Notification* notification = target->toNotification())
- return toV8(notification);
-#endif
-
-#if ENABLE(INDEXED_DATABASE)
- if (IDBRequest* idbRequest = target->toIDBRequest())
- return toV8(idbRequest);
- if (IDBTransaction* idbTransaction = target->toIDBTransaction())
- return toV8(idbTransaction);
-#endif
-
-#if ENABLE(WEB_SOCKETS)
- if (WebSocket* webSocket = target->toWebSocket())
- return toV8(webSocket);
-#endif
-
- if (Node* node = target->toNode())
- return toV8(node);
-
- if (DOMWindow* domWindow = target->toDOMWindow())
- return toV8(domWindow);
-
- // XMLHttpRequest is created within its JS counterpart.
- if (XMLHttpRequest* xmlHttpRequest = target->toXMLHttpRequest()) {
- v8::Handle<v8::Object> wrapper = getActiveDOMObjectMap().get(xmlHttpRequest);
- ASSERT(!wrapper.IsEmpty());
- return wrapper;
- }
-
- // MessagePort is created within its JS counterpart
- if (MessagePort* port = target->toMessagePort()) {
- v8::Handle<v8::Object> wrapper = getActiveDOMObjectMap().get(port);
- ASSERT(!wrapper.IsEmpty());
- return wrapper;
- }
-
- if (XMLHttpRequestUpload* upload = target->toXMLHttpRequestUpload()) {
- v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(upload);
- ASSERT(!wrapper.IsEmpty());
- return wrapper;
- }
-
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
- if (DOMApplicationCache* domAppCache = target->toDOMApplicationCache())
- return toV8(domAppCache);
-#endif
-
-#if ENABLE(EVENTSOURCE)
- if (EventSource* eventSource = target->toEventSource())
- return toV8(eventSource);
-#endif
-
-#if ENABLE(BLOB)
- if (FileReader* fileReader = target->toFileReader())
- return toV8(fileReader);
-#endif
-
-#if ENABLE(FILE_SYSTEM)
- if (FileWriter* fileWriter = target->toFileWriter())
- return toV8(fileWriter);
-#endif
-
-#if ENABLE(WEB_AUDIO)
- if (JavaScriptAudioNode* jsAudioNode = target->toJavaScriptAudioNode())
- return toV8(jsAudioNode);
-#endif
-
- ASSERT(0);
- return notHandledByInterceptor();
-}
-
-PassRefPtr<EventListener> V8DOMWrapper::getEventListener(v8::Local<v8::Value> value, bool isAttribute, ListenerLookupType lookup)
-{
- v8::Handle<v8::Context> context = v8::Context::GetCurrent();
- if (context.IsEmpty())
- return 0;
- if (lookup == ListenerFindOnly)
- return V8EventListenerList::findWrapper(value, isAttribute);
- v8::Handle<v8::Object> globalPrototype = v8::Handle<v8::Object>::Cast(context->Global()->GetPrototype());
- if (globalObjectPrototypeIsDOMWindow(globalPrototype))
- return V8EventListenerList::findOrCreateWrapper<V8EventListener>(value, isAttribute);
-#if ENABLE(WORKERS)
- return V8EventListenerList::findOrCreateWrapper<V8WorkerContextEventListener>(value, isAttribute);
-#else
- return 0;
-#endif
-}
-
-#if ENABLE(XPATH)
-// XPath-related utilities
-RefPtr<XPathNSResolver> V8DOMWrapper::getXPathNSResolver(v8::Handle<v8::Value> value, V8Proxy* proxy)
-{
- RefPtr<XPathNSResolver> resolver;
- if (V8XPathNSResolver::HasInstance(value))
- resolver = V8XPathNSResolver::toNative(v8::Handle<v8::Object>::Cast(value));
- else if (value->IsObject())
- resolver = V8CustomXPathNSResolver::create(value->ToObject());
- return resolver;
-}
-#endif
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/V8DOMWrapper.h b/WebCore/bindings/v8/V8DOMWrapper.h
deleted file mode 100644
index 7f4490a..0000000
--- a/WebCore/bindings/v8/V8DOMWrapper.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8DOMWrapper_h
-#define V8DOMWrapper_h
-
-#include "Event.h"
-#include "IsolatedWorld.h"
-#include "Node.h"
-#include "NodeFilter.h"
-#include "PlatformString.h"
-#include "V8CustomXPathNSResolver.h"
-#include "V8Event.h"
-#include "V8Utilities.h"
-#include "V8XPathNSResolver.h"
-#include "WrapperTypeInfo.h"
-#include "XPathNSResolver.h"
-#include <v8.h>
-
-namespace WebCore {
-
- class DOMWindow;
- class EventTarget;
- class Frame;
- class Node;
- class V8Proxy;
- class WorkerContext;
-
- enum ListenerLookupType {
- ListenerFindOnly,
- ListenerFindOrCreate,
- };
-
- class V8DOMWrapper {
- public:
-#ifndef NDEBUG
- // Checks if a v8 value can be a DOM wrapper
- static bool maybeDOMWrapper(v8::Handle<v8::Value>);
-#endif
-
- // Sets contents of a DOM wrapper.
- static void setDOMWrapper(v8::Handle<v8::Object> object, WrapperTypeInfo* type, void* cptr)
- {
- ASSERT(object->InternalFieldCount() >= 2);
- object->SetPointerInInternalField(v8DOMWrapperObjectIndex, cptr);
- object->SetPointerInInternalField(v8DOMWrapperTypeIndex, type);
- }
-
- static v8::Handle<v8::Object> lookupDOMWrapper(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Handle<v8::Object> object)
- {
- return object.IsEmpty() ? object : object->FindInstanceInPrototypeChain(functionTemplate);
- }
-
- static WrapperTypeInfo* domWrapperType(v8::Handle<v8::Object>);
-
- static v8::Handle<v8::Value> convertEventTargetToV8Object(PassRefPtr<EventTarget> eventTarget)
- {
- return convertEventTargetToV8Object(eventTarget.get());
- }
-
- static v8::Handle<v8::Value> convertEventTargetToV8Object(EventTarget*);
-
- static PassRefPtr<EventListener> getEventListener(v8::Local<v8::Value> value, bool isAttribute, ListenerLookupType lookup);
-
-#if ENABLE(XPATH)
- // XPath-related utilities
- static RefPtr<XPathNSResolver> getXPathNSResolver(v8::Handle<v8::Value> value, V8Proxy* proxy = 0);
-#endif
-
- // Wrap JS node filter in C++.
- static PassRefPtr<NodeFilter> wrapNativeNodeFilter(v8::Handle<v8::Value>);
-
- static v8::Local<v8::Function> getConstructorForContext(WrapperTypeInfo*, v8::Handle<v8::Context>);
- static v8::Local<v8::Function> getConstructor(WrapperTypeInfo*, v8::Handle<v8::Value> objectPrototype);
- static v8::Local<v8::Function> getConstructor(WrapperTypeInfo*, DOMWindow*);
-#if ENABLE(WORKERS)
- static v8::Local<v8::Function> getConstructor(WrapperTypeInfo*, WorkerContext*);
-#endif
-
- // Set JS wrapper of a DOM object, the caller in charge of increase ref.
- static void setJSWrapperForDOMObject(void*, v8::Persistent<v8::Object>);
- static void setJSWrapperForActiveDOMObject(void*, v8::Persistent<v8::Object>);
- static void setJSWrapperForDOMNode(Node*, v8::Persistent<v8::Object>);
-
- static bool isValidDOMObject(v8::Handle<v8::Value>);
-
- // Check whether a V8 value is a wrapper of type |classType|.
- static bool isWrapperOfType(v8::Handle<v8::Value>, WrapperTypeInfo*);
-
- static void setHiddenReference(v8::Handle<v8::Object> parent, v8::Handle<v8::Value> child);
-
- // Set hidden references in a DOMWindow object of a frame.
- static void setHiddenWindowReference(Frame*, v8::Handle<v8::Value>);
-
- static v8::Local<v8::Object> instantiateV8Object(V8Proxy* proxy, WrapperTypeInfo*, void* impl);
-
- static v8::Handle<v8::Object> getWrapper(Node* node)
- {
- ASSERT(WTF::isMainThread());
- if (LIKELY(!IsolatedWorld::count())) {
- v8::Persistent<v8::Object>* wrapper = node->wrapper();
- if (wrapper)
- return *wrapper;
- }
- return getWrapperSlow(node);
- }
-
- private:
- static v8::Handle<v8::Object> getWrapperSlow(Node*);
- };
-
-}
-
-#endif // V8DOMWrapper_h
diff --git a/WebCore/bindings/v8/V8DataGridDataSource.cpp b/WebCore/bindings/v8/V8DataGridDataSource.cpp
deleted file mode 100644
index 6fff1f5..0000000
--- a/WebCore/bindings/v8/V8DataGridDataSource.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(DATAGRID)
-
-#include "V8DataGridDataSource.h"
-
-#include "Document.h"
-#include "Frame.h"
-#include "HTMLDataGridElement.h"
-#include "V8HTMLDataGridElement.h"
-
-
-namespace WebCore {
-
-V8DataGridDataSource::V8DataGridDataSource(v8::Handle<v8::Value> dataSource, Frame* frame)
- : m_dataSource(v8::Persistent<v8::Value>::New(dataSource))
- , m_frame(frame)
-{
-#ifndef NDEBUG
- V8GCController::registerGlobalHandle(DATASOURCE, this, m_dataSource);
-#endif
-}
-
-V8DataGridDataSource::~V8DataGridDataSource()
-{
-#ifndef NDEBUG
- V8GCController::unregisterGlobalHandle(this, m_dataSource);
-#endif
- m_dataSource.Dispose();
- m_dataSource.Clear();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(DATAGRID)
diff --git a/WebCore/bindings/v8/V8DataGridDataSource.h b/WebCore/bindings/v8/V8DataGridDataSource.h
deleted file mode 100644
index 7f6d8d8..0000000
--- a/WebCore/bindings/v8/V8DataGridDataSource.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8DataGridDataSource_h
-#define V8DataGridDataSource_h
-
-#if ENABLE(DATAGRID)
-
-#include "DataGridDataSource.h"
-#include <v8.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-class Frame;
-class HTMLDataGridElement;
-
-class V8DataGridDataSource : public DataGridDataSource {
-public:
- static PassRefPtr<V8DataGridDataSource> create(v8::Handle<v8::Value> dataSource, Frame* frame)
- {
- return adoptRef(new V8DataGridDataSource(dataSource, frame));
- }
-
- virtual ~V8DataGridDataSource();
-
- virtual bool isJSDataGridDataSource() const { return true; }
- v8::Handle<v8::Value> jsDataSource() const { return m_dataSource; }
-
-private:
- V8DataGridDataSource(v8::Handle<v8::Value>, Frame*);
-
- v8::Persistent<v8::Value> m_dataSource;
- RefPtr<Frame> m_frame;
-};
-
-inline V8DataGridDataSource* asV8DataGridDataSource(DataGridDataSource* dataSource)
-{
- ASSERT(dataSource->isJSDataGridDataSource());
- return static_cast<V8DataGridDataSource*>(dataSource);
-}
-
-inline const V8DataGridDataSource* asV8DataGridDataSource(const DataGridDataSource* dataSource)
-{
- ASSERT(dataSource->isJSDataGridDataSource());
- return static_cast<const V8DataGridDataSource*>(dataSource);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(DATAGRID)
-#endif // V8DataGridDataSource_h
diff --git a/WebCore/bindings/v8/V8EventListenerList.cpp b/WebCore/bindings/v8/V8EventListenerList.cpp
deleted file mode 100644
index e37d630..0000000
--- a/WebCore/bindings/v8/V8EventListenerList.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8EventListenerList.h"
-
-namespace WebCore {
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/V8EventListenerList.h b/WebCore/bindings/v8/V8EventListenerList.h
deleted file mode 100644
index fdf211d..0000000
--- a/WebCore/bindings/v8/V8EventListenerList.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8EventListenerList_h
-#define V8EventListenerList_h
-
-#include "V8CustomEventListener.h"
-#include "V8HiddenPropertyName.h"
-
-#include <v8.h>
-#include <wtf/PassRefPtr.h>
-
-namespace WebCore {
- class Frame;
-
- // This is a container for V8EventListener objects that uses hidden properties of v8::Object to speed up lookups.
- class V8EventListenerList {
- public:
- static PassRefPtr<V8EventListener> findWrapper(v8::Local<v8::Value> value, bool isAttribute)
- {
- ASSERT(v8::Context::InContext());
- if (!value->IsObject())
- return 0;
-
- v8::Handle<v8::String> wrapperProperty = getHiddenProperty(isAttribute);
- return doFindWrapper(v8::Local<v8::Object>::Cast(value), wrapperProperty);
- }
-
- template<typename WrapperType>
- static PassRefPtr<V8EventListener> findOrCreateWrapper(v8::Local<v8::Value>, bool isAttribute);
-
- static void clearWrapper(v8::Handle<v8::Object> listenerObject, bool isAttribute)
- {
- v8::Handle<v8::String> wrapperProperty = getHiddenProperty(isAttribute);
- listenerObject->DeleteHiddenValue(wrapperProperty);
- }
-
- private:
- static V8EventListener* doFindWrapper(v8::Local<v8::Object> object, v8::Handle<v8::String> wrapperProperty)
- {
- ASSERT(v8::Context::InContext());
- v8::HandleScope scope;
- v8::Local<v8::Value> listener = object->GetHiddenValue(wrapperProperty);
- if (listener.IsEmpty())
- return 0;
- return static_cast<V8EventListener*>(v8::External::Unwrap(listener));
- }
-
- static inline v8::Handle<v8::String> getHiddenProperty(bool isAttribute)
- {
- return isAttribute ? V8HiddenPropertyName::attributeListener() : V8HiddenPropertyName::listener();
- }
- };
-
- template<typename WrapperType>
- PassRefPtr<V8EventListener> V8EventListenerList::findOrCreateWrapper(v8::Local<v8::Value> value, bool isAttribute)
- {
- ASSERT(v8::Context::InContext());
- if (!value->IsObject())
- return 0;
-
- v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value);
- v8::Handle<v8::String> wrapperProperty = getHiddenProperty(isAttribute);
-
- V8EventListener* wrapper = doFindWrapper(object, wrapperProperty);
- if (wrapper)
- return wrapper;
-
- PassRefPtr<V8EventListener> wrapperPtr = WrapperType::create(object, isAttribute, WorldContextHandle(UseCurrentWorld));
- if (wrapperPtr)
- object->SetHiddenValue(wrapperProperty, v8::External::Wrap(wrapperPtr.get()));
-
- return wrapperPtr;
- }
-
-} // namespace WebCore
-
-#endif // V8EventListenerList_h
diff --git a/WebCore/bindings/v8/V8GCController.cpp b/WebCore/bindings/v8/V8GCController.cpp
deleted file mode 100644
index 01e34f3..0000000
--- a/WebCore/bindings/v8/V8GCController.cpp
+++ /dev/null
@@ -1,584 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8GCController.h"
-
-#include "ActiveDOMObject.h"
-#include "Attr.h"
-#include "DOMDataStore.h"
-#include "Frame.h"
-#include "HTMLImageElement.h"
-#include "HTMLNames.h"
-#include "MessagePort.h"
-#include "PlatformBridge.h"
-#include "SVGElement.h"
-#include "V8Binding.h"
-#include "V8CSSCharsetRule.h"
-#include "V8CSSFontFaceRule.h"
-#include "V8CSSImportRule.h"
-#include "V8CSSMediaRule.h"
-#include "V8CSSRuleList.h"
-#include "V8CSSStyleDeclaration.h"
-#include "V8CSSStyleRule.h"
-#include "V8CSSStyleSheet.h"
-#include "V8DOMMap.h"
-#include "V8HTMLLinkElement.h"
-#include "V8HTMLStyleElement.h"
-#include "V8MessagePort.h"
-#include "V8ProcessingInstruction.h"
-#include "V8Proxy.h"
-#include "V8StyleSheetList.h"
-#include "WrapperTypeInfo.h"
-
-#include <algorithm>
-#include <utility>
-#include <v8-debug.h>
-#include <wtf/HashMap.h>
-#include <wtf/StdLibExtras.h>
-#include <wtf/UnusedParam.h>
-
-namespace WebCore {
-
-#ifndef NDEBUG
-// Keeps track of global handles created (not JS wrappers
-// of DOM objects). Often these global handles are source
-// of leaks.
-//
-// If you want to let a C++ object hold a persistent handle
-// to a JS object, you should register the handle here to
-// keep track of leaks.
-//
-// When creating a persistent handle, call:
-//
-// #ifndef NDEBUG
-// V8GCController::registerGlobalHandle(type, host, handle);
-// #endif
-//
-// When releasing the handle, call:
-//
-// #ifndef NDEBUG
-// V8GCController::unregisterGlobalHandle(type, host, handle);
-// #endif
-//
-typedef HashMap<v8::Value*, GlobalHandleInfo*> GlobalHandleMap;
-
-static GlobalHandleMap& globalHandleMap()
-{
- DEFINE_STATIC_LOCAL(GlobalHandleMap, staticGlobalHandleMap, ());
- return staticGlobalHandleMap;
-}
-
-// The function is the place to set the break point to inspect
-// live global handles. Leaks are often come from leaked global handles.
-static void enumerateGlobalHandles()
-{
- for (GlobalHandleMap::iterator it = globalHandleMap().begin(), end = globalHandleMap().end(); it != end; ++it) {
- GlobalHandleInfo* info = it->second;
- UNUSED_PARAM(info);
- v8::Value* handle = it->first;
- UNUSED_PARAM(handle);
- }
-}
-
-void V8GCController::registerGlobalHandle(GlobalHandleType type, void* host, v8::Persistent<v8::Value> handle)
-{
- ASSERT(!globalHandleMap().contains(*handle));
- globalHandleMap().set(*handle, new GlobalHandleInfo(host, type));
-}
-
-void V8GCController::unregisterGlobalHandle(void* host, v8::Persistent<v8::Value> handle)
-{
- ASSERT(globalHandleMap().contains(*handle));
- GlobalHandleInfo* info = globalHandleMap().take(*handle);
- ASSERT(info->m_host == host);
- delete info;
-}
-#endif // ifndef NDEBUG
-
-typedef HashMap<Node*, v8::Object*> DOMNodeMap;
-typedef HashMap<void*, v8::Object*> DOMObjectMap;
-
-#ifndef NDEBUG
-
-static void enumerateDOMObjectMap(DOMObjectMap& wrapperMap)
-{
- for (DOMObjectMap::iterator it = wrapperMap.begin(), end = wrapperMap.end(); it != end; ++it) {
- v8::Persistent<v8::Object> wrapper(it->second);
- WrapperTypeInfo* type = V8DOMWrapper::domWrapperType(wrapper);
- void* object = it->first;
- UNUSED_PARAM(type);
- UNUSED_PARAM(object);
- }
-}
-
-class DOMObjectVisitor : public DOMWrapperMap<void>::Visitor {
-public:
- void visitDOMWrapper(DOMDataStore* store, void* object, v8::Persistent<v8::Object> wrapper)
- {
- WrapperTypeInfo* type = V8DOMWrapper::domWrapperType(wrapper);
- UNUSED_PARAM(type);
- UNUSED_PARAM(object);
- }
-};
-
-class EnsureWeakDOMNodeVisitor : public DOMWrapperMap<Node>::Visitor {
-public:
- void visitDOMWrapper(DOMDataStore* store, Node* object, v8::Persistent<v8::Object> wrapper)
- {
- UNUSED_PARAM(object);
- ASSERT(wrapper.IsWeak());
- }
-};
-
-#endif // NDEBUG
-
-// A map from a DOM node to its JS wrapper, the wrapper
-// is kept as a strong reference to survive GCs.
-static DOMObjectMap& gcProtectedMap()
-{
- DEFINE_STATIC_LOCAL(DOMObjectMap, staticGcProtectedMap, ());
- return staticGcProtectedMap;
-}
-
-void V8GCController::gcProtect(void* domObject)
-{
- if (!domObject)
- return;
- if (gcProtectedMap().contains(domObject))
- return;
- if (!getDOMObjectMap().contains(domObject))
- return;
-
- // Create a new (strong) persistent handle for the object.
- v8::Persistent<v8::Object> wrapper = getDOMObjectMap().get(domObject);
- if (wrapper.IsEmpty())
- return;
-
- gcProtectedMap().set(domObject, *v8::Persistent<v8::Object>::New(wrapper));
-}
-
-void V8GCController::gcUnprotect(void* domObject)
-{
- if (!domObject)
- return;
- if (!gcProtectedMap().contains(domObject))
- return;
-
- // Dispose the strong reference.
- v8::Persistent<v8::Object> wrapper(gcProtectedMap().take(domObject));
- wrapper.Dispose();
-}
-
-class GCPrologueVisitor : public DOMWrapperMap<void>::Visitor {
-public:
- void visitDOMWrapper(DOMDataStore* store, void* object, v8::Persistent<v8::Object> wrapper)
- {
- WrapperTypeInfo* typeInfo = V8DOMWrapper::domWrapperType(wrapper);
-
- // Additional handling of message port ensuring that entangled ports also
- // have their wrappers entangled. This should ideally be handled when the
- // ports are actually entangled in MessagePort::entangle, but to avoid
- // forking MessagePort.* this is postponed to GC time. Having this postponed
- // has the drawback that the wrappers are "entangled/unentangled" for each
- // GC even though their entaglement most likely is still the same.
- if (V8MessagePort::info.equals(typeInfo)) {
- // Mark each port as in-use if it's entangled. For simplicity's sake, we assume all ports are remotely entangled,
- // since the Chromium port implementation can't tell the difference.
- MessagePort* port1 = static_cast<MessagePort*>(object);
- if (port1->isEntangled() || port1->hasPendingActivity())
- wrapper.ClearWeak();
- } else {
- ActiveDOMObject* activeDOMObject = typeInfo->toActiveDOMObject(wrapper);
- if (activeDOMObject && activeDOMObject->hasPendingActivity())
- wrapper.ClearWeak();
- }
- }
-};
-
-class GrouperItem {
-public:
- GrouperItem(uintptr_t groupId, v8::Persistent<v8::Object> wrapper)
- : m_groupId(groupId)
- , m_wrapper(wrapper)
- {
- }
-
- uintptr_t groupId() const { return m_groupId; }
- v8::Persistent<v8::Object> wrapper() const { return m_wrapper; }
-
-private:
- uintptr_t m_groupId;
- v8::Persistent<v8::Object> m_wrapper;
-};
-
-bool operator<(const GrouperItem& a, const GrouperItem& b)
-{
- return a.groupId() < b.groupId();
-}
-
-typedef Vector<GrouperItem> GrouperList;
-
-void makeV8ObjectGroups(GrouperList& grouper)
-{
- // Group by sorting by the group id.
- std::sort(grouper.begin(), grouper.end());
-
- // FIXME Should probably work in iterators here, but indexes were easier for my simple mind.
- for (size_t i = 0; i < grouper.size(); ) {
- // Seek to the next key (or the end of the list).
- size_t nextKeyIndex = grouper.size();
- for (size_t j = i; j < grouper.size(); ++j) {
- if (grouper[i].groupId() != grouper[j].groupId()) {
- nextKeyIndex = j;
- break;
- }
- }
-
- ASSERT(nextKeyIndex > i);
-
- // We only care about a group if it has more than one object. If it only
- // has one object, it has nothing else that needs to be kept alive.
- if (nextKeyIndex - i <= 1) {
- i = nextKeyIndex;
- continue;
- }
-
- Vector<v8::Persistent<v8::Value> > group;
- group.reserveCapacity(nextKeyIndex - i);
- for (; i < nextKeyIndex; ++i) {
- v8::Persistent<v8::Value> wrapper = grouper[i].wrapper();
- if (!wrapper.IsEmpty())
- group.append(wrapper);
- }
-
- if (group.size() > 1)
- v8::V8::AddObjectGroup(&group[0], group.size());
-
- ASSERT(i == nextKeyIndex);
- }
-}
-
-class NodeGrouperVisitor : public DOMWrapperMap<Node>::Visitor {
-public:
- NodeGrouperVisitor()
- {
- // FIXME: grouper_.reserveCapacity(node_map.size()); ?
- }
-
- void visitDOMWrapper(DOMDataStore* store, Node* node, v8::Persistent<v8::Object> wrapper)
- {
- // If the node is in document, put it in the ownerDocument's object group.
- //
- // If an image element was created by JavaScript "new Image",
- // it is not in a document. However, if the load event has not
- // been fired (still onloading), it is treated as in the document.
- //
- // Otherwise, the node is put in an object group identified by the root
- // element of the tree to which it belongs.
- uintptr_t groupId;
- if (node->inDocument() || (node->hasTagName(HTMLNames::imgTag) && !static_cast<HTMLImageElement*>(node)->haveFiredLoadEvent()))
- groupId = reinterpret_cast<uintptr_t>(node->document());
- else {
- Node* root = node;
- if (node->isAttributeNode()) {
- root = static_cast<Attr*>(node)->ownerElement();
- // If the attribute has no element, no need to put it in the group,
- // because it'll always be a group of 1.
- if (!root)
- return;
- } else {
- while (root->parentNode())
- root = root->parentNode();
-
- // If the node is alone in its DOM tree (doesn't have a parent or any
- // children) then the group will be filtered out later anyway.
- if (root == node && !node->hasChildNodes() && !node->hasAttributes())
- return;
- }
- groupId = reinterpret_cast<uintptr_t>(root);
- }
- m_grouper.append(GrouperItem(groupId, wrapper));
-
- // If the node is styled and there is a wrapper for the inline
- // style declaration, we need to keep that style declaration
- // wrapper alive as well, so we add it to the object group.
- if (node->isStyledElement()) {
- StyledElement* element = reinterpret_cast<StyledElement*>(node);
- addDOMObjectToGroup(store, groupId, element->inlineStyleDecl());
- }
-
- if (node->isDocumentNode()) {
- Document* document = reinterpret_cast<Document*>(node);
- addDOMObjectToGroup(store, groupId, document->styleSheets());
- }
-
- WrapperTypeInfo* typeInfo = V8DOMWrapper::domWrapperType(wrapper);
-
- if (V8HTMLLinkElement::info.equals(typeInfo)) {
- HTMLLinkElement* htmlLinkElement = static_cast<HTMLLinkElement*>(node);
- addDOMObjectToGroup(store, groupId, htmlLinkElement->sheet());
- }
-
- if (V8HTMLStyleElement::info.equals(typeInfo)) {
- HTMLStyleElement* htmlStyleElement = static_cast<HTMLStyleElement*>(node);
- addDOMObjectToGroup(store, groupId, htmlStyleElement->sheet());
- }
-
- if (V8ProcessingInstruction::info.equals(typeInfo)) {
- ProcessingInstruction* processingInstruction = static_cast<ProcessingInstruction*>(node);
- addDOMObjectToGroup(store, groupId, processingInstruction->sheet());
- }
- }
-
- void applyGrouping()
- {
- makeV8ObjectGroups(m_grouper);
- }
-
-private:
- GrouperList m_grouper;
-
- void addDOMObjectToGroup(DOMDataStore* store, uintptr_t groupId, void* object)
- {
- if (!object)
- return;
- v8::Persistent<v8::Object> wrapper = store->domObjectMap().get(object);
- if (!wrapper.IsEmpty())
- m_grouper.append(GrouperItem(groupId, wrapper));
- }
-};
-
-class DOMObjectGrouperVisitor : public DOMWrapperMap<void>::Visitor {
-public:
- DOMObjectGrouperVisitor()
- {
- }
-
- void startMap()
- {
- m_grouper.shrink(0);
- }
-
- void endMap()
- {
- makeV8ObjectGroups(m_grouper);
- }
-
- void visitDOMWrapper(DOMDataStore* store, void* object, v8::Persistent<v8::Object> wrapper)
- {
- WrapperTypeInfo* typeInfo = V8DOMWrapper::domWrapperType(wrapper);
- // FIXME: extend WrapperTypeInfo with isStyle to simplify the check below or consider
- // adding a virtual method to WrapperTypeInfo which would know how to group objects.
- // FIXME: check if there are other StyleBase wrappers we should care of.
- if (V8CSSStyleSheet::info.equals(typeInfo)
- || V8CSSStyleDeclaration::info.equals(typeInfo)
- || V8CSSCharsetRule::info.equals(typeInfo)
- || V8CSSFontFaceRule::info.equals(typeInfo)
- || V8CSSStyleRule::info.equals(typeInfo)
- || V8CSSImportRule::info.equals(typeInfo)
- || V8CSSMediaRule::info.equals(typeInfo)) {
- StyleBase* styleBase = static_cast<StyleBase*>(object);
-
- // We put the whole tree of style elements into a single object group.
- // To achieve that we group elements by the roots of their trees.
- StyleBase* root = styleBase;
- ASSERT(root);
- while (true) {
- StyleBase* parent = root->parent();
- if (!parent)
- break;
- root = parent;
- }
- // Group id is an address of the root.
- uintptr_t groupId = reinterpret_cast<uintptr_t>(root);
- m_grouper.append(GrouperItem(groupId, wrapper));
-
- if (V8CSSStyleDeclaration::info.equals(typeInfo)) {
- CSSStyleDeclaration* cssStyleDeclaration = static_cast<CSSStyleDeclaration*>(styleBase);
- if (cssStyleDeclaration->isMutableStyleDeclaration()) {
- CSSMutableStyleDeclaration* cssMutableStyleDeclaration = static_cast<CSSMutableStyleDeclaration*>(cssStyleDeclaration);
- CSSMutableStyleDeclaration::const_iterator end = cssMutableStyleDeclaration->end();
- for (CSSMutableStyleDeclaration::const_iterator it = cssMutableStyleDeclaration->begin(); it != end; ++it) {
- wrapper = store->domObjectMap().get(it->value());
- if (!wrapper.IsEmpty())
- m_grouper.append(GrouperItem(groupId, wrapper));
- }
- }
- }
- } else if (V8StyleSheetList::info.equals(typeInfo)) {
- addAllItems(store, static_cast<StyleSheetList*>(object), wrapper);
- } else if (V8CSSRuleList::info.equals(typeInfo)) {
- addAllItems(store, static_cast<CSSRuleList*>(object), wrapper);
- }
- }
-
-private:
- GrouperList m_grouper;
-
- template <class C>
- void addAllItems(DOMDataStore* store, C* collection, v8::Persistent<v8::Object> wrapper)
- {
- uintptr_t groupId = reinterpret_cast<uintptr_t>(collection);
- m_grouper.append(GrouperItem(groupId, wrapper));
- for (unsigned i = 0; i < collection->length(); i++) {
- wrapper = store->domObjectMap().get(collection->item(i));
- if (!wrapper.IsEmpty())
- m_grouper.append(GrouperItem(groupId, wrapper));
- }
- }
-};
-
-// Create object groups for DOM tree nodes.
-void V8GCController::gcPrologue()
-{
- v8::HandleScope scope;
-
-#ifndef NDEBUG
- DOMObjectVisitor domObjectVisitor;
- visitDOMObjectsInCurrentThread(&domObjectVisitor);
-#endif
-
- // Run through all objects with possible pending activity making their
- // wrappers non weak if there is pending activity.
- GCPrologueVisitor prologueVisitor;
- visitActiveDOMObjectsInCurrentThread(&prologueVisitor);
-
- // Create object groups.
- NodeGrouperVisitor nodeGrouperVisitor;
- visitDOMNodesInCurrentThread(&nodeGrouperVisitor);
- nodeGrouperVisitor.applyGrouping();
-
- DOMObjectGrouperVisitor domObjectGrouperVisitor;
- visitDOMObjectsInCurrentThread(&domObjectGrouperVisitor);
-
- // Clean single element cache for string conversions.
- lastStringImpl = 0;
- lastV8String.Clear();
-}
-
-class GCEpilogueVisitor : public DOMWrapperMap<void>::Visitor {
-public:
- void visitDOMWrapper(DOMDataStore* store, void* object, v8::Persistent<v8::Object> wrapper)
- {
- WrapperTypeInfo* typeInfo = V8DOMWrapper::domWrapperType(wrapper);
- if (V8MessagePort::info.equals(typeInfo)) {
- MessagePort* port1 = static_cast<MessagePort*>(object);
- // We marked this port as reachable in GCPrologueVisitor. Undo this now since the
- // port could be not reachable in the future if it gets disentangled (and also
- // GCPrologueVisitor expects to see all handles marked as weak).
- if ((!wrapper.IsWeak() && !wrapper.IsNearDeath()) || port1->hasPendingActivity())
- wrapper.MakeWeak(port1, &DOMDataStore::weakActiveDOMObjectCallback);
- } else {
- ActiveDOMObject* activeDOMObject = typeInfo->toActiveDOMObject(wrapper);
- if (activeDOMObject && activeDOMObject->hasPendingActivity()) {
- ASSERT(!wrapper.IsWeak());
- // NOTE: To re-enable weak status of the active object we use
- // |object| from the map and not |activeDOMObject|. The latter
- // may be a different pointer (in case ActiveDOMObject is not
- // the main base class of the object's class) and pointer
- // identity is required by DOM map functions.
- wrapper.MakeWeak(object, &DOMDataStore::weakActiveDOMObjectCallback);
- }
- }
- }
-};
-
-int V8GCController::workingSetEstimateMB = 0;
-
-namespace {
-
-int getMemoryUsageInMB()
-{
-#if PLATFORM(CHROMIUM) || PLATFORM(ANDROID)
- return PlatformBridge::memoryUsageMB();
-#else
- return 0;
-#endif
-}
-
-int getActualMemoryUsageInMB()
-{
-#if PLATFORM(CHROMIUM) || PLATFORM(ANDROID)
- return PlatformBridge::actualMemoryUsageMB();
-#else
- return 0;
-#endif
-}
-
-} // anonymous namespace
-
-void V8GCController::gcEpilogue()
-{
- v8::HandleScope scope;
-
- // Run through all objects with pending activity making their wrappers weak
- // again.
- GCEpilogueVisitor epilogueVisitor;
- visitActiveDOMObjectsInCurrentThread(&epilogueVisitor);
-
- workingSetEstimateMB = getActualMemoryUsageInMB();
-
-#ifndef NDEBUG
- // Check all survivals are weak.
- DOMObjectVisitor domObjectVisitor;
- visitDOMObjectsInCurrentThread(&domObjectVisitor);
-
- EnsureWeakDOMNodeVisitor weakDOMNodeVisitor;
- visitDOMNodesInCurrentThread(&weakDOMNodeVisitor);
-
- enumerateDOMObjectMap(gcProtectedMap());
- enumerateGlobalHandles();
-#endif
-}
-
-void V8GCController::checkMemoryUsage()
-{
-#if PLATFORM(CHROMIUM) || PLATFORM(QT) && !OS(SYMBIAN)
- // These values are appropriate for Chromium only.
- const int lowUsageMB = 256; // If memory usage is below this threshold, do not bother forcing GC.
- const int highUsageMB = 1024; // If memory usage is above this threshold, force GC more aggresively.
- const int highUsageDeltaMB = 128; // Delta of memory usage growth (vs. last workingSetEstimateMB) to force GC when memory usage is high.
-#elif PLATFORM(ANDROID)
- // Query the PlatformBridge for memory thresholds as these vary device to device.
- static const int lowUsageMB = PlatformBridge::lowMemoryUsageMB();
- static const int highUsageMB = PlatformBridge::highMemoryUsageMB();
- static const int highUsageDeltaMB = PlatformBridge::highUsageDeltaMB();
-#else
- return;
-#endif
-
- int memoryUsageMB = getMemoryUsageInMB();
- if ((memoryUsageMB > lowUsageMB && memoryUsageMB > 2 * workingSetEstimateMB) || (memoryUsageMB > highUsageMB && memoryUsageMB > workingSetEstimateMB + highUsageDeltaMB))
- v8::V8::LowMemoryNotification();
-}
-
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/V8GCController.h b/WebCore/bindings/v8/V8GCController.h
deleted file mode 100644
index 484be24..0000000
--- a/WebCore/bindings/v8/V8GCController.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8GCController_h
-#define V8GCController_h
-
-#include <v8.h>
-
-namespace WebCore {
-
-#ifndef NDEBUG
-
-#define GlobalHandleTypeList(V) \
- V(PROXY) \
- V(NPOBJECT) \
- V(SCHEDULED_ACTION) \
- V(EVENT_LISTENER) \
- V(NODE_FILTER) \
- V(SCRIPTINSTANCE) \
- V(SCRIPTVALUE) \
- V(DATASOURCE)
-
-
- // Host information of persistent handles.
- enum GlobalHandleType {
-#define ENUM(name) name,
- GlobalHandleTypeList(ENUM)
-#undef ENUM
- };
-
- class GlobalHandleInfo {
- public:
- GlobalHandleInfo(void* host, GlobalHandleType type) : m_host(host), m_type(type) { }
- void* m_host;
- GlobalHandleType m_type;
- };
-
-#endif // NDEBUG
-
- class V8GCController {
- public:
- // Protect/Unprotect JS wrappers of a DOM object.
- static void gcProtect(void* domObject);
- static void gcUnprotect(void* domObject);
-
-#ifndef NDEBUG
- // For debugging and leak detection purpose.
- static void registerGlobalHandle(GlobalHandleType, void*, v8::Persistent<v8::Value>);
- static void unregisterGlobalHandle(void*, v8::Persistent<v8::Value>);
-#endif
-
- static void gcPrologue();
- static void gcEpilogue();
-
- static void checkMemoryUsage();
-
- private:
- // Estimate of current working set.
- static int workingSetEstimateMB;
- };
-
-}
-
-#endif // V8GCController_h
diff --git a/WebCore/bindings/v8/V8GCForContextDispose.cpp b/WebCore/bindings/v8/V8GCForContextDispose.cpp
deleted file mode 100644
index 06a0555..0000000
--- a/WebCore/bindings/v8/V8GCForContextDispose.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8GCForContextDispose.h"
-
-#include <wtf/StdLibExtras.h>
-
-namespace WebCore {
-
-V8GCForContextDispose::V8GCForContextDispose()
- : m_pseudoIdleTimer(this, &V8GCForContextDispose::pseudoIdleTimerFired)
-{
-}
-
-void V8GCForContextDispose::notifyContextDisposed()
-{
- v8::V8::ContextDisposedNotification();
- if (!m_pseudoIdleTimer.isActive())
- m_pseudoIdleTimer.startOneShot(0.8);
-}
-
-void V8GCForContextDispose::notifyIdleSooner(double maximumFireInterval)
-{
- if (m_pseudoIdleTimer.isActive()) {
- double nextFireInterval = m_pseudoIdleTimer.nextFireInterval();
- if (nextFireInterval > maximumFireInterval) {
- m_pseudoIdleTimer.stop();
- m_pseudoIdleTimer.startOneShot(maximumFireInterval);
- }
- }
-}
-
-V8GCForContextDispose& V8GCForContextDispose::instance()
-{
- DEFINE_STATIC_LOCAL(V8GCForContextDispose, staticInstance, ());
- return staticInstance;
-}
-
-void V8GCForContextDispose::pseudoIdleTimerFired(Timer<V8GCForContextDispose>*)
-{
- v8::V8::IdleNotification();
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/V8GCForContextDispose.h b/WebCore/bindings/v8/V8GCForContextDispose.h
deleted file mode 100644
index b15c5af..0000000
--- a/WebCore/bindings/v8/V8GCForContextDispose.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8GCForContextDispose_h
-#define V8GCForContextDispose_h
-
-#include "Timer.h"
-#include <v8.h>
-
-namespace WebCore {
-
-class V8GCForContextDispose {
-public:
- void notifyContextDisposed();
- void notifyIdleSooner(double maximumFireInterval);
-
- static V8GCForContextDispose& instance();
-
-private:
- V8GCForContextDispose(); // Use instance() instead.
- void pseudoIdleTimerFired(Timer<V8GCForContextDispose>*);
-
- Timer<V8GCForContextDispose> m_pseudoIdleTimer;
-};
-
-}
-
-#endif // V8GCForContextDispose_h
diff --git a/WebCore/bindings/v8/V8Helpers.cpp b/WebCore/bindings/v8/V8Helpers.cpp
deleted file mode 100644
index 486bc48..0000000
--- a/WebCore/bindings/v8/V8Helpers.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-* Copyright (C) 2008, 2009 Google 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:
-*
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * 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.
-* * Neither the name of Google Inc. nor the names of its
-* contributors may be used to endorse or promote products derived from
-* this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "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 THE COPYRIGHT
-* OWNER 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.
-*/
-
-#include "config.h"
-#include "V8Helpers.h"
-
-#include "DOMWindow.h"
-#include "NPV8Object.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Local<v8::Context> toV8Context(NPP npp, NPObject* npObject)
-{
- V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject);
- return V8Proxy::mainWorldContext(object->rootObject->frame());
-}
-
-V8Proxy* toV8Proxy(NPObject* npObject)
-{
- V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject);
- Frame* frame = object->rootObject->frame();
- return V8Proxy::retrieve(frame);
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/V8Helpers.h b/WebCore/bindings/v8/V8Helpers.h
deleted file mode 100644
index 43d765a..0000000
--- a/WebCore/bindings/v8/V8Helpers.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-* Copyright (C) 2006, 2007, 2008, 2009 Google 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:
-*
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * 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.
-* * Neither the name of Google Inc. nor the names of its
-* contributors may be used to endorse or promote products derived from
-* this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "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 THE COPYRIGHT
-* OWNER 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 V8Helpers_h
-#define V8Helpers_h
-
-#include "npruntime_internal.h"
-#include <v8.h>
-
-namespace WebCore {
- class V8Proxy;
-
- v8::Local<v8::Context> toV8Context(NPP, NPObject*);
-
- V8Proxy* toV8Proxy(NPObject*);
-
-} // namespace WebCore
-
-#endif // V8Helpers_h
diff --git a/WebCore/bindings/v8/V8HiddenPropertyName.cpp b/WebCore/bindings/v8/V8HiddenPropertyName.cpp
deleted file mode 100644
index d83573f..0000000
--- a/WebCore/bindings/v8/V8HiddenPropertyName.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8HiddenPropertyName.h"
-
-namespace WebCore {
-
-#define V8_AS_STRING(x) V8_AS_STRING_IMPL(x)
-#define V8_AS_STRING_IMPL(x) #x
-
-#define V8_DEFINE_PROPERTY(name) \
-v8::Handle<v8::String> V8HiddenPropertyName::name() \
-{ \
- static v8::Persistent<v8::String>* string = createString("WebCore::V8HiddenPropertyName::" V8_AS_STRING(name)); \
- return *string; \
-}
-
-V8_HIDDEN_PROPERTIES(V8_DEFINE_PROPERTY);
-
-v8::Persistent<v8::String>* V8HiddenPropertyName::createString(const char* key)
-{
- v8::HandleScope scope;
- return new v8::Persistent<v8::String>(v8::Persistent<v8::String>::New(v8::String::NewSymbol(key)));
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/V8HiddenPropertyName.h b/WebCore/bindings/v8/V8HiddenPropertyName.h
deleted file mode 100644
index 7867b36..0000000
--- a/WebCore/bindings/v8/V8HiddenPropertyName.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8HiddenPropertyName_h
-#define V8HiddenPropertyName_h
-
-#include <v8.h>
-
-namespace WebCore {
-
-#define V8_HIDDEN_PROPERTIES(V) \
- V(objectPrototype) \
- V(listener) \
- V(attributeListener) \
- V(scriptState) \
- V(devtoolsInjectedScript) \
- V(sleepFunction) \
- V(toStringString) \
- V(event)
-
-
- class V8HiddenPropertyName {
- public:
-#define V8_DECLARE_PROPERTY(name) static v8::Handle<v8::String> name();
- V8_HIDDEN_PROPERTIES(V8_DECLARE_PROPERTY);
-#undef V8_DECLARE_PROPERTY
-
- private:
- static v8::Persistent<v8::String>* createString(const char* key);
- };
-
-}
-
-#endif // V8HiddenPropertyName_h
diff --git a/WebCore/bindings/v8/V8IsolatedContext.cpp b/WebCore/bindings/v8/V8IsolatedContext.cpp
deleted file mode 100644
index b5e4590..0000000
--- a/WebCore/bindings/v8/V8IsolatedContext.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#include "V8IsolatedContext.h"
-
-#include "Frame.h"
-#include "FrameLoaderClient.h"
-#include "HashMap.h"
-#include "ScriptController.h"
-#include "V8DOMWindow.h"
-#include "V8HiddenPropertyName.h"
-
-namespace WebCore {
-
-
-void V8IsolatedContext::contextWeakReferenceCallback(v8::Persistent<v8::Value> object, void* isolatedContext)
-{
- // Our context is going away. Time to clean up the world.
- V8IsolatedContext* context = static_cast<V8IsolatedContext*>(isolatedContext);
- delete context;
-}
-
-V8IsolatedContext::V8IsolatedContext(V8Proxy* proxy, int extensionGroup)
- : m_world(IsolatedWorld::create())
-{
- v8::HandleScope scope;
- // FIXME: We should be creating a new V8DOMWindowShell here instead of riping out the context.
- m_context = SharedPersistent<v8::Context>::create(proxy->windowShell()->createNewContext(v8::Handle<v8::Object>(), extensionGroup));
- if (m_context->get().IsEmpty())
- return;
-
- // Run code in the new context.
- v8::Context::Scope contextScope(m_context->get());
-
- getGlobalObject(m_context->get())->SetPointerInInternalField(V8DOMWindow::enteredIsolatedWorldIndex, this);
-
- V8DOMWindowShell::installHiddenObjectPrototype(m_context->get());
- // FIXME: This will go away once we have a windowShell for the isolated world.
- proxy->windowShell()->installDOMWindow(m_context->get(), proxy->frame()->domWindow());
-
- // Using the default security token means that the canAccess is always
- // called, which is slow.
- // FIXME: Use tokens where possible. This will mean keeping track of all
- // created contexts so that they can all be updated when the
- // document domain
- // changes.
- m_context->get()->UseDefaultSecurityToken();
-
- proxy->frame()->loader()->client()->didCreateIsolatedScriptContext();
-}
-
-void V8IsolatedContext::destroy()
-{
- m_context->get().MakeWeak(this, &contextWeakReferenceCallback);
-}
-
-V8IsolatedContext::~V8IsolatedContext()
-{
- m_context->disposeHandle();
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/V8IsolatedContext.h b/WebCore/bindings/v8/V8IsolatedContext.h
deleted file mode 100644
index 5cd9c65..0000000
--- a/WebCore/bindings/v8/V8IsolatedContext.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8IsolatedContext_h
-#define V8IsolatedContext_h
-
-#include "IsolatedWorld.h"
-#include "ScriptSourceCode.h" // for WebCore::ScriptSourceCode
-#include "V8DOMWindow.h"
-#include "V8Proxy.h"
-#include "V8Utilities.h"
-#include <v8.h>
-
-namespace WebCore {
-
-class V8Proxy;
-
-// V8IsolatedContext
-//
-// V8IsolatedContext represents a isolated execution environment for
-// JavaScript. Each isolated world executes in parallel with the main
-// JavaScript world. An isolated world has access to the same DOM data
-// structures as the main world but none of the JavaScript pointers.
-//
-// It is an error to ever share a JavaScript pointer between two isolated
-// worlds or between an isolated world and the main world. Because
-// isolated worlds have access to the DOM, they need their own DOM wrappers
-// to avoid having pointers to the main world's DOM wrappers (which are
-// JavaScript objects).
-class V8IsolatedContext {
-public:
- // Creates an isolated world. To destroy it, call destroy().
- // This will delete the isolated world when the context it owns is GC'd.
- V8IsolatedContext(V8Proxy* proxy, int extensionGroup);
- ~V8IsolatedContext();
-
- // Call this to destroy the isolated world. It will be deleted sometime
- // after this call, once all script references to the world's context
- // have been dropped.
- void destroy();
-
- // Returns the isolated world associated with
- // v8::Context::GetEntered(). Because worlds are isolated, the entire
- // JavaScript call stack should be from the same isolated world.
- // Returns 0 if the entered context is from the main world.
- //
- // FIXME: Consider edge cases with DOM mutation events that might
- // violate this invariant.
- //
- static V8IsolatedContext* getEntered()
- {
- // This is a temporary performance optimization. Essentially,
- // GetHiddenValue is too slow for this code path. We need to get the
- // V8 team to add a real property to v8::Context for isolated worlds.
- // Until then, we optimize the common case of not having any isolated
- // worlds at all.
- if (!IsolatedWorld::count())
- return 0;
- if (!v8::Context::InContext())
- return 0;
- return reinterpret_cast<V8IsolatedContext*>(getGlobalObject(v8::Context::GetEntered())->GetPointerFromInternalField(V8DOMWindow::enteredIsolatedWorldIndex));
- }
-
- v8::Handle<v8::Context> context() { return m_context->get(); }
- PassRefPtr<SharedPersistent<v8::Context> > sharedContext() { return m_context; }
-
- IsolatedWorld* world() const { return m_world.get(); }
-
-private:
- static v8::Handle<v8::Object> getGlobalObject(v8::Handle<v8::Context> context)
- {
- return v8::Handle<v8::Object>::Cast(context->Global()->GetPrototype());
- }
-
- // Called by the garbage collector when our JavaScript context is about
- // to be destroyed.
- static void contextWeakReferenceCallback(v8::Persistent<v8::Value> object, void* isolatedContext);
-
- // The underlying v8::Context. This object is keep on the heap as
- // long as |m_context| has not been garbage collected.
- RefPtr<SharedPersistent<v8::Context> > m_context;
-
- RefPtr<IsolatedWorld> m_world;
-};
-
-} // namespace WebCore
-
-#endif // V8IsolatedContext_h
diff --git a/WebCore/bindings/v8/V8LazyEventListener.cpp b/WebCore/bindings/v8/V8LazyEventListener.cpp
deleted file mode 100644
index 7f46333..0000000
--- a/WebCore/bindings/v8/V8LazyEventListener.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8LazyEventListener.h"
-
-#include "Frame.h"
-#include "V8Binding.h"
-#include "V8HiddenPropertyName.h"
-#include "V8Proxy.h"
-#include "WorldContextHandle.h"
-
-#include <wtf/StdLibExtras.h>
-
-namespace WebCore {
-
-V8LazyEventListener::V8LazyEventListener(const String& functionName, bool isSVGEvent, const String& code, const String sourceURL, const TextPosition0& position, const WorldContextHandle& worldContext)
- : V8AbstractEventListener(true, worldContext)
- , m_functionName(functionName)
- , m_isSVGEvent(isSVGEvent)
- , m_code(code)
- , m_sourceURL(sourceURL)
- , m_position(position)
-{
-}
-
-v8::Local<v8::Value> V8LazyEventListener::callListenerFunction(ScriptExecutionContext* context, v8::Handle<v8::Value> jsEvent, Event* event)
-{
- v8::Local<v8::Object> listenerObject = getListenerObject(context);
- if (listenerObject.IsEmpty())
- return v8::Local<v8::Value>();
-
- v8::Local<v8::Function> handlerFunction = v8::Local<v8::Function>::Cast(listenerObject);
- v8::Local<v8::Object> receiver = getReceiverObject(event);
- if (handlerFunction.IsEmpty() || receiver.IsEmpty())
- return v8::Local<v8::Value>();
-
- v8::Handle<v8::Value> parameters[1] = { jsEvent };
-
- if (V8Proxy* proxy = V8Proxy::retrieve(context))
- return proxy->callFunction(handlerFunction, receiver, 1, parameters);
-
- return v8::Local<v8::Value>();
-}
-
-static v8::Handle<v8::Value> V8LazyEventListenerToString(const v8::Arguments& args)
-{
- return args.Holder()->GetHiddenValue(V8HiddenPropertyName::toStringString());
-}
-
-void V8LazyEventListener::prepareListenerObject(ScriptExecutionContext* context)
-{
- if (hasExistingListenerObject())
- return;
-
- v8::HandleScope handleScope;
-
- V8Proxy* proxy = V8Proxy::retrieve(context);
- if (!proxy)
- return;
-
- // Use the outer scope to hold context.
- v8::Local<v8::Context> v8Context = worldContext().adjustedContext(proxy);
- // Bail out if we cannot get the context.
- if (v8Context.IsEmpty())
- return;
-
- v8::Context::Scope scope(v8Context);
-
- // FIXME: cache the wrapper function.
-
- // Nodes other than the document object, when executing inline event handlers push document, form, and the target node on the scope chain.
- // We do this by using 'with' statement.
- // See chrome/fast/forms/form-action.html
- // chrome/fast/forms/selected-index-value.html
- // base/fast/overflow/onscroll-layer-self-destruct.html
- //
- // Don't use new lines so that lines in the modified handler
- // have the same numbers as in the original code.
- String code = "(function (evt) {" \
- "with (this.ownerDocument ? this.ownerDocument : {}) {" \
- "with (this.form ? this.form : {}) {" \
- "with (this) {" \
- "return (function(evt){";
- code.append(m_code);
- // Insert '\n' otherwise //-style comments could break the handler.
- code.append( "\n}).call(this, evt);}}}})");
- v8::Handle<v8::String> codeExternalString = v8ExternalString(code);
- v8::Handle<v8::Script> script = V8Proxy::compileScript(codeExternalString, m_sourceURL, m_position);
- if (!script.IsEmpty()) {
- v8::Local<v8::Value> value = proxy->runScript(script, false);
- if (!value.IsEmpty()) {
- ASSERT(value->IsFunction());
-
- v8::Local<v8::Function> wrappedFunction = v8::Local<v8::Function>::Cast(value);
-
- // Change the toString function on the wrapper function to avoid it
- // returning the source for the actual wrapper function. Instead it
- // returns source for a clean wrapper function with the event
- // argument wrapping the event source code. The reason for this is
- // that some web sites use toString on event functions and eval the
- // source returned (sometimes a RegExp is applied as well) for some
- // other use. That fails miserably if the actual wrapper source is
- // returned.
- DEFINE_STATIC_LOCAL(v8::Persistent<v8::FunctionTemplate>, toStringTemplate, ());
- if (toStringTemplate.IsEmpty())
- toStringTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8LazyEventListenerToString));
- v8::Local<v8::Function> toStringFunction;
- if (!toStringTemplate.IsEmpty())
- toStringFunction = toStringTemplate->GetFunction();
- if (!toStringFunction.IsEmpty()) {
- String toStringResult = "function ";
- toStringResult.append(m_functionName);
- toStringResult.append("(");
- toStringResult.append(m_isSVGEvent ? "evt" : "event");
- toStringResult.append(") {\n ");
- toStringResult.append(m_code);
- toStringResult.append("\n}");
- wrappedFunction->SetHiddenValue(V8HiddenPropertyName::toStringString(), v8ExternalString(toStringResult));
- wrappedFunction->Set(v8::String::New("toString"), toStringFunction);
- }
-
- wrappedFunction->SetName(v8::String::New(fromWebCoreString(m_functionName), m_functionName.length()));
-
- setListenerObject(wrappedFunction);
- }
- }
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/V8LazyEventListener.h b/WebCore/bindings/v8/V8LazyEventListener.h
deleted file mode 100644
index 08467fe..0000000
--- a/WebCore/bindings/v8/V8LazyEventListener.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8LazyEventListener_h
-#define V8LazyEventListener_h
-
-#include "PlatformString.h"
-#include "V8AbstractEventListener.h"
-#include <v8.h>
-#include <wtf/text/TextPosition.h>
-#include <wtf/PassRefPtr.h>
-
-namespace WebCore {
-
- class Event;
- class Frame;
-
- // V8LazyEventListener is a wrapper for a JavaScript code string that is compiled and evaluated when an event is fired.
- // A V8LazyEventListener is always a HTML event handler.
- class V8LazyEventListener : public V8AbstractEventListener {
- public:
- static PassRefPtr<V8LazyEventListener> create(const String& functionName, bool isSVGEvent, const String& code, const String& sourceURL, const TextPosition0& position, const WorldContextHandle& worldContext)
- {
- return adoptRef(new V8LazyEventListener(functionName, isSVGEvent, code, sourceURL, position, worldContext));
- }
-
- virtual bool isLazy() const { return true; }
-
- protected:
- virtual void prepareListenerObject(ScriptExecutionContext*);
-
- private:
- V8LazyEventListener(const String& functionName, bool isSVGEvent, const String& code, const String sourceURL, const TextPosition0& position, const WorldContextHandle& worldContext);
-
- virtual v8::Local<v8::Value> callListenerFunction(ScriptExecutionContext*, v8::Handle<v8::Value> jsEvent, Event*);
-
- // Needs to return true for all event handlers implemented in JavaScript so that
- // the SVG code does not add the event handler in both
- // SVGUseElement::buildShadowTree and again in
- // SVGUseElement::transferEventListenersToShadowTree
- virtual bool wasCreatedFromMarkup() const { return true; }
-
- String m_functionName;
- bool m_isSVGEvent;
- String m_code;
- String m_sourceURL;
- TextPosition0 m_position;
- };
-
-} // namespace WebCore
-
-#endif // V8LazyEventListener_h
diff --git a/WebCore/bindings/v8/V8NPObject.cpp b/WebCore/bindings/v8/V8NPObject.cpp
deleted file mode 100644
index 0b1d25e..0000000
--- a/WebCore/bindings/v8/V8NPObject.cpp
+++ /dev/null
@@ -1,419 +0,0 @@
-/*
-* Copyright (C) 2006, 2007, 2008, 2009 Google 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:
-*
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * 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.
-* * Neither the name of Google Inc. nor the names of its
-* contributors may be used to endorse or promote products derived from
-* this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "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 THE COPYRIGHT
-* OWNER 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.
-*/
-
-#include "config.h"
-
-#include "V8NPObject.h"
-
-#include "HTMLPlugInElement.h"
-#include "NPV8Object.h"
-#include "V8DOMMap.h"
-#include "V8HTMLAppletElement.h"
-#include "V8HTMLEmbedElement.h"
-#include "V8HTMLObjectElement.h"
-#include "V8Helpers.h"
-#include "V8NPUtils.h"
-#include "V8Proxy.h"
-#include "npruntime_impl.h"
-#include "npruntime_priv.h"
-#include <wtf/OwnArrayPtr.h>
-
-namespace WebCore {
-
-enum InvokeFunctionType {
- InvokeMethod = 1,
- InvokeConstruct = 2,
- InvokeDefault = 3
-};
-
-struct IdentifierRep {
- int number() const { return m_isString ? 0 : m_value.m_number; }
- const char* string() const { return m_isString ? m_value.m_string : 0; }
-
- union {
- const char* m_string;
- int m_number;
- } m_value;
- bool m_isString;
-};
-
-// FIXME: need comments.
-// Params: holder could be HTMLEmbedElement or NPObject
-static v8::Handle<v8::Value> npObjectInvokeImpl(const v8::Arguments& args, InvokeFunctionType functionId)
-{
- NPObject* npObject;
-
- // These three types are subtypes of HTMLPlugInElement.
- if (V8HTMLAppletElement::HasInstance(args.Holder()) || V8HTMLEmbedElement::HasInstance(args.Holder())
- || V8HTMLObjectElement::HasInstance(args.Holder())) {
- // The holder object is a subtype of HTMLPlugInElement.
- HTMLPlugInElement* element;
- if (V8HTMLAppletElement::HasInstance(args.Holder()))
- element = V8HTMLAppletElement::toNative(args.Holder());
- else if (V8HTMLEmbedElement::HasInstance(args.Holder()))
- element = V8HTMLEmbedElement::toNative(args.Holder());
- else
- element = V8HTMLObjectElement::toNative(args.Holder());
- ScriptInstance scriptInstance = element->getInstance();
- if (scriptInstance)
- npObject = v8ObjectToNPObject(scriptInstance->instance());
- else
- npObject = 0;
- } else {
- // The holder object is not a subtype of HTMLPlugInElement, it must be an NPObject which has three
- // internal fields.
- if (args.Holder()->InternalFieldCount() != npObjectInternalFieldCount)
- return throwError("NPMethod called on non-NPObject", V8Proxy::ReferenceError);
-
- npObject = v8ObjectToNPObject(args.Holder());
- }
-
- // Verify that our wrapper wasn't using a NPObject which has already been deleted.
- if (!npObject || !_NPN_IsAlive(npObject))
- return throwError("NPObject deleted", V8Proxy::ReferenceError);
-
- // Wrap up parameters.
- int numArgs = args.Length();
- OwnArrayPtr<NPVariant> npArgs(new NPVariant[numArgs]);
-
- for (int i = 0; i < numArgs; i++)
- convertV8ObjectToNPVariant(args[i], npObject, &npArgs[i]);
-
- NPVariant result;
- VOID_TO_NPVARIANT(result);
-
- bool retval = true;
- switch (functionId) {
- case InvokeMethod:
- if (npObject->_class->invoke) {
- v8::Handle<v8::String> functionName(v8::String::Cast(*args.Data()));
- NPIdentifier identifier = getStringIdentifier(functionName);
- retval = npObject->_class->invoke(npObject, identifier, npArgs.get(), numArgs, &result);
- }
- break;
- case InvokeConstruct:
- if (npObject->_class->construct)
- retval = npObject->_class->construct(npObject, npArgs.get(), numArgs, &result);
- break;
- case InvokeDefault:
- if (npObject->_class->invokeDefault)
- retval = npObject->_class->invokeDefault(npObject, npArgs.get(), numArgs, &result);
- break;
- default:
- break;
- }
-
- if (!retval)
- throwError("Error calling method on NPObject.", V8Proxy::GeneralError);
-
- for (int i = 0; i < numArgs; i++)
- _NPN_ReleaseVariantValue(&npArgs[i]);
-
- // Unwrap return values.
- v8::Handle<v8::Value> returnValue = convertNPVariantToV8Object(&result, npObject);
- _NPN_ReleaseVariantValue(&result);
-
- return returnValue;
-}
-
-
-v8::Handle<v8::Value> npObjectMethodHandler(const v8::Arguments& args)
-{
- return npObjectInvokeImpl(args, InvokeMethod);
-}
-
-
-v8::Handle<v8::Value> npObjectInvokeDefaultHandler(const v8::Arguments& args)
-{
- if (args.IsConstructCall())
- return npObjectInvokeImpl(args, InvokeConstruct);
-
- return npObjectInvokeImpl(args, InvokeDefault);
-}
-
-
-static void weakTemplateCallback(v8::Persistent<v8::Value>, void* parameter);
-
-// NPIdentifier is PrivateIdentifier*.
-static WeakReferenceMap<PrivateIdentifier, v8::FunctionTemplate> staticTemplateMap(&weakTemplateCallback);
-
-static void weakTemplateCallback(v8::Persistent<v8::Value> object, void* parameter)
-{
- PrivateIdentifier* identifier = static_cast<PrivateIdentifier*>(parameter);
- ASSERT(identifier);
- ASSERT(staticTemplateMap.contains(identifier));
-
- staticTemplateMap.forget(identifier);
-}
-
-
-static v8::Handle<v8::Value> npObjectGetProperty(v8::Local<v8::Object> self, NPIdentifier identifier, v8::Local<v8::Value> key)
-{
- NPObject* npObject = v8ObjectToNPObject(self);
-
- // Verify that our wrapper wasn't using a NPObject which
- // has already been deleted.
- if (!npObject || !_NPN_IsAlive(npObject))
- return throwError("NPObject deleted", V8Proxy::ReferenceError);
-
-
- if (npObject->_class->hasProperty && npObject->_class->hasProperty(npObject, identifier)
- && npObject->_class->getProperty) {
-
- NPVariant result;
- VOID_TO_NPVARIANT(result);
- if (!npObject->_class->getProperty(npObject, identifier, &result))
- return v8::Handle<v8::Value>();
-
- v8::Handle<v8::Value> returnValue = convertNPVariantToV8Object(&result, npObject);
- _NPN_ReleaseVariantValue(&result);
- return returnValue;
-
- }
-
- if (key->IsString() && npObject->_class->hasMethod && npObject->_class->hasMethod(npObject, identifier)) {
- PrivateIdentifier* id = static_cast<PrivateIdentifier*>(identifier);
- v8::Persistent<v8::FunctionTemplate> functionTemplate = staticTemplateMap.get(id);
- // Cache templates using identifier as the key.
- if (functionTemplate.IsEmpty()) {
- // Create a new template.
- v8::Local<v8::FunctionTemplate> temp = v8::FunctionTemplate::New();
- temp->SetCallHandler(npObjectMethodHandler, key);
- functionTemplate = v8::Persistent<v8::FunctionTemplate>::New(temp);
- staticTemplateMap.set(id, functionTemplate);
- }
-
- // FunctionTemplate caches function for each context.
- v8::Local<v8::Function> v8Function = functionTemplate->GetFunction();
- v8Function->SetName(v8::Handle<v8::String>::Cast(key));
- return v8Function;
- }
-
- return v8::Handle<v8::Value>();
-}
-
-v8::Handle<v8::Value> npObjectNamedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- NPIdentifier identifier = getStringIdentifier(name);
- return npObjectGetProperty(info.Holder(), identifier, name);
-}
-
-v8::Handle<v8::Value> npObjectIndexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
-{
- NPIdentifier identifier = _NPN_GetIntIdentifier(index);
- return npObjectGetProperty(info.Holder(), identifier, v8::Number::New(index));
-}
-
-v8::Handle<v8::Value> npObjectGetNamedProperty(v8::Local<v8::Object> self, v8::Local<v8::String> name)
-{
- NPIdentifier identifier = getStringIdentifier(name);
- return npObjectGetProperty(self, identifier, name);
-}
-
-v8::Handle<v8::Value> npObjectGetIndexedProperty(v8::Local<v8::Object> self, uint32_t index)
-{
- NPIdentifier identifier = _NPN_GetIntIdentifier(index);
- return npObjectGetProperty(self, identifier, v8::Number::New(index));
-}
-
-v8::Handle<v8::Integer> npObjectQueryProperty(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- NPIdentifier identifier = getStringIdentifier(name);
- return npObjectGetProperty(info.Holder(), identifier, name).IsEmpty() ? v8::Handle<v8::Integer>() : v8::Integer::New(v8::None);
-}
-
-static v8::Handle<v8::Value> npObjectSetProperty(v8::Local<v8::Object> self, NPIdentifier identifier, v8::Local<v8::Value> value)
-{
- NPObject* npObject = v8ObjectToNPObject(self);
-
- // Verify that our wrapper wasn't using a NPObject which has already been deleted.
- if (!npObject || !_NPN_IsAlive(npObject)) {
- throwError("NPObject deleted", V8Proxy::ReferenceError);
- return value; // Intercepted, but an exception was thrown.
- }
-
- if (npObject->_class->hasProperty && npObject->_class->hasProperty(npObject, identifier)
- && npObject->_class->setProperty) {
-
- NPVariant npValue;
- VOID_TO_NPVARIANT(npValue);
- convertV8ObjectToNPVariant(value, npObject, &npValue);
- bool success = npObject->_class->setProperty(npObject, identifier, &npValue);
- _NPN_ReleaseVariantValue(&npValue);
- if (success)
- return value; // Intercept the call.
- }
- return notHandledByInterceptor();
-}
-
-
-v8::Handle<v8::Value> npObjectNamedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- NPIdentifier identifier = getStringIdentifier(name);
- return npObjectSetProperty(info.Holder(), identifier, value);
-}
-
-
-v8::Handle<v8::Value> npObjectIndexedPropertySetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- NPIdentifier identifier = _NPN_GetIntIdentifier(index);
- return npObjectSetProperty(info.Holder(), identifier, value);
-}
-
-v8::Handle<v8::Value> npObjectSetNamedProperty(v8::Local<v8::Object> self, v8::Local<v8::String> name, v8::Local<v8::Value> value)
-{
- NPIdentifier identifier = getStringIdentifier(name);
- return npObjectSetProperty(self, identifier, value);
-}
-
-v8::Handle<v8::Value> npObjectSetIndexedProperty(v8::Local<v8::Object> self, uint32_t index, v8::Local<v8::Value> value)
-{
- NPIdentifier identifier = _NPN_GetIntIdentifier(index);
- return npObjectSetProperty(self, identifier, value);
-}
-
-v8::Handle<v8::Array> npObjectPropertyEnumerator(const v8::AccessorInfo& info, bool namedProperty)
-{
- NPObject* npObject = v8ObjectToNPObject(info.Holder());
-
- // Verify that our wrapper wasn't using a NPObject which
- // has already been deleted.
- if (!npObject || !_NPN_IsAlive(npObject))
- throwError("NPObject deleted", V8Proxy::ReferenceError);
-
- if (NP_CLASS_STRUCT_VERSION_HAS_ENUM(npObject->_class) && npObject->_class->enumerate) {
- uint32_t count;
- NPIdentifier* identifiers;
- if (npObject->_class->enumerate(npObject, &identifiers, &count)) {
- v8::Handle<v8::Array> properties = v8::Array::New(count);
- for (uint32_t i = 0; i < count; ++i) {
- IdentifierRep* identifier = static_cast<IdentifierRep*>(identifiers[i]);
- if (namedProperty)
- properties->Set(v8::Integer::New(i), v8::String::New(identifier->string()));
- else
- properties->Set(v8::Integer::New(i), v8::Integer::New(identifier->number()));
- }
-
- return properties;
- }
- }
-
- return v8::Handle<v8::Array>();
-}
-
-v8::Handle<v8::Array> npObjectNamedPropertyEnumerator(const v8::AccessorInfo& info)
-{
- return npObjectPropertyEnumerator(info, true);
-}
-
-v8::Handle<v8::Array> npObjectIndexedPropertyEnumerator(const v8::AccessorInfo& info)
-{
- return npObjectPropertyEnumerator(info, false);
-}
-
-static void weakNPObjectCallback(v8::Persistent<v8::Value>, void* parameter);
-
-static DOMWrapperMap<NPObject> staticNPObjectMap(&weakNPObjectCallback);
-
-static void weakNPObjectCallback(v8::Persistent<v8::Value> object, void* parameter)
-{
- NPObject* npObject = static_cast<NPObject*>(parameter);
- ASSERT(staticNPObjectMap.contains(npObject));
- ASSERT(npObject);
-
- // Must remove from our map before calling _NPN_ReleaseObject(). _NPN_ReleaseObject can call ForgetV8ObjectForNPObject, which
- // uses the table as well.
- staticNPObjectMap.forget(npObject);
-
- if (_NPN_IsAlive(npObject))
- _NPN_ReleaseObject(npObject);
-}
-
-
-v8::Local<v8::Object> createV8ObjectForNPObject(NPObject* object, NPObject* root)
-{
- static v8::Persistent<v8::FunctionTemplate> npObjectDesc;
-
- ASSERT(v8::Context::InContext());
-
- // If this is a v8 object, just return it.
- if (object->_class == npScriptObjectClass) {
- V8NPObject* v8NPObject = reinterpret_cast<V8NPObject*>(object);
- return v8::Local<v8::Object>::New(v8NPObject->v8Object);
- }
-
- // If we've already wrapped this object, just return it.
- if (staticNPObjectMap.contains(object))
- return v8::Local<v8::Object>::New(staticNPObjectMap.get(object));
-
- // FIXME: we should create a Wrapper type as a subclass of JSObject. It has two internal fields, field 0 is the wrapped
- // pointer, and field 1 is the type. There should be an api function that returns unused type id. The same Wrapper type
- // can be used by DOM bindings.
- if (npObjectDesc.IsEmpty()) {
- npObjectDesc = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New());
- npObjectDesc->InstanceTemplate()->SetInternalFieldCount(npObjectInternalFieldCount);
- npObjectDesc->InstanceTemplate()->SetNamedPropertyHandler(npObjectNamedPropertyGetter, npObjectNamedPropertySetter, npObjectQueryProperty, 0, npObjectNamedPropertyEnumerator);
- npObjectDesc->InstanceTemplate()->SetIndexedPropertyHandler(npObjectIndexedPropertyGetter, npObjectIndexedPropertySetter, 0, 0, npObjectIndexedPropertyEnumerator);
- npObjectDesc->InstanceTemplate()->SetCallAsFunctionHandler(npObjectInvokeDefaultHandler);
- }
-
- v8::Handle<v8::Function> v8Function = npObjectDesc->GetFunction();
- v8::Local<v8::Object> value = SafeAllocation::newInstance(v8Function);
-
- // If we were unable to allocate the instance, we avoid wrapping and registering the NP object.
- if (value.IsEmpty())
- return value;
-
- V8DOMWrapper::setDOMWrapper(value, npObjectTypeInfo(), object);
-
- // KJS retains the object as part of its wrapper (see Bindings::CInstance).
- _NPN_RetainObject(object);
-
- _NPN_RegisterObject(object, root);
-
- // Maintain a weak pointer for v8 so we can cleanup the object.
- v8::Persistent<v8::Object> weakRef = v8::Persistent<v8::Object>::New(value);
- staticNPObjectMap.set(object, weakRef);
-
- return value;
-}
-
-void forgetV8ObjectForNPObject(NPObject* object)
-{
- if (staticNPObjectMap.contains(object)) {
- v8::HandleScope scope;
- v8::Persistent<v8::Object> handle(staticNPObjectMap.get(object));
- V8DOMWrapper::setDOMWrapper(handle, npObjectTypeInfo(), 0);
- staticNPObjectMap.forget(object);
- _NPN_ReleaseObject(object);
- }
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/V8NPObject.h b/WebCore/bindings/v8/V8NPObject.h
deleted file mode 100644
index 832d649..0000000
--- a/WebCore/bindings/v8/V8NPObject.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8NPObject_h
-#define V8NPObject_h
-
-#if PLATFORM(CHROMIUM)
-#include <bindings/npruntime.h>
-#else
-#include "npruntime_internal.h"
-#endif
-
-#include <v8.h>
-
-namespace WebCore {
-
-// These functions can be replaced by normal JS operation.
-// Getters
-v8::Handle<v8::Value> npObjectNamedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo&);
-v8::Handle<v8::Value> npObjectIndexedPropertyGetter(uint32_t index, const v8::AccessorInfo&);
-v8::Handle<v8::Value> npObjectGetNamedProperty(v8::Local<v8::Object> self, v8::Local<v8::String> name);
-v8::Handle<v8::Value> npObjectGetIndexedProperty(v8::Local<v8::Object> self, uint32_t index);
-
-// Setters
-v8::Handle<v8::Value> npObjectNamedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value>, const v8::AccessorInfo&);
-v8::Handle<v8::Value> npObjectIndexedPropertySetter(uint32_t index, const v8::AccessorInfo&);
-v8::Handle<v8::Value> npObjectSetNamedProperty(v8::Local<v8::Object> self, v8::Local<v8::String> name, v8::Local<v8::Value>);
-v8::Handle<v8::Value> npObjectSetIndexedProperty(v8::Local<v8::Object> self, uint32_t index, v8::Local<v8::Value>);
-
-v8::Handle<v8::Value> npObjectInvokeDefaultHandler(const v8::Arguments&);
-
-// Get a wrapper for a NPObject.
-// If the object is already wrapped, the pre-existing wrapper will be returned. If the object is not wrapped, wrap it, and
-// give V8 a weak reference to the wrapper which will cleanup when there are no more JS references to the object.
-v8::Local<v8::Object> createV8ObjectForNPObject(NPObject*, NPObject* root);
-
-// Tell V8 to forcibly remove an object.
-// This is used at plugin teardown so that the caller can aggressively unload the plugin library. After calling this
-// function, the persistent handle to the wrapper will be gone, and the wrapped NPObject will be removed so that it
-// cannot be referred to.
-void forgetV8ObjectForNPObject(NPObject*);
-
-} // namespace WebCore
-
-#endif // V8NPObject_h
diff --git a/WebCore/bindings/v8/V8NPUtils.cpp b/WebCore/bindings/v8/V8NPUtils.cpp
deleted file mode 100644
index 250ee5b..0000000
--- a/WebCore/bindings/v8/V8NPUtils.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (C) 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8NPUtils.h"
-
-#include "DOMWindow.h"
-#include "Frame.h"
-#include "PlatformString.h"
-#include "npruntime_impl.h"
-#include "npruntime_priv.h"
-#include "NPV8Object.h"
-#include "V8NPObject.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-void convertV8ObjectToNPVariant(v8::Local<v8::Value> object, NPObject* owner, NPVariant* result)
-{
- VOID_TO_NPVARIANT(*result);
-
- // It is really the caller's responsibility to deal with the empty handle case because there could be different actions to
- // take in different contexts.
- ASSERT(!object.IsEmpty());
-
- if (object.IsEmpty())
- return;
-
- if (object->IsNumber())
- DOUBLE_TO_NPVARIANT(object->NumberValue(), *result);
- else if (object->IsBoolean())
- BOOLEAN_TO_NPVARIANT(object->BooleanValue(), *result);
- else if (object->IsNull())
- NULL_TO_NPVARIANT(*result);
- else if (object->IsUndefined())
- VOID_TO_NPVARIANT(*result);
- else if (object->IsString()) {
- v8::String::Utf8Value utf8(object);
- int length = utf8.length() + 1;
- char* utf8Chars = reinterpret_cast<char*>(malloc(length));
- memcpy(utf8Chars, *utf8, length);
- STRINGN_TO_NPVARIANT(utf8Chars, utf8.length(), *result);
- } else if (object->IsObject()) {
- DOMWindow* window = V8Proxy::retrieveWindow(V8Proxy::currentContext());
- NPObject* npobject = npCreateV8ScriptObject(0, v8::Handle<v8::Object>::Cast(object), window);
- if (npobject)
- _NPN_RegisterObject(npobject, owner);
- OBJECT_TO_NPVARIANT(npobject, *result);
- }
-}
-
-v8::Handle<v8::Value> convertNPVariantToV8Object(const NPVariant* variant, NPObject* npobject)
-{
- NPVariantType type = variant->type;
-
- switch (type) {
- case NPVariantType_Int32:
- return v8::Integer::New(NPVARIANT_TO_INT32(*variant));
- case NPVariantType_Double:
- return v8::Number::New(NPVARIANT_TO_DOUBLE(*variant));
- case NPVariantType_Bool:
- return NPVARIANT_TO_BOOLEAN(*variant) ? v8::True() : v8::False();
- case NPVariantType_Null:
- return v8::Null();
- case NPVariantType_Void:
- return v8::Undefined();
- case NPVariantType_String: {
- NPString src = NPVARIANT_TO_STRING(*variant);
- return v8::String::New(src.UTF8Characters, src.UTF8Length);
- }
- case NPVariantType_Object: {
- NPObject* obj = NPVARIANT_TO_OBJECT(*variant);
- if (obj->_class == npScriptObjectClass)
- return reinterpret_cast<V8NPObject*>(obj)->v8Object;
- return createV8ObjectForNPObject(obj, npobject);
- }
- default:
- return v8::Undefined();
- }
-}
-
-// Helper function to create an NPN String Identifier from a v8 string.
-NPIdentifier getStringIdentifier(v8::Handle<v8::String> str)
-{
- const int kStackBufferSize = 100;
-
- int bufferLength = str->Utf8Length() + 1;
- if (bufferLength <= kStackBufferSize) {
- // Use local stack buffer to avoid heap allocations for small strings. Here we should only use the stack space for
- // stackBuffer when it's used, not when we use the heap.
- //
- // WriteUtf8 is guaranteed to generate a null-terminated string because bufferLength is constructed to be one greater
- // than the string length.
- char stackBuffer[kStackBufferSize];
- str->WriteUtf8(stackBuffer, bufferLength);
- return _NPN_GetStringIdentifier(stackBuffer);
- }
-
- v8::String::Utf8Value utf8(str);
- return _NPN_GetStringIdentifier(*utf8);
-}
-
-struct ExceptionHandlerInfo {
- ExceptionHandlerInfo* previous;
- ExceptionHandler handler;
- void* data;
-};
-
-static ExceptionHandlerInfo* topHandler;
-
-void pushExceptionHandler(ExceptionHandler handler, void* data)
-{
- ExceptionHandlerInfo* info = new ExceptionHandlerInfo;
- info->previous = topHandler;
- info->handler = handler;
- info->data = data;
- topHandler = info;
-}
-
-void popExceptionHandler()
-{
- ASSERT(topHandler);
- ExceptionHandlerInfo* doomed = topHandler;
- topHandler = topHandler->previous;
- delete doomed;
-}
-
-ExceptionCatcher::ExceptionCatcher()
-{
- if (!topHandler)
- m_tryCatch.SetVerbose(true);
-}
-
-ExceptionCatcher::~ExceptionCatcher()
-{
- if (!m_tryCatch.HasCaught())
- return;
-
- if (topHandler)
- topHandler->handler(topHandler->data, *v8::String::Utf8Value(m_tryCatch.Exception()));
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/V8NPUtils.h b/WebCore/bindings/v8/V8NPUtils.h
deleted file mode 100644
index dc6185b..0000000
--- a/WebCore/bindings/v8/V8NPUtils.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Copyright (C) 2006, 2007, 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8NPUtils_h
-#define V8NPUtils_h
-
-#if PLATFORM(CHROMIUM)
-#include <bindings/npruntime.h>
-#else
-#include "npruntime_internal.h"
-#endif
-
-#include <v8.h>
-
-namespace WebCore {
-
-// Convert a V8 Value of any type (string, bool, object, etc) to a NPVariant.
-void convertV8ObjectToNPVariant(v8::Local<v8::Value>, NPObject*, NPVariant*);
-
-// Convert a NPVariant (string, bool, object, etc) back to a V8 Value. The owner object is the NPObject which relates to the
-// object, if the object is an Object. The created NPObject will be tied to the lifetime of the owner.
-v8::Handle<v8::Value> convertNPVariantToV8Object(const NPVariant*, NPObject*);
-
-// Helper function to create an NPN String Identifier from a v8 string.
-NPIdentifier getStringIdentifier(v8::Handle<v8::String>);
-
-// The ExceptionHandler will be notified of any exceptions thrown while
-// operating on a NPObject.
-typedef void (*ExceptionHandler)(void* data, const NPUTF8* message);
-void pushExceptionHandler(ExceptionHandler, void* data);
-void popExceptionHandler();
-
-// Upon destruction, an ExceptionCatcher will pass a caught exception to the
-// current ExceptionHandler.
-class ExceptionCatcher {
-public:
- ExceptionCatcher();
- ~ExceptionCatcher();
-private:
- v8::TryCatch m_tryCatch;
-};
-
-} // namespace WebCore
-
-#endif // V8NPUtils_h
diff --git a/WebCore/bindings/v8/V8NodeFilterCondition.cpp b/WebCore/bindings/v8/V8NodeFilterCondition.cpp
deleted file mode 100644
index 4e0240d..0000000
--- a/WebCore/bindings/v8/V8NodeFilterCondition.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8NodeFilterCondition.h"
-
-#include "Node.h"
-#include "NodeFilter.h"
-#include "ScriptState.h"
-#include "V8Node.h"
-#include "V8Proxy.h"
-
-#include <wtf/OwnArrayPtr.h>
-
-namespace WebCore {
-
-V8NodeFilterCondition::V8NodeFilterCondition(v8::Handle<v8::Value> filter)
- : m_filter(v8::Persistent<v8::Value>::New(filter))
-{
-#ifndef NDEBUG
- V8GCController::registerGlobalHandle(NODE_FILTER, this, m_filter);
-#endif
-}
-
-V8NodeFilterCondition::~V8NodeFilterCondition()
-{
-#ifndef NDEBUG
- V8GCController::unregisterGlobalHandle(this, m_filter);
-#endif
- m_filter.Dispose();
- m_filter.Clear();
-}
-
-short V8NodeFilterCondition::acceptNode(ScriptState* state, Node* node) const
-{
- ASSERT(v8::Context::InContext());
-
- if (!m_filter->IsObject())
- return NodeFilter::FILTER_ACCEPT;
-
- v8::TryCatch exceptionCatcher;
-
- v8::Handle<v8::Function> callback;
- if (m_filter->IsFunction())
- callback = v8::Handle<v8::Function>::Cast(m_filter);
- else {
- v8::Local<v8::Value> value = m_filter->ToObject()->Get(v8::String::New("acceptNode"));
- if (!value->IsFunction()) {
- V8Proxy::throwError(V8Proxy::TypeError, "NodeFilter object does not have an acceptNode function");
- return NodeFilter::FILTER_REJECT;
- }
- callback = v8::Handle<v8::Function>::Cast(value);
- }
-
- v8::Handle<v8::Object> object = v8::Context::GetCurrent()->Global();
- OwnArrayPtr<v8::Handle<v8::Value> > args(new v8::Handle<v8::Value>[1]);
- args[0] = toV8(node);
-
- v8::Handle<v8::Value> result = V8Proxy::callFunctionWithoutFrame(callback, object, 1, args.get());
-
- if (exceptionCatcher.HasCaught()) {
- state->setException(exceptionCatcher.Exception());
- return NodeFilter::FILTER_REJECT;
- }
-
- ASSERT(!result.IsEmpty());
-
- return result->Int32Value();
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/V8NodeFilterCondition.h b/WebCore/bindings/v8/V8NodeFilterCondition.h
deleted file mode 100644
index b864e5e..0000000
--- a/WebCore/bindings/v8/V8NodeFilterCondition.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8NodeFilterCondition_h
-#define V8NodeFilterCondition_h
-
-#include "NodeFilterCondition.h"
-#include <v8.h>
-#include <wtf/PassRefPtr.h>
-
-// NodeFilter is a JavaScript function that takes a Node as parameter and returns a short (ACCEPT, SKIP, REJECT) as the result.
-namespace WebCore {
-
- class Node;
- class ScriptState;
-
- // NodeFilterCondition is a wrapper around a NodeFilter JS function.
- class V8NodeFilterCondition : public NodeFilterCondition {
- public:
- static PassRefPtr<V8NodeFilterCondition> create(v8::Handle<v8::Value> filter)
- {
- return adoptRef(new V8NodeFilterCondition(filter));
- }
-
- virtual ~V8NodeFilterCondition();
-
- virtual short acceptNode(ScriptState*, Node*) const;
-
- private:
- explicit V8NodeFilterCondition(v8::Handle<v8::Value> filter);
-
- mutable v8::Persistent<v8::Value> m_filter;
- };
-
-} // namespace WebCore
-
-#endif // V8NodeFilterCondition_h
diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp
deleted file mode 100644
index 5eaba00..0000000
--- a/WebCore/bindings/v8/V8Proxy.cpp
+++ /dev/null
@@ -1,884 +0,0 @@
-/*
- * Copyright (C) 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8Proxy.h"
-
-#include "CSSMutableStyleDeclaration.h"
-#include "CachedMetadata.h"
-#include "DateExtension.h"
-#include "DocumentLoader.h"
-#include "Frame.h"
-#include "FrameLoaderClient.h"
-#include "IDBDatabaseException.h"
-#include "IDBFactoryBackendInterface.h"
-#include "IDBPendingTransactionMonitor.h"
-#include "InspectorInstrumentation.h"
-#include "Page.h"
-#include "PageGroup.h"
-#include "PlatformBridge.h"
-#include "ScriptController.h"
-#include "Settings.h"
-#include "StorageNamespace.h"
-#include "V8Binding.h"
-#include "V8BindingState.h"
-#include "V8Collection.h"
-#include "V8ConsoleMessage.h"
-#include "V8DOMCoreException.h"
-#include "V8DOMMap.h"
-#include "V8DOMWindow.h"
-#include "V8EventException.h"
-#include "V8FileException.h"
-#include "V8HiddenPropertyName.h"
-#include "V8IsolatedContext.h"
-#include "V8RangeException.h"
-#include "V8SQLException.h"
-#include "V8XMLHttpRequestException.h"
-#include "V8XPathException.h"
-#include "WorkerContext.h"
-#include "WorkerContextExecutionProxy.h"
-
-#if ENABLE(INDEXED_DATABASE)
-#include "V8IDBDatabaseException.h"
-#endif
-
-#if ENABLE(SVG)
-#include "V8SVGException.h"
-#endif
-
-#include <algorithm>
-#include <stdio.h>
-#include <utility>
-#include <wtf/Assertions.h>
-#include <wtf/OwnArrayPtr.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/StdLibExtras.h>
-#include <wtf/StringExtras.h>
-#include <wtf/UnusedParam.h>
-#include <wtf/text/StringConcatenate.h>
-
-#ifdef ANDROID_INSTRUMENT
-#include "TimeCounter.h"
-#endif
-
-#if PLATFORM(ANDROID)
-#include <wtf/text/CString.h>
-#endif
-
-namespace WebCore {
-
-// Static list of registered extensions
-V8Extensions V8Proxy::m_extensions;
-
-void batchConfigureAttributes(v8::Handle<v8::ObjectTemplate> instance,
- v8::Handle<v8::ObjectTemplate> proto,
- const BatchedAttribute* attributes,
- size_t attributeCount)
-{
- for (size_t i = 0; i < attributeCount; ++i)
- configureAttribute(instance, proto, attributes[i]);
-}
-
-void batchConfigureCallbacks(v8::Handle<v8::ObjectTemplate> proto,
- v8::Handle<v8::Signature> signature,
- v8::PropertyAttribute attributes,
- const BatchedCallback* callbacks,
- size_t callbackCount)
-{
- for (size_t i = 0; i < callbackCount; ++i) {
- proto->Set(v8::String::New(callbacks[i].name),
- v8::FunctionTemplate::New(callbacks[i].callback,
- v8::Handle<v8::Value>(),
- signature),
- attributes);
- }
-}
-
-void batchConfigureConstants(v8::Handle<v8::FunctionTemplate> functionDescriptor,
- v8::Handle<v8::ObjectTemplate> proto,
- const BatchedConstant* constants,
- size_t constantCount)
-{
- for (size_t i = 0; i < constantCount; ++i) {
- const BatchedConstant* constant = &constants[i];
- functionDescriptor->Set(v8::String::New(constant->name), v8::Integer::New(constant->value), v8::ReadOnly);
- proto->Set(v8::String::New(constant->name), v8::Integer::New(constant->value), v8::ReadOnly);
- }
-}
-
-typedef HashMap<Node*, v8::Object*> DOMNodeMap;
-typedef HashMap<void*, v8::Object*> DOMObjectMap;
-typedef HashMap<int, v8::FunctionTemplate*> FunctionTemplateMap;
-
-bool AllowAllocation::m_current = false;
-
-void logInfo(Frame* frame, const String& message, const String& url)
-{
- Page* page = frame->page();
- if (!page)
- return;
- V8ConsoleMessage consoleMessage(message, url, 0);
- consoleMessage.dispatchNow(page);
-}
-
-enum DelayReporting {
- ReportLater,
- ReportNow
-};
-
-void V8Proxy::reportUnsafeAccessTo(Frame* target, DelayReporting delay)
-{
- ASSERT(target);
- Document* targetDocument = target->document();
- if (!targetDocument)
- return;
-
- Frame* source = V8Proxy::retrieveFrameForEnteredContext();
- if (!source || !source->document())
- return; // Ignore error if the source document is gone.
-
- Document* sourceDocument = source->document();
-
- // FIXME: This error message should contain more specifics of why the same
- // origin check has failed.
- String str = makeString("Unsafe JavaScript attempt to access frame with URL ", targetDocument->url().string(),
- " from frame with URL ", sourceDocument->url().string(), ". Domains, protocols and ports must match.\n");
-
- // Build a console message with fake source ID and line number.
- const String kSourceID = "";
- const int kLineNumber = 1;
- V8ConsoleMessage message(str, kSourceID, kLineNumber);
-
- if (delay == ReportNow) {
- // NOTE: Safari prints the message in the target page, but it seems like
- // it should be in the source page. Even for delayed messages, we put it in
- // the source page; see V8ConsoleMessage::processDelayed().
- message.dispatchNow(source->page());
- } else {
- ASSERT(delay == ReportLater);
- // We cannot safely report the message eagerly, because this may cause
- // allocations and GCs internally in V8 and we cannot handle that at this
- // point. Therefore we delay the reporting.
- message.dispatchLater();
- }
-}
-
-static void handleFatalErrorInV8()
-{
- // FIXME: We temporarily deal with V8 internal error situations
- // such as out-of-memory by crashing the renderer.
- CRASH();
-}
-
-V8Proxy::V8Proxy(Frame* frame)
- : m_frame(frame)
- , m_windowShell(V8DOMWindowShell::create(frame))
- , m_inlineCode(false)
- , m_timerCallback(false)
- , m_recursion(0)
-{
-}
-
-V8Proxy::~V8Proxy()
-{
- clearForClose();
- windowShell()->destroyGlobal();
-}
-
-v8::Handle<v8::Script> V8Proxy::compileScript(v8::Handle<v8::String> code, const String& fileName, const TextPosition0& scriptStartPosition, v8::ScriptData* scriptData)
-#ifdef ANDROID_INSTRUMENT
-{
- android::TimeCounter::start(android::TimeCounter::JavaScriptParseTimeCounter);
- v8::Handle<v8::Script> script = compileScriptInternal(code, fileName, scriptStartPosition, scriptData);
- android::TimeCounter::record(android::TimeCounter::JavaScriptParseTimeCounter, __FUNCTION__);
- return script;
-}
-
-v8::Handle<v8::Script> V8Proxy::compileScriptInternal(v8::Handle<v8::String> code, const String& fileName, const TextPosition0& scriptStartPosition, v8::ScriptData* scriptData)
-#endif
-{
- const uint16_t* fileNameString = fromWebCoreString(fileName);
- v8::Handle<v8::String> name = v8::String::New(fileNameString, fileName.length());
- v8::Handle<v8::Integer> line = v8::Integer::New(scriptStartPosition.m_line.zeroBasedInt());
- v8::Handle<v8::Integer> column = v8::Integer::New(scriptStartPosition.m_column.zeroBasedInt());
- v8::ScriptOrigin origin(name, line, column);
- v8::Handle<v8::Script> script = v8::Script::Compile(code, &origin, scriptData);
- return script;
-}
-
-bool V8Proxy::handleOutOfMemory()
-{
- v8::Local<v8::Context> context = v8::Context::GetCurrent();
-
- if (!context->HasOutOfMemoryException())
- return false;
-
- // Warning, error, disable JS for this frame?
- Frame* frame = V8Proxy::retrieveFrame(context);
-
- V8Proxy* proxy = V8Proxy::retrieve(frame);
- if (proxy) {
- // Clean m_context, and event handlers.
- proxy->clearForClose();
-
- proxy->windowShell()->destroyGlobal();
- }
-
-#if PLATFORM(CHROMIUM)
- PlatformBridge::notifyJSOutOfMemory(frame);
-#endif
-
- // Disable JS.
- Settings* settings = frame->settings();
- ASSERT(settings);
- settings->setJavaScriptEnabled(false);
-
- return true;
-}
-
-void V8Proxy::evaluateInIsolatedWorld(int worldID, const Vector<ScriptSourceCode>& sources, int extensionGroup)
-{
- // FIXME: This will need to get reorganized once we have a windowShell for the isolated world.
- windowShell()->initContextIfNeeded();
-
- v8::HandleScope handleScope;
- V8IsolatedContext* isolatedContext = 0;
-
- if (worldID > 0) {
- IsolatedWorldMap::iterator iter = m_isolatedWorlds.find(worldID);
- if (iter != m_isolatedWorlds.end()) {
- isolatedContext = iter->second;
- } else {
- isolatedContext = new V8IsolatedContext(this, extensionGroup);
- if (isolatedContext->context().IsEmpty()) {
- delete isolatedContext;
- return;
- }
-
- // FIXME: We should change this to using window shells to match JSC.
- m_isolatedWorlds.set(worldID, isolatedContext);
-
- // Setup context id for JS debugger.
- if (!setInjectedScriptContextDebugId(isolatedContext->context())) {
- m_isolatedWorlds.take(worldID);
- delete isolatedContext;
- return;
- }
- }
- } else {
- isolatedContext = new V8IsolatedContext(this, extensionGroup);
- if (isolatedContext->context().IsEmpty()) {
- delete isolatedContext;
- return;
- }
- }
-
- v8::Local<v8::Context> context = v8::Local<v8::Context>::New(isolatedContext->context());
- v8::Context::Scope context_scope(context);
- for (size_t i = 0; i < sources.size(); ++i)
- evaluate(sources[i], 0);
-
- if (worldID == 0)
- isolatedContext->destroy();
-}
-
-bool V8Proxy::setInjectedScriptContextDebugId(v8::Handle<v8::Context> targetContext)
-{
- // Setup context id for JS debugger.
- v8::Context::Scope contextScope(targetContext);
- v8::Handle<v8::Context> context = windowShell()->context();
- if (context.IsEmpty())
- return false;
- int debugId = contextDebugId(context);
-
- char buffer[32];
- if (debugId == -1)
- snprintf(buffer, sizeof(buffer), "injected");
- else
- snprintf(buffer, sizeof(buffer), "injected,%d", debugId);
- targetContext->SetData(v8::String::New(buffer));
-
- return true;
-}
-
-PassOwnPtr<v8::ScriptData> V8Proxy::precompileScript(v8::Handle<v8::String> code, CachedScript* cachedScript)
-{
- // A pseudo-randomly chosen ID used to store and retrieve V8 ScriptData from
- // the CachedScript. If the format changes, this ID should be changed too.
- static const unsigned dataTypeID = 0xECC13BD7;
-
- // Very small scripts are not worth the effort to preparse.
- static const int minPreparseLength = 1024;
-
- if (!cachedScript || code->Length() < minPreparseLength)
- return 0;
-
- CachedMetadata* cachedMetadata = cachedScript->cachedMetadata(dataTypeID);
- if (cachedMetadata)
- return v8::ScriptData::New(cachedMetadata->data(), cachedMetadata->size());
-
- OwnPtr<v8::ScriptData> scriptData(v8::ScriptData::PreCompile(code));
- cachedScript->setCachedMetadata(dataTypeID, scriptData->Data(), scriptData->Length());
-
- return scriptData.release();
-}
-
-bool V8Proxy::executingScript() const
-{
- return m_recursion;
-}
-
-v8::Local<v8::Value> V8Proxy::evaluate(const ScriptSourceCode& source, Node* node)
-{
- ASSERT(v8::Context::InContext());
-
- V8GCController::checkMemoryUsage();
-
- InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvaluateScript(m_frame, source.url().isNull() ? String() : source.url().string(), source.startLine());
-
- v8::Local<v8::Value> result;
- {
- // Isolate exceptions that occur when compiling and executing
- // the code. These exceptions should not interfere with
- // javascript code we might evaluate from C++ when returning
- // from here.
- v8::TryCatch tryCatch;
- tryCatch.SetVerbose(true);
-
- // Compile the script.
- v8::Local<v8::String> code = v8ExternalString(source.source());
-#if PLATFORM(CHROMIUM)
- PlatformBridge::traceEventBegin("v8.compile", node, "");
-#endif
- OwnPtr<v8::ScriptData> scriptData = precompileScript(code, source.cachedScript());
-
- // NOTE: For compatibility with WebCore, ScriptSourceCode's line starts at
- // 1, whereas v8 starts at 0.
- v8::Handle<v8::Script> script = compileScript(code, source.url(), WTF::toZeroBasedTextPosition(source.startPosition()), scriptData.get());
-#if PLATFORM(CHROMIUM)
- PlatformBridge::traceEventEnd("v8.compile", node, "");
-
- PlatformBridge::traceEventBegin("v8.run", node, "");
-#endif
- // Set inlineCode to true for <a href="javascript:doSomething()">
- // and false for <script>doSomething</script>. We make a rough guess at
- // this based on whether the script source has a URL.
- result = runScript(script, source.url().string().isNull());
- }
-#if PLATFORM(CHROMIUM)
- PlatformBridge::traceEventEnd("v8.run", node, "");
-#endif
-
- InspectorInstrumentation::didEvaluateScript(cookie);
-
- return result;
-}
-
-v8::Local<v8::Value> V8Proxy::runScript(v8::Handle<v8::Script> script, bool isInlineCode)
-#ifdef ANDROID_INSTRUMENT
-{
- android::TimeCounter::start(android::TimeCounter::JavaScriptExecuteTimeCounter);
- v8::Local<v8::Value> result = runScriptInternal(script, isInlineCode);
- android::TimeCounter::record(android::TimeCounter::JavaScriptExecuteTimeCounter, __FUNCTION__);
- return result;
-}
-
-v8::Local<v8::Value> V8Proxy::runScriptInternal(v8::Handle<v8::Script> script, bool isInlineCode)
-#endif
-{
- if (script.IsEmpty())
- return notHandledByInterceptor();
-
- V8GCController::checkMemoryUsage();
- // Compute the source string and prevent against infinite recursion.
- if (m_recursion >= kMaxRecursionDepth) {
- v8::Local<v8::String> code = v8ExternalString("throw RangeError('Recursion too deep')");
- // FIXME: Ideally, we should be able to re-use the origin of the
- // script passed to us as the argument instead of using an empty string
- // and 0 baseLine.
- script = compileScript(code, "", TextPosition0::minimumPosition());
- }
-
- if (handleOutOfMemory())
- ASSERT(script.IsEmpty());
-
- if (script.IsEmpty())
- return notHandledByInterceptor();
-
- // Save the previous value of the inlineCode flag and update the flag for
- // the duration of the script invocation.
- bool previousInlineCode = inlineCode();
- setInlineCode(isInlineCode);
-
- // Run the script and keep track of the current recursion depth.
- v8::Local<v8::Value> result;
- {
- V8ConsoleMessage::Scope scope;
-
- // See comment in V8Proxy::callFunction.
- m_frame->keepAlive();
-
- m_recursion++;
- result = script->Run();
- m_recursion--;
- }
-
- // Release the storage mutex if applicable.
- didLeaveScriptContext();
-
- if (handleOutOfMemory())
- ASSERT(result.IsEmpty());
-
- // Handle V8 internal error situation (Out-of-memory).
- if (result.IsEmpty())
- return notHandledByInterceptor();
-
- // Restore inlineCode flag.
- setInlineCode(previousInlineCode);
-
- if (v8::V8::IsDead())
- handleFatalErrorInV8();
-
- return result;
-}
-
-v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[])
-{
-#ifdef ANDROID_INSTRUMENT
- android::TimeCounter::start(android::TimeCounter::JavaScriptExecuteTimeCounter);
-#endif
- V8GCController::checkMemoryUsage();
- v8::Local<v8::Value> result;
- {
- V8ConsoleMessage::Scope scope;
-
- if (m_recursion >= kMaxRecursionDepth) {
- v8::Local<v8::String> code = v8::String::New("throw new RangeError('Maximum call stack size exceeded.')");
- if (code.IsEmpty())
- return result;
- v8::Local<v8::Script> script = v8::Script::Compile(code);
- if (script.IsEmpty())
- return result;
- script->Run();
- return result;
- }
-
- // Evaluating the JavaScript could cause the frame to be deallocated,
- // so we start the keep alive timer here.
- // Frame::keepAlive method adds the ref count of the frame and sets a
- // timer to decrease the ref count. It assumes that the current JavaScript
- // execution finishs before firing the timer.
- m_frame->keepAlive();
-
- InspectorInstrumentationCookie cookie;
- if (InspectorInstrumentation::hasFrontends()) {
- v8::ScriptOrigin origin = function->GetScriptOrigin();
- String resourceName("undefined");
- int lineNumber = 1;
- if (!origin.ResourceName().IsEmpty()) {
- resourceName = toWebCoreString(origin.ResourceName());
- lineNumber = function->GetScriptLineNumber() + 1;
- }
- cookie = InspectorInstrumentation::willCallFunction(m_frame, resourceName, lineNumber);
- }
-
- m_recursion++;
- result = function->Call(receiver, argc, args);
- m_recursion--;
-
- InspectorInstrumentation::didCallFunction(cookie);
- }
-
- // Release the storage mutex if applicable.
- didLeaveScriptContext();
-
- if (v8::V8::IsDead())
- handleFatalErrorInV8();
-
-#ifdef ANDROID_INSTRUMENT
- android::TimeCounter::record(android::TimeCounter::JavaScriptExecuteTimeCounter, __FUNCTION__);
-#endif
- return result;
-}
-
-v8::Local<v8::Value> V8Proxy::callFunctionWithoutFrame(v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[])
-{
- V8GCController::checkMemoryUsage();
- v8::Local<v8::Value> result = function->Call(receiver, argc, args);
-
- if (v8::V8::IsDead())
- handleFatalErrorInV8();
-
- return result;
-}
-
-v8::Local<v8::Value> V8Proxy::newInstance(v8::Handle<v8::Function> constructor, int argc, v8::Handle<v8::Value> args[])
-{
- // No artificial limitations on the depth of recursion, see comment in
- // V8Proxy::callFunction.
- v8::Local<v8::Value> result;
- {
- V8ConsoleMessage::Scope scope;
-
- // See comment in V8Proxy::callFunction.
- m_frame->keepAlive();
-
- result = constructor->NewInstance(argc, args);
- }
-
- if (v8::V8::IsDead())
- handleFatalErrorInV8();
-
- return result;
-}
-
-DOMWindow* V8Proxy::retrieveWindow(v8::Handle<v8::Context> context)
-{
- v8::Handle<v8::Object> global = context->Global();
- ASSERT(!global.IsEmpty());
- global = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), global);
- ASSERT(!global.IsEmpty());
- return V8DOMWindow::toNative(global);
-}
-
-Frame* V8Proxy::retrieveFrame(v8::Handle<v8::Context> context)
-{
- DOMWindow* window = retrieveWindow(context);
- Frame* frame = window->frame();
- if (frame && frame->domWindow() == window)
- return frame;
- // We return 0 here because |context| is detached from the Frame. If we
- // did return |frame| we could get in trouble because the frame could be
- // navigated to another security origin.
- return 0;
-}
-
-Frame* V8Proxy::retrieveFrameForEnteredContext()
-{
- v8::Handle<v8::Context> context = v8::Context::GetEntered();
- if (context.IsEmpty())
- return 0;
- return retrieveFrame(context);
-}
-
-Frame* V8Proxy::retrieveFrameForCurrentContext()
-{
- v8::Handle<v8::Context> context = v8::Context::GetCurrent();
- if (context.IsEmpty())
- return 0;
- return retrieveFrame(context);
-}
-
-Frame* V8Proxy::retrieveFrameForCallingContext()
-{
- v8::Handle<v8::Context> context = v8::Context::GetCalling();
- if (context.IsEmpty())
- return 0;
- return retrieveFrame(context);
-}
-
-V8Proxy* V8Proxy::retrieve()
-{
- DOMWindow* window = retrieveWindow(currentContext());
- ASSERT(window);
- return retrieve(window->frame());
-}
-
-V8Proxy* V8Proxy::retrieve(Frame* frame)
-{
- if (!frame)
- return 0;
- return frame->script()->canExecuteScripts(NotAboutToExecuteScript) ? frame->script()->proxy() : 0;
-}
-
-V8Proxy* V8Proxy::retrieve(ScriptExecutionContext* context)
-{
- if (!context || !context->isDocument())
- return 0;
- return retrieve(static_cast<Document*>(context)->frame());
-}
-
-void V8Proxy::disconnectFrame()
-{
-}
-
-void V8Proxy::didLeaveScriptContext()
-{
- Page* page = m_frame->page();
- if (!page)
- return;
-#if ENABLE(INDEXED_DATABASE)
- // If we've just left a script context and indexed database has been
- // instantiated, we must let its transaction coordinator know so it can terminate
- // any not-yet-started transactions.
- IDBPendingTransactionMonitor::abortPendingTransactions();
-#endif // ENABLE(INDEXED_DATABASE)
- // If we've just left a top level script context and local storage has been
- // instantiated, we must ensure that any storage locks have been freed.
- // Per http://dev.w3.org/html5/spec/Overview.html#storage-mutex
- if (m_recursion != 0)
- return;
- if (page->group().hasLocalStorage())
- page->group().localStorage()->unlock();
-}
-
-void V8Proxy::resetIsolatedWorlds()
-{
- for (IsolatedWorldMap::iterator iter = m_isolatedWorlds.begin();
- iter != m_isolatedWorlds.end(); ++iter) {
- iter->second->destroy();
- }
- m_isolatedWorlds.clear();
-}
-
-void V8Proxy::clearForClose()
-{
- resetIsolatedWorlds();
- windowShell()->clearForClose();
-}
-
-void V8Proxy::clearForNavigation()
-{
- resetIsolatedWorlds();
- windowShell()->clearForNavigation();
-}
-
-void V8Proxy::setDOMException(int exceptionCode)
-{
- if (exceptionCode <= 0)
- return;
-
- ExceptionCodeDescription description;
- getExceptionCodeDescription(exceptionCode, description);
-
- v8::Handle<v8::Value> exception;
- switch (description.type) {
- case DOMExceptionType:
- exception = toV8(DOMCoreException::create(description));
- break;
- case RangeExceptionType:
- exception = toV8(RangeException::create(description));
- break;
- case EventExceptionType:
- exception = toV8(EventException::create(description));
- break;
- case XMLHttpRequestExceptionType:
- exception = toV8(XMLHttpRequestException::create(description));
- break;
-#if ENABLE(SVG)
- case SVGExceptionType:
- exception = toV8(SVGException::create(description));
- break;
-#endif
-#if ENABLE(XPATH)
- case XPathExceptionType:
- exception = toV8(XPathException::create(description));
- break;
-#endif
-#if ENABLE(DATABASE)
- case SQLExceptionType:
- exception = toV8(SQLException::create(description));
- break;
-#endif
-#if ENABLE(BLOB) || ENABLE(FILE_SYSTEM)
- case FileExceptionType:
- exception = toV8(FileException::create(description));
- break;
-#endif
-#if ENABLE(INDEXED_DATABASE)
- case IDBDatabaseExceptionType:
- exception = toV8(IDBDatabaseException::create(description));
- break;
-#endif
- default:
- ASSERT_NOT_REACHED();
- }
-
- if (!exception.IsEmpty())
- v8::ThrowException(exception);
-}
-
-v8::Handle<v8::Value> V8Proxy::throwError(ErrorType type, const char* message)
-{
- switch (type) {
- case RangeError:
- return v8::ThrowException(v8::Exception::RangeError(v8String(message)));
- case ReferenceError:
- return v8::ThrowException(v8::Exception::ReferenceError(v8String(message)));
- case SyntaxError:
- return v8::ThrowException(v8::Exception::SyntaxError(v8String(message)));
- case TypeError:
- return v8::ThrowException(v8::Exception::TypeError(v8String(message)));
- case GeneralError:
- return v8::ThrowException(v8::Exception::Error(v8String(message)));
- default:
- ASSERT_NOT_REACHED();
- return notHandledByInterceptor();
- }
-}
-
-v8::Handle<v8::Value> V8Proxy::throwTypeError()
-{
- return throwError(TypeError, "Type error");
-}
-
-v8::Handle<v8::Value> V8Proxy::throwSyntaxError()
-{
- return throwError(SyntaxError, "Syntax error");
-}
-
-v8::Local<v8::Context> V8Proxy::context(Frame* frame)
-{
- v8::Local<v8::Context> context = V8Proxy::mainWorldContext(frame);
- if (context.IsEmpty())
- return v8::Local<v8::Context>();
-
- if (V8IsolatedContext* isolatedContext = V8IsolatedContext::getEntered()) {
- context = v8::Local<v8::Context>::New(isolatedContext->context());
- if (frame != V8Proxy::retrieveFrame(context))
- return v8::Local<v8::Context>();
- }
-
- return context;
-}
-
-v8::Local<v8::Context> V8Proxy::context()
-{
- if (V8IsolatedContext* isolatedContext = V8IsolatedContext::getEntered()) {
- RefPtr<SharedPersistent<v8::Context> > context = isolatedContext->sharedContext();
- if (m_frame != V8Proxy::retrieveFrame(context->get()))
- return v8::Local<v8::Context>();
- return v8::Local<v8::Context>::New(context->get());
- }
- return mainWorldContext();
-}
-
-v8::Local<v8::Context> V8Proxy::mainWorldContext()
-{
- windowShell()->initContextIfNeeded();
- return v8::Local<v8::Context>::New(windowShell()->context());
-}
-
-v8::Local<v8::Context> V8Proxy::mainWorldContext(Frame* frame)
-{
- V8Proxy* proxy = retrieve(frame);
- if (!proxy)
- return v8::Local<v8::Context>();
-
- return proxy->mainWorldContext();
-}
-
-v8::Local<v8::Context> V8Proxy::currentContext()
-{
- return v8::Context::GetCurrent();
-}
-
-v8::Handle<v8::Value> V8Proxy::checkNewLegal(const v8::Arguments& args)
-{
- if (!AllowAllocation::m_current)
- return throwError(TypeError, "Illegal constructor");
-
- return args.This();
-}
-
-void V8Proxy::processConsoleMessages()
-{
- V8ConsoleMessage::processDelayed();
-}
-
-void V8Proxy::registerExtensionWithV8(v8::Extension* extension)
-{
- // If the extension exists in our list, it was already registered with V8.
- if (!registeredExtensionWithV8(extension))
- v8::RegisterExtension(extension);
-}
-
-bool V8Proxy::registeredExtensionWithV8(v8::Extension* extension)
-{
- for (size_t i = 0; i < m_extensions.size(); ++i) {
- if (m_extensions[i] == extension)
- return true;
- }
-
- return false;
-}
-
-void V8Proxy::registerExtension(v8::Extension* extension)
-{
- registerExtensionWithV8(extension);
- m_extensions.append(extension);
-}
-
-bool V8Proxy::setContextDebugId(int debugId)
-{
- ASSERT(debugId > 0);
- v8::HandleScope scope;
- v8::Handle<v8::Context> context = windowShell()->context();
- if (context.IsEmpty())
- return false;
- if (!context->GetData()->IsUndefined())
- return false;
-
- v8::Context::Scope contextScope(context);
-
- char buffer[32];
- snprintf(buffer, sizeof(buffer), "page,%d", debugId);
- context->SetData(v8::String::New(buffer));
-
- return true;
-}
-
-int V8Proxy::contextDebugId(v8::Handle<v8::Context> context)
-{
- v8::HandleScope scope;
- if (!context->GetData()->IsString())
- return -1;
- v8::String::AsciiValue ascii(context->GetData());
- char* comma = strnstr(*ascii, ",", ascii.length());
- if (!comma)
- return -1;
- return atoi(comma + 1);
-}
-
-v8::Local<v8::Context> toV8Context(ScriptExecutionContext* context, const WorldContextHandle& worldContext)
-{
- if (context->isDocument()) {
- if (V8Proxy* proxy = V8Proxy::retrieve(context))
- return worldContext.adjustedContext(proxy);
-#if ENABLE(WORKERS)
- } else if (context->isWorkerContext()) {
- if (WorkerContextExecutionProxy* proxy = static_cast<WorkerContext*>(context)->script()->proxy())
- return proxy->context();
-#endif
- }
- return v8::Local<v8::Context>();
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/V8Proxy.h b/WebCore/bindings/v8/V8Proxy.h
deleted file mode 100644
index 34e80e1..0000000
--- a/WebCore/bindings/v8/V8Proxy.h
+++ /dev/null
@@ -1,439 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8Proxy_h
-#define V8Proxy_h
-
-#include "PlatformBridge.h"
-#include "ScriptSourceCode.h" // for WebCore::ScriptSourceCode
-#include "SecurityOrigin.h" // for WebCore::SecurityOrigin
-#include "SharedPersistent.h"
-#include "V8AbstractEventListener.h"
-#include "V8DOMWindowShell.h"
-#include "V8DOMWrapper.h"
-#include "V8GCController.h"
-#include "V8Utilities.h"
-#include "WrapperTypeInfo.h"
-#include <v8.h>
-#include <wtf/Forward.h>
-#include <wtf/PassRefPtr.h> // so generated bindings don't have to
-#include <wtf/Vector.h>
-
-#if defined(ENABLE_DOM_STATS_COUNTERS) && PLATFORM(CHROMIUM)
-#define INC_STATS(name) PlatformBridge::incrementStatsCounter(name)
-#else
-#define INC_STATS(name)
-#endif
-
-namespace WebCore {
-
- class CachedScript;
- class DOMWindow;
- class Frame;
- class Node;
- class ScriptExecutionContext;
- class V8EventListener;
- class V8IsolatedContext;
- class WorldContextHandle;
-
- // FIXME: use standard logging facilities in WebCore.
- void logInfo(Frame*, const String& message, const String& url);
-
- // The following Batch structs and methods are used for setting multiple
- // properties on an ObjectTemplate, used from the generated bindings
- // initialization (ConfigureXXXTemplate). This greatly reduces the binary
- // size by moving from code driven setup to data table driven setup.
-
- // BatchedAttribute translates into calls to SetAccessor() on either the
- // instance or the prototype ObjectTemplate, based on |onProto|.
- struct BatchedAttribute {
- const char* const name;
- v8::AccessorGetter getter;
- v8::AccessorSetter setter;
- WrapperTypeInfo* data;
- v8::AccessControl settings;
- v8::PropertyAttribute attribute;
- bool onProto;
- };
-
- void batchConfigureAttributes(v8::Handle<v8::ObjectTemplate>, v8::Handle<v8::ObjectTemplate>, const BatchedAttribute*, size_t attributeCount);
-
- inline void configureAttribute(v8::Handle<v8::ObjectTemplate> instance, v8::Handle<v8::ObjectTemplate> proto, const BatchedAttribute& attribute)
- {
- (attribute.onProto ? proto : instance)->SetAccessor(v8::String::New(attribute.name),
- attribute.getter,
- attribute.setter,
- v8::External::Wrap(attribute.data),
- attribute.settings,
- attribute.attribute);
- }
-
- // BatchedConstant translates into calls to Set() for setting up an object's
- // constants. It sets the constant on both the FunctionTemplate and the
- // ObjectTemplate. PropertyAttributes is always ReadOnly.
- struct BatchedConstant {
- const char* const name;
- int value;
- };
-
- void batchConfigureConstants(v8::Handle<v8::FunctionTemplate>, v8::Handle<v8::ObjectTemplate>, const BatchedConstant*, size_t constantCount);
-
- struct BatchedCallback {
- const char* const name;
- v8::InvocationCallback callback;
- };
-
- void batchConfigureCallbacks(v8::Handle<v8::ObjectTemplate>,
- v8::Handle<v8::Signature>,
- v8::PropertyAttribute,
- const BatchedCallback*,
- size_t callbackCount);
-
- const int kMaxRecursionDepth = 20;
-
- // The list of extensions that are registered for use with V8.
- typedef WTF::Vector<v8::Extension*> V8Extensions;
-
- class V8Proxy {
- public:
- // The types of javascript errors that can be thrown.
- enum ErrorType {
- RangeError,
- ReferenceError,
- SyntaxError,
- TypeError,
- GeneralError
- };
-
- // When to report errors.
- enum DelayReporting {
- ReportLater,
- ReportNow
- };
-
- explicit V8Proxy(Frame*);
-
- ~V8Proxy();
-
- Frame* frame() { return m_frame; }
-
- void clearForNavigation();
- void clearForClose();
-
- // FIXME: Need comment. User Gesture related.
- bool inlineCode() const { return m_inlineCode; }
- void setInlineCode(bool value) { m_inlineCode = value; }
-
- bool timerCallback() const { return m_timerCallback; }
- void setTimerCallback(bool value) { m_timerCallback = value; }
-
- // Disconnects the proxy from its owner frame,
- // and clears all timeouts on the DOM window.
- void disconnectFrame();
-
- void finishedWithEvent(Event*) { }
-
- // Evaluate JavaScript in a new isolated world. The script gets its own
- // global scope, its own prototypes for intrinsic JavaScript objects (String,
- // Array, and so-on), and its own wrappers for all DOM nodes and DOM
- // constructors.
- void evaluateInIsolatedWorld(int worldId, const Vector<ScriptSourceCode>& sources, int extensionGroup);
-
- // Returns true if the proxy is currently executing a script in V8.
- bool executingScript() const;
-
- // Evaluate a script file in the current execution environment.
- // The caller must hold an execution context.
- // If cannot evalute the script, it returns an error.
- v8::Local<v8::Value> evaluate(const ScriptSourceCode&, Node*);
-
- // Run an already compiled script.
- v8::Local<v8::Value> runScript(v8::Handle<v8::Script>, bool isInlineCode);
-
-#ifdef ANDROID_INSTRUMENT
- v8::Local<v8::Value> runScriptInternal(v8::Handle<v8::Script> script, bool inline_code);
-#endif
-
- // Call the function with the given receiver and arguments.
- v8::Local<v8::Value> callFunction(v8::Handle<v8::Function>, v8::Handle<v8::Object>, int argc, v8::Handle<v8::Value> argv[]);
-
- // Call the function with the given receiver and arguments.
- static v8::Local<v8::Value> callFunctionWithoutFrame(v8::Handle<v8::Function>, v8::Handle<v8::Object>, int argc, v8::Handle<v8::Value> argv[]);
-
- // Call the function as constructor with the given arguments.
- v8::Local<v8::Value> newInstance(v8::Handle<v8::Function>, int argc, v8::Handle<v8::Value> argv[]);
-
- // Returns the window object associated with a context.
- static DOMWindow* retrieveWindow(v8::Handle<v8::Context>);
- // Returns V8Proxy object of the currently executing context.
- static V8Proxy* retrieve();
- // Returns V8Proxy object associated with a frame.
- static V8Proxy* retrieve(Frame*);
- // Returns V8Proxy object associated with a script execution context.
- static V8Proxy* retrieve(ScriptExecutionContext*);
-
- // Returns the frame object of the window object associated with
- // a context.
- static Frame* retrieveFrame(v8::Handle<v8::Context>);
-
-
- // The three functions below retrieve WebFrame instances relating the
- // currently executing JavaScript. Since JavaScript can make function calls
- // across frames, though, we need to be more precise.
- //
- // For example, imagine that a JS function in frame A calls a function in
- // frame B, which calls native code, which wants to know what the 'active'
- // frame is.
- //
- // The 'entered context' is the context where execution first entered the
- // script engine; the context that is at the bottom of the JS function stack.
- // RetrieveFrameForEnteredContext() would return Frame A in our example.
- // This frame is often referred to as the "dynamic global object."
- //
- // The 'current context' is the context the JS engine is currently inside of;
- // the context that is at the top of the JS function stack.
- // RetrieveFrameForCurrentContext() would return Frame B in our example.
- // This frame is often referred to as the "lexical global object."
- //
- // Finally, the 'calling context' is the context one below the current
- // context on the JS function stack. For example, if function f calls
- // function g, then the calling context will be the context associated with
- // f. This context is commonly used by DOM security checks because they want
- // to know who called them.
- //
- // If you are unsure which of these functions to use, ask abarth.
- //
- // NOTE: These cannot be declared as inline function, because VS complains at
- // linking time.
- static Frame* retrieveFrameForEnteredContext();
- static Frame* retrieveFrameForCurrentContext();
- static Frame* retrieveFrameForCallingContext();
-
- // Returns V8 Context of a frame. If none exists, creates
- // a new context. It is potentially slow and consumes memory.
- static v8::Local<v8::Context> context(Frame*);
- static v8::Local<v8::Context> mainWorldContext(Frame*);
- static v8::Local<v8::Context> currentContext();
-
- // If the current context causes out of memory, JavaScript setting
- // is disabled and it returns true.
- static bool handleOutOfMemory();
-
- static v8::Handle<v8::Value> checkNewLegal(const v8::Arguments&);
-
- static v8::Handle<v8::Script> compileScript(v8::Handle<v8::String> code, const String& fileName, const TextPosition0& scriptStartPosition, v8::ScriptData* = 0);
-
-#ifdef ANDROID_INSTRUMENT
- static v8::Handle<v8::Script> compileScriptInternal(v8::Handle<v8::String> code, const String& fileName, int baseLine, v8::ScriptData* scriptData);
-#endif
-
- // If the exception code is different from zero, a DOM exception is
- // schedule to be thrown.
- static void setDOMException(int exceptionCode);
-
- // Schedule an error object to be thrown.
- static v8::Handle<v8::Value> throwError(ErrorType, const char* message);
-
- // Helpers for throwing syntax and type errors with predefined messages.
- static v8::Handle<v8::Value> throwTypeError();
- static v8::Handle<v8::Value> throwSyntaxError();
-
- template <typename T>
- static v8::Handle<v8::Value> constructDOMObject(const v8::Arguments&, WrapperTypeInfo*);
-
- template <typename T>
- static v8::Handle<v8::Value> constructDOMObjectWithScriptExecutionContext(const v8::Arguments&, WrapperTypeInfo*);
-
- // Process any pending JavaScript console messages.
- static void processConsoleMessages();
-
- v8::Local<v8::Context> context();
- v8::Local<v8::Context> mainWorldContext();
-
- // FIXME: This should eventually take DOMWrapperWorld argument!
- V8DOMWindowShell* windowShell() const { return m_windowShell.get(); }
-
- bool setContextDebugId(int id);
- static int contextDebugId(v8::Handle<v8::Context>);
-
- // Registers a v8 extension to be available on webpages. Will only
- // affect v8 contexts initialized after this call. Takes ownership of
- // the v8::Extension object passed.
- static void registerExtension(v8::Extension*);
-
- static void registerExtensionWithV8(v8::Extension*);
- static bool registeredExtensionWithV8(v8::Extension*);
-
- static const V8Extensions& extensions() { return m_extensions; }
-
- // Report an unsafe attempt to access the given frame on the console.
- static void reportUnsafeAccessTo(Frame* target, DelayReporting delay);
-
- private:
- void didLeaveScriptContext();
-
- void resetIsolatedWorlds();
-
- PassOwnPtr<v8::ScriptData> precompileScript(v8::Handle<v8::String>, CachedScript*);
-
- // Returns false when we're out of memory in V8.
- bool setInjectedScriptContextDebugId(v8::Handle<v8::Context> targetContext);
-
- static const char* rangeExceptionName(int exceptionCode);
- static const char* eventExceptionName(int exceptionCode);
- static const char* xmlHttpRequestExceptionName(int exceptionCode);
- static const char* domExceptionName(int exceptionCode);
-
-#if ENABLE(XPATH)
- static const char* xpathExceptionName(int exceptionCode);
-#endif
-
-#if ENABLE(SVG)
- static const char* svgExceptionName(int exceptionCode);
-#endif
-
-#if ENABLE(DATABASE)
- static const char* sqlExceptionName(int exceptionCode);
-#endif
-
- Frame* m_frame;
-
- // For the moment, we have one of these. Soon we will have one per DOMWrapperWorld.
- RefPtr<V8DOMWindowShell> m_windowShell;
-
- // True for <a href="javascript:foo()"> and false for <script>foo()</script>.
- // Only valid during execution.
- bool m_inlineCode;
-
- // True when executing from within a timer callback. Only valid during
- // execution.
- bool m_timerCallback;
-
- // Track the recursion depth to be able to avoid too deep recursion. The V8
- // engine allows much more recursion than KJS does so we need to guard against
- // excessive recursion in the binding layer.
- int m_recursion;
-
- // All of the extensions registered with the context.
- static V8Extensions m_extensions;
-
- // The isolated worlds we are tracking for this frame. We hold them alive
- // here so that they can be used again by future calls to
- // evaluateInIsolatedWorld().
- //
- // Note: although the pointer is raw, the instance is kept alive by a strong
- // reference to the v8 context it contains, which is not made weak until we
- // call world->destroy().
- //
- // FIXME: We want to eventually be holding window shells instead of the
- // IsolatedContext directly.
- typedef HashMap<int, V8IsolatedContext*> IsolatedWorldMap;
- IsolatedWorldMap m_isolatedWorlds;
- };
-
- template <typename T>
- v8::Handle<v8::Value> V8Proxy::constructDOMObject(const v8::Arguments& args, WrapperTypeInfo* type)
- {
- if (!args.IsConstructCall())
- return throwError(V8Proxy::TypeError, "DOM object constructor cannot be called as a function.");
-
- // Note: it's OK to let this RefPtr go out of scope because we also call
- // SetDOMWrapper(), which effectively holds a reference to obj.
- RefPtr<T> obj = T::create();
- V8DOMWrapper::setDOMWrapper(args.Holder(), type, obj.get());
- obj->ref();
- V8DOMWrapper::setJSWrapperForDOMObject(obj.get(), v8::Persistent<v8::Object>::New(args.Holder()));
- return args.Holder();
- }
-
- template <typename T>
- v8::Handle<v8::Value> V8Proxy::constructDOMObjectWithScriptExecutionContext(const v8::Arguments& args, WrapperTypeInfo* type)
- {
- if (!args.IsConstructCall())
- return throwError(V8Proxy::TypeError, "");
-
- ScriptExecutionContext* context = getScriptExecutionContext();
- if (!context)
- return throwError(V8Proxy::ReferenceError, "");
-
- // Note: it's OK to let this RefPtr go out of scope because we also call
- // SetDOMWrapper(), which effectively holds a reference to obj.
- RefPtr<T> obj = T::create(context);
- V8DOMWrapper::setDOMWrapper(args.Holder(), type, obj.get());
- obj->ref();
- V8DOMWrapper::setJSWrapperForDOMObject(obj.get(), v8::Persistent<v8::Object>::New(args.Holder()));
- return args.Holder();
- }
-
-
- v8::Local<v8::Context> toV8Context(ScriptExecutionContext*, const WorldContextHandle& worldContext);
-
- // Used by an interceptor callback that it hasn't found anything to
- // intercept.
- inline static v8::Local<v8::Object> notHandledByInterceptor()
- {
- return v8::Local<v8::Object>();
- }
-
- inline static v8::Local<v8::Boolean> deletionNotHandledByInterceptor()
- {
- return v8::Local<v8::Boolean>();
- }
- inline v8::Handle<v8::Primitive> throwError(const char* message, V8Proxy::ErrorType type = V8Proxy::TypeError)
- {
- if (!v8::V8::IsExecutionTerminating())
- V8Proxy::throwError(type, message);
- return v8::Undefined();
- }
-
- inline v8::Handle<v8::Primitive> throwError(ExceptionCode ec)
- {
- if (!v8::V8::IsExecutionTerminating())
- V8Proxy::setDOMException(ec);
- return v8::Undefined();
- }
-
- inline v8::Handle<v8::Primitive> throwError(v8::Local<v8::Value> exception)
- {
- if (!v8::V8::IsExecutionTerminating())
- v8::ThrowException(exception);
- return v8::Undefined();
- }
-
- template <class T> inline v8::Handle<v8::Object> toV8(PassRefPtr<T> object, v8::Local<v8::Object> holder)
- {
- object->ref();
- V8DOMWrapper::setJSWrapperForDOMObject(object.get(), v8::Persistent<v8::Object>::New(holder));
- return holder;
- }
-
-}
-
-#endif // V8Proxy_h
diff --git a/WebCore/bindings/v8/V8Utilities.cpp b/WebCore/bindings/v8/V8Utilities.cpp
deleted file mode 100644
index 7665a0a..0000000
--- a/WebCore/bindings/v8/V8Utilities.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (C) 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8Utilities.h"
-
-#include <v8.h>
-
-#include "Document.h"
-#include "Frame.h"
-#include "ScriptExecutionContext.h"
-#include "ScriptState.h"
-#include "V8Binding.h"
-#include "V8BindingState.h"
-#include "V8Proxy.h"
-#include "WorkerContext.h"
-#include "WorkerContextExecutionProxy.h"
-
-#include <wtf/Assertions.h>
-#include "Frame.h"
-
-namespace WebCore {
-
-// Use an array to hold dependents. It works like a ref-counted scheme.
-// A value can be added more than once to the DOM object.
-void createHiddenDependency(v8::Handle<v8::Object> object, v8::Local<v8::Value> value, int cacheIndex)
-{
- v8::Local<v8::Value> cache = object->GetInternalField(cacheIndex);
- if (cache->IsNull() || cache->IsUndefined()) {
- cache = v8::Array::New();
- object->SetInternalField(cacheIndex, cache);
- }
-
- v8::Local<v8::Array> cacheArray = v8::Local<v8::Array>::Cast(cache);
- cacheArray->Set(v8::Integer::New(cacheArray->Length()), value);
-}
-
-void removeHiddenDependency(v8::Handle<v8::Object> object, v8::Local<v8::Value> value, int cacheIndex)
-{
- v8::Local<v8::Value> cache = object->GetInternalField(cacheIndex);
- if (!cache->IsArray())
- return;
- v8::Local<v8::Array> cacheArray = v8::Local<v8::Array>::Cast(cache);
- for (int i = cacheArray->Length() - 1; i >= 0; --i) {
- v8::Local<v8::Value> cached = cacheArray->Get(v8::Integer::New(i));
- if (cached->StrictEquals(value)) {
- cacheArray->Delete(i);
- return;
- }
- }
-}
-
-void transferHiddenDependency(v8::Handle<v8::Object> object,
- EventListener* oldValue,
- v8::Local<v8::Value> newValue,
- int cacheIndex)
-{
- if (oldValue) {
- V8AbstractEventListener* oldListener = V8AbstractEventListener::cast(oldValue);
- if (oldListener) {
- v8::Local<v8::Object> oldListenerObject = oldListener->getExistingListenerObject();
- if (!oldListenerObject.IsEmpty())
- removeHiddenDependency(object, oldListenerObject, cacheIndex);
- }
- }
- if (!newValue->IsNull() && !newValue->IsUndefined())
- createHiddenDependency(object, newValue, cacheIndex);
-}
-
-bool processingUserGesture()
-{
- return V8BindingState::Only()->processingUserGesture();
-}
-
-Frame* callingOrEnteredFrame()
-{
- return V8BindingState::Only()->activeFrame();
-}
-
-bool shouldAllowNavigation(Frame* frame)
-{
- return V8BindingSecurity::shouldAllowNavigation(V8BindingState::Only(), frame);
-}
-
-KURL completeURL(const String& relativeURL)
-{
- return completeURL(V8BindingState::Only(), relativeURL);
-}
-
-void navigateIfAllowed(Frame* frame, const KURL& url, bool lockHistory, bool lockBackForwardList)
-{
- return V8Binding::Frame::navigateIfAllowed(V8BindingState::Only(), frame, url, lockHistory, lockBackForwardList);
-}
-
-ScriptExecutionContext* getScriptExecutionContext()
-{
-#if ENABLE(WORKERS)
- if (WorkerScriptController* controller = WorkerScriptController::controllerForContext())
- return controller->workerContext();
-#endif
-
- if (Frame* frame = V8Proxy::retrieveFrameForCurrentContext())
- return frame->document()->scriptExecutionContext();
-
- return 0;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/V8Utilities.h b/WebCore/bindings/v8/V8Utilities.h
deleted file mode 100644
index 2b82f4d..0000000
--- a/WebCore/bindings/v8/V8Utilities.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8Utilities_h
-#define V8Utilities_h
-
-#include <wtf/Forward.h>
-#include <v8.h>
-
-namespace WebCore {
-
- class EventListener;
- class Frame;
- class KURL;
- class ScriptExecutionContext;
- class ScriptState;
-
- // Use an array to hold dependents. It works like a ref-counted scheme. A value can be added more than once to the DOM object.
- void createHiddenDependency(v8::Handle<v8::Object>, v8::Local<v8::Value>, int cacheIndex);
- void removeHiddenDependency(v8::Handle<v8::Object>, v8::Local<v8::Value>, int cacheIndex);
-
- // Combo create/remove, for generated event-handler-setter bindings:
- void transferHiddenDependency(v8::Handle<v8::Object>, EventListener* oldValue, v8::Local<v8::Value> newValue, int cacheIndex);
-
- bool processingUserGesture();
- bool shouldAllowNavigation(Frame*);
- KURL completeURL(const String& relativeURL);
- void navigateIfAllowed(Frame*, const KURL&, bool lockHistory, bool lockBackForwardList);
-
- ScriptExecutionContext* getScriptExecutionContext();
-
- class AllowAllocation {
- public:
- inline AllowAllocation()
- {
- m_previous = m_current;
- m_current = true;
- }
-
- inline ~AllowAllocation()
- {
- m_current = m_previous;
- }
-
- static bool m_current;
-
- private:
- bool m_previous;
- };
-
- class SafeAllocation {
- public:
- static inline v8::Local<v8::Object> newInstance(v8::Handle<v8::Function>);
- static inline v8::Local<v8::Object> newInstance(v8::Handle<v8::ObjectTemplate>);
- static inline v8::Local<v8::Object> newInstance(v8::Handle<v8::Function>, int argc, v8::Handle<v8::Value> argv[]);
- };
-
- v8::Local<v8::Object> SafeAllocation::newInstance(v8::Handle<v8::Function> function)
- {
- if (function.IsEmpty())
- return v8::Local<v8::Object>();
- AllowAllocation allow;
- return function->NewInstance();
- }
-
- v8::Local<v8::Object> SafeAllocation::newInstance(v8::Handle<v8::ObjectTemplate> objectTemplate)
- {
- if (objectTemplate.IsEmpty())
- return v8::Local<v8::Object>();
- AllowAllocation allow;
- return objectTemplate->NewInstance();
- }
-
- v8::Local<v8::Object> SafeAllocation::newInstance(v8::Handle<v8::Function> function, int argc, v8::Handle<v8::Value> argv[])
- {
- if (function.IsEmpty())
- return v8::Local<v8::Object>();
- AllowAllocation allow;
- return function->NewInstance(argc, argv);
- }
-
-} // namespace WebCore
-
-#endif // V8Utilities_h
diff --git a/WebCore/bindings/v8/V8WorkerContextErrorHandler.cpp b/WebCore/bindings/v8/V8WorkerContextErrorHandler.cpp
deleted file mode 100644
index 5a75a40..0000000
--- a/WebCore/bindings/v8/V8WorkerContextErrorHandler.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(WORKERS)
-
-#include "V8WorkerContextErrorHandler.h"
-
-#include "ErrorEvent.h"
-#include "V8Binding.h"
-
-namespace WebCore {
-
-V8WorkerContextErrorHandler::V8WorkerContextErrorHandler(v8::Local<v8::Object> listener, bool isInline, const WorldContextHandle& worldContext)
- : V8WorkerContextEventListener(listener, isInline, worldContext)
-{
-}
-
-v8::Local<v8::Value> V8WorkerContextErrorHandler::callListenerFunction(ScriptExecutionContext* context, v8::Handle<v8::Value> jsEvent, Event* event)
-{
- ASSERT(event->isErrorEvent());
- v8::Local<v8::Object> listener = getListenerObject(context);
- v8::Local<v8::Value> returnValue;
- if (!listener.IsEmpty() && listener->IsFunction()) {
- ErrorEvent* errorEvent = static_cast<ErrorEvent*>(event);
- v8::Local<v8::Function> callFunction = v8::Local<v8::Function>::Cast(listener);
- v8::Local<v8::Object> thisValue = v8::Context::GetCurrent()->Global();
- v8::Handle<v8::Value> parameters[3] = { v8String(errorEvent->message()), v8String(errorEvent->filename()), v8::Integer::New(errorEvent->lineno()) };
- returnValue = callFunction->Call(thisValue, 3, parameters);
- if (!returnValue.IsEmpty() && returnValue->IsBoolean() && !returnValue->BooleanValue())
- event->preventDefault();
- }
- return returnValue;
-}
-
-} // namespace WebCore
-
-#endif // WORKERS
diff --git a/WebCore/bindings/v8/V8WorkerContextErrorHandler.h b/WebCore/bindings/v8/V8WorkerContextErrorHandler.h
deleted file mode 100644
index cd1e0e6..0000000
--- a/WebCore/bindings/v8/V8WorkerContextErrorHandler.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8WorkerContextErrorHandler_h
-#define V8WorkerContextErrorHandler_h
-
-#if ENABLE(WORKERS)
-
-#include "V8WorkerContextEventListener.h"
-#include <v8.h>
-#include <wtf/PassRefPtr.h>
-
-namespace WebCore {
-
-class V8WorkerContextErrorHandler : public V8WorkerContextEventListener {
-public:
- static PassRefPtr<V8WorkerContextErrorHandler> create(v8::Local<v8::Object> listener, bool isInline, const WorldContextHandle& worldContext)
- {
- return adoptRef(new V8WorkerContextErrorHandler(listener, isInline, worldContext));
- }
-
-private:
- V8WorkerContextErrorHandler(v8::Local<v8::Object> listener, bool isInline, const WorldContextHandle& worldContext);
-
- virtual v8::Local<v8::Value> callListenerFunction(ScriptExecutionContext*, v8::Handle<v8::Value> jsEvent, Event*);
-};
-
-} // namespace WebCore
-
-#endif // WORKERS
-
-#endif // V8WorkerContextErrorHandler_h
diff --git a/WebCore/bindings/v8/V8WorkerContextEventListener.cpp b/WebCore/bindings/v8/V8WorkerContextEventListener.cpp
deleted file mode 100644
index 30b9865..0000000
--- a/WebCore/bindings/v8/V8WorkerContextEventListener.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(WORKERS)
-
-#include "V8WorkerContextEventListener.h"
-
-#include "V8Binding.h"
-#include "V8DOMWrapper.h"
-#include "V8Event.h"
-#include "WorkerContext.h"
-#include "WorkerContextExecutionProxy.h"
-
-namespace WebCore {
-
-static WorkerContextExecutionProxy* workerProxy(ScriptExecutionContext* context)
-{
- ASSERT(context->isWorkerContext());
- WorkerContext* workerContext = static_cast<WorkerContext*>(context);
- return workerContext->script()->proxy();
-}
-
-V8WorkerContextEventListener::V8WorkerContextEventListener(v8::Local<v8::Object> listener, bool isInline, const WorldContextHandle& worldContext)
- : V8EventListener(listener, isInline, worldContext)
-{
-}
-
-void V8WorkerContextEventListener::handleEvent(ScriptExecutionContext* context, Event* event)
-{
- if (!context)
- return;
-
- // The callback function on XMLHttpRequest can clear the event listener and destroys 'this' object. Keep a local reference to it.
- // See issue 889829.
- RefPtr<V8AbstractEventListener> protect(this);
-
- v8::HandleScope handleScope;
-
- WorkerContextExecutionProxy* proxy = workerProxy(context);
- if (!proxy)
- return;
-
- v8::Handle<v8::Context> v8Context = proxy->context();
- if (v8Context.IsEmpty())
- return;
-
- // Enter the V8 context in which to perform the event handling.
- v8::Context::Scope scope(v8Context);
-
- // Get the V8 wrapper for the event object.
- v8::Handle<v8::Value> jsEvent = toV8(event);
-
- invokeEventHandler(context, event, jsEvent);
-}
-
-v8::Local<v8::Value> V8WorkerContextEventListener::callListenerFunction(ScriptExecutionContext* context, v8::Handle<v8::Value> jsEvent, Event* event)
-{
- v8::Local<v8::Function> handlerFunction = getListenerFunction(context);
- v8::Local<v8::Object> receiver = getReceiverObject(context, event);
- if (handlerFunction.IsEmpty() || receiver.IsEmpty())
- return v8::Local<v8::Value>();
-
- v8::Handle<v8::Value> parameters[1] = { jsEvent };
- v8::Local<v8::Value> result = handlerFunction->Call(receiver, 1, parameters);
-
- if (WorkerContextExecutionProxy* proxy = workerProxy(context))
- proxy->trackEvent(event);
-
- return result;
-}
-
-v8::Local<v8::Object> V8WorkerContextEventListener::getReceiverObject(ScriptExecutionContext* context, Event* event)
-{
- v8::Local<v8::Object> listener = getListenerObject(context);
-
- if (!listener.IsEmpty() && !listener->IsFunction())
- return listener;
-
- EventTarget* target = event->currentTarget();
- v8::Handle<v8::Value> value = V8DOMWrapper::convertEventTargetToV8Object(target);
- if (value.IsEmpty())
- return v8::Local<v8::Object>();
- return v8::Local<v8::Object>::New(v8::Handle<v8::Object>::Cast(value));
-}
-
-} // namespace WebCore
-
-#endif // WORKERS
diff --git a/WebCore/bindings/v8/V8WorkerContextEventListener.h b/WebCore/bindings/v8/V8WorkerContextEventListener.h
deleted file mode 100644
index 1d0bfc8..0000000
--- a/WebCore/bindings/v8/V8WorkerContextEventListener.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8WorkerContextEventListener_h
-#define V8WorkerContextEventListener_h
-
-#if ENABLE(WORKERS)
-
-#include "V8CustomEventListener.h"
-#include <v8.h>
-#include <wtf/PassRefPtr.h>
-
-namespace WebCore {
-
- class Event;
- class WorkerContextExecutionProxy;
-
- class V8WorkerContextEventListener : public V8EventListener {
- public:
- static PassRefPtr<V8WorkerContextEventListener> create(v8::Local<v8::Object> listener, bool isInline, const WorldContextHandle& worldContext)
- {
- return adoptRef(new V8WorkerContextEventListener(listener, isInline, worldContext));
- }
-
- virtual void handleEvent(ScriptExecutionContext*, Event*);
-
- protected:
- V8WorkerContextEventListener(v8::Local<v8::Object> listener, bool isInline, const WorldContextHandle& worldContext);
-
- private:
- virtual v8::Local<v8::Value> callListenerFunction(ScriptExecutionContext*, v8::Handle<v8::Value> jsEvent, Event*);
- v8::Local<v8::Object> getReceiverObject(ScriptExecutionContext*, Event*);
- };
-
-} // namespace WebCore
-
-#endif // WORKERS
-
-#endif // V8WorkerContextEventListener_h
diff --git a/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp b/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
deleted file mode 100644
index cefb2fa..0000000
--- a/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-
-#include "config.h"
-
-#if ENABLE(WORKERS)
-
-#include "WorkerContextExecutionProxy.h"
-
-#include "DedicatedWorkerContext.h"
-#include "Event.h"
-#include "SharedWorker.h"
-#include "SharedWorkerContext.h"
-#include "V8Binding.h"
-#include "V8ConsoleMessage.h"
-#include "V8DOMMap.h"
-#include "V8DedicatedWorkerContext.h"
-#include "V8Proxy.h"
-#include "V8SharedWorkerContext.h"
-#include "Worker.h"
-#include "WorkerContext.h"
-#include "WorkerScriptController.h"
-#include "WrapperTypeInfo.h"
-
-namespace WebCore {
-
-static void reportFatalErrorInV8(const char* location, const char* message)
-{
- // FIXME: We temporarily deal with V8 internal error situations such as out-of-memory by crashing the worker.
- CRASH();
-}
-
-static void v8MessageHandler(v8::Handle<v8::Message> message, v8::Handle<v8::Value> data)
-{
- static bool isReportingException = false;
- // Exceptions that occur in error handler should be ignored since in that case
- // WorkerContext::reportException will send the exception to the worker object.
- if (isReportingException)
- return;
- isReportingException = true;
-
- // During the frame teardown, there may not be a valid context.
- if (ScriptExecutionContext* context = getScriptExecutionContext()) {
- String errorMessage = toWebCoreString(message->Get());
- int lineNumber = message->GetLineNumber();
- String sourceURL = toWebCoreString(message->GetScriptResourceName());
- context->reportException(errorMessage, lineNumber, sourceURL);
- }
-
- isReportingException = false;
-}
-
-WorkerContextExecutionProxy::WorkerContextExecutionProxy(WorkerContext* workerContext)
- : m_workerContext(workerContext)
- , m_recursion(0)
-{
- initV8IfNeeded();
-}
-
-WorkerContextExecutionProxy::~WorkerContextExecutionProxy()
-{
- dispose();
-}
-
-void WorkerContextExecutionProxy::dispose()
-{
- // Detach all events from their JS wrappers.
- for (size_t eventIndex = 0; eventIndex < m_events.size(); ++eventIndex) {
- Event* event = m_events[eventIndex];
- if (forgetV8EventObject(event))
- event->deref();
- }
- m_events.clear();
-
- // Dispose the context.
- if (!m_context.IsEmpty()) {
- m_context.Dispose();
- m_context.Clear();
- }
-}
-
-void WorkerContextExecutionProxy::initV8IfNeeded()
-{
- static bool v8Initialized = false;
-
- if (v8Initialized)
- return;
-
- // Tell V8 not to call the default OOM handler, binding code will handle it.
- v8::V8::IgnoreOutOfMemoryException();
- v8::V8::SetFatalErrorHandler(reportFatalErrorInV8);
-
- v8::ResourceConstraints resource_constraints;
- uint32_t here;
- resource_constraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uint32_t*));
- v8::SetResourceConstraints(&resource_constraints);
-
- v8Initialized = true;
-}
-
-bool WorkerContextExecutionProxy::initContextIfNeeded()
-{
- // Bail out if the context has already been initialized.
- if (!m_context.IsEmpty())
- return true;
-
- // Setup the security handlers and message listener. This only has
- // to be done once.
- static bool isV8Initialized = false;
- if (!isV8Initialized)
- v8::V8::AddMessageListener(&v8MessageHandler);
-
- // Create a new environment
- v8::Persistent<v8::ObjectTemplate> globalTemplate;
- m_context = v8::Context::New(0, globalTemplate);
- if (m_context.IsEmpty())
- return false;
-
- // Starting from now, use local context only.
- v8::Local<v8::Context> context = v8::Local<v8::Context>::New(m_context);
-
- v8::Context::Scope scope(context);
-
- // Create a new JS object and use it as the prototype for the shadow global object.
- WrapperTypeInfo* contextType = &V8DedicatedWorkerContext::info;
-#if ENABLE(SHARED_WORKERS)
- if (!m_workerContext->isDedicatedWorkerContext())
- contextType = &V8SharedWorkerContext::info;
-#endif
- v8::Handle<v8::Function> workerContextConstructor = V8DOMWrapper::getConstructorForContext(contextType, context);
- v8::Local<v8::Object> jsWorkerContext = SafeAllocation::newInstance(workerContextConstructor);
- // Bail out if allocation failed.
- if (jsWorkerContext.IsEmpty()) {
- dispose();
- return false;
- }
-
- // Wrap the object.
- V8DOMWrapper::setDOMWrapper(jsWorkerContext, contextType, m_workerContext);
-
- V8DOMWrapper::setJSWrapperForDOMObject(m_workerContext, v8::Persistent<v8::Object>::New(jsWorkerContext));
- m_workerContext->ref();
-
- // Insert the object instance as the prototype of the shadow object.
- v8::Handle<v8::Object> globalObject = v8::Handle<v8::Object>::Cast(m_context->Global()->GetPrototype());
- globalObject->SetPrototype(jsWorkerContext);
- return true;
-}
-
-bool WorkerContextExecutionProxy::forgetV8EventObject(Event* event)
-{
- if (getDOMObjectMap().contains(event)) {
- getDOMObjectMap().forget(event);
- return true;
- }
- return false;
-}
-
-ScriptValue WorkerContextExecutionProxy::evaluate(const String& script, const String& fileName, const TextPosition0& scriptStartPosition, WorkerContextExecutionState* state)
-{
- v8::HandleScope hs;
-
- if (!initContextIfNeeded())
- return ScriptValue();
-
- v8::Context::Scope scope(m_context);
-
- v8::TryCatch exceptionCatcher;
-
- v8::Local<v8::String> scriptString = v8ExternalString(script);
- v8::Handle<v8::Script> compiledScript = V8Proxy::compileScript(scriptString, fileName, scriptStartPosition);
- v8::Local<v8::Value> result = runScript(compiledScript);
-
- if (!exceptionCatcher.CanContinue())
- return ScriptValue();
-
- if (exceptionCatcher.HasCaught()) {
- v8::Local<v8::Message> message = exceptionCatcher.Message();
- state->hadException = true;
- state->exception = ScriptValue(exceptionCatcher.Exception());
- state->errorMessage = toWebCoreString(message->Get());
- state->lineNumber = message->GetLineNumber();
- state->sourceURL = toWebCoreString(message->GetScriptResourceName());
- exceptionCatcher.Reset();
- } else
- state->hadException = false;
-
- if (result.IsEmpty() || result->IsUndefined())
- return ScriptValue();
-
- return ScriptValue(result);
-}
-
-v8::Local<v8::Value> WorkerContextExecutionProxy::runScript(v8::Handle<v8::Script> script)
-{
- if (script.IsEmpty())
- return v8::Local<v8::Value>();
-
- // Compute the source string and prevent against infinite recursion.
- if (m_recursion >= kMaxRecursionDepth) {
- v8::Local<v8::String> code = v8ExternalString("throw RangeError('Recursion too deep')");
- script = V8Proxy::compileScript(code, "", TextPosition0::minimumPosition());
- }
-
- if (V8Proxy::handleOutOfMemory())
- ASSERT(script.IsEmpty());
-
- if (script.IsEmpty())
- return v8::Local<v8::Value>();
-
- // Run the script and keep track of the current recursion depth.
- v8::Local<v8::Value> result;
- {
- m_recursion++;
- result = script->Run();
- m_recursion--;
- }
-
- // Handle V8 internal error situation (Out-of-memory).
- if (result.IsEmpty())
- return v8::Local<v8::Value>();
-
- return result;
-}
-
-void WorkerContextExecutionProxy::trackEvent(Event* event)
-{
- m_events.append(event);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WORKERS)
diff --git a/WebCore/bindings/v8/WorkerContextExecutionProxy.h b/WebCore/bindings/v8/WorkerContextExecutionProxy.h
deleted file mode 100644
index e70c3d2..0000000
--- a/WebCore/bindings/v8/WorkerContextExecutionProxy.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 WorkerContextExecutionProxy_h
-#define WorkerContextExecutionProxy_h
-
-#if ENABLE(WORKERS)
-
-#include "ScriptValue.h"
-#include <v8.h>
-#include <wtf/text/TextPosition.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
- class Event;
- class EventTarget;
- class WorkerContext;
-
- struct WorkerContextExecutionState {
- WorkerContextExecutionState() : hadException(false), lineNumber(0) { }
-
- bool hadException;
- ScriptValue exception;
- String errorMessage;
- int lineNumber;
- String sourceURL;
- };
-
- class WorkerContextExecutionProxy {
- public:
- WorkerContextExecutionProxy(WorkerContext*);
- ~WorkerContextExecutionProxy();
-
- // Track the event so that we can detach it from the JS wrapper when a worker
- // terminates. This is needed because we need to be able to dispose these
- // events and releases references to their event targets: WorkerContext.
- void trackEvent(Event*);
-
- // Evaluate a script file in the current execution environment.
- ScriptValue evaluate(const String& script, const String& fileName, const TextPosition0& scriptStartPosition, WorkerContextExecutionState*);
-
- // Returns a local handle of the context.
- v8::Local<v8::Context> context() { return v8::Local<v8::Context>::New(m_context); }
-
- private:
- void initV8IfNeeded();
- bool initContextIfNeeded();
- void dispose();
-
- // Run an already compiled script.
- v8::Local<v8::Value> runScript(v8::Handle<v8::Script>);
-
- static bool forgetV8EventObject(Event*);
-
- static const int kWorkerMaxStackSize = 500 * 1024;
-
- WorkerContext* m_workerContext;
- v8::Persistent<v8::Context> m_context;
- int m_recursion;
-
- Vector<Event*> m_events;
- };
-
-} // namespace WebCore
-
-#endif // ENABLE(WORKERS)
-
-#endif // WorkerContextExecutionProxy_h
diff --git a/WebCore/bindings/v8/WorkerScriptController.cpp b/WebCore/bindings/v8/WorkerScriptController.cpp
deleted file mode 100644
index b56d383..0000000
--- a/WebCore/bindings/v8/WorkerScriptController.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(WORKERS)
-
-#include "WorkerScriptController.h"
-
-#include <v8.h>
-
-#include "ScriptSourceCode.h"
-#include "ScriptValue.h"
-#include "DOMTimer.h"
-#include "V8DOMMap.h"
-#include "V8Proxy.h"
-#include "V8WorkerContext.h"
-#include "WorkerContext.h"
-#include "WorkerContextExecutionProxy.h"
-#include "WorkerObjectProxy.h"
-#include "WorkerThread.h"
-
-namespace WebCore {
-
-WorkerScriptController::WorkerScriptController(WorkerContext* workerContext)
- : m_workerContext(workerContext)
- , m_proxy(new WorkerContextExecutionProxy(workerContext))
- , m_executionForbidden(false)
-{
-}
-
-WorkerScriptController::~WorkerScriptController()
-{
- removeAllDOMObjectsInCurrentThread();
-}
-
-ScriptValue WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode)
-{
- return evaluate(sourceCode, 0);
-}
-
-ScriptValue WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, ScriptValue* exception)
-{
- {
- MutexLocker lock(m_sharedDataMutex);
- if (m_executionForbidden)
- return ScriptValue();
- }
-
- WorkerContextExecutionState state;
- ScriptValue result = m_proxy->evaluate(sourceCode.source(), sourceCode.url().string(), WTF::toZeroBasedTextPosition(sourceCode.startPosition()), &state);
- if (state.hadException) {
- if (exception)
- *exception = state.exception;
- else
- m_workerContext->reportException(state.errorMessage, state.lineNumber, state.sourceURL);
- }
-
- return result;
-}
-
-void WorkerScriptController::forbidExecution(ForbidExecutionOption option)
-{
- // This function may be called from another thread.
- MutexLocker lock(m_sharedDataMutex);
- m_executionForbidden = true;
- if (option == TerminateRunningScript)
- v8::V8::TerminateExecution();
-}
-
-void WorkerScriptController::setException(ScriptValue exception)
-{
- throwError(*exception.v8Value());
-}
-
-WorkerScriptController* WorkerScriptController::controllerForContext()
-{
- // Happens on frame destruction, check otherwise GetCurrent() will crash.
- if (!v8::Context::InContext())
- return 0;
- v8::Handle<v8::Context> context = v8::Context::GetCurrent();
- v8::Handle<v8::Object> global = context->Global();
- global = V8DOMWrapper::lookupDOMWrapper(V8WorkerContext::GetTemplate(), global);
- // Return 0 if the current executing context is not the worker context.
- if (global.IsEmpty())
- return 0;
- WorkerContext* workerContext = V8WorkerContext::toNative(global);
- return workerContext->script();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WORKERS)
diff --git a/WebCore/bindings/v8/WorkerScriptController.h b/WebCore/bindings/v8/WorkerScriptController.h
deleted file mode 100644
index 5e3159f..0000000
--- a/WebCore/bindings/v8/WorkerScriptController.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 WorkerScriptController_h
-#define WorkerScriptController_h
-
-#if ENABLE(WORKERS)
-
-#include <wtf/OwnPtr.h>
-#include <wtf/Threading.h>
-
-namespace WebCore {
-
- class ScriptSourceCode;
- class ScriptValue;
- class WorkerContext;
- class WorkerContextExecutionProxy;
-
- class WorkerScriptController {
- public:
- WorkerScriptController(WorkerContext*);
- ~WorkerScriptController();
-
- WorkerContextExecutionProxy* proxy() { return m_executionForbidden ? 0 : m_proxy.get(); }
- WorkerContext* workerContext() { return m_workerContext; }
-
- ScriptValue evaluate(const ScriptSourceCode&);
- ScriptValue evaluate(const ScriptSourceCode&, ScriptValue* exception);
-
- void setException(ScriptValue);
-
- enum ForbidExecutionOption { TerminateRunningScript, LetRunningScriptFinish };
- void forbidExecution(ForbidExecutionOption);
- bool isExecutionForbidden() const { return m_executionForbidden; }
-
- // Returns WorkerScriptController for the currently executing context. 0 will be returned if the current executing context is not the worker context.
- static WorkerScriptController* controllerForContext();
-
- private:
- WorkerContext* m_workerContext;
- OwnPtr<WorkerContextExecutionProxy> m_proxy;
-
- Mutex m_sharedDataMutex;
- bool m_executionForbidden;
- };
-
-} // namespace WebCore
-
-#endif // ENABLE(WORKERS)
-
-#endif // WorkerScriptController_h
diff --git a/WebCore/bindings/v8/WorldContextHandle.cpp b/WebCore/bindings/v8/WorldContextHandle.cpp
deleted file mode 100644
index 24f461f..0000000
--- a/WebCore/bindings/v8/WorldContextHandle.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "WorldContextHandle.h"
-
-#include "V8IsolatedContext.h"
-
-namespace WebCore {
-
-WorldContextHandle::WorldContextHandle(WorldToUse worldToUse)
- : m_worldToUse(worldToUse)
-{
- if (worldToUse == UseMainWorld)
- return;
-
- if (V8IsolatedContext* context = V8IsolatedContext::getEntered())
- m_context = context->sharedContext();
-}
-
-v8::Local<v8::Context> WorldContextHandle::adjustedContext(V8Proxy* proxy) const
-{
- if (m_worldToUse == UseMainWorld || !m_context || m_context->get().IsEmpty())
- return proxy->mainWorldContext();
-
- return v8::Local<v8::Context>::New(m_context->get());
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/WorldContextHandle.h b/WebCore/bindings/v8/WorldContextHandle.h
deleted file mode 100644
index ad0983e..0000000
--- a/WebCore/bindings/v8/WorldContextHandle.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 WorldContextHandle_h
-#define WorldContextHandle_h
-
-#include "SharedPersistent.h"
-
-#include <v8.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-class V8Proxy;
-
-enum WorldToUse { UseMainWorld, UseCurrentWorld };
-
-class WorldContextHandle {
-public:
- WorldContextHandle(WorldToUse);
- v8::Local<v8::Context> adjustedContext(V8Proxy*) const;
-
-private:
- WorldToUse m_worldToUse;
- RefPtr<SharedPersistent<v8::Context> > m_context;
-};
-
-} // namespace WebCore
-
-#endif // WorldContextHandle_h
diff --git a/WebCore/bindings/v8/WrapperTypeInfo.h b/WebCore/bindings/v8/WrapperTypeInfo.h
deleted file mode 100644
index 1d1cbfd..0000000
--- a/WebCore/bindings/v8/WrapperTypeInfo.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 WrapperTypeInfo_h
-#define WrapperTypeInfo_h
-
-#include <v8.h>
-
-namespace WebCore {
-
- class ActiveDOMObject;
-
- static const int v8DOMWrapperTypeIndex = 0;
- static const int v8DOMWrapperObjectIndex = 1;
- static const int v8DOMHiddenReferenceArrayIndex = 2;
- static const int v8DefaultWrapperInternalFieldCount = 3;
-
- typedef v8::Persistent<v8::FunctionTemplate> (*GetTemplateFunction)();
- typedef void (*DerefObjectFunction)(void*);
- typedef ActiveDOMObject* (*ToActiveDOMObjectFunction)(v8::Handle<v8::Object>);
-
- // This struct provides a way to store a bunch of information that is helpful when unwrapping
- // v8 objects. Each v8 bindings class has exactly one static WrapperTypeInfo member, so
- // comparing pointers is a safe way to determine if types match.
- struct WrapperTypeInfo {
-
- static WrapperTypeInfo* unwrap(v8::Handle<v8::Value> typeInfoWrapper)
- {
- return reinterpret_cast<WrapperTypeInfo*>(v8::External::Unwrap(typeInfoWrapper));
- }
-
-
- bool equals(const WrapperTypeInfo* that) const
- {
- return this == that;
- }
-
- v8::Persistent<v8::FunctionTemplate> getTemplate() { return getTemplateFunction(); }
-
- void derefObject(void* object)
- {
- if (derefObjectFunction)
- derefObjectFunction(object);
- }
-
- ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object> object)
- {
- if (!toActiveDOMObjectFunction)
- return 0;
- return toActiveDOMObjectFunction(object);
- }
-
- const GetTemplateFunction getTemplateFunction;
- const DerefObjectFunction derefObjectFunction;
- const ToActiveDOMObjectFunction toActiveDOMObjectFunction;
- };
-}
-
-#endif // WrapperTypeInfo_h
diff --git a/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp b/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp
deleted file mode 100644
index 99edc8b..0000000
--- a/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
-#include "ArrayBuffer.h"
-
-#include "ExceptionCode.h"
-#include "V8Binding.h"
-#include "V8ArrayBuffer.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8ArrayBuffer::constructorCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.ArrayBuffer.Constructor");
-
- if (!args.IsConstructCall())
- return throwError("DOM object constructor cannot be called as a function.", V8Proxy::SyntaxError);
-
- // If we return a previously constructed ArrayBuffer,
- // e.g. from the call to ArrayBufferView.buffer, this code is called
- // with a zero-length argument list. The V8DOMWrapper will then
- // set the internal pointer in the newly-created object.
- // Unfortunately it doesn't look like it's possible to distinguish
- // between this case and that where the user calls "new
- // ArrayBuffer()" from JavaScript. To guard against problems,
- // we always create at least a zero-length ArrayBuffer, even
- // if it is immediately overwritten by the V8DOMWrapper.
-
- // Supported constructors:
- // ArrayBuffer(n) where n is an integer:
- // -- create an empty buffer of n bytes
-
- int argLength = args.Length();
- int length = 0;
- if (argLength > 0)
- length = toInt32(args[0]); // NaN/+inf/-inf returns 0, this is intended by WebIDL
- RefPtr<ArrayBuffer> buffer;
- if (length >= 0)
- buffer = ArrayBuffer::create(static_cast<unsigned>(length), 1);
- if (!buffer.get())
- return throwError("ArrayBuffer size is not a small enough positive integer.", V8Proxy::RangeError);
- // Transform the holder into a wrapper object for the array.
- V8DOMWrapper::setDOMWrapper(args.Holder(), &info, buffer.get());
- return toV8(buffer.release(), args.Holder());
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h b/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h
deleted file mode 100644
index 6881a01..0000000
--- a/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8ArrayBufferViewCustom_h
-#define V8ArrayBufferViewCustom_h
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
-#include "ArrayBuffer.h"
-
-#include "V8ArrayBuffer.h"
-#include "V8Binding.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-// Template function used by the ArrayBufferView*Constructor callbacks.
-template<class ArrayClass, class ElementType>
-v8::Handle<v8::Value> constructWebGLArrayWithArrayBufferArgument(const v8::Arguments& args, WrapperTypeInfo* type, v8::ExternalArrayType arrayType, bool hasIndexer)
-{
- ArrayBuffer* buf = V8ArrayBuffer::toNative(args[0]->ToObject());
- if (!buf)
- return throwError("Could not convert argument 0 to a ArrayBuffer");
- bool ok;
- uint32_t offset = 0;
- int argLen = args.Length();
- if (argLen > 1) {
- offset = toUInt32(args[1], ok);
- if (!ok)
- return throwError("Could not convert argument 1 to a number");
- }
- if ((buf->byteLength() - offset) % sizeof(ElementType))
- return throwError("ArrayBuffer length minus the byteOffset is not a multiple of the element size.", V8Proxy::RangeError);
- uint32_t length = (buf->byteLength() - offset) / sizeof(ElementType);
- if (argLen > 2) {
- length = toUInt32(args[2], ok);
- if (!ok)
- return throwError("Could not convert argument 2 to a number");
- }
-
- RefPtr<ArrayClass> array = ArrayClass::create(buf, offset, length);
- if (!array) {
- V8Proxy::setDOMException(INDEX_SIZE_ERR);
- return notHandledByInterceptor();
- }
- // Transform the holder into a wrapper object for the array.
- V8DOMWrapper::setDOMWrapper(args.Holder(), type, array.get());
- if (hasIndexer)
- args.Holder()->SetIndexedPropertiesToExternalArrayData(array.get()->baseAddress(), arrayType, array.get()->length());
- return toV8(array.release(), args.Holder());
-}
-
-// Template function used by the ArrayBufferView*Constructor callbacks.
-template<class ArrayClass, class ElementType>
-v8::Handle<v8::Value> constructWebGLArray(const v8::Arguments& args, WrapperTypeInfo* type, v8::ExternalArrayType arrayType)
-{
- if (!args.IsConstructCall())
- return throwError("DOM object constructor cannot be called as a function.");
-
- int argLen = args.Length();
- if (!argLen) {
- // This happens when we return a previously constructed
- // ArrayBufferView, e.g. from the call to <Type>Array.slice().
- // The V8DOMWrapper will set the internal pointer in the
- // created object. Unfortunately it doesn't look like it's
- // possible to distinguish between this case and that where
- // the user calls "new <Type>Array()" from JavaScript. We must
- // construct an empty view to avoid crashes when fetching the
- // length.
- RefPtr<ArrayClass> array = ArrayClass::create(0);
- // Transform the holder into a wrapper object for the array.
- V8DOMWrapper::setDOMWrapper(args.Holder(), type, array.get());
- // Do not call SetIndexedPropertiesToExternalArrayData on this
- // object. Not only is there no point from a performance
- // perspective, but doing so causes errors in the slice() case.
- return toV8(array.release(), args.Holder());
- }
-
- // Supported constructors:
- // WebGL<T>Array(n) where n is an integer:
- // -- create an empty array of n elements
- // WebGL<T>Array(arr) where arr is an array:
- // -- create a WebGL<T>Array containing the contents of "arr"
- // WebGL<T>Array(buf, offset, length)
- // -- create a WebGL<T>Array pointing to the ArrayBuffer
- // "buf", starting at the specified offset, for the given
- // length
-
- if (args[0]->IsNull()) {
- // Invalid first argument
- // FIXME: use forthcoming V8Proxy::throwTypeError().
- return V8Proxy::throwError(V8Proxy::TypeError, "Type error");
- }
-
- // See whether the first argument is a ArrayBuffer.
- if (V8ArrayBuffer::HasInstance(args[0]))
- return constructWebGLArrayWithArrayBufferArgument<ArrayClass, ElementType>(args, type, arrayType, true);
-
- uint32_t len = 0;
- v8::Handle<v8::Object> srcArray;
- bool doInstantiation = false;
-
- if (args[0]->IsObject()) {
- srcArray = args[0]->ToObject();
- if (srcArray.IsEmpty())
- return throwError("Could not convert argument 0 to an array");
- len = toUInt32(srcArray->Get(v8::String::New("length")));
- doInstantiation = true;
- } else {
- bool ok = false;
- int32_t tempLength = toInt32(args[0], ok); // NaN/+inf/-inf returns 0, this is intended by WebIDL
- if (ok && tempLength >= 0) {
- len = static_cast<uint32_t>(tempLength);
- doInstantiation = true;
- }
- }
-
- RefPtr<ArrayClass> array;
- if (doInstantiation)
- array = ArrayClass::create(len);
- if (!array.get())
- return throwError("ArrayBufferView size is not a small enough positive integer.", V8Proxy::RangeError);
-
- if (!srcArray.IsEmpty()) {
- // Need to copy the incoming array into the newly created ArrayBufferView.
- for (unsigned i = 0; i < len; i++) {
- v8::Local<v8::Value> val = srcArray->Get(v8::Integer::NewFromUnsigned(i));
- array->set(i, val->NumberValue());
- }
- }
-
- // Transform the holder into a wrapper object for the array.
- V8DOMWrapper::setDOMWrapper(args.Holder(), type, array.get());
- args.Holder()->SetIndexedPropertiesToExternalArrayData(array.get()->baseAddress(), arrayType, array.get()->length());
- return toV8(array.release(), args.Holder());
-}
-
-template <class CPlusPlusArrayType, class JavaScriptWrapperArrayType>
-v8::Handle<v8::Value> setWebGLArrayHelper(const v8::Arguments& args)
-{
- if (args.Length() < 1) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
-
- CPlusPlusArrayType* impl = JavaScriptWrapperArrayType::toNative(args.Holder());
-
- if (JavaScriptWrapperArrayType::HasInstance(args[0])) {
- // void set(in WebGL<T>Array array, [Optional] in unsigned long offset);
- CPlusPlusArrayType* src = JavaScriptWrapperArrayType::toNative(args[0]->ToObject());
- uint32_t offset = 0;
- if (args.Length() == 2)
- offset = toUInt32(args[1]);
- ExceptionCode ec = 0;
- impl->set(src, offset, ec);
- V8Proxy::setDOMException(ec);
- return v8::Undefined();
- }
-
- if (args[0]->IsObject()) {
- // void set(in sequence<long> array, [Optional] in unsigned long offset);
- v8::Local<v8::Object> array = args[0]->ToObject();
- uint32_t offset = 0;
- if (args.Length() == 2)
- offset = toUInt32(args[1]);
- uint32_t length = toUInt32(array->Get(v8::String::New("length")));
- if (offset > impl->length()
- || offset + length > impl->length()
- || offset + length < offset)
- // Out of range offset or overflow
- V8Proxy::setDOMException(INDEX_SIZE_ERR);
- else
- for (uint32_t i = 0; i < length; i++)
- impl->set(offset + i, array->Get(v8::Integer::NewFromUnsigned(i))->NumberValue());
-
- return v8::Undefined();
- }
-
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
-}
-
-}
-
-#endif // ENABLE(3D_CANVAS)
-
-#endif // V8ArrayBufferViewCustom_h
diff --git a/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp b/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp
deleted file mode 100644
index e1a1ba4..0000000
--- a/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2010, Google 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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.
- */
-
-#include "config.h"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "V8AudioContext.h"
-
-#include "AudioContext.h"
-#include "Frame.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8AudioContext::constructorCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.AudioContext.Contructor");
-
- Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
- if (!frame)
- return throwError("AudioContext constructor associated frame is unavailable", V8Proxy::ReferenceError);
-
- Document* document = frame->document();
- if (!document)
- return throwError("AudioContext constructor associated document is unavailable", V8Proxy::ReferenceError);
-
- RefPtr<AudioContext> audioContext = AudioContext::create(document);
-
- // Transform the holder into a wrapper object for the audio context.
- V8DOMWrapper::setDOMWrapper(args.Holder(), &info, audioContext.get());
- audioContext->ref();
-
- return args.Holder();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/WebCore/bindings/v8/custom/V8AudioNodeCustom.cpp b/WebCore/bindings/v8/custom/V8AudioNodeCustom.cpp
deleted file mode 100644
index 924b2ce..0000000
--- a/WebCore/bindings/v8/custom/V8AudioNodeCustom.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2010, Google 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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.
- */
-
-#include "config.h"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "V8AudioNode.h"
-
-#include "AudioNode.h"
-#include "ExceptionCode.h"
-#include "NotImplemented.h"
-#include "V8Binding.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8AudioNode::connectCallback(const v8::Arguments& args)
-{
- if (args.Length() < 1)
- return throwError("Not enough arguments", V8Proxy::SyntaxError);
-
- AudioNode* destinationNode = toNative(args[0]->ToObject());
- if (!destinationNode)
- return throwError("Invalid destination node", V8Proxy::SyntaxError);
-
- unsigned output = 0;
- unsigned input = 0;
- bool ok = false;
- if (args.Length() > 1) {
- output = toInt32(args[1], ok);
- if (!ok)
- return throwError("Invalid index parameters", V8Proxy::SyntaxError);
- }
-
- if (args.Length() > 2) {
- input = toInt32(args[2], ok);
- if (!ok)
- return throwError("Invalid index parameters", V8Proxy::SyntaxError);
- }
-
- AudioNode* audioNode = toNative(args.Holder());
- bool success = audioNode->connect(destinationNode, output, input);
- if (!success)
- return throwError("Invalid index parameter", V8Proxy::SyntaxError);
-
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8AudioNode::disconnectCallback(const v8::Arguments& args)
-{
- unsigned output = 0;
- bool ok = false;
- if (args.Length() > 0) {
- output = toInt32(args[0], ok);
- if (!ok)
- return throwError("Invalid index parameters", V8Proxy::SyntaxError);
- }
-
- AudioNode* audioNode = toNative(args.Holder());
- bool success = audioNode->disconnect(output);
- if (!success)
- return throwError("Invalid index parameter", V8Proxy::SyntaxError);
-
- return v8::Undefined();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/WebCore/bindings/v8/custom/V8BindingMacros.h b/WebCore/bindings/v8/custom/V8BindingMacros.h
deleted file mode 100644
index ad02c3e..0000000
--- a/WebCore/bindings/v8/custom/V8BindingMacros.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#define EXCEPTION_BLOCK(type, var, value) \
- type var; \
- { \
- v8::TryCatch block; \
- var = (value); \
- if (block.HasCaught()) \
- return block.ReThrow(); \
- }
-
-#define STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(type, var, value) \
- type var(value); \
- if (!var.prepare()) \
- return v8::Undefined();
-
-#define STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(type, var, value) \
- type var(value); \
- if (!var.prepare()) \
- return;
diff --git a/WebCore/bindings/v8/custom/V8CSSRuleCustom.cpp b/WebCore/bindings/v8/custom/V8CSSRuleCustom.cpp
deleted file mode 100644
index 0dfd954..0000000
--- a/WebCore/bindings/v8/custom/V8CSSRuleCustom.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8CSSRule.h"
-
-#include "V8CSSCharsetRule.h"
-#include "V8CSSFontFaceRule.h"
-#include "V8CSSImportRule.h"
-#include "V8CSSMediaRule.h"
-#include "V8CSSPageRule.h"
-#include "V8CSSStyleRule.h"
-#include "V8WebKitCSSKeyframeRule.h"
-#include "V8WebKitCSSKeyframesRule.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> toV8(CSSRule* impl)
-{
- if (!impl)
- return v8::Null();
- switch (impl->type()) {
- case CSSRule::STYLE_RULE:
- return toV8(static_cast<CSSStyleRule*>(impl));
- case CSSRule::CHARSET_RULE:
- return toV8(static_cast<CSSCharsetRule*>(impl));
- case CSSRule::IMPORT_RULE:
- return toV8(static_cast<CSSImportRule*>(impl));
- case CSSRule::MEDIA_RULE:
- return toV8(static_cast<CSSMediaRule*>(impl));
- case CSSRule::FONT_FACE_RULE:
- return toV8(static_cast<CSSFontFaceRule*>(impl));
- case CSSRule::PAGE_RULE:
- return toV8(static_cast<CSSPageRule*>(impl));
- case CSSRule::WEBKIT_KEYFRAME_RULE:
- return toV8(static_cast<WebKitCSSKeyframeRule*>(impl));
- case CSSRule::WEBKIT_KEYFRAMES_RULE:
- return toV8(static_cast<WebKitCSSKeyframesRule*>(impl));
- }
- return V8CSSRule::wrap(impl);
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp b/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp
deleted file mode 100644
index 850ae14..0000000
--- a/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright (C) 2007-2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8CSSStyleDeclaration.h"
-
-#include "CSSParser.h"
-#include "CSSStyleDeclaration.h"
-#include "CSSValue.h"
-#include "CSSPrimitiveValue.h"
-#include "EventTarget.h"
-
-#include "V8Binding.h"
-#include "V8Proxy.h"
-
-#include <wtf/ASCIICType.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-#include <wtf/StdLibExtras.h>
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-// FIXME: Next two functions look lifted verbatim from JSCSSStyleDeclarationCustom. Please remove duplication.
-
-// Check for a CSS prefix.
-// Passed prefix is all lowercase.
-// First character of the prefix within the property name may be upper or lowercase.
-// Other characters in the prefix within the property name must be lowercase.
-// The prefix within the property name must be followed by a capital letter.
-static bool hasCSSPropertyNamePrefix(const String& propertyName, const char* prefix)
-{
-#ifndef NDEBUG
- ASSERT(*prefix);
- for (const char* p = prefix; *p; ++p)
- ASSERT(WTF::isASCIILower(*p));
- ASSERT(propertyName.length());
-#endif
-
- if (WTF::toASCIILower(propertyName[0]) != prefix[0])
- return false;
-
- unsigned length = propertyName.length();
- for (unsigned i = 1; i < length; ++i) {
- if (!prefix[i])
- return WTF::isASCIIUpper(propertyName[i]);
- if (propertyName[i] != prefix[i])
- return false;
- }
- return false;
-}
-
-class CSSPropertyInfo {
-public:
- int propID;
- bool hadPixelOrPosPrefix;
- bool wasFilter;
-};
-
-// When getting properties on CSSStyleDeclarations, the name used from
-// Javascript and the actual name of the property are not the same, so
-// we have to do the following translation. The translation turns upper
-// case characters into lower case characters and inserts dashes to
-// separate words.
-//
-// Example: 'backgroundPositionY' -> 'background-position-y'
-//
-// Also, certain prefixes such as 'pos', 'css-' and 'pixel-' are stripped
-// and the hadPixelOrPosPrefix out parameter is used to indicate whether or
-// not the property name was prefixed with 'pos-' or 'pixel-'.
-static CSSPropertyInfo* cssPropertyInfo(v8::Handle<v8::String>v8PropertyName)
-{
- String propertyName = toWebCoreString(v8PropertyName);
- typedef HashMap<String, CSSPropertyInfo*> CSSPropertyInfoMap;
- DEFINE_STATIC_LOCAL(CSSPropertyInfoMap, map, ());
- CSSPropertyInfo* propInfo = map.get(propertyName);
- if (!propInfo) {
- unsigned length = propertyName.length();
- bool hadPixelOrPosPrefix = false;
- if (!length)
- return 0;
-
- Vector<UChar> name;
- name.reserveCapacity(length);
-
- unsigned i = 0;
-
- if (hasCSSPropertyNamePrefix(propertyName, "css"))
- i += 3;
- else if (hasCSSPropertyNamePrefix(propertyName, "pixel")) {
- i += 5;
- hadPixelOrPosPrefix = true;
- } else if (hasCSSPropertyNamePrefix(propertyName, "pos")) {
- i += 3;
- hadPixelOrPosPrefix = true;
- } else if (hasCSSPropertyNamePrefix(propertyName, "webkit")
- || hasCSSPropertyNamePrefix(propertyName, "khtml")
- || hasCSSPropertyNamePrefix(propertyName, "apple"))
- name.append('-');
- else if (WTF::isASCIIUpper(propertyName[0]))
- return 0;
-
- name.append(WTF::toASCIILower(propertyName[i++]));
-
- for (; i < length; ++i) {
- UChar c = propertyName[i];
- if (!WTF::isASCIIUpper(c))
- name.append(c);
- else {
- name.append('-');
- name.append(WTF::toASCIILower(c));
- }
- }
-
- String propName = String::adopt(name);
- int propertyID = cssPropertyID(propName);
- if (propertyID) {
- propInfo = new CSSPropertyInfo();
- propInfo->hadPixelOrPosPrefix = hadPixelOrPosPrefix;
- propInfo->wasFilter = (propName == "filter");
- propInfo->propID = propertyID;
- map.add(propertyName, propInfo);
- }
- }
- return propInfo;
-}
-
-v8::Handle<v8::Value> V8CSSStyleDeclaration::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.CSSStyleDeclaration.NamedPropertyGetter");
- // First look for API defined attributes on the style declaration object.
- if (info.Holder()->HasRealNamedCallbackProperty(name))
- return notHandledByInterceptor();
-
- // Search the style declaration.
- CSSStyleDeclaration* imp = V8CSSStyleDeclaration::toNative(info.Holder());
- CSSPropertyInfo* propInfo = cssPropertyInfo(name);
-
- // Do not handle non-property names.
- if (!propInfo)
- return notHandledByInterceptor();
-
-
- RefPtr<CSSValue> cssValue = imp->getPropertyCSSValue(propInfo->propID);
- if (cssValue) {
- if (propInfo->hadPixelOrPosPrefix &&
- cssValue->cssValueType() == CSSValue::CSS_PRIMITIVE_VALUE) {
- return v8::Number::New(static_cast<CSSPrimitiveValue*>(
- cssValue.get())->getFloatValue(CSSPrimitiveValue::CSS_PX));
- }
- return v8StringOrNull(cssValue->cssText());
- }
-
- String result = imp->getPropertyValue(propInfo->propID);
- if (result.isNull())
- result = ""; // convert null to empty string.
-
- // The 'filter' attribute is made undetectable in KJS/WebKit
- // to avoid confusion with IE's filter extension.
- if (propInfo->wasFilter)
- return v8UndetectableString(result);
-
- return v8String(result);
-}
-
-v8::Handle<v8::Value> V8CSSStyleDeclaration::namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.CSSStyleDeclaration.NamedPropertySetter");
- CSSStyleDeclaration* imp = V8CSSStyleDeclaration::toNative(info.Holder());
- CSSPropertyInfo* propInfo = cssPropertyInfo(name);
- if (!propInfo)
- return notHandledByInterceptor();
-
- String propertyValue = toWebCoreStringWithNullCheck(value);
- if (propInfo->hadPixelOrPosPrefix)
- propertyValue.append("px");
-
- ExceptionCode ec = 0;
- int importantIndex = propertyValue.find("!important", 0, false);
- bool important = false;
- if (importantIndex != -1) {
- important = true;
- propertyValue = propertyValue.left(importantIndex - 1);
- }
- imp->setProperty(propInfo->propID, propertyValue, important, ec);
-
- if (ec)
- throwError(ec);
-
- return value;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8CSSStyleSheetCustom.cpp b/WebCore/bindings/v8/custom/V8CSSStyleSheetCustom.cpp
deleted file mode 100644
index 9effca3..0000000
--- a/WebCore/bindings/v8/custom/V8CSSStyleSheetCustom.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8CSSStyleSheet.h"
-
-#include "V8DOMWrapper.h"
-#include "V8Node.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> toV8(CSSStyleSheet* impl)
-{
- if (!impl)
- return v8::Null();
- v8::Handle<v8::Object> wrapper = V8CSSStyleSheet::wrap(impl);
- // Add a hidden reference from stylesheet object to its owner node.
- Node* ownerNode = impl->ownerNode();
- if (ownerNode && !wrapper.IsEmpty())
- V8DOMWrapper::setHiddenReference(wrapper, toV8(ownerNode));
- return wrapper;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8CSSValueCustom.cpp b/WebCore/bindings/v8/custom/V8CSSValueCustom.cpp
deleted file mode 100644
index 601a62a..0000000
--- a/WebCore/bindings/v8/custom/V8CSSValueCustom.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8CSSValue.h"
-
-#include "V8CSSPrimitiveValue.h"
-#include "V8CSSValueList.h"
-#include "V8WebKitCSSTransformValue.h"
-
-#if ENABLE(SVG)
-#include "V8SVGColor.h"
-#include "V8SVGPaint.h"
-#endif
-
-namespace WebCore {
-
-v8::Handle<v8::Value> toV8(CSSValue* impl)
-{
- if (!impl)
- return v8::Null();
- if (impl->isWebKitCSSTransformValue())
- return toV8(static_cast<WebKitCSSTransformValue*>(impl));
- if (impl->isValueList())
- return toV8(static_cast<CSSValueList*>(impl));
- if (impl->isPrimitiveValue())
- return toV8(static_cast<CSSPrimitiveValue*>(impl));
-#if ENABLE(SVG)
- if (impl->isSVGPaint())
- return toV8(static_cast<SVGPaint*>(impl));
- if (impl->isSVGColor())
- return toV8(static_cast<SVGColor*>(impl));
-#endif
- return V8CSSValue::wrap(impl);
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8CanvasPixelArrayCustom.cpp b/WebCore/bindings/v8/custom/V8CanvasPixelArrayCustom.cpp
deleted file mode 100644
index 91e39b7..0000000
--- a/WebCore/bindings/v8/custom/V8CanvasPixelArrayCustom.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8CanvasPixelArray.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> toV8(CanvasPixelArray* impl)
-{
- if (!impl)
- return v8::Null();
- v8::Handle<v8::Object> wrapper = V8CanvasPixelArray::wrap(impl);
- if (!wrapper.IsEmpty()) {
- wrapper->SetIndexedPropertiesToPixelData(impl->data()->data(), impl->length());
- wrapper->Set(v8::String::NewSymbol("length"),
- v8::Integer::New(impl->length()),
- v8::ReadOnly);
- }
- return wrapper;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp b/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
deleted file mode 100644
index 3491170..0000000
--- a/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8CanvasRenderingContext2D.h"
-
-#include "CanvasGradient.h"
-#include "CanvasRenderingContext2D.h"
-#include "CanvasPattern.h"
-#include "CanvasStyle.h"
-#include "ExceptionCode.h"
-#include "FloatRect.h"
-
-#include "V8Binding.h"
-#include "V8CanvasGradient.h"
-#include "V8CanvasPattern.h"
-#include "V8HTMLCanvasElement.h"
-#include "V8HTMLImageElement.h"
-#include "V8HTMLVideoElement.h"
-#include "V8ImageData.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-static v8::Handle<v8::Value> toV8Object(CanvasStyle* style)
-{
- if (style->canvasGradient())
- return toV8(style->canvasGradient());
-
- if (style->canvasPattern())
- return toV8(style->canvasPattern());
-
- return v8String(style->color());
-}
-
-static PassRefPtr<CanvasStyle> toCanvasStyle(v8::Handle<v8::Value> value)
-{
- if (value->IsString())
- return CanvasStyle::createFromString(toWebCoreString(value));
-
- if (V8CanvasGradient::HasInstance(value))
- return CanvasStyle::createFromGradient(V8CanvasGradient::toNative(v8::Handle<v8::Object>::Cast(value)));
-
- if (V8CanvasPattern::HasInstance(value))
- return CanvasStyle::createFromPattern(V8CanvasPattern::toNative(v8::Handle<v8::Object>::Cast(value)));
-
- return 0;
-}
-
-v8::Handle<v8::Value> V8CanvasRenderingContext2D::strokeStyleAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- CanvasRenderingContext2D* impl = V8CanvasRenderingContext2D::toNative(info.Holder());
- return toV8Object(impl->strokeStyle());
-}
-
-void V8CanvasRenderingContext2D::strokeStyleAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- CanvasRenderingContext2D* impl = V8CanvasRenderingContext2D::toNative(info.Holder());
- impl->setStrokeStyle(toCanvasStyle(value));
-}
-
-v8::Handle<v8::Value> V8CanvasRenderingContext2D::fillStyleAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- CanvasRenderingContext2D* impl = V8CanvasRenderingContext2D::toNative(info.Holder());
- return toV8Object(impl->fillStyle());
-}
-
-void V8CanvasRenderingContext2D::fillStyleAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- CanvasRenderingContext2D* impl = V8CanvasRenderingContext2D::toNative(info.Holder());
- impl->setFillStyle(toCanvasStyle(value));
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp b/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp
deleted file mode 100644
index d85d7a0..0000000
--- a/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 2007-2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8Clipboard.h"
-
-#include "Clipboard.h"
-#include "HTMLImageElement.h"
-#include "HTMLNames.h"
-#include "IntPoint.h"
-#include "Node.h"
-#include "Element.h"
-
-#include "V8Binding.h"
-#include "V8Node.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8Clipboard::typesAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.Clipboard.types()");
- Clipboard* clipboard = V8Clipboard::toNative(info.Holder());
-
- HashSet<String> types = clipboard->types();
- if (types.isEmpty())
- return v8::Null();
-
- v8::Local<v8::Array> result = v8::Array::New(types.size());
- HashSet<String>::const_iterator end = types.end();
- int index = 0;
- for (HashSet<String>::const_iterator it = types.begin(); it != end; ++it, ++index)
- result->Set(v8::Integer::New(index), v8String(*it));
-
- return result;
-}
-
-v8::Handle<v8::Value> V8Clipboard::clearDataCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Clipboard.clearData()");
- Clipboard* clipboard = V8Clipboard::toNative(args.Holder());
-
- if (!args.Length()) {
- clipboard->clearAllData();
- return v8::Undefined();
- }
-
- if (args.Length() != 1)
- return throwError("clearData: Invalid number of arguments", V8Proxy::SyntaxError);
-
- String type = toWebCoreString(args[0]);
- clipboard->clearData(type);
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Clipboard::getDataCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Clipboard.getData()");
- Clipboard* clipboard = V8Clipboard::toNative(args.Holder());
-
- if (args.Length() != 1)
- return throwError("getData: Invalid number of arguments", V8Proxy::SyntaxError);
-
- bool success;
- String result = clipboard->getData(toWebCoreString(args[0]), success);
- if (success)
- return v8String(result);
-
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Clipboard::setDragImageCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Clipboard.setDragImage()");
- Clipboard* clipboard = V8Clipboard::toNative(args.Holder());
-
- if (!clipboard->isForDragAndDrop())
- return v8::Undefined();
-
- if (args.Length() != 3)
- return throwError("setDragImage: Invalid number of arguments", V8Proxy::SyntaxError);
-
- int x = toInt32(args[1]);
- int y = toInt32(args[2]);
-
- Node* node = 0;
- if (V8Node::HasInstance(args[0]))
- node = V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0]));
-
- if (!node || !node->isElementNode())
- return throwError("setDragImageFromElement: Invalid first argument");
-
- if (static_cast<Element*>(node)->hasLocalName(HTMLNames::imgTag) && !node->inDocument())
- clipboard->setDragImage(static_cast<HTMLImageElement*>(node)->cachedImage(), IntPoint(x, y));
- else
- clipboard->setDragImageElement(node, IntPoint(x, y));
-
- return v8::Undefined();
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp b/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp
deleted file mode 100644
index e21354e..0000000
--- a/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#include "V8Console.h"
-
-#include "Console.h"
-#include "ScriptArguments.h"
-#include "ScriptCallStack.h"
-#include "ScriptCallStackFactory.h"
-#include "ScriptProfile.h"
-#include "V8Binding.h"
-#include "V8BindingMacros.h"
-#include "V8Proxy.h"
-#include "V8ScriptProfile.h"
-
-namespace WebCore {
-
-typedef Vector<RefPtr<ScriptProfile> > ProfilesArray;
-
-#if ENABLE(JAVASCRIPT_DEBUGGER)
-v8::Handle<v8::Value> V8Console::profilesAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.Console.profilesAccessorGetter");
- Console* imp = V8Console::toNative(info.Holder());
- const ProfilesArray& profiles = imp->profiles();
- v8::Handle<v8::Array> result = v8::Array::New(profiles.size());
- int index = 0;
- ProfilesArray::const_iterator end = profiles.end();
- for (ProfilesArray::const_iterator iter = profiles.begin(); iter != end; ++iter)
- result->Set(v8::Integer::New(index++), toV8(iter->get()));
- return result;
-}
-#endif
-
-v8::Handle<v8::Value> V8Console::traceCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Console.traceCallback");
- Console* imp = V8Console::toNative(args.Holder());
- RefPtr<ScriptCallStack> callStack(createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture));
- RefPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 0));
- imp->trace(scriptArguments.release(), callStack);
- return v8::Handle<v8::Value>();
-}
-
-v8::Handle<v8::Value> V8Console::assertCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Console.assertCallback");
- Console* imp = V8Console::toNative(args.Holder());
- RefPtr<ScriptCallStack> callStack(createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture));
- bool condition = args[0]->BooleanValue();
- RefPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 1));
- imp->assertCondition(condition, scriptArguments.release(), callStack);
- return v8::Handle<v8::Value>();
-}
-
-#if ENABLE(JAVASCRIPT_DEBUGGER)
-v8::Handle<v8::Value> V8Console::profileCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Console.profile");
- Console* imp = V8Console::toNative(args.Holder());
- RefPtr<ScriptCallStack> callStack(createScriptCallStack(1));
- if (!callStack)
- return v8::Undefined();
- STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<WithUndefinedOrNullCheck>, title, args[0]);
- imp->profile(title, ScriptState::current(), callStack);
- return v8::Handle<v8::Value>();
-}
-
-v8::Handle<v8::Value> V8Console::profileEndCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Console.profileEnd");
- Console* imp = V8Console::toNative(args.Holder());
- RefPtr<ScriptCallStack> callStack(createScriptCallStack(1));
- if (!callStack)
- return v8::Undefined();
- STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<WithUndefinedOrNullCheck>, title, args[0]);
- imp->profileEnd(title, ScriptState::current(), callStack);
- return v8::Handle<v8::Value>();
-}
-#endif
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp b/WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp
deleted file mode 100644
index fc5c750..0000000
--- a/WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2009, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT OWNER 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.
- */
-
-#include "config.h"
-#include "V8Coordinates.h"
-
-#include "Coordinates.h"
-#include "V8Binding.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8Coordinates::altitudeAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.Coordinates.altitude._get");
- v8::Handle<v8::Object> holder = info.Holder();
- Coordinates* imp = V8Coordinates::toNative(holder);
- if (!imp->canProvideAltitude())
- return v8::Null();
- return v8::Number::New(imp->altitude());
-}
-
-v8::Handle<v8::Value> V8Coordinates::altitudeAccuracyAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.Coordinates.altitudeAccuracy._get");
- v8::Handle<v8::Object> holder = info.Holder();
- Coordinates* imp = V8Coordinates::toNative(holder);
- if (!imp->canProvideAltitudeAccuracy())
- return v8::Null();
- return v8::Number::New(imp->altitudeAccuracy());
-}
-
-v8::Handle<v8::Value> V8Coordinates::headingAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.Coordinates.heading._get");
- v8::Handle<v8::Object> holder = info.Holder();
- Coordinates* imp = V8Coordinates::toNative(holder);
- if (!imp->canProvideHeading())
- return v8::Null();
- return v8::Number::New(imp->heading());
-}
-
-v8::Handle<v8::Value> V8Coordinates::speedAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.Coordinates.speed._get");
- v8::Handle<v8::Object> holder = info.Holder();
- Coordinates* imp = V8Coordinates::toNative(holder);
- if (!imp->canProvideSpeed())
- return v8::Null();
- return v8::Number::New(imp->speed());
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8CustomEventListener.cpp b/WebCore/bindings/v8/custom/V8CustomEventListener.cpp
deleted file mode 100644
index 24d752f..0000000
--- a/WebCore/bindings/v8/custom/V8CustomEventListener.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8CustomEventListener.h"
-
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-V8EventListener::V8EventListener(v8::Local<v8::Object> listener, bool isAttribute, const WorldContextHandle& worldContext)
- : V8AbstractEventListener(isAttribute, worldContext)
-{
- setListenerObject(listener);
-}
-
-v8::Local<v8::Function> V8EventListener::getListenerFunction(ScriptExecutionContext* context)
-{
- v8::Local<v8::Object> listener = getListenerObject(context);
-
- // Has the listener been disposed?
- if (listener.IsEmpty())
- return v8::Local<v8::Function>();
-
- if (listener->IsFunction())
- return v8::Local<v8::Function>::Cast(listener);
-
- if (listener->IsObject()) {
- v8::Local<v8::Value> property = listener->Get(v8::String::NewSymbol("handleEvent"));
- if (property->IsFunction())
- return v8::Local<v8::Function>::Cast(property);
- }
-
- return v8::Local<v8::Function>();
-}
-
-v8::Local<v8::Value> V8EventListener::callListenerFunction(ScriptExecutionContext* context, v8::Handle<v8::Value> jsEvent, Event* event)
-{
-
- v8::Local<v8::Function> handlerFunction = getListenerFunction(context);
- v8::Local<v8::Object> receiver = getReceiverObject(event);
- if (handlerFunction.IsEmpty() || receiver.IsEmpty())
- return v8::Local<v8::Value>();
-
- v8::Handle<v8::Value> parameters[1] = { jsEvent };
-
- if (V8Proxy* proxy = V8Proxy::retrieve(context))
- return proxy->callFunction(handlerFunction, receiver, 1, parameters);
-
- return v8::Local<v8::Value>();
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8CustomEventListener.h b/WebCore/bindings/v8/custom/V8CustomEventListener.h
deleted file mode 100644
index f9d5385..0000000
--- a/WebCore/bindings/v8/custom/V8CustomEventListener.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8CustomEventListener_h
-#define V8CustomEventListener_h
-
-#include "V8AbstractEventListener.h"
-#include <v8.h>
-#include <wtf/PassRefPtr.h>
-
-namespace WebCore {
-
- class Event;
- class Frame;
-
- // V8EventListener is a wrapper of a JS object implements EventListener interface (has handleEvent(event) method), or a JS function
- // that can handle the event.
- class V8EventListener : public V8AbstractEventListener {
- public:
- static PassRefPtr<V8EventListener> create(v8::Local<v8::Object> listener, bool isAttribute, const WorldContextHandle& worldContext)
- {
- return adoptRef(new V8EventListener(listener, isAttribute, worldContext));
- }
-
- protected:
- V8EventListener(v8::Local<v8::Object> listener, bool isAttribute, const WorldContextHandle& worldContext);
-
- v8::Local<v8::Function> getListenerFunction(ScriptExecutionContext*);
-
- private:
- virtual v8::Local<v8::Value> callListenerFunction(ScriptExecutionContext*, v8::Handle<v8::Value> jsEvent, Event*);
- };
-
-} // namespace WebCore
-
-#endif // V8CustomEventListener_h
diff --git a/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp b/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp
deleted file mode 100644
index 97d0dde..0000000
--- a/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2009, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT OWNER 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.
- */
-
-#include "config.h"
-#include "V8CustomPositionCallback.h"
-
-#if ENABLE(GEOLOCATION)
-
-#include "ScriptExecutionContext.h"
-#include "V8CustomVoidCallback.h" // For invokeCallback
-#include "V8Geoposition.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-V8CustomPositionCallback::V8CustomPositionCallback(v8::Local<v8::Object> callback, ScriptExecutionContext* context)
- : PositionCallback(context)
- , m_callback(v8::Persistent<v8::Object>::New(callback))
-{
-}
-
-V8CustomPositionCallback::~V8CustomPositionCallback()
-{
- m_callback.Dispose();
-}
-
-void V8CustomPositionCallback::handleEvent(Geoposition* position)
-{
- v8::HandleScope handleScope;
-
- // ActiveDOMObject will null our pointer to the ScriptExecutionContext when it goes away.
- ScriptExecutionContext* scriptContext = scriptExecutionContext();
- if (!scriptContext)
- return;
-
- // The lookup of the proxy will fail if the Frame has been detached.
- V8Proxy* proxy = V8Proxy::retrieve(scriptContext);
- if (!proxy)
- return;
-
- v8::Handle<v8::Context> context = proxy->context();
- if (context.IsEmpty())
- return;
-
- v8::Context::Scope scope(context);
-
- v8::Handle<v8::Value> argv[] = {
- toV8(position)
- };
-
- // Protect the script context until the callback returns.
- RefPtr<ScriptExecutionContext> protector(scriptContext);
-
- bool callbackReturnValue = false;
- invokeCallback(m_callback, 1, argv, callbackReturnValue, scriptContext);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(GEOLOCATION)
diff --git a/WebCore/bindings/v8/custom/V8CustomPositionCallback.h b/WebCore/bindings/v8/custom/V8CustomPositionCallback.h
deleted file mode 100644
index 61db922..0000000
--- a/WebCore/bindings/v8/custom/V8CustomPositionCallback.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2009, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT OWNER 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 V8CustomPositionCallback_h
-#define V8CustomPositionCallback_h
-
-#include "PositionCallback.h"
-
-#include <v8.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-class Frame;
-class Geoposition;
-class ScriptExecutionContext;
-
-class V8CustomPositionCallback : public PositionCallback {
-public:
- static PassRefPtr<V8CustomPositionCallback> create(v8::Local<v8::Value> value, ScriptExecutionContext* context)
- {
- ASSERT(value->IsObject());
- return adoptRef(new V8CustomPositionCallback(value->ToObject(), context));
- }
- virtual ~V8CustomPositionCallback();
-
- virtual void handleEvent(Geoposition*);
-
-private:
- V8CustomPositionCallback(v8::Local<v8::Object>, ScriptExecutionContext*);
-
- v8::Persistent<v8::Object> m_callback;
-};
-
-} // namespace WebCore
-
-#endif // V8CustomPositionCallback_h
diff --git a/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp b/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp
deleted file mode 100644
index 906a909..0000000
--- a/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2009, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT OWNER 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.
- */
-
-#include "config.h"
-#include "V8CustomPositionErrorCallback.h"
-
-#if ENABLE(GEOLOCATION)
-
-#include "ScriptExecutionContext.h"
-#include "V8CustomVoidCallback.h" // For invokeCallback
-#include "V8PositionError.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-V8CustomPositionErrorCallback::V8CustomPositionErrorCallback(v8::Local<v8::Object> callback, ScriptExecutionContext* context)
- : PositionErrorCallback(context)
- , m_callback(v8::Persistent<v8::Object>::New(callback))
-{
-}
-
-V8CustomPositionErrorCallback::~V8CustomPositionErrorCallback()
-{
- m_callback.Dispose();
-}
-
-void V8CustomPositionErrorCallback::handleEvent(PositionError* error)
-{
- v8::HandleScope handleScope;
-
- // ActiveDOMObject will null our pointer to the ScriptExecutionContext when it goes away.
- ScriptExecutionContext* scriptContext = scriptExecutionContext();
- if (!scriptContext)
- return;
-
- // The lookup of the proxy will fail if the Frame has been detached.
- V8Proxy* proxy = V8Proxy::retrieve(scriptContext);
- if (!proxy)
- return;
-
- v8::Handle<v8::Context> context = proxy->context();
- if (context.IsEmpty())
- return;
-
- v8::Context::Scope scope(context);
-
- v8::Handle<v8::Value> argv[] = {
- toV8(error)
- };
-
- // Protect the script context until the callback returns.
- RefPtr<ScriptExecutionContext> protector(scriptContext);
-
- bool callbackReturnValue = false;
- invokeCallback(m_callback, 1, argv, callbackReturnValue, scriptContext);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(GEOLOCATION)
diff --git a/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.h b/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.h
deleted file mode 100644
index 5211b60..0000000
--- a/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2009, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT OWNER 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 V8CustomPositionErrorCallback_h
-#define V8CustomPositionErrorCallback_h
-
-#include "PositionErrorCallback.h"
-
-#include <v8.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-class Frame;
-class PositionError;
-class ScriptExecutionContext;
-
-class V8CustomPositionErrorCallback : public PositionErrorCallback {
-public:
- static PassRefPtr<V8CustomPositionErrorCallback> create(v8::Local<v8::Value> value, ScriptExecutionContext* context)
- {
- ASSERT(value->IsObject());
- return adoptRef(new V8CustomPositionErrorCallback(value->ToObject(), context));
- }
- virtual ~V8CustomPositionErrorCallback();
-
- virtual void handleEvent(PositionError*);
-
-private:
- V8CustomPositionErrorCallback(v8::Local<v8::Object>, ScriptExecutionContext*);
-
- v8::Persistent<v8::Object> m_callback;
-};
-
-} // namespace WebCore
-
-#endif // V8CustomPositionErrorCallback_h
diff --git a/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp b/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp
deleted file mode 100644
index 17fca22..0000000
--- a/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2009, Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(DATABASE)
-
-#include "V8SQLStatementErrorCallback.h"
-
-#include "ScriptExecutionContext.h"
-#include "V8CustomVoidCallback.h"
-#include "V8Proxy.h"
-#include "V8SQLError.h"
-#include "V8SQLTransaction.h"
-#include <wtf/Assertions.h>
-
-namespace WebCore {
-
-bool V8SQLStatementErrorCallback::handleEvent(SQLTransaction* transaction, SQLError* error)
-{
- if (!canInvokeCallback())
- return true;
-
- v8::HandleScope handleScope;
-
- v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_worldContext);
- if (v8Context.IsEmpty())
- return true;
-
- v8::Context::Scope scope(v8Context);
-
- v8::Handle<v8::Value> transactionHandle = toV8(transaction);
- v8::Handle<v8::Value> errorHandle = toV8(error);
- if (transactionHandle.IsEmpty() || errorHandle.IsEmpty()) {
- CRASH();
- return true;
- }
-
- v8::Handle<v8::Value> argv[] = {
- transactionHandle,
- errorHandle
- };
-
- bool callbackReturnValue = false;
- // Step 6: If the error callback returns false, then move on to the next
- // statement, if any, or onto the next overall step otherwise. Otherwise,
- // the error callback did not return false, or there was no error callback.
- // Jump to the last step in the overall steps.
- return invokeCallback(m_callback, 2, argv, callbackReturnValue, scriptExecutionContext()) || callbackReturnValue;
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp b/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp
deleted file mode 100644
index 11f309b..0000000
--- a/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8CustomVoidCallback.h"
-
-#include "ScriptExecutionContext.h"
-#include "V8Binding.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-V8CustomVoidCallback::V8CustomVoidCallback(v8::Local<v8::Object> callback, ScriptExecutionContext *context)
- : m_callback(v8::Persistent<v8::Object>::New(callback))
- , m_scriptExecutionContext(context)
- , m_worldContext(UseCurrentWorld)
-{
-}
-
-V8CustomVoidCallback::~V8CustomVoidCallback()
-{
- m_callback.Dispose();
-}
-
-void V8CustomVoidCallback::handleEvent()
-{
- v8::HandleScope handleScope;
-
- v8::Handle<v8::Context> v8Context = toV8Context(m_scriptExecutionContext.get(), m_worldContext);
- if (v8Context.IsEmpty())
- return;
-
- v8::Context::Scope scope(v8Context);
-
- bool callbackReturnValue = false;
- invokeCallback(m_callback, 0, 0, callbackReturnValue, m_scriptExecutionContext.get());
-}
-
-bool invokeCallback(v8::Persistent<v8::Object> callback, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue, ScriptExecutionContext* scriptExecutionContext)
-{
- v8::TryCatch exceptionCatcher;
- exceptionCatcher.SetVerbose(true);
-
- v8::Local<v8::Function> callbackFunction;
- if (callback->IsFunction()) {
- callbackFunction = v8::Local<v8::Function>::New(v8::Persistent<v8::Function>::Cast(callback));
- } else if (callback->IsObject()) {
- v8::Local<v8::Value> handleEventFunction = callback->Get(v8::String::NewSymbol("handleEvent"));
- if (handleEventFunction->IsFunction())
- callbackFunction = v8::Local<v8::Function>::Cast(handleEventFunction);
- } else
- return false;
-
- if (callbackFunction.IsEmpty())
- return false;
-
- v8::Handle<v8::Object> thisObject = v8::Context::GetCurrent()->Global();
-
- v8::Handle<v8::Value> result = callbackFunction->Call(thisObject, argc, argv);
- callbackReturnValue = !result.IsEmpty() && result->BooleanValue();
- return exceptionCatcher.HasCaught();
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8CustomVoidCallback.h b/WebCore/bindings/v8/custom/V8CustomVoidCallback.h
deleted file mode 100644
index 94bb782..0000000
--- a/WebCore/bindings/v8/custom/V8CustomVoidCallback.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8CustomVoidCallback_h
-#define V8CustomVoidCallback_h
-
-#include "VoidCallback.h"
-#include "WorldContextHandle.h"
-#include <v8.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-class ScriptExecutionContext;
-
-class V8CustomVoidCallback : public VoidCallback {
-public:
- static PassRefPtr<V8CustomVoidCallback> create(v8::Local<v8::Value> value, ScriptExecutionContext* context)
- {
- ASSERT(value->IsObject());
- return adoptRef(new V8CustomVoidCallback(value->ToObject(), context));
- }
- virtual ~V8CustomVoidCallback();
-
- virtual void handleEvent();
-
-private:
- V8CustomVoidCallback(v8::Local<v8::Object>, ScriptExecutionContext* context);
-
- v8::Persistent<v8::Object> m_callback;
- RefPtr<ScriptExecutionContext> m_scriptExecutionContext;
- WorldContextHandle m_worldContext;
-};
-
-// Returns false if callback failed (null, wrong type, or threw exception).
-bool invokeCallback(v8::Persistent<v8::Object> callback, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue, ScriptExecutionContext* scriptExecutionContext);
-
-} // namespace WebCore
-
-#endif // V8CustomVoidCallback_h
diff --git a/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.cpp b/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.cpp
deleted file mode 100644
index 01448d9..0000000
--- a/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright (c) 2008, Google 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:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * 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.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "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 THE COPYRIGHT
-// OWNER 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.
-
-#include "config.h"
-#include "V8CustomXPathNSResolver.h"
-
-#if ENABLE(XPATH)
-
-#include "PlatformString.h"
-#include "V8Binding.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-PassRefPtr<V8CustomXPathNSResolver> V8CustomXPathNSResolver::create(v8::Handle<v8::Object> resolver)
-{
- return adoptRef(new V8CustomXPathNSResolver(resolver));
-}
-
-V8CustomXPathNSResolver::V8CustomXPathNSResolver(v8::Handle<v8::Object> resolver)
- : m_resolver(resolver)
-{
-}
-
-V8CustomXPathNSResolver::~V8CustomXPathNSResolver()
-{
-}
-
-String V8CustomXPathNSResolver::lookupNamespaceURI(const String& prefix)
-{
- v8::Handle<v8::Function> lookupNamespaceURIFunc;
- v8::Handle<v8::String> lookupNamespaceURIName = v8::String::New("lookupNamespaceURI");
-
- // Check if the resolver has a function property named lookupNamespaceURI.
- if (m_resolver->Has(lookupNamespaceURIName)) {
- v8::Handle<v8::Value> lookupNamespaceURI = m_resolver->Get(lookupNamespaceURIName);
- if (lookupNamespaceURI->IsFunction())
- lookupNamespaceURIFunc = v8::Handle<v8::Function>::Cast(lookupNamespaceURI);
- }
-
- if (lookupNamespaceURIFunc.IsEmpty() && !m_resolver->IsFunction()) {
- if (V8Proxy* proxy = V8Proxy::retrieve()) {
- if (Frame* frame = proxy->frame())
- logInfo(frame, "XPathNSResolver does not have a lookupNamespaceURI method.", String());
- }
- return String();
- }
-
- // Catch exceptions from calling the namespace resolver.
- v8::TryCatch try_catch;
- try_catch.SetVerbose(true); // Print exceptions to console.
-
- const int argc = 1;
- v8::Handle<v8::Value> argv[argc] = { v8String(prefix) };
- v8::Handle<v8::Function> function = lookupNamespaceURIFunc.IsEmpty() ? v8::Handle<v8::Function>::Cast(m_resolver) : lookupNamespaceURIFunc;
-
- v8::Handle<v8::Value> retval = V8Proxy::callFunctionWithoutFrame(function, m_resolver, argc, argv);
-
- // Eat exceptions from namespace resolver and return an empty string. This will most likely cause NAMESPACE_ERR.
- if (try_catch.HasCaught())
- return String();
-
- return toWebCoreStringWithNullCheck(retval);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(XPATH)
diff --git a/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.h b/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.h
deleted file mode 100644
index 9677252..0000000
--- a/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8CustomXPathNSResolver_h
-#define V8CustomXPathNSResolver_h
-
-#if ENABLE(XPATH)
-
-#include "XPathNSResolver.h"
-#include <v8.h>
-#include <wtf/Forward.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-class V8Proxy;
-
-// V8CustomXPathNSResolver does not create a persistent handle to the
-// given resolver object. So the lifetime of V8CustomXPathNSResolver
-// must not exceed the lifetime of the passed handle.
-class V8CustomXPathNSResolver : public XPathNSResolver {
-public:
- static PassRefPtr<V8CustomXPathNSResolver> create(v8::Handle<v8::Object> resolver);
-
- virtual ~V8CustomXPathNSResolver();
- virtual String lookupNamespaceURI(const String& prefix);
-
-private:
- explicit V8CustomXPathNSResolver(v8::Handle<v8::Object> resolver);
-
- v8::Handle<v8::Object> m_resolver; // Handle to resolver object.
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(XPATH)
-
-#endif // V8CustomXPathNSResolver_h
diff --git a/WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp b/WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp
deleted file mode 100644
index caf2e16..0000000
--- a/WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8DOMFormData.h"
-
-#include "DOMFormData.h"
-#include "V8Binding.h"
-#include "V8Blob.h"
-#include "V8HTMLFormElement.h"
-#include "V8Proxy.h"
-#include "V8Utilities.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8DOMFormData::constructorCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.FormData.Constructor");
-
- if (!args.IsConstructCall())
- return throwError("DOM object constructor cannot be called as a function.", V8Proxy::SyntaxError);
-
- HTMLFormElement* form = 0;
- if (args.Length() > 0 && V8HTMLFormElement::HasInstance(args[0]))
- form = V8HTMLFormElement::toNative(args[0]->ToObject());
- RefPtr<DOMFormData> domFormData = DOMFormData::create(form);
-
- V8DOMWrapper::setDOMWrapper(args.Holder(), &info, domFormData.get());
- return toV8(domFormData.release(), args.Holder());
-}
-
-v8::Handle<v8::Value> V8DOMFormData::appendCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.FormData.append()");
-
- if (args.Length() < 2)
- return throwError("Not enough arguments", V8Proxy::SyntaxError);
-
- DOMFormData* domFormData = V8DOMFormData::toNative(args.Holder());
-
- String name = toWebCoreStringWithNullCheck(args[0]);
-
- v8::Handle<v8::Value> arg = args[1];
- if (V8Blob::HasInstance(arg)) {
- v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg);
- Blob* blob = V8Blob::toNative(object);
- ASSERT(blob);
- domFormData->append(name, blob);
- } else
- domFormData->append(name, toWebCoreStringWithNullCheck(arg));
-
- return v8::Undefined();
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8DOMSettableTokenListCustom.cpp b/WebCore/bindings/v8/custom/V8DOMSettableTokenListCustom.cpp
deleted file mode 100644
index e1c9be4..0000000
--- a/WebCore/bindings/v8/custom/V8DOMSettableTokenListCustom.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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.
- */
-
-#include "config.h"
-#include "V8DOMSettableTokenList.h"
-
-#include "DOMSettableTokenList.h"
-
-#include "V8Binding.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8DOMSettableTokenList::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.DOMSettableTokenList.IndexedPropertyGetter");
- DOMSettableTokenList* list = V8DOMSettableTokenList::toNative(info.Holder());
- return v8StringOrNull(list->item(index));
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp b/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp
deleted file mode 100644
index 71ff357..0000000
--- a/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8DOMStringMap.h"
-
-#include "DOMStringMap.h"
-#include "V8Binding.h"
-#include "V8DOMWrapper.h"
-#include "V8Element.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Integer> V8DOMStringMap::namedPropertyQuery(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.DOMStringMap.NamedPropertyQuery");
- if (V8DOMStringMap::toNative(info.Holder())->contains(toWebCoreString(name)))
- return v8::Integer::New(v8::None);
- return v8::Handle<v8::Integer>();
-}
-
-v8::Handle<v8::Value> V8DOMStringMap::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.DOMStringMap.NamedPropertyGetter");
- return v8String(V8DOMStringMap::toNative(info.Holder())->item(toWebCoreString(name)));
-}
-
-v8::Handle<v8::Array> V8DOMStringMap::namedPropertyEnumerator(const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.DOMStringMap.NamedPropertyEnumerator");
- Vector<String> names;
- V8DOMStringMap::toNative(info.Holder())->getNames(names);
- v8::Handle<v8::Array> properties = v8::Array::New(names.size());
- for (unsigned i = 0; i < names.size(); ++i)
- properties->Set(v8::Integer::New(i), v8String(names[i]));
- return properties;
-}
-
-v8::Handle<v8::Boolean> V8DOMStringMap::namedPropertyDeleter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.DOMStringMap.NamedPropertyDeleter");
- v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototypeChain(name);
- if (!value.IsEmpty())
- return v8::False();
- if (info.Holder()->HasRealNamedCallbackProperty(name))
- return v8::False();
-
- ExceptionCode ec = 0;
- V8DOMStringMap::toNative(info.Holder())->deleteItem(toWebCoreString(name), ec);
- if (ec)
- throwError(ec);
- return v8::True();
-}
-
-v8::Handle<v8::Value> V8DOMStringMap::namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.DOMStringMap.NamedPropertySetter");
- v8::Handle<v8::Value> property = info.Holder()->GetRealNamedPropertyInPrototypeChain(name);
- if (!property.IsEmpty())
- return value;
- if (info.Holder()->HasRealNamedCallbackProperty(name))
- return value;
-
- ExceptionCode ec = 0;
- V8DOMStringMap::toNative(info.Holder())->setItem(toWebCoreString(name), toWebCoreString(value), ec);
- if (ec)
- return throwError(ec);
- return value;
-}
-
-v8::Handle<v8::Value> toV8(DOMStringMap* impl)
-{
- if (!impl)
- return v8::Null();
- v8::Handle<v8::Object> wrapper = V8DOMStringMap::wrap(impl);
- // Add a hidden reference from the element to the DOMStringMap.
- Element* element = impl->element();
- if (!wrapper.IsEmpty() && element) {
- v8::Handle<v8::Value> elementValue = toV8(element);
- if (!elementValue.IsEmpty() && elementValue->IsObject())
- V8DOMWrapper::setHiddenReference(elementValue.As<v8::Object>(), wrapper);
- }
- return wrapper;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8DOMTokenListCustom.cpp b/WebCore/bindings/v8/custom/V8DOMTokenListCustom.cpp
deleted file mode 100644
index 171ff5c..0000000
--- a/WebCore/bindings/v8/custom/V8DOMTokenListCustom.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8DOMTokenList.h"
-
-#include "DOMTokenList.h"
-#include "V8Binding.h"
-#include "V8DOMWrapper.h"
-#include "V8Element.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> toV8(DOMTokenList* impl)
-{
- if (!impl)
- return v8::Null();
- v8::Handle<v8::Object> wrapper = V8DOMTokenList::wrap(impl);
- // Add a hidden reference from the element to the DOMTokenList.
- Element* element = impl->element();
- if (!wrapper.IsEmpty() && element) {
- v8::Handle<v8::Value> elementValue = toV8(element);
- if (!elementValue.IsEmpty() && elementValue->IsObject())
- V8DOMWrapper::setHiddenReference(elementValue.As<v8::Object>(), wrapper);
- }
- return wrapper;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
deleted file mode 100644
index dc953b4..0000000
--- a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
+++ /dev/null
@@ -1,688 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8DOMWindow.h"
-
-#include "Chrome.h"
-#include "DOMTimer.h"
-#include "DOMWindow.h"
-#include "ExceptionCode.h"
-#include "Frame.h"
-#include "FrameLoadRequest.h"
-#include "FrameView.h"
-#include "HTMLCollection.h"
-#include "HTMLDocument.h"
-#include "MediaPlayer.h"
-#include "Page.h"
-#include "PlatformScreen.h"
-#include "ScheduledAction.h"
-#include "ScriptSourceCode.h"
-#include "SerializedScriptValue.h"
-#include "Settings.h"
-#include "SharedWorkerRepository.h"
-#include "Storage.h"
-#include "V8Binding.h"
-#include "V8BindingDOMWindow.h"
-#include "V8BindingMacros.h"
-#include "V8BindingState.h"
-#include "V8CustomEventListener.h"
-#include "V8GCForContextDispose.h"
-#include "V8HiddenPropertyName.h"
-#include "V8HTMLAudioElementConstructor.h"
-#include "V8HTMLCollection.h"
-#include "V8HTMLImageElementConstructor.h"
-#include "V8HTMLOptionElementConstructor.h"
-#include "V8MessagePortCustom.h"
-#include "V8Node.h"
-#include "V8Proxy.h"
-#include "V8Utilities.h"
-#if ENABLE(WEB_SOCKETS)
-#include "WebSocket.h"
-#endif
-#include "WindowFeatures.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> WindowSetTimeoutImpl(const v8::Arguments& args, bool singleShot)
-{
- int argumentCount = args.Length();
-
- if (argumentCount < 1)
- return v8::Undefined();
-
- DOMWindow* imp = V8DOMWindow::toNative(args.Holder());
- ScriptExecutionContext* scriptContext = static_cast<ScriptExecutionContext*>(imp->document());
-
- if (!scriptContext) {
- V8Proxy::setDOMException(INVALID_ACCESS_ERR);
- return v8::Undefined();
- }
-
- v8::Handle<v8::Value> function = args[0];
- WTF::String functionString;
- if (!function->IsFunction()) {
- if (function->IsString())
- functionString = toWebCoreString(function);
- else {
- v8::Handle<v8::Value> v8String = function->ToString();
-
- // Bail out if string conversion failed.
- if (v8String.IsEmpty())
- return v8::Undefined();
-
- functionString = toWebCoreString(v8String);
- }
-
- // Don't allow setting timeouts to run empty functions!
- // (Bug 1009597)
- if (functionString.length() == 0)
- return v8::Undefined();
- }
-
- int32_t timeout = 0;
- if (argumentCount >= 2)
- timeout = args[1]->Int32Value();
-
- if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true))
- return v8::Undefined();
-
- int id;
- if (function->IsFunction()) {
- int paramCount = argumentCount >= 2 ? argumentCount - 2 : 0;
- v8::Local<v8::Value>* params = 0;
- if (paramCount > 0) {
- params = new v8::Local<v8::Value>[paramCount];
- for (int i = 0; i < paramCount; i++)
- // parameters must be globalized
- params[i] = args[i+2];
- }
-
- // params is passed to action, and released in action's destructor
- ScheduledAction* action = new ScheduledAction(V8Proxy::context(imp->frame()), v8::Handle<v8::Function>::Cast(function), paramCount, params);
-
- delete[] params;
-
- id = DOMTimer::install(scriptContext, action, timeout, singleShot);
- } else {
- id = DOMTimer::install(scriptContext, new ScheduledAction(V8Proxy::context(imp->frame()), functionString), timeout, singleShot);
- }
-
- // Try to do the idle notification before the timeout expires to get better
- // use of any idle time. Aim for the middle of the interval for simplicity.
- if (timeout > 0) {
- double maximumFireInterval = static_cast<double>(timeout) / 1000 / 2;
- V8GCForContextDispose::instance().notifyIdleSooner(maximumFireInterval);
- }
-
- return v8::Integer::New(id);
-}
-
-v8::Handle<v8::Value> V8DOMWindow::eventAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), info.This());
- if (holder.IsEmpty())
- return v8::Undefined();
-
- Frame* frame = V8DOMWindow::toNative(holder)->frame();
- if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), frame, true))
- return v8::Undefined();
-
- v8::Local<v8::Context> context = V8Proxy::context(frame);
- if (context.IsEmpty())
- return v8::Undefined();
-
- v8::Handle<v8::String> eventSymbol = V8HiddenPropertyName::event();
- v8::Handle<v8::Value> jsEvent = context->Global()->GetHiddenValue(eventSymbol);
- if (jsEvent.IsEmpty())
- return v8::Undefined();
- return jsEvent;
-}
-
-void V8DOMWindow::eventAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), info.This());
- if (holder.IsEmpty())
- return;
-
- Frame* frame = V8DOMWindow::toNative(holder)->frame();
- if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), frame, true))
- return;
-
- v8::Local<v8::Context> context = V8Proxy::context(frame);
- if (context.IsEmpty())
- return;
-
- v8::Handle<v8::String> eventSymbol = V8HiddenPropertyName::event();
- context->Global()->SetHiddenValue(eventSymbol, value);
-}
-
-v8::Handle<v8::Value> V8DOMWindow::cryptoAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- // FIXME: Implement me.
- return v8::Undefined();
-}
-
-void V8DOMWindow::locationAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- DOMWindow* imp = V8DOMWindow::toNative(info.Holder());
- State<V8Binding>* state = V8BindingState::Only();
-
- DOMWindow* activeWindow = state->activeWindow();
- if (!activeWindow)
- return;
-
- DOMWindow* firstWindow = state->firstWindow();
- if (!firstWindow)
- return;
-
- imp->setLocation(toWebCoreString(value), activeWindow, firstWindow);
-}
-
-void V8DOMWindow::openerAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- DOMWindow* imp = V8DOMWindow::toNative(info.Holder());
-
- if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true))
- return;
-
- // Opener can be shadowed if it is in the same domain.
- // Have a special handling of null value to behave
- // like Firefox. See bug http://b/1224887 & http://b/791706.
- if (value->IsNull()) {
- // imp->frame() cannot be null,
- // otherwise, SameOrigin check would have failed.
- ASSERT(imp->frame());
- imp->frame()->loader()->setOpener(0);
- }
-
- // Delete the accessor from this object.
- info.Holder()->Delete(name);
-
- // Put property on the front (this) object.
- info.This()->Set(name, value);
-}
-
-#if ENABLE(VIDEO)
-
-v8::Handle<v8::Value> V8DOMWindow::AudioAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- DOMWindow* window = V8DOMWindow::toNative(info.Holder());
- return V8DOMWrapper::getConstructor(&V8HTMLAudioElementConstructor::info, window);
-}
-
-#endif
-
-v8::Handle<v8::Value> V8DOMWindow::ImageAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- DOMWindow* window = V8DOMWindow::toNative(info.Holder());
- return V8DOMWrapper::getConstructor(&V8HTMLImageElementConstructor::info, window);
-}
-
-v8::Handle<v8::Value> V8DOMWindow::OptionAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- DOMWindow* window = V8DOMWindow::toNative(info.Holder());
- return V8DOMWrapper::getConstructor(&V8HTMLOptionElementConstructor::info, window);
-}
-
-v8::Handle<v8::Value> V8DOMWindow::addEventListenerCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.DOMWindow.addEventListener()");
-
- String eventType = toWebCoreString(args[0]);
- bool useCapture = args[2]->BooleanValue();
-
- DOMWindow* imp = V8DOMWindow::toNative(args.Holder());
-
- if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true))
- return v8::Undefined();
-
- Document* doc = imp->document();
-
- if (!doc)
- return v8::Undefined();
-
- // FIXME: Check if there is not enough arguments
- V8Proxy* proxy = V8Proxy::retrieve(imp->frame());
- if (!proxy)
- return v8::Undefined();
-
- RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(args[1], false, ListenerFindOrCreate);
-
- if (listener) {
- imp->addEventListener(eventType, listener, useCapture);
- createHiddenDependency(args.Holder(), args[1], eventListenerCacheIndex);
- }
-
- return v8::Undefined();
-}
-
-
-v8::Handle<v8::Value> V8DOMWindow::removeEventListenerCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.DOMWindow.removeEventListener()");
-
- String eventType = toWebCoreString(args[0]);
- bool useCapture = args[2]->BooleanValue();
-
- DOMWindow* imp = V8DOMWindow::toNative(args.Holder());
-
- if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true))
- return v8::Undefined();
-
- Document* doc = imp->document();
-
- if (!doc)
- return v8::Undefined();
-
- V8Proxy* proxy = V8Proxy::retrieve(imp->frame());
- if (!proxy)
- return v8::Undefined();
-
- RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(args[1], false, ListenerFindOnly);
-
- if (listener) {
- imp->removeEventListener(eventType, listener.get(), useCapture);
- removeHiddenDependency(args.Holder(), args[1], eventListenerCacheIndex);
- }
-
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8DOMWindow::postMessageCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.DOMWindow.postMessage()");
- DOMWindow* window = V8DOMWindow::toNative(args.Holder());
-
- DOMWindow* source = V8Proxy::retrieveFrameForCallingContext()->domWindow();
- ASSERT(source->frame());
-
- bool didThrow = false;
- RefPtr<SerializedScriptValue> message = SerializedScriptValue::create(args[0], didThrow);
- if (didThrow)
- return v8::Undefined();
-
- MessagePortArray portArray;
- String targetOrigin;
-
- // This function has variable arguments and can either be:
- // postMessage(message, port, targetOrigin);
- // or
- // postMessage(message, targetOrigin);
- v8::TryCatch tryCatch;
- if (args.Length() > 2) {
- if (!getMessagePortArray(args[1], portArray))
- return v8::Undefined();
- targetOrigin = toWebCoreStringWithNullOrUndefinedCheck(args[2]);
- } else {
- targetOrigin = toWebCoreStringWithNullOrUndefinedCheck(args[1]);
- }
-
- if (tryCatch.HasCaught())
- return v8::Undefined();
-
- ExceptionCode ec = 0;
- window->postMessage(message.release(), &portArray, targetOrigin, source, ec);
- return throwError(ec);
-}
-
-// FIXME(fqian): returning string is cheating, and we should
-// fix this by calling toString function on the receiver.
-// However, V8 implements toString in JavaScript, which requires
-// switching context of receiver. I consider it is dangerous.
-v8::Handle<v8::Value> V8DOMWindow::toStringCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.DOMWindow.toString()");
- v8::Handle<v8::Object> domWrapper = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), args.This());
- if (domWrapper.IsEmpty())
- return args.This()->ObjectProtoToString();
- return domWrapper->ObjectProtoToString();
-}
-
-v8::Handle<v8::Value> V8DOMWindow::releaseEventsCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.DOMWindow.nop()");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8DOMWindow::captureEventsCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.DOMWindow.nop()");
- return v8::Undefined();
-}
-
-static bool canShowModalDialogNow(const Frame* frame)
-{
- // A frame can out live its page. See bug 1219613.
- if (!frame || !frame->page())
- return false;
- return frame->page()->chrome()->canRunModalNow();
-}
-
-static HashMap<String, String> parseModalDialogFeatures(const String& featuresArg)
-{
- HashMap<String, String> map;
-
- Vector<String> features;
- featuresArg.split(';', features);
- Vector<String>::const_iterator end = features.end();
- for (Vector<String>::const_iterator it = features.begin(); it != end; ++it) {
- String featureString = *it;
- int pos = featureString.find('=');
- int colonPos = featureString.find(':');
- if (pos >= 0 && colonPos >= 0)
- continue; // ignore any strings that have both = and :
- if (pos < 0)
- pos = colonPos;
- if (pos < 0) {
- // null string for value means key without value
- map.set(featureString.stripWhiteSpace().lower(), String());
- } else {
- String key = featureString.left(pos).stripWhiteSpace().lower();
- String val = featureString.substring(pos + 1).stripWhiteSpace().lower();
- int spacePos = val.find(' ');
- if (spacePos != -1)
- val = val.left(spacePos);
- map.set(key, val);
- }
- }
-
- return map;
-}
-
-v8::Handle<v8::Value> V8DOMWindow::showModalDialogCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.DOMWindow.showModalDialog()");
-
- String url = toWebCoreStringWithNullOrUndefinedCheck(args[0]);
- v8::Local<v8::Value> dialogArgs = args[1];
- String featureArgs = toWebCoreStringWithNullOrUndefinedCheck(args[2]);
-
- DOMWindow* window = V8DOMWindow::toNative(args.Holder());
- Frame* frame = window->frame();
-
- if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), frame, true))
- return v8::Undefined();
-
- Frame* callingFrame = V8Proxy::retrieveFrameForCallingContext();
- if (!callingFrame)
- return v8::Undefined();
-
- Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
- if (!enteredFrame)
- return v8::Undefined();
-
- if (!canShowModalDialogNow(frame) || !V8BindingSecurity::allowPopUp(V8BindingState::Only()))
- return v8::Undefined();
-
- const HashMap<String, String> features = parseModalDialogFeatures(featureArgs);
-
- const bool trusted = false;
-
- FloatRect screenRect = screenAvailableRect(frame->view());
-
- WindowFeatures windowFeatures;
- // default here came from frame size of dialog in MacIE.
- windowFeatures.width = WindowFeatures::floatFeature(features, "dialogwidth", 100, screenRect.width(), 620);
- windowFeatures.widthSet = true;
- // default here came from frame size of dialog in MacIE.
- windowFeatures.height = WindowFeatures::floatFeature(features, "dialogheight", 100, screenRect.height(), 450);
- windowFeatures.heightSet = true;
-
- windowFeatures.x = WindowFeatures::floatFeature(features, "dialogleft", screenRect.x(), screenRect.right() - windowFeatures.width, -1);
- windowFeatures.xSet = windowFeatures.x > 0;
- windowFeatures.y = WindowFeatures::floatFeature(features, "dialogtop", screenRect.y(), screenRect.bottom() - windowFeatures.height, -1);
- windowFeatures.ySet = windowFeatures.y > 0;
-
- if (WindowFeatures::boolFeature(features, "center", true)) {
- if (!windowFeatures.xSet) {
- windowFeatures.x = screenRect.x() + (screenRect.width() - windowFeatures.width) / 2;
- windowFeatures.xSet = true;
- }
- if (!windowFeatures.ySet) {
- windowFeatures.y = screenRect.y() + (screenRect.height() - windowFeatures.height) / 2;
- windowFeatures.ySet = true;
- }
- }
-
- windowFeatures.dialog = true;
- windowFeatures.resizable = WindowFeatures::boolFeature(features, "resizable");
- windowFeatures.scrollbarsVisible = WindowFeatures::boolFeature(features, "scroll", true);
- windowFeatures.statusBarVisible = WindowFeatures::boolFeature(features, "status", !trusted);
- windowFeatures.menuBarVisible = false;
- windowFeatures.toolBarVisible = false;
- windowFeatures.locationBarVisible = false;
- windowFeatures.fullscreen = false;
-
- Frame* dialogFrame = V8BindingDOMWindow::createWindow(V8BindingState::Only(), callingFrame, enteredFrame, frame, url, "", windowFeatures, dialogArgs);
- if (!dialogFrame)
- return v8::Undefined();
-
- // Hold on to the context of the dialog window long enough to retrieve the
- // value of the return value property.
- v8::Local<v8::Context> context = V8Proxy::context(dialogFrame);
-
- // Run the dialog.
- dialogFrame->page()->chrome()->runModal();
-
- // Extract the return value property from the dialog window.
- v8::Local<v8::Value> returnValue;
- if (!context.IsEmpty()) {
- v8::Context::Scope scope(context);
- returnValue = context->Global()->Get(v8::String::New("returnValue"));
- }
-
- if (!returnValue.IsEmpty())
- return returnValue;
-
- return v8::Undefined();
-}
-
-
-v8::Handle<v8::Value> V8DOMWindow::openCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.DOMWindow.open()");
- DOMWindow* impl = V8DOMWindow::toNative(args.Holder());
-
- V8BindingState* state = V8BindingState::Only();
-
- DOMWindow* activeWindow = state->activeWindow();
- DOMWindow* firstWindow = state->firstWindow();
-
- EXCEPTION_BLOCK(String, urlString, toWebCoreStringWithNullOrUndefinedCheck(args[0]));
- EXCEPTION_BLOCK(AtomicString, frameName, (args[1]->IsUndefined() || args[1]->IsNull()) ? "_blank" : AtomicString(toWebCoreString(args[1])));
- EXCEPTION_BLOCK(String, windowFeaturesString, toWebCoreStringWithNullOrUndefinedCheck(args[2]));
-
- RefPtr<DOMWindow> openedWindow = impl->open(urlString, frameName, windowFeaturesString, activeWindow, firstWindow);
- if (!openedWindow)
- return v8::Undefined();
- return toV8(openedWindow.release());
-}
-
-v8::Handle<v8::Value> V8DOMWindow::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.DOMWindow.IndexedPropertyGetter");
-
- DOMWindow* window = V8DOMWindow::toNative(info.Holder());
- if (!window)
- return notHandledByInterceptor();
-
- Frame* frame = window->frame();
- if (!frame)
- return notHandledByInterceptor();
-
- Frame* child = frame->tree()->child(index);
- if (child)
- return toV8(child->domWindow());
-
- return notHandledByInterceptor();
-}
-
-
-v8::Handle<v8::Value> V8DOMWindow::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.DOMWindow.NamedPropertyGetter");
-
- DOMWindow* window = V8DOMWindow::toNative(info.Holder());
- if (!window)
- return notHandledByInterceptor();
-
- Frame* frame = window->frame();
- // window is detached from a frame.
- if (!frame)
- return notHandledByInterceptor();
-
- // Search sub-frames.
- AtomicString propName = v8StringToAtomicWebCoreString(name);
- Frame* child = frame->tree()->child(propName);
- if (child)
- return toV8(child->domWindow());
-
- // Search IDL functions defined in the prototype
- v8::Handle<v8::Value> result = info.Holder()->GetRealNamedProperty(name);
- if (!result.IsEmpty())
- return result;
-
- // Search named items in the document.
- Document* doc = frame->document();
-
- if (doc && doc->isHTMLDocument()) {
- if (static_cast<HTMLDocument*>(doc)->hasNamedItem(propName.impl()) || doc->hasElementWithId(propName.impl())) {
- RefPtr<HTMLCollection> items = doc->windowNamedItems(propName);
- if (items->length() >= 1) {
- if (items->length() == 1)
- return toV8(items->firstItem());
- return toV8(items.release());
- }
- }
- }
-
- return notHandledByInterceptor();
-}
-
-
-v8::Handle<v8::Value> V8DOMWindow::setTimeoutCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.DOMWindow.setTimeout()");
- return WindowSetTimeoutImpl(args, true);
-}
-
-
-v8::Handle<v8::Value> V8DOMWindow::setIntervalCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.DOMWindow.setInterval()");
- return WindowSetTimeoutImpl(args, false);
-}
-
-bool V8DOMWindow::namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value>)
-{
- v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), host);
- if (window.IsEmpty())
- return false; // the frame is gone.
-
- DOMWindow* targetWindow = V8DOMWindow::toNative(window);
-
- ASSERT(targetWindow);
-
- Frame* target = targetWindow->frame();
- if (!target)
- return false;
-
- if (key->IsString()) {
- String name = toWebCoreString(key);
- // Notice that we can't call HasRealNamedProperty for ACCESS_HAS
- // because that would generate infinite recursion.
- if (type == v8::ACCESS_HAS && target->tree()->child(name))
- return true;
- if (type == v8::ACCESS_GET && target->tree()->child(name) && !host->HasRealNamedProperty(key->ToString()))
- return true;
- }
-
- return V8BindingSecurity::canAccessFrame(V8BindingState::Only(), target, false);
-}
-
-bool V8DOMWindow::indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::AccessType type, v8::Local<v8::Value>)
-{
- v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), host);
- if (window.IsEmpty())
- return false;
-
- DOMWindow* targetWindow = V8DOMWindow::toNative(window);
-
- ASSERT(targetWindow);
-
- Frame* target = targetWindow->frame();
- if (!target)
- return false;
-
- // Notice that we can't call HasRealNamedProperty for ACCESS_HAS
- // because that would generate infinite recursion.
- if (type == v8::ACCESS_HAS && target->tree()->child(index))
- return true;
- if (type == v8::ACCESS_GET && target->tree()->child(index) && !host->HasRealIndexedProperty(index))
- return true;
-
- return V8BindingSecurity::canAccessFrame(V8BindingState::Only(), target, false);
-}
-
-v8::Handle<v8::Value> toV8(DOMWindow* window)
-{
- if (!window)
- return v8::Null();
- // Initializes environment of a frame, and return the global object
- // of the frame.
- Frame* frame = window->frame();
- if (!frame)
- return v8::Handle<v8::Object>();
-
- // Special case: Because of evaluateInIsolatedWorld() one DOMWindow can have
- // multiple contexts and multiple global objects associated with it. When
- // code running in one of those contexts accesses the window object, we
- // want to return the global object associated with that context, not
- // necessarily the first global object associated with that DOMWindow.
- v8::Handle<v8::Context> currentContext = v8::Context::GetCurrent();
- v8::Handle<v8::Object> currentGlobal = currentContext->Global();
- v8::Handle<v8::Object> windowWrapper = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), currentGlobal);
- if (!windowWrapper.IsEmpty()) {
- if (V8DOMWindow::toNative(windowWrapper) == window)
- return currentGlobal;
- }
-
- // Otherwise, return the global object associated with this frame.
- v8::Handle<v8::Context> context = V8Proxy::context(frame);
- if (context.IsEmpty())
- return v8::Handle<v8::Object>();
-
- v8::Handle<v8::Object> global = context->Global();
- ASSERT(!global.IsEmpty());
- return global;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp b/WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp
deleted file mode 100644
index 3dad5c0..0000000
--- a/WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "DataGridColumnList.h"
-
-#include "Document.h"
-#include "V8Binding.h"
-#include "V8Proxy.h"
-
-#if ENABLE(DATAGRID)
-
-namespace WebCore {
-
-NAMED_PROPERTY_GETTER(DataGridColumnList)
-{
- INC_STATS("DataGridColumnList.NamedPropertyGetter");
- // Search the prototype chain first.
- v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototypeChain(name);
- if (!value.IsEmpty())
- return value;
-
- // Then look for IDL defined properties on the object itself.
- if (info.Holder()->HasRealNamedCallbackProperty(name))
- return notHandledByInterceptor();
-
- // Finally, look up a column by name.
- DataGridColumnList* imp = V8DataGridColumnList::toNative(info.Holder());
- DataGridColumn* result = imp->itemWithName(toWebCoreString(name));
- if (!result)
- return notHandledByInterceptor();
- return toV8(result);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(DATAGRID)
diff --git a/WebCore/bindings/v8/custom/V8DataViewCustom.cpp b/WebCore/bindings/v8/custom/V8DataViewCustom.cpp
deleted file mode 100755
index 16bd4a5..0000000
--- a/WebCore/bindings/v8/custom/V8DataViewCustom.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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 AND ITS CONTRIBUTORS "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 OR ITS 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.
- */
-
-#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
-#include "DataView.h"
-
-#include "V8ArrayBufferViewCustom.h"
-#include "V8Binding.h"
-#include "V8BindingMacros.h"
-#include "V8DataView.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8DataView::constructorCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.ArrayBuffer.Constructor");
-
- if (args[0]->IsNull() || !V8ArrayBuffer::HasInstance(args[0]))
- return V8Proxy::throwTypeError();
- return constructWebGLArrayWithArrayBufferArgument<DataView, char>(args, &info, v8::kExternalByteArray, false);
-}
-
-v8::Handle<v8::Value> toV8(DataView* impl)
-{
- if (!impl)
- return v8::Null();
- return V8DataView::wrap(impl);
-}
-
-v8::Handle<v8::Value> V8DataView::getInt8Callback(const v8::Arguments& args)
-{
- INC_STATS("DOM.DataView.getInt8");
- if (args.Length() < 1)
- return throwError("Not enough arguments", V8Proxy::SyntaxError);
-
- DataView* imp = V8DataView::toNative(args.Holder());
- ExceptionCode ec = 0;
- EXCEPTION_BLOCK(unsigned, byteOffset, toUInt32(args[0]));
- char result = imp->getInt8(byteOffset, ec);
- if (UNLIKELY(ec)) {
- V8Proxy::setDOMException(ec);
- return v8::Handle<v8::Value>();
- }
- return v8::Integer::New(result);
-}
-
-v8::Handle<v8::Value> V8DataView::getUint8Callback(const v8::Arguments& args)
-{
- INC_STATS("DOM.DataView.getUint8");
- if (args.Length() < 1)
- return throwError("Not enough arguments", V8Proxy::SyntaxError);
-
- DataView* imp = V8DataView::toNative(args.Holder());
- ExceptionCode ec = 0;
- EXCEPTION_BLOCK(unsigned, byteOffset, toUInt32(args[0]));
- unsigned char result = imp->getUint8(byteOffset, ec);
- if (UNLIKELY(ec)) {
- V8Proxy::setDOMException(ec);
- return v8::Handle<v8::Value>();
- }
- return v8::Integer::New(result);
-}
-
-v8::Handle<v8::Value> V8DataView::setInt8Callback(const v8::Arguments& args)
-{
- INC_STATS("DOM.DataView.setInt8");
- if (args.Length() < 2)
- return throwError("Not enough arguments", V8Proxy::SyntaxError);
-
- DataView* imp = V8DataView::toNative(args.Holder());
- ExceptionCode ec = 0;
- EXCEPTION_BLOCK(unsigned, byteOffset, toUInt32(args[0]));
- EXCEPTION_BLOCK(int, value, toInt32(args[1]));
- imp->setInt8(byteOffset, static_cast<char>(value), ec);
- if (UNLIKELY(ec))
- V8Proxy::setDOMException(ec);
- return v8::Handle<v8::Value>();
-}
-
-v8::Handle<v8::Value> V8DataView::setUint8Callback(const v8::Arguments& args)
-{
- INC_STATS("DOM.DataView.setUint8");
- if (args.Length() < 2)
- return throwError("Not enough arguments", V8Proxy::SyntaxError);
-
- DataView* imp = V8DataView::toNative(args.Holder());
- ExceptionCode ec = 0;
- EXCEPTION_BLOCK(unsigned, byteOffset, toUInt32(args[0]));
- EXCEPTION_BLOCK(int, value, toInt32(args[1]));
- imp->setUint8(byteOffset, static_cast<unsigned char>(value), ec);
- if (UNLIKELY(ec))
- V8Proxy::setDOMException(ec);
- return v8::Handle<v8::Value>();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp b/WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp
deleted file mode 100644
index 8fcf9a8..0000000
--- a/WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(WORKERS)
-#include "V8DedicatedWorkerContext.h"
-
-#include "DedicatedWorkerContext.h"
-#include "WorkerContextExecutionProxy.h"
-#include "V8Binding.h"
-#include "V8MessagePortCustom.h"
-#include "V8Proxy.h"
-#include "V8WorkerContextEventListener.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8DedicatedWorkerContext::postMessageCallback(const v8::Arguments& args)
-{
- INC_STATS(L"DOM.DedicatedWorkerContext.postMessage");
- DedicatedWorkerContext* workerContext = V8DedicatedWorkerContext::toNative(args.Holder());
- bool didThrow = false;
- RefPtr<SerializedScriptValue> message = SerializedScriptValue::create(args[0], didThrow);
- if (didThrow)
- return v8::Undefined();
- MessagePortArray portArray;
- if (args.Length() > 1) {
- if (!getMessagePortArray(args[1], portArray))
- return v8::Undefined();
- }
- ExceptionCode ec = 0;
- workerContext->postMessage(message.release(), &portArray, ec);
- return throwError(ec);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WORKERS)
diff --git a/WebCore/bindings/v8/custom/V8DeviceMotionEventCustom.cpp b/WebCore/bindings/v8/custom/V8DeviceMotionEventCustom.cpp
deleted file mode 100644
index f7a03f9..0000000
--- a/WebCore/bindings/v8/custom/V8DeviceMotionEventCustom.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (C) 2010 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:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT OWNER 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.
- */
-
-#include "config.h"
-#include "V8DeviceMotionEvent.h"
-
-#if ENABLE(DEVICE_ORIENTATION)
-
-#include "DeviceMotionData.h"
-#include "V8Binding.h"
-#include "V8BindingMacros.h"
-#include "V8Proxy.h"
-
-#include <v8.h>
-
-namespace WebCore {
-
-namespace {
-
-v8::Handle<v8::Value> createAccelerationObject(const DeviceMotionData::Acceleration* acceleration)
-{
- v8::Local<v8::Object> object = v8::Object::New();
- object->Set(v8::String::New("x"), acceleration->canProvideX() ? v8::Number::New(acceleration->x()) : v8::Null());
- object->Set(v8::String::New("y"), acceleration->canProvideY() ? v8::Number::New(acceleration->y()) : v8::Null());
- object->Set(v8::String::New("z"), acceleration->canProvideZ() ? v8::Number::New(acceleration->z()) : v8::Null());
- return object;
-}
-
-v8::Handle<v8::Value> createRotationRateObject(const DeviceMotionData::RotationRate* rotationRate)
-{
- v8::Local<v8::Object> object = v8::Object::New();
- object->Set(v8::String::New("alpha"), rotationRate->canProvideAlpha() ? v8::Number::New(rotationRate->alpha()) : v8::Null());
- object->Set(v8::String::New("beta"), rotationRate->canProvideBeta() ? v8::Number::New(rotationRate->beta()) : v8::Null());
- object->Set(v8::String::New("gamma"), rotationRate->canProvideGamma() ? v8::Number::New(rotationRate->gamma()) : v8::Null());
- return object;
-}
-
-RefPtr<DeviceMotionData::Acceleration> readAccelerationArgument(v8::Local<v8::Value> value)
-{
- if (isUndefinedOrNull(value))
- return 0;
-
- // Given the test above, this will always yield an object.
- v8::Local<v8::Object> object = value->ToObject();
-
- v8::Local<v8::Value> xValue = object->Get(v8::String::New("x"));
- if (xValue.IsEmpty())
- return 0;
- bool canProvideX = !isUndefinedOrNull(xValue);
- double x = xValue->NumberValue();
-
- v8::Local<v8::Value> yValue = object->Get(v8::String::New("y"));
- if (yValue.IsEmpty())
- return 0;
- bool canProvideY = !isUndefinedOrNull(yValue);
- double y = yValue->NumberValue();
-
- v8::Local<v8::Value> zValue = object->Get(v8::String::New("z"));
- if (zValue.IsEmpty())
- return 0;
- bool canProvideZ = !isUndefinedOrNull(zValue);
- double z = zValue->NumberValue();
-
- if (!canProvideX && !canProvideY && !canProvideZ)
- return 0;
-
- return DeviceMotionData::Acceleration::create(canProvideX, x, canProvideY, y, canProvideZ, z);
-}
-
-RefPtr<DeviceMotionData::RotationRate> readRotationRateArgument(v8::Local<v8::Value> value)
-{
- if (isUndefinedOrNull(value))
- return 0;
-
- // Given the test above, this will always yield an object.
- v8::Local<v8::Object> object = value->ToObject();
-
- v8::Local<v8::Value> alphaValue = object->Get(v8::String::New("alpha"));
- if (alphaValue.IsEmpty())
- return 0;
- bool canProvideAlpha = !isUndefinedOrNull(alphaValue);
- double alpha = alphaValue->NumberValue();
-
- v8::Local<v8::Value> betaValue = object->Get(v8::String::New("beta"));
- if (betaValue.IsEmpty())
- return 0;
- bool canProvideBeta = !isUndefinedOrNull(betaValue);
- double beta = betaValue->NumberValue();
-
- v8::Local<v8::Value> gammaValue = object->Get(v8::String::New("gamma"));
- if (gammaValue.IsEmpty())
- return 0;
- bool canProvideGamma = !isUndefinedOrNull(gammaValue);
- double gamma = gammaValue->NumberValue();
-
- if (!canProvideAlpha && !canProvideBeta && !canProvideGamma)
- return 0;
-
- return DeviceMotionData::RotationRate::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma);
-}
-
-} // namespace
-
-v8::Handle<v8::Value> V8DeviceMotionEvent::accelerationAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.DeviceMotionEvent.acceleration._get");
- v8::Handle<v8::Object> holder = info.Holder();
- DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder);
- if (!imp->deviceMotionData()->acceleration())
- return v8::Null();
- return createAccelerationObject(imp->deviceMotionData()->acceleration());
-}
-
-v8::Handle<v8::Value> V8DeviceMotionEvent::accelerationIncludingGravityAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.DeviceMotionEvent.accelerationIncludingGravity._get");
- v8::Handle<v8::Object> holder = info.Holder();
- DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder);
- if (!imp->deviceMotionData()->accelerationIncludingGravity())
- return v8::Null();
- return createAccelerationObject(imp->deviceMotionData()->accelerationIncludingGravity());
-}
-
-v8::Handle<v8::Value> V8DeviceMotionEvent::rotationRateAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.DeviceMotionEvent.rotationRate._get");
- v8::Handle<v8::Object> holder = info.Holder();
- DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder);
- if (!imp->deviceMotionData()->rotationRate())
- return v8::Null();
- return createRotationRateObject(imp->deviceMotionData()->rotationRate());
-}
-
-v8::Handle<v8::Value> V8DeviceMotionEvent::intervalAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.DeviceMotionEvent.interval._get");
- v8::Handle<v8::Object> holder = info.Holder();
- DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder);
- if (!imp->deviceMotionData()->canProvideInterval())
- return v8::Null();
- return v8::Number::New(imp->deviceMotionData()->interval());
-}
-
-v8::Handle<v8::Value> V8DeviceMotionEvent::initDeviceMotionEventCallback(const v8::Arguments& args)
-{
- DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(args.Holder());
- STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, type, args[0]);
- bool bubbles = args[1]->BooleanValue();
- bool cancelable = args[2]->BooleanValue();
- RefPtr<DeviceMotionData::Acceleration> acceleration = readAccelerationArgument(args[3]);
- RefPtr<DeviceMotionData::Acceleration> accelerationIncludingGravity = readAccelerationArgument(args[4]);
- RefPtr<DeviceMotionData::RotationRate> rotationRate = readRotationRateArgument(args[5]);
- bool intervalProvided = !isUndefinedOrNull(args[6]);
- double interval = args[6]->NumberValue();
- RefPtr<DeviceMotionData> deviceMotionData = DeviceMotionData::create(acceleration, accelerationIncludingGravity, rotationRate, intervalProvided, interval);
- imp->initDeviceMotionEvent(type, bubbles, cancelable, deviceMotionData.get());
- return v8::Handle<v8::Value>();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(DEVICE_ORIENTATION)
diff --git a/WebCore/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp b/WebCore/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp
deleted file mode 100644
index ce8eaf3..0000000
--- a/WebCore/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT OWNER 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.
- */
-
-#include "config.h"
-#include "V8DeviceOrientationEvent.h"
-
-#if ENABLE(DEVICE_ORIENTATION)
-
-#include "DeviceOrientation.h"
-#include "V8Binding.h"
-#include "V8BindingMacros.h"
-#include "V8Proxy.h"
-
-#include <v8.h>
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8DeviceOrientationEvent::alphaAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.DeviceOrientationEvent.alpha._get");
- v8::Handle<v8::Object> holder = info.Holder();
- DeviceOrientationEvent* imp = V8DeviceOrientationEvent::toNative(holder);
- if (!imp->orientation()->canProvideAlpha())
- return v8::Null();
- return v8::Number::New(imp->orientation()->alpha());
-}
-
-v8::Handle<v8::Value> V8DeviceOrientationEvent::betaAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.DeviceOrientationEvent.beta._get");
- v8::Handle<v8::Object> holder = info.Holder();
- DeviceOrientationEvent* imp = V8DeviceOrientationEvent::toNative(holder);
- if (!imp->orientation()->canProvideBeta())
- return v8::Null();
- return v8::Number::New(imp->orientation()->beta());
-}
-
-v8::Handle<v8::Value> V8DeviceOrientationEvent::gammaAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.DeviceOrientationEvent.gamma._get");
- v8::Handle<v8::Object> holder = info.Holder();
- DeviceOrientationEvent* imp = V8DeviceOrientationEvent::toNative(holder);
- if (!imp->orientation()->canProvideGamma())
- return v8::Null();
- return v8::Number::New(imp->orientation()->gamma());
-}
-
-v8::Handle<v8::Value> V8DeviceOrientationEvent::initDeviceOrientationEventCallback(const v8::Arguments& args)
-{
- DeviceOrientationEvent* imp = V8DeviceOrientationEvent::toNative(args.Holder());
- STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, type, args[0]);
- bool bubbles = args[1]->BooleanValue();
- bool cancelable = args[2]->BooleanValue();
- // If alpha, beta or gamma are null or undefined, mark them as not provided.
- // Otherwise, use the standard JavaScript conversion.
- bool alphaProvided = !isUndefinedOrNull(args[3]);
- double alpha = args[3]->NumberValue();
- bool betaProvided = !isUndefinedOrNull(args[4]);
- double beta = args[4]->NumberValue();
- bool gammaProvided = !isUndefinedOrNull(args[5]);
- double gamma = args[5]->NumberValue();
- RefPtr<DeviceOrientation> orientation = DeviceOrientation::create(alphaProvided, alpha, betaProvided, beta, gammaProvided, gamma);
- imp->initDeviceOrientationEvent(type, bubbles, cancelable, orientation.get());
- return v8::Handle<v8::Value>();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(DEVICE_ORIENTATION)
diff --git a/WebCore/bindings/v8/custom/V8DirectoryEntryCustom.cpp b/WebCore/bindings/v8/custom/V8DirectoryEntryCustom.cpp
deleted file mode 100644
index a44131a..0000000
--- a/WebCore/bindings/v8/custom/V8DirectoryEntryCustom.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8DirectoryEntry.h"
-
-#if ENABLE(FILE_SYSTEM)
-
-#include "DirectoryEntry.h"
-#include "ExceptionCode.h"
-#include "V8Binding.h"
-#include "V8BindingMacros.h"
-#include "V8EntryCallback.h"
-#include "V8ErrorCallback.h"
-#include "V8Flags.h"
-#include "V8Proxy.h"
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8DirectoryEntry::getDirectoryCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.DirectoryEntry.getDirectory");
- DirectoryEntry* imp = V8DirectoryEntry::toNative(args.Holder());
- STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<WithUndefinedOrNullCheck>, path, args[0]);
- if (args.Length() <= 1) {
- imp->getDirectory(path);
- return v8::Handle<v8::Value>();
- }
- RefPtr<Flags> flags;
- if (!isUndefinedOrNull(args[1]) && args[1]->IsObject() && !V8Flags::HasInstance(args[1])) {
- EXCEPTION_BLOCK(v8::Handle<v8::Object>, object, v8::Handle<v8::Object>::Cast(args[1]));
- flags = Flags::create();
- v8::Local<v8::Value> v8Create = object->Get(v8::String::New("create"));
- if (!v8Create.IsEmpty() && !isUndefinedOrNull(v8Create)) {
- EXCEPTION_BLOCK(bool, isCreate, v8Create->BooleanValue());
- flags->setCreate(isCreate);
- }
- v8::Local<v8::Value> v8Exclusive = object->Get(v8::String::New("exclusive"));
- if (!v8Exclusive.IsEmpty() && !isUndefinedOrNull(v8Exclusive)) {
- EXCEPTION_BLOCK(bool, isExclusive, v8Exclusive->BooleanValue());
- flags->setExclusive(isExclusive);
- }
- } else {
- EXCEPTION_BLOCK(Flags*, tmp_flags, V8Flags::HasInstance(args[1]) ? V8Flags::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0);
- flags = tmp_flags;
- }
- RefPtr<EntryCallback> successCallback;
- if (args.Length() > 2 && !args[2]->IsNull() && !args[2]->IsUndefined()) {
- if (!args[2]->IsObject())
- return throwError(TYPE_MISMATCH_ERR);
- successCallback = V8EntryCallback::create(args[2], getScriptExecutionContext());
- }
- RefPtr<ErrorCallback> errorCallback;
- if (args.Length() > 3 && !args[3]->IsNull() && !args[3]->IsUndefined()) {
- if (!args[3]->IsObject())
- return throwError(TYPE_MISMATCH_ERR);
- errorCallback = V8ErrorCallback::create(args[3], getScriptExecutionContext());
- }
- imp->getDirectory(path, flags, successCallback, errorCallback);
- return v8::Handle<v8::Value>();
-}
-
-v8::Handle<v8::Value> V8DirectoryEntry::getFileCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.DirectoryEntry.getFile");
- DirectoryEntry* imp = V8DirectoryEntry::toNative(args.Holder());
- STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<WithUndefinedOrNullCheck>, path, args[0]);
- if (args.Length() <= 1) {
- imp->getFile(path);
- return v8::Handle<v8::Value>();
- }
- RefPtr<Flags> flags;
- if (!isUndefinedOrNull(args[1]) && args[1]->IsObject() && !V8Flags::HasInstance(args[1])) {
- EXCEPTION_BLOCK(v8::Handle<v8::Object>, object, v8::Handle<v8::Object>::Cast(args[1]));
- flags = Flags::create();
- v8::Local<v8::Value> v8Create = object->Get(v8::String::New("create"));
- if (!v8Create.IsEmpty() && !isUndefinedOrNull(v8Create)) {
- EXCEPTION_BLOCK(bool, isCreate, v8Create->BooleanValue());
- flags->setCreate(isCreate);
- }
- v8::Local<v8::Value> v8Exclusive = object->Get(v8::String::New("exclusive"));
- if (!v8Exclusive.IsEmpty() && !isUndefinedOrNull(v8Exclusive)) {
- EXCEPTION_BLOCK(bool, isExclusive, v8Exclusive->BooleanValue());
- flags->setExclusive(isExclusive);
- }
- } else {
- EXCEPTION_BLOCK(Flags*, tmp_flags, V8Flags::HasInstance(args[1]) ? V8Flags::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0);
- flags = tmp_flags;
- }
- RefPtr<EntryCallback> successCallback;
- if (args.Length() > 2 && !args[2]->IsNull() && !args[2]->IsUndefined()) {
- if (!args[2]->IsObject())
- return throwError(TYPE_MISMATCH_ERR);
- successCallback = V8EntryCallback::create(args[2], getScriptExecutionContext());
- }
- RefPtr<ErrorCallback> errorCallback;
- if (args.Length() > 3 && !args[3]->IsNull() && !args[3]->IsUndefined()) {
- if (!args[3]->IsObject())
- return throwError(TYPE_MISMATCH_ERR);
- errorCallback = V8ErrorCallback::create(args[3], getScriptExecutionContext());
- }
- imp->getFile(path, flags, successCallback, errorCallback);
- return v8::Handle<v8::Value>();
-}
-
-
-
-} // namespace WebCore
-
-#endif // ENABLE(FILE_SYSTEM)
diff --git a/WebCore/bindings/v8/custom/V8DirectoryEntrySyncCustom.cpp b/WebCore/bindings/v8/custom/V8DirectoryEntrySyncCustom.cpp
deleted file mode 100644
index 90b3d13..0000000
--- a/WebCore/bindings/v8/custom/V8DirectoryEntrySyncCustom.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8DirectoryEntrySync.h"
-
-#if ENABLE(FILE_SYSTEM)
-
-#include "DirectoryEntrySync.h"
-#include "ExceptionCode.h"
-#include "V8Binding.h"
-#include "V8BindingMacros.h"
-#include "V8EntryCallback.h"
-#include "V8ErrorCallback.h"
-#include "V8FileEntrySync.h"
-#include "V8Flags.h"
-#include "V8Proxy.h"
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-static bool extractBooleanValue(const v8::Handle<v8::Object>& object, const char* name, ExceptionCode& ec) {
- ec = 0;
- v8::Local<v8::Value> value = object->Get(v8::String::New(name));
- if (!value.IsEmpty() && !isUndefinedOrNull(value)) {
- v8::TryCatch block;
- bool nativeValue = value->BooleanValue();
- if (block.HasCaught()) {
- ec = TYPE_MISMATCH_ERR;
- return false;
- }
- return nativeValue;
- }
- return false;
-}
-
-static PassRefPtr<Flags> getFlags(const v8::Local<v8::Value>& arg, ExceptionCode& ec)
-{
- ec = 0;
- if (isUndefinedOrNull(arg) || !arg->IsObject())
- return 0;
- if (V8Flags::HasInstance(arg))
- return V8Flags::toNative(v8::Handle<v8::Object>::Cast(arg));
-
- v8::Handle<v8::Object> object;
- {
- v8::TryCatch block;
- object = v8::Handle<v8::Object>::Cast(arg);
- if (block.HasCaught()) {
- ec = TYPE_MISMATCH_ERR;
- return 0;
- }
- }
-
- bool isCreate = extractBooleanValue(object, "create", ec);
- if (ec)
- return 0;
- bool isExclusive = extractBooleanValue(object, "exclusive", ec);
- if (ec)
- return 0;
-
- RefPtr<Flags> flags = Flags::create();
- flags->setCreate(isCreate);
- flags->setExclusive(isExclusive);
-
- return flags;
-}
-
-v8::Handle<v8::Value> V8DirectoryEntrySync::getDirectoryCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.DirectoryEntrySync.getDirectory");
- DirectoryEntrySync* imp = V8DirectoryEntrySync::toNative(args.Holder());
- ExceptionCode ec = 0;
- STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, path, args[0]);
- RefPtr<Flags> flags = getFlags(args[1], ec);
- if (UNLIKELY(ec)) {
- V8Proxy::setDOMException(ec);
- return v8::Handle<v8::Value>();
- }
- RefPtr<DirectoryEntrySync> result = imp->getDirectory(path, flags, ec);
- if (UNLIKELY(ec)) {
- V8Proxy::setDOMException(ec);
- return v8::Handle<v8::Value>();
- }
- return toV8(result.release());
-}
-
-v8::Handle<v8::Value> V8DirectoryEntrySync::getFileCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.DirectoryEntrySync.getFile");
- DirectoryEntrySync* imp = V8DirectoryEntrySync::toNative(args.Holder());
- ExceptionCode ec = 0;
- STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, path, args[0]);
- RefPtr<Flags> flags = getFlags(args[1], ec);
- if (UNLIKELY(ec)) {
- V8Proxy::setDOMException(ec);
- return v8::Handle<v8::Value>();
- }
- RefPtr<FileEntrySync> result = imp->getFile(path, flags, ec);
- if (UNLIKELY(ec)) {
- V8Proxy::setDOMException(ec);
- return v8::Handle<v8::Value>();
- }
- return toV8(result.release());
-}
-
-
-
-} // namespace WebCore
-
-#endif // ENABLE(FILE_SYSTEM)
diff --git a/WebCore/bindings/v8/custom/V8DocumentCustom.cpp b/WebCore/bindings/v8/custom/V8DocumentCustom.cpp
deleted file mode 100644
index 9fa9f80..0000000
--- a/WebCore/bindings/v8/custom/V8DocumentCustom.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (C) 2007-2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8Document.h"
-
-#include "CanvasRenderingContext.h"
-#include "Document.h"
-#include "ExceptionCode.h"
-#include "Node.h"
-#include "XPathNSResolver.h"
-#include "XPathResult.h"
-
-#include "V8Binding.h"
-#include "V8CanvasRenderingContext2D.h"
-#include "V8CustomXPathNSResolver.h"
-#include "V8DOMImplementation.h"
-#include "V8HTMLDocument.h"
-#include "V8IsolatedContext.h"
-#include "V8Node.h"
-#include "V8Proxy.h"
-#if ENABLE(3D_CANVAS)
-#include "V8WebGLRenderingContext.h"
-#endif
-#include "V8XPathNSResolver.h"
-#include "V8XPathResult.h"
-
-#if ENABLE(SVG)
-#include "V8SVGDocument.h"
-#endif
-
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-#if ENABLE(XPATH)
-v8::Handle<v8::Value> V8Document::evaluateCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Document.evaluate()");
-
- RefPtr<Document> document = V8Document::toNative(args.Holder());
- ExceptionCode ec = 0;
- String expression = toWebCoreString(args[0]);
- RefPtr<Node> contextNode;
- if (V8Node::HasInstance(args[1]))
- contextNode = V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1]));
-
- RefPtr<XPathNSResolver> resolver = V8DOMWrapper::getXPathNSResolver(args[2]);
- if (!resolver && !args[2]->IsNull() && !args[2]->IsUndefined())
- return throwError(TYPE_MISMATCH_ERR);
-
- int type = toInt32(args[3]);
- RefPtr<XPathResult> inResult;
- if (V8XPathResult::HasInstance(args[4]))
- inResult = V8XPathResult::toNative(v8::Handle<v8::Object>::Cast(args[4]));
-
- v8::TryCatch exceptionCatcher;
- RefPtr<XPathResult> result = document->evaluate(expression, contextNode.get(), resolver.get(), type, inResult.get(), ec);
- if (exceptionCatcher.HasCaught())
- return throwError(exceptionCatcher.Exception());
-
- if (ec)
- return throwError(ec);
-
- return toV8(result.release());
-}
-#endif
-
-v8::Handle<v8::Value> V8Document::getCSSCanvasContextCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Document.getCSSCanvasContext");
- v8::Handle<v8::Object> holder = args.Holder();
- Document* imp = V8Document::toNative(holder);
- String contextId = toWebCoreString(args[0]);
- String name = toWebCoreString(args[1]);
- int width = toInt32(args[2]);
- int height = toInt32(args[3]);
- CanvasRenderingContext* result = imp->getCSSCanvasContext(contextId, name, width, height);
- if (!result)
- return v8::Undefined();
- if (result->is2d())
- return toV8(static_cast<CanvasRenderingContext2D*>(result));
-#if ENABLE(3D_CANVAS)
- else if (result->is3d())
- return toV8(static_cast<WebGLRenderingContext*>(result));
-#endif // ENABLE(3D_CANVAS)
- ASSERT_NOT_REACHED();
- return v8::Undefined();
-}
-
-
-// DOMImplementation is a singleton in WebCore. If we use our normal
-// mapping from DOM objects to V8 wrappers, the same wrapper will be
-// shared for all frames in the same process. This is a major
-// security problem. Therefore, we generate a DOMImplementation
-// wrapper per document and store it in an internal field of the
-// document. Since the DOMImplementation object is a singleton, we do
-// not have to do anything to keep the DOMImplementation object alive
-// for the lifetime of the wrapper.
-v8::Handle<v8::Value> V8Document::implementationAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- ASSERT(info.Holder()->InternalFieldCount() >= internalFieldCount);
-
- // Check if the internal field already contains a wrapper.
- v8::Local<v8::Value> implementation = info.Holder()->GetInternalField(V8Document::implementationIndex);
- if (!implementation->IsUndefined())
- return implementation;
-
- // Generate a wrapper.
- Document* document = V8Document::toNative(info.Holder());
- v8::Handle<v8::Value> wrapper = toV8(document->implementation());
-
- // Store the wrapper in the internal field.
- info.Holder()->SetInternalField(implementationIndex, wrapper);
-
- return wrapper;
-}
-
-v8::Handle<v8::Value> toV8(Document* impl, bool forceNewObject)
-{
- if (!impl)
- return v8::Null();
- if (impl->isHTMLDocument())
- return toV8(static_cast<HTMLDocument*>(impl), forceNewObject);
-#if ENABLE(SVG)
- if (impl->isSVGDocument())
- return toV8(static_cast<SVGDocument*>(impl), forceNewObject);
-#endif
- v8::Handle<v8::Object> wrapper = V8Document::wrap(impl, forceNewObject);
- if (wrapper.IsEmpty())
- return wrapper;
- if (!V8IsolatedContext::getEntered()) {
- if (V8Proxy* proxy = V8Proxy::retrieve(impl->frame()))
- proxy->windowShell()->updateDocumentWrapper(wrapper);
- }
- return wrapper;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp b/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp
deleted file mode 100644
index f86054b..0000000
--- a/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2000 Harri Porten (porten@kde.org)
- * Copyright (C) 2001 Peter Kelly (pmk@post.com)
- * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
- * Copyright (C) 2006 James G. Speth (speth@end.com)
- * Copyright (C) 2006 Samuel Weinig (sam@webkit.org)
- * Copyright (C) 2007, 2008, 2009 Google Inc. All Rights Reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "config.h"
-#include "V8Document.h"
-
-#include "DOMWindow.h"
-#include "Frame.h"
-#include "V8Binding.h"
-#include "V8Location.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8Document::locationAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- Document* document = V8Document::toNative(info.Holder());
- if (!document->frame())
- return v8::Null();
-
- DOMWindow* window = document->frame()->domWindow();
- return toV8(window->location());
-}
-
-void V8Document::locationAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- Document* document = V8Document::toNative(info.Holder());
- if (!document->frame())
- return;
-
- DOMWindow* window = document->frame()->domWindow();
- // setLocation does security checks. // XXXMB- verify!
- V8DOMWindowShell::setLocation(window, toWebCoreString(value));
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8ElementCustom.cpp b/WebCore/bindings/v8/custom/V8ElementCustom.cpp
deleted file mode 100644
index 02fc457..0000000
--- a/WebCore/bindings/v8/custom/V8ElementCustom.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2007-2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8Element.h"
-
-#include "Attr.h"
-#include "Document.h"
-#include "Element.h"
-#include "ExceptionCode.h"
-#include "HTMLFrameElementBase.h"
-#include "HTMLNames.h"
-#include "Node.h"
-
-#include "V8Attr.h"
-#include "V8Binding.h"
-#include "V8BindingState.h"
-#include "V8HTMLElement.h"
-#include "V8Proxy.h"
-
-#if ENABLE(SVG)
-#include "V8SVGElement.h"
-#endif
-
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-v8::Handle<v8::Value> toV8(Element* impl, bool forceNewObject)
-{
- if (!impl)
- return v8::Null();
- if (impl->isHTMLElement())
- return toV8(static_cast<HTMLElement*>(impl), forceNewObject);
-#if ENABLE(SVG)
- if (impl->isSVGElement())
- return toV8(static_cast<SVGElement*>(impl), forceNewObject);
-#endif
- return V8Element::wrap(impl, forceNewObject);
-}
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8EntryCustom.cpp b/WebCore/bindings/v8/custom/V8EntryCustom.cpp
deleted file mode 100644
index c02cd6f..0000000
--- a/WebCore/bindings/v8/custom/V8EntryCustom.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "Entry.h"
-
-#if ENABLE(FILE_SYSTEM)
-
-#include "V8Attr.h"
-#include "V8Binding.h"
-#include "V8BindingState.h"
-#include "V8DirectoryEntry.h"
-#include "V8Entry.h"
-#include "V8FileEntry.h"
-#include "V8Proxy.h"
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-v8::Handle<v8::Value> toV8(Entry* impl)
-{
- if (!impl)
- return v8::Null();
-
- if (impl->isFile())
- return toV8(static_cast<FileEntry*>(impl));
-
- ASSERT(impl->isDirectory());
- return toV8(static_cast<DirectoryEntry*>(impl));
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(FILE_SYSTEM)
diff --git a/WebCore/bindings/v8/custom/V8EntrySyncCustom.cpp b/WebCore/bindings/v8/custom/V8EntrySyncCustom.cpp
deleted file mode 100644
index e98df19..0000000
--- a/WebCore/bindings/v8/custom/V8EntrySyncCustom.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "EntrySync.h"
-
-#if ENABLE(FILE_SYSTEM)
-
-#include "V8Attr.h"
-#include "V8Binding.h"
-#include "V8BindingState.h"
-#include "V8DirectoryEntrySync.h"
-#include "V8EntrySync.h"
-#include "V8FileEntrySync.h"
-#include "V8Proxy.h"
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-v8::Handle<v8::Value> toV8(EntrySync* impl)
-{
- if (!impl)
- return v8::Null();
-
- if (impl->isFile())
- return toV8(static_cast<FileEntrySync*>(impl));
-
- ASSERT(impl->isDirectory());
- return toV8(static_cast<DirectoryEntrySync*>(impl));
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(FILE_SYSTEM)
diff --git a/WebCore/bindings/v8/custom/V8EventCustom.cpp b/WebCore/bindings/v8/custom/V8EventCustom.cpp
deleted file mode 100644
index ff9b98b..0000000
--- a/WebCore/bindings/v8/custom/V8EventCustom.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8Event.h"
-
-#include "Clipboard.h"
-#include "ClipboardEvent.h"
-#include "CustomEvent.h"
-#include "Event.h"
-#include "V8BeforeLoadEvent.h"
-#include "V8Binding.h"
-#include "V8Clipboard.h"
-#include "V8CompositionEvent.h"
-#include "V8CustomEvent.h"
-#include "V8DeviceMotionEvent.h"
-#include "V8DeviceOrientationEvent.h"
-#include "V8ErrorEvent.h"
-#include "V8HashChangeEvent.h"
-#include "V8IDBErrorEvent.h"
-#include "V8IDBSuccessEvent.h"
-#include "V8KeyboardEvent.h"
-#include "V8MessageEvent.h"
-#include "V8MouseEvent.h"
-#include "V8MutationEvent.h"
-#include "V8OverflowEvent.h"
-#include "V8PageTransitionEvent.h"
-#include "V8PopStateEvent.h"
-#include "V8ProgressEvent.h"
-#include "V8Proxy.h"
-#include "V8SpeechInputEvent.h"
-#include "V8StorageEvent.h"
-#include "V8TextEvent.h"
-#include "V8TouchEvent.h"
-#include "V8UIEvent.h"
-#include "V8WebKitAnimationEvent.h"
-#include "V8WebKitTransitionEvent.h"
-#include "V8WheelEvent.h"
-#include "V8XMLHttpRequestProgressEvent.h"
-
-#if ENABLE(SVG)
-#include "V8SVGZoomEvent.h"
-#endif
-
-#if ENABLE(WEB_AUDIO)
-#include "V8AudioProcessingEvent.h"
-#endif
-
-namespace WebCore {
-
-void V8Event::valueAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- Event* event = V8Event::toNative(info.Holder());
- event->setDefaultPrevented(!value->BooleanValue());
-}
-
-v8::Handle<v8::Value> V8Event::dataTransferAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- Event* event = V8Event::toNative(info.Holder());
-
- if (event->isDragEvent())
- return toV8(static_cast<MouseEvent*>(event)->clipboard());
-
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Event::clipboardDataAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- Event* event = V8Event::toNative(info.Holder());
-
- if (event->isClipboardEvent())
- return toV8(static_cast<ClipboardEvent*>(event)->clipboard());
-
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> toV8(Event* impl)
-{
- if (!impl)
- return v8::Null();
- if (impl->isUIEvent()) {
- if (impl->isKeyboardEvent())
- return toV8(static_cast<KeyboardEvent*>(impl));
- if (impl->isTextEvent())
- return toV8(static_cast<TextEvent*>(impl));
- if (impl->isMouseEvent())
- return toV8(static_cast<MouseEvent*>(impl));
- if (impl->isWheelEvent())
- return toV8(static_cast<WheelEvent*>(impl));
-#if ENABLE(SVG)
- if (impl->isSVGZoomEvent())
- return toV8(static_cast<SVGZoomEvent*>(impl));
-#endif
- if (impl->isCompositionEvent())
- return toV8(static_cast<CompositionEvent*>(impl));
-#if ENABLE(TOUCH_EVENTS)
- if (impl->isTouchEvent())
- return toV8(static_cast<TouchEvent*>(impl));
-#endif
- return toV8(static_cast<UIEvent*>(impl));
- }
- if (impl->isHashChangeEvent())
- return toV8(static_cast<HashChangeEvent*>(impl));
- if (impl->isMutationEvent())
- return toV8(static_cast<MutationEvent*>(impl));
- if (impl->isOverflowEvent())
- return toV8(static_cast<OverflowEvent*>(impl));
- if (impl->isMessageEvent())
- return toV8(static_cast<MessageEvent*>(impl));
- if (impl->isPageTransitionEvent())
- return toV8(static_cast<PageTransitionEvent*>(impl));
- if (impl->isPopStateEvent())
- return toV8(static_cast<PopStateEvent*>(impl));
- if (impl->isProgressEvent()) {
- if (impl->isXMLHttpRequestProgressEvent())
- return toV8(static_cast<XMLHttpRequestProgressEvent*>(impl));
- return toV8(static_cast<ProgressEvent*>(impl));
- }
- if (impl->isWebKitAnimationEvent())
- return toV8(static_cast<WebKitAnimationEvent*>(impl));
- if (impl->isWebKitTransitionEvent())
- return toV8(static_cast<WebKitTransitionEvent*>(impl));
-#if ENABLE(WORKERS)
- if (impl->isErrorEvent())
- return toV8(static_cast<ErrorEvent*>(impl));
-#endif
-#if ENABLE(DOM_STORAGE)
- if (impl->isStorageEvent())
- return toV8(static_cast<StorageEvent*>(impl));
-#endif
-#if ENABLE(INDEXED_DATABASE)
- if (impl->isIDBErrorEvent())
- return toV8(static_cast<IDBErrorEvent*>(impl));
- if (impl->isIDBSuccessEvent())
- return toV8(static_cast<IDBSuccessEvent*>(impl));
-#endif
- if (impl->isBeforeLoadEvent())
- return toV8(static_cast<BeforeLoadEvent*>(impl));
-#if ENABLE(DEVICE_ORIENTATION)
- if (impl->isDeviceMotionEvent())
- return toV8(static_cast<DeviceMotionEvent*>(impl));
- if (impl->isDeviceOrientationEvent())
- return toV8(static_cast<DeviceOrientationEvent*>(impl));
-#endif
-#if ENABLE(WEB_AUDIO)
- if (impl->isAudioProcessingEvent())
- return toV8(static_cast<AudioProcessingEvent*>(impl));
-#endif
-#if ENABLE(INPUT_SPEECH)
- if (impl->isSpeechInputEvent())
- return toV8(static_cast<SpeechInputEvent*>(impl));
-#endif
- if (impl->isCustomEvent())
- return toV8(static_cast<CustomEvent*>(impl));
- return V8Event::wrap(impl);
-}
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8EventSourceConstructor.cpp b/WebCore/bindings/v8/custom/V8EventSourceConstructor.cpp
deleted file mode 100644
index 01e9c44..0000000
--- a/WebCore/bindings/v8/custom/V8EventSourceConstructor.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(EVENTSOURCE)
-#include "V8EventSource.h"
-
-#include "EventSource.h"
-#include "Frame.h"
-#include "V8Binding.h"
-#include "V8Proxy.h"
-#include "V8Utilities.h"
-#include "WorkerContext.h"
-#include "WorkerContextExecutionProxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8EventSource::constructorCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.EventSource.Constructor");
-
- if (!args.IsConstructCall())
- return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
-
- // Expect one parameter.
- // Allocate an EventSource object as its internal field.
- ScriptExecutionContext* context = getScriptExecutionContext();
- if (!context)
- return throwError("EventSource constructor's associated context is not available", V8Proxy::ReferenceError);
- if (args.Length() != 1)
- return throwError("Not enough arguments", V8Proxy::SyntaxError);
-
- ExceptionCode ec = 0;
- String url = toWebCoreString(args[0]);
-
- RefPtr<EventSource> eventSource = EventSource::create(url, context, ec);
-
- if (ec)
- return throwError(ec);
-
- V8DOMWrapper::setDOMWrapper(args.Holder(), &info, eventSource.get());
-
- // Add object to the wrapper map.
- eventSource->ref();
- V8DOMWrapper::setJSWrapperForActiveDOMObject(eventSource.get(), v8::Persistent<v8::Object>::New(args.Holder()));
- return args.Holder();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(EVENTSOURCE)
diff --git a/WebCore/bindings/v8/custom/V8FileReaderCustom.cpp b/WebCore/bindings/v8/custom/V8FileReaderCustom.cpp
deleted file mode 100755
index fb0d53c..0000000
--- a/WebCore/bindings/v8/custom/V8FileReaderCustom.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(BLOB)
-
-#include "V8FileReader.h"
-
-#include "ScriptExecutionContext.h"
-#include "V8ArrayBuffer.h"
-#include "V8Binding.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8FileReader::constructorCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.FileReader.Constructor");
-
- if (!args.IsConstructCall())
- return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
-
- // Expect no parameters.
- // Allocate a FileReader object as its internal field.
- ScriptExecutionContext* context = getScriptExecutionContext();
- if (!context)
- return throwError("FileReader constructor's associated context is not available", V8Proxy::ReferenceError);
- RefPtr<FileReader> fileReader = FileReader::create(context);
- V8DOMWrapper::setDOMWrapper(args.Holder(), &info, fileReader.get());
-
- // Add object to the wrapper map.
- fileReader->ref();
- V8DOMWrapper::setJSWrapperForActiveDOMObject(fileReader.get(), v8::Persistent<v8::Object>::New(args.Holder()));
- return args.Holder();
-}
-
-v8::Handle<v8::Value> V8FileReader::resultAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.FileReader.result._get");
- v8::Handle<v8::Object> holder = info.Holder();
- FileReader* imp = V8FileReader::toNative(holder);
- if (imp->readType() == FileReaderLoader::ReadAsArrayBuffer)
- return toV8(imp->arrayBufferResult());
- return v8StringOrNull(imp->stringResult());
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp b/WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp
deleted file mode 100644
index c3dbe3b..0000000
--- a/WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
-#include "ArrayBuffer.h"
-#include "Float32Array.h"
-
-#include "V8Binding.h"
-#include "V8ArrayBuffer.h"
-#include "V8ArrayBufferViewCustom.h"
-#include "V8Float32Array.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8Float32Array::constructorCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Float32Array.Contructor");
-
- return constructWebGLArray<Float32Array, float>(args, &info, v8::kExternalFloatArray);
-}
-
-v8::Handle<v8::Value> V8Float32Array::setCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Float32Array.set()");
- return setWebGLArrayHelper<Float32Array, V8Float32Array>(args);
-}
-
-v8::Handle<v8::Value> toV8(Float32Array* impl)
-{
- if (!impl)
- return v8::Null();
- v8::Handle<v8::Object> wrapper = V8Float32Array::wrap(impl);
- if (!wrapper.IsEmpty())
- wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalFloatArray, impl->length());
- return wrapper;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp b/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp
deleted file mode 100644
index 54bd11c..0000000
--- a/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Copyright 2009, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT OWNER 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.
- */
-
-#include "config.h"
-#include "V8Geolocation.h"
-
-#if ENABLE(GEOLOCATION)
-
-#include "Frame.h"
-#include "Geolocation.h"
-#include "V8Binding.h"
-#include "V8CustomPositionCallback.h"
-#include "V8CustomPositionErrorCallback.h"
-#include "V8Proxy.h"
-
-using namespace std;
-using namespace WTF;
-
-namespace WebCore {
-
-static const char typeMismatchError[] = "TYPE_MISMATCH_ERR: DOM Exception 17";
-
-static void throwTypeMismatchException()
-{
- V8Proxy::throwError(V8Proxy::GeneralError, typeMismatchError);
-}
-
-static PassRefPtr<PositionCallback> createPositionCallback(v8::Local<v8::Value> value, bool& succeeded)
-{
- succeeded = true;
-
- // The spec specifies 'FunctionOnly' for this object.
- if (!value->IsFunction()) {
- succeeded = false;
- throwTypeMismatchException();
- return 0;
- }
-
- return V8CustomPositionCallback::create(value, getScriptExecutionContext());
-}
-
-static PassRefPtr<PositionErrorCallback> createPositionErrorCallback(v8::Local<v8::Value> value, bool& succeeded)
-{
- succeeded = true;
-
- // Argument is optional (hence undefined is allowed), and null is allowed.
- if (isUndefinedOrNull(value))
- return 0;
-
- // The spec specifies 'FunctionOnly' for this object.
- if (!value->IsFunction()) {
- succeeded = false;
- throwTypeMismatchException();
- return 0;
- }
-
- return V8CustomPositionErrorCallback::create(value, getScriptExecutionContext());
-}
-
-static PassRefPtr<PositionOptions> createPositionOptions(v8::Local<v8::Value> value, bool& succeeded)
-{
- succeeded = true;
-
- // Create default options.
- RefPtr<PositionOptions> options = PositionOptions::create();
-
- // Argument is optional (hence undefined is allowed), and null is allowed.
- if (isUndefinedOrNull(value)) {
- // Use default options.
- return options.release();
- }
-
- // Given the above test, this will always yield an object.
- v8::Local<v8::Object> object = value->ToObject();
-
- // For all three properties, we apply the following ...
- // - If the getter or the property's valueOf method throws an exception, we
- // quit so as not to risk overwriting the exception.
- // - If the value is absent or undefined, we don't override the default.
- v8::Local<v8::Value> enableHighAccuracyValue = object->Get(v8::String::New("enableHighAccuracy"));
- if (enableHighAccuracyValue.IsEmpty()) {
- succeeded = false;
- return 0;
- }
- if (!enableHighAccuracyValue->IsUndefined()) {
- v8::Local<v8::Boolean> enableHighAccuracyBoolean = enableHighAccuracyValue->ToBoolean();
- if (enableHighAccuracyBoolean.IsEmpty()) {
- succeeded = false;
- return 0;
- }
- options->setEnableHighAccuracy(enableHighAccuracyBoolean->Value());
- }
-
- v8::Local<v8::Value> timeoutValue = object->Get(v8::String::New("timeout"));
- if (timeoutValue.IsEmpty()) {
- succeeded = false;
- return 0;
- }
- if (!timeoutValue->IsUndefined()) {
- v8::Local<v8::Number> timeoutNumber = timeoutValue->ToNumber();
- if (timeoutNumber.IsEmpty()) {
- succeeded = false;
- return 0;
- }
- double timeoutDouble = timeoutNumber->Value();
- // If the value is positive infinity, there's nothing to do.
- if (!(isinf(timeoutDouble) && timeoutDouble > 0)) {
- v8::Local<v8::Int32> timeoutInt32 = timeoutValue->ToInt32();
- if (timeoutInt32.IsEmpty()) {
- succeeded = false;
- return 0;
- }
- // Wrap to int32 and force non-negative to match behavior of window.setTimeout.
- options->setTimeout(max(0, timeoutInt32->Value()));
- }
- }
-
- v8::Local<v8::Value> maximumAgeValue = object->Get(v8::String::New("maximumAge"));
- if (maximumAgeValue.IsEmpty()) {
- succeeded = false;
- return 0;
- }
- if (!maximumAgeValue->IsUndefined()) {
- v8::Local<v8::Number> maximumAgeNumber = maximumAgeValue->ToNumber();
- if (maximumAgeNumber.IsEmpty()) {
- succeeded = false;
- return 0;
- }
- double maximumAgeDouble = maximumAgeNumber->Value();
- if (isinf(maximumAgeDouble) && maximumAgeDouble > 0) {
- // If the value is positive infinity, clear maximumAge.
- options->clearMaximumAge();
- } else {
- v8::Local<v8::Int32> maximumAgeInt32 = maximumAgeValue->ToInt32();
- if (maximumAgeInt32.IsEmpty()) {
- succeeded = false;
- return 0;
- }
- // Wrap to int32 and force non-negative to match behavior of window.setTimeout.
- options->setMaximumAge(max(0, maximumAgeInt32->Value()));
- }
- }
-
- return options.release();
-}
-
-v8::Handle<v8::Value> V8Geolocation::getCurrentPositionCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Geolocation.getCurrentPosition()");
-
- bool succeeded = false;
-
- RefPtr<PositionCallback> positionCallback = createPositionCallback(args[0], succeeded);
- if (!succeeded)
- return v8::Undefined();
- ASSERT(positionCallback);
-
- RefPtr<PositionErrorCallback> positionErrorCallback = createPositionErrorCallback(args[1], succeeded);
- if (!succeeded)
- return v8::Undefined();
-
- RefPtr<PositionOptions> positionOptions = createPositionOptions(args[2], succeeded);
- if (!succeeded)
- return v8::Undefined();
- ASSERT(positionOptions);
-
- Geolocation* geolocation = V8Geolocation::toNative(args.Holder());
- geolocation->getCurrentPosition(positionCallback.release(), positionErrorCallback.release(), positionOptions.release());
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Geolocation::watchPositionCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Geolocation.watchPosition()");
-
- bool succeeded = false;
-
- RefPtr<PositionCallback> positionCallback = createPositionCallback(args[0], succeeded);
- if (!succeeded)
- return v8::Undefined();
- ASSERT(positionCallback);
-
- RefPtr<PositionErrorCallback> positionErrorCallback = createPositionErrorCallback(args[1], succeeded);
- if (!succeeded)
- return v8::Undefined();
-
- RefPtr<PositionOptions> positionOptions = createPositionOptions(args[2], succeeded);
- if (!succeeded)
- return v8::Undefined();
- ASSERT(positionOptions);
-
- Geolocation* geolocation = V8Geolocation::toNative(args.Holder());
- int watchId = geolocation->watchPosition(positionCallback.release(), positionErrorCallback.release(), positionOptions.release());
- return v8::Number::New(watchId);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(GEOLOCATION)
diff --git a/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
deleted file mode 100644
index ef428a9..0000000
--- a/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8HTMLAllCollection.h"
-
-#include "HTMLAllCollection.h"
-
-#include "V8Binding.h"
-#include "V8NamedNodesCollection.h"
-#include "V8Node.h"
-#include "V8NodeList.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-static v8::Handle<v8::Value> getNamedItems(HTMLAllCollection* collection, AtomicString name)
-{
- Vector<RefPtr<Node> > namedItems;
- collection->namedItems(name, namedItems);
-
- if (!namedItems.size())
- return v8::Handle<v8::Value>();
-
- if (namedItems.size() == 1)
- return toV8(namedItems.at(0).release());
-
- return toV8(V8NamedNodesCollection::create(namedItems));
-}
-
-static v8::Handle<v8::Value> getItem(HTMLAllCollection* collection, v8::Handle<v8::Value> argument)
-{
- v8::Local<v8::Uint32> index = argument->ToArrayIndex();
- if (index.IsEmpty()) {
- v8::Handle<v8::Value> result = getNamedItems(collection, toWebCoreString(argument->ToString()));
-
- if (result.IsEmpty())
- return v8::Undefined();
-
- return result;
- }
-
- RefPtr<Node> result = collection->item(index->Uint32Value());
- return toV8(result.release());
-}
-
-v8::Handle<v8::Value> V8HTMLAllCollection::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLAllCollection.NamedPropertyGetter");
- // Search the prototype chain first.
- v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototypeChain(name);
-
- if (!value.IsEmpty())
- return value;
-
- // Search local callback properties next to find IDL defined
- // properties.
- if (info.Holder()->HasRealNamedCallbackProperty(name))
- return v8::Handle<v8::Value>();
-
- // Finally, search the DOM structure.
- HTMLAllCollection* imp = V8HTMLAllCollection::toNative(info.Holder());
- return getNamedItems(imp, v8StringToAtomicWebCoreString(name));
-}
-
-v8::Handle<v8::Value> V8HTMLAllCollection::itemCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.HTMLAllCollection.item()");
- HTMLAllCollection* imp = V8HTMLAllCollection::toNative(args.Holder());
- return getItem(imp, args[0]);
-}
-
-v8::Handle<v8::Value> V8HTMLAllCollection::namedItemCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.HTMLAllCollection.namedItem()");
- HTMLAllCollection* imp = V8HTMLAllCollection::toNative(args.Holder());
- v8::Handle<v8::Value> result = getNamedItems(imp, toWebCoreString(args[0]));
-
- if (result.IsEmpty())
- return v8::Undefined();
-
- return result;
-}
-
-v8::Handle<v8::Value> V8HTMLAllCollection::callAsFunctionCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.HTMLAllCollection.callAsFunction()");
- if (args.Length() < 1)
- return v8::Undefined();
-
- HTMLAllCollection* imp = V8HTMLAllCollection::toNative(args.Holder());
-
- if (args.Length() == 1)
- return getItem(imp, args[0]);
-
- // If there is a second argument it is the index of the item we want.
- String name = toWebCoreString(args[0]);
- v8::Local<v8::Uint32> index = args[1]->ToArrayIndex();
- if (index.IsEmpty())
- return v8::Undefined();
-
- unsigned current = index->Uint32Value();
- Node* node = imp->namedItem(name);
- while (node) {
- if (!current)
- return toV8(node);
-
- node = imp->nextNamedItem(name);
- current--;
- }
-
- return v8::Undefined();
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp
deleted file mode 100644
index 7a0a545..0000000
--- a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8HTMLAudioElementConstructor.h"
-
-#include "HTMLAudioElement.h"
-#include "Document.h"
-#include "Frame.h"
-#include "HTMLNames.h"
-#include "V8Binding.h"
-#include "V8Document.h"
-#include "V8HTMLAudioElement.h"
-#include "V8Proxy.h"
-
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-WrapperTypeInfo V8HTMLAudioElementConstructor::info = { V8HTMLAudioElementConstructor::GetTemplate, 0, 0 };
-
-static v8::Handle<v8::Value> v8HTMLAudioElementConstructorCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.HTMLAudioElement.Contructor");
-
- if (!args.IsConstructCall())
- return throwError("DOM object constructor cannot be called as a function.");
-
- Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
- if (!frame)
- return throwError("Audio constructor associated frame is unavailable", V8Proxy::ReferenceError);
-
- Document* document = frame->document();
- if (!document)
- return throwError("Audio constructor associated document is unavailable", V8Proxy::ReferenceError);
-
- // Make sure the document is added to the DOM Node map. Otherwise, the HTMLAudioElement instance
- // may end up being the only node in the map and get garbage-collected prematurely.
- toV8(document);
-
-
- String src;
- if (args.Length() > 0)
- src = toWebCoreString(args[0]);
- RefPtr<HTMLAudioElement> audio = HTMLAudioElement::createForJSConstructor(document, src);
-
- V8DOMWrapper::setDOMWrapper(args.Holder(), &V8HTMLAudioElementConstructor::info, audio.get());
- audio->ref();
- V8DOMWrapper::setJSWrapperForDOMNode(audio.get(), v8::Persistent<v8::Object>::New(args.Holder()));
- return args.Holder();
-}
-
-v8::Persistent<v8::FunctionTemplate> V8HTMLAudioElementConstructor::GetTemplate()
-{
- static v8::Persistent<v8::FunctionTemplate> cachedTemplate;
- if (!cachedTemplate.IsEmpty())
- return cachedTemplate;
-
- v8::HandleScope scope;
- v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(v8HTMLAudioElementConstructorCallback);
-
- v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
- instance->SetInternalFieldCount(V8HTMLAudioElement::internalFieldCount);
- result->SetClassName(v8::String::New("HTMLAudioElement"));
- result->Inherit(V8HTMLAudioElement::GetTemplate());
-
- cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(result);
- return cachedTemplate;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.h b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.h
deleted file mode 100644
index 8bc5f2c..0000000
--- a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8HTMLAudioElementConstructor_h
-#define V8HTMLAudioElementConstructor_h
-
-#include "WrapperTypeInfo.h"
-
-#include <v8.h>
-
-namespace WebCore {
-
-class V8HTMLAudioElementConstructor {
-public:
- static v8::Persistent<v8::FunctionTemplate> GetTemplate();
- static WrapperTypeInfo info;
-};
-
-}
-
-#endif // V8HTMLAudioElementConstructor_h
diff --git a/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
deleted file mode 100644
index e154f7f..0000000
--- a/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (C) 2007-2009 Google Inc. All rights reserved.
- * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8HTMLCanvasElement.h"
-
-#include "CanvasContextAttributes.h"
-#include "CanvasRenderingContext.h"
-#include "HTMLCanvasElement.h"
-#include "PlatformString.h"
-#include "WebGLContextAttributes.h"
-#include "V8Binding.h"
-#include "V8CanvasRenderingContext2D.h"
-#include "V8Node.h"
-#include "V8Proxy.h"
-#if ENABLE(3D_CANVAS)
-#include "V8WebGLRenderingContext.h"
-#endif
-#include <wtf/MathExtras.h>
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8HTMLCanvasElement::getContextCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.HTMLCanvasElement.context");
- v8::Handle<v8::Object> holder = args.Holder();
- HTMLCanvasElement* imp = V8HTMLCanvasElement::toNative(holder);
- String contextId = toWebCoreString(args[0]);
- RefPtr<CanvasContextAttributes> attrs;
-#if ENABLE(3D_CANVAS)
- if (contextId == "experimental-webgl" || contextId == "webkit-3d") {
- attrs = WebGLContextAttributes::create();
- WebGLContextAttributes* webGLAttrs = static_cast<WebGLContextAttributes*>(attrs.get());
- if (args.Length() > 1 && args[1]->IsObject()) {
- v8::Handle<v8::Object> jsAttrs = args[1]->ToObject();
- v8::Handle<v8::String> alpha = v8::String::New("alpha");
- if (jsAttrs->Has(alpha))
- webGLAttrs->setAlpha(jsAttrs->Get(alpha)->BooleanValue());
- v8::Handle<v8::String> depth = v8::String::New("depth");
- if (jsAttrs->Has(depth))
- webGLAttrs->setDepth(jsAttrs->Get(depth)->BooleanValue());
- v8::Handle<v8::String> stencil = v8::String::New("stencil");
- if (jsAttrs->Has(stencil))
- webGLAttrs->setStencil(jsAttrs->Get(stencil)->BooleanValue());
- v8::Handle<v8::String> antialias = v8::String::New("antialias");
- if (jsAttrs->Has(antialias))
- webGLAttrs->setAntialias(jsAttrs->Get(antialias)->BooleanValue());
- v8::Handle<v8::String> premultipliedAlpha = v8::String::New("premultipliedAlpha");
- if (jsAttrs->Has(premultipliedAlpha))
- webGLAttrs->setPremultipliedAlpha(jsAttrs->Get(premultipliedAlpha)->BooleanValue());
- }
- }
-#endif
- CanvasRenderingContext* result = imp->getContext(contextId, attrs.get());
- if (!result)
- return v8::Null();
- if (result->is2d())
- return toV8(static_cast<CanvasRenderingContext2D*>(result));
-#if ENABLE(3D_CANVAS)
- else if (result->is3d())
- return toV8(static_cast<WebGLRenderingContext*>(result));
-#endif
- ASSERT_NOT_REACHED();
- return v8::Null();
-}
-
-v8::Handle<v8::Value> V8HTMLCanvasElement::toDataURLCallback(const v8::Arguments& args)
-{
- v8::Handle<v8::Object> holder = args.Holder();
- HTMLCanvasElement* canvas = V8HTMLCanvasElement::toNative(holder);
- ExceptionCode ec = 0;
-
- String type = toWebCoreString(args[0]);
- double quality;
- double* qualityPtr = 0;
- if (args.Length() > 1 && args[1]->IsNumber()) {
- quality = args[1]->NumberValue();
- qualityPtr = &quality;
- }
-
- String result = canvas->toDataURL(type, qualityPtr, ec);
- V8Proxy::setDOMException(ec);
- return v8StringOrUndefined(result);
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp
deleted file mode 100644
index 9e89ce8..0000000
--- a/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8HTMLCollection.h"
-
-#include "HTMLCollection.h"
-#include "V8Binding.h"
-#include "V8HTMLAllCollection.h"
-#include "V8NamedNodesCollection.h"
-#include "V8Node.h"
-#include "V8NodeList.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-static v8::Handle<v8::Value> getNamedItems(HTMLCollection* collection, AtomicString name)
-{
- Vector<RefPtr<Node> > namedItems;
- collection->namedItems(name, namedItems);
-
- if (!namedItems.size())
- return v8::Handle<v8::Value>();
-
- if (namedItems.size() == 1)
- return toV8(namedItems.at(0).release());
-
- return toV8(V8NamedNodesCollection::create(namedItems));
-}
-
-static v8::Handle<v8::Value> getItem(HTMLCollection* collection, v8::Handle<v8::Value> argument)
-{
- v8::Local<v8::Uint32> index = argument->ToArrayIndex();
- if (index.IsEmpty()) {
- v8::Handle<v8::Value> result = getNamedItems(collection, toWebCoreString(argument->ToString()));
-
- if (result.IsEmpty())
- return v8::Undefined();
-
- return result;
- }
-
- RefPtr<Node> result = collection->item(index->Uint32Value());
- return toV8(result.release());
-}
-
-v8::Handle<v8::Value> V8HTMLCollection::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLCollection.NamedPropertyGetter");
- // Search the prototype chain first.
- v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototypeChain(name);
-
- if (!value.IsEmpty())
- return value;
-
- // Search local callback properties next to find IDL defined
- // properties.
- if (info.Holder()->HasRealNamedCallbackProperty(name))
- return v8::Handle<v8::Value>();
-
- // Finally, search the DOM structure.
- HTMLCollection* imp = V8HTMLCollection::toNative(info.Holder());
- return getNamedItems(imp, v8StringToAtomicWebCoreString(name));
-}
-
-v8::Handle<v8::Value> V8HTMLCollection::itemCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.HTMLCollection.item()");
- HTMLCollection* imp = V8HTMLCollection::toNative(args.Holder());
- return getItem(imp, args[0]);
-}
-
-v8::Handle<v8::Value> V8HTMLCollection::namedItemCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.HTMLCollection.namedItem()");
- HTMLCollection* imp = V8HTMLCollection::toNative(args.Holder());
- v8::Handle<v8::Value> result = getNamedItems(imp, toWebCoreString(args[0]));
-
- if (result.IsEmpty())
- return v8::Undefined();
-
- return result;
-}
-
-v8::Handle<v8::Value> V8HTMLCollection::callAsFunctionCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.HTMLCollection.callAsFunction()");
- if (args.Length() < 1)
- return v8::Undefined();
-
- HTMLCollection* imp = V8HTMLCollection::toNative(args.Holder());
-
- if (args.Length() == 1)
- return getItem(imp, args[0]);
-
- // If there is a second argument it is the index of the item we want.
- String name = toWebCoreString(args[0]);
- v8::Local<v8::Uint32> index = args[1]->ToArrayIndex();
- if (index.IsEmpty())
- return v8::Undefined();
-
- unsigned current = index->Uint32Value();
- Node* node = imp->namedItem(name);
- while (node) {
- if (!current)
- return toV8(node);
-
- node = imp->nextNamedItem(name);
- current--;
- }
-
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> toV8(HTMLCollection* impl)
-{
- if (impl->type() == DocAll)
- return toV8(static_cast<HTMLAllCollection*>(impl));
- return V8HTMLCollection::wrap(impl);
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLDataGridElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLDataGridElementCustom.cpp
deleted file mode 100644
index d6918cf..0000000
--- a/WebCore/bindings/v8/custom/V8HTMLDataGridElementCustom.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "HTMLDataGridElement.h"
-
-#include "Document.h"
-#include "V8Binding.h"
-#include "V8DataGridDataSource.h"
-#include "V8Proxy.h"
-
-#if ENABLE(DATAGRID)
-
-namespace WebCore {
-
-ACCESSOR_GETTER(HTMLDataGridElementDataSource)
-{
- INC_STATS("DOM.HTMLDataGridElement.dataSource._get");
- v8::Handle<v8::Object> holder = info.Holder();
- HTMLDataGridElement* imp = V8DOMWrapper::convertDOMWrapperToNode<HTMLDataGridElement>(holder);
- DataGridDataSource* dataSource = imp->dataSource();
- if (dataSource && dataSource->isJSDataGridDataSource())
- return asV8DataGridDataSource(dataSource)->jsDataSource();
- return v8::Null();
-}
-
-ACCESSOR_SETTER(HTMLDataGridElementDataSource)
-{
- INC_STATS("DOM.HTMLDataGridElement.dataSource._set");
- v8::Handle<v8::Object> holder = info.Holder();
- HTMLDataGridElement* imp = V8DOMWrapper::convertDOMWrapperToNode<HTMLDataGridElement>(holder);
- RefPtr<DataGridDataSource> dataSource;
- if (!value.IsEmpty()) {
- Frame *frame = imp->document()->frame();
- dataSource = V8DataGridDataSource::create(value, frame);
- }
- imp->setDataSource(dataSource.get());
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(DATAGRID)
diff --git a/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
deleted file mode 100644
index 24ac47c..0000000
--- a/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright (C) 2007, 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8HTMLDocument.h"
-
-#include "Frame.h"
-#include "HTMLAllCollection.h"
-#include "HTMLDocument.h"
-#include "HTMLCollection.h"
-#include "HTMLIFrameElement.h"
-#include "HTMLNames.h"
-#include "V8Binding.h"
-#include "V8DOMWindow.h"
-#include "V8HTMLAllCollection.h"
-#include "V8HTMLCollection.h"
-#include "V8IsolatedContext.h"
-#include "V8Node.h"
-#include "V8Proxy.h"
-#include <wtf/RefPtr.h>
-#include <wtf/StdLibExtras.h>
-
-namespace WebCore {
-
-v8::Local<v8::Object> V8HTMLDocument::WrapInShadowObject(v8::Local<v8::Object> wrapper, Node* impl)
-{
- DEFINE_STATIC_LOCAL(v8::Persistent<v8::FunctionTemplate>, shadowTemplate, ());
- if (shadowTemplate.IsEmpty()) {
- shadowTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New());
- if (shadowTemplate.IsEmpty())
- return v8::Local<v8::Object>();
- shadowTemplate->SetClassName(v8::String::New("HTMLDocument"));
- shadowTemplate->Inherit(V8HTMLDocument::GetTemplate());
- shadowTemplate->InstanceTemplate()->SetInternalFieldCount(V8HTMLDocument::internalFieldCount);
- }
-
- v8::Local<v8::Function> shadowConstructor = shadowTemplate->GetFunction();
- if (shadowConstructor.IsEmpty())
- return v8::Local<v8::Object>();
-
- v8::Local<v8::Object> shadow = shadowConstructor->NewInstance();
- if (shadow.IsEmpty())
- return v8::Local<v8::Object>();
- V8DOMWrapper::setDOMWrapper(shadow, &V8HTMLDocument::info, impl);
- shadow->SetPrototype(wrapper);
- return shadow;
-}
-
-v8::Handle<v8::Value> V8HTMLDocument::GetNamedProperty(HTMLDocument* htmlDocument, const AtomicString& key)
-{
- if (!htmlDocument->hasNamedItem(key.impl()) && !htmlDocument->hasExtraNamedItem(key.impl()))
- return v8::Handle<v8::Value>();
-
- RefPtr<HTMLCollection> items = htmlDocument->documentNamedItems(key);
- if (!items->length())
- return v8::Handle<v8::Value>();
-
- if (items->length() == 1) {
- Node* node = items->firstItem();
- Frame* frame = 0;
- if (node->hasTagName(HTMLNames::iframeTag) && (frame = static_cast<HTMLIFrameElement*>(node)->contentFrame()))
- return toV8(frame->domWindow());
-
- return toV8(node);
- }
-
- return toV8(items.release());
-}
-
-// HTMLDocument ----------------------------------------------------------------
-
-// Concatenates "args" to a string. If args is empty, returns empty string.
-// Firefox/Safari/IE support non-standard arguments to document.write, ex:
-// document.write("a", "b", "c") --> document.write("abc")
-// document.write() --> document.write("")
-static String writeHelperGetString(const v8::Arguments& args)
-{
- String str = "";
- for (int i = 0; i < args.Length(); ++i)
- str += toWebCoreString(args[i]);
- return str;
-}
-
-v8::Handle<v8::Value> V8HTMLDocument::writeCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.HTMLDocument.write()");
- HTMLDocument* htmlDocument = V8HTMLDocument::toNative(args.Holder());
- Frame* frame = V8Proxy::retrieveFrameForCallingContext();
- htmlDocument->write(writeHelperGetString(args), frame ? frame->document() : NULL);
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8HTMLDocument::writelnCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.HTMLDocument.writeln()");
- HTMLDocument* htmlDocument = V8HTMLDocument::toNative(args.Holder());
- Frame* frame = V8Proxy::retrieveFrameForCallingContext();
- htmlDocument->writeln(writeHelperGetString(args), frame ? frame->document() : NULL);
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8HTMLDocument::openCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.HTMLDocument.open()");
- HTMLDocument* htmlDocument = V8HTMLDocument::toNative(args.Holder());
-
- if (args.Length() > 2) {
- if (Frame* frame = htmlDocument->frame()) {
- // Fetch the global object for the frame.
- v8::Local<v8::Context> context = V8Proxy::context(frame);
- // Bail out if we cannot get the context.
- if (context.IsEmpty())
- return v8::Undefined();
- v8::Local<v8::Object> global = context->Global();
- // Get the open property of the global object.
- v8::Local<v8::Value> function = global->Get(v8::String::New("open"));
- // If the open property is not a function throw a type error.
- if (!function->IsFunction()) {
- throwError("open is not a function");
- return v8::Undefined();
- }
- // Wrap up the arguments and call the function.
- v8::Local<v8::Value>* params = new v8::Local<v8::Value>[args.Length()];
- for (int i = 0; i < args.Length(); i++)
- params[i] = args[i];
-
- V8Proxy* proxy = V8Proxy::retrieve(frame);
- ASSERT(proxy);
-
- v8::Local<v8::Value> result = proxy->callFunction(v8::Local<v8::Function>::Cast(function), global, args.Length(), params);
- delete[] params;
- return result;
- }
- }
-
- Frame* frame = V8Proxy::retrieveFrameForCallingContext();
- htmlDocument->open(frame ? frame->document() : NULL);
- // Return the document.
- return args.Holder();
-}
-
-v8::Handle<v8::Value> V8HTMLDocument::allAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLDocument.all._get");
- v8::Handle<v8::Object> holder = info.Holder();
- HTMLDocument* htmlDocument = V8HTMLDocument::toNative(holder);
- return toV8(htmlDocument->all());
-}
-
-void V8HTMLDocument::allAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- // Just emulate a normal JS behaviour---install a property on this.
- info.This()->ForceSet(name, value);
-}
-
-v8::Handle<v8::Value> toV8(HTMLDocument* impl, bool forceNewObject)
-{
- if (!impl)
- return v8::Null();
- v8::Handle<v8::Object> wrapper = V8HTMLDocument::wrap(impl, forceNewObject);
- if (wrapper.IsEmpty())
- return wrapper;
- if (!V8IsolatedContext::getEntered()) {
- if (V8Proxy* proxy = V8Proxy::retrieve(impl->frame()))
- proxy->windowShell()->updateDocumentWrapper(wrapper);
- }
- return wrapper;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLElementCustom.cpp
deleted file mode 100644
index 0eb55e9..0000000
--- a/WebCore/bindings/v8/custom/V8HTMLElementCustom.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8HTMLElement.h"
-
-#include "V8HTMLElementWrapperFactory.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> toV8(HTMLElement* impl, bool forceNewObject)
-{
- if (!impl)
- return v8::Null();
- return createV8HTMLWrapper(impl, forceNewObject);
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp
deleted file mode 100644
index 9baf78a..0000000
--- a/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8HTMLFormElement.h"
-
-#include "HTMLCollection.h"
-#include "HTMLFormElement.h"
-#include "V8Binding.h"
-#include "V8NamedNodesCollection.h"
-#include "V8Node.h"
-#include "V8NodeList.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8HTMLFormElement::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLFormElement.IndexedPropertyGetter");
- HTMLFormElement* form = V8HTMLFormElement::toNative(info.Holder());
-
- RefPtr<Node> formElement = form->elements()->item(index);
- if (!formElement)
- return notHandledByInterceptor();
- return toV8(formElement.release());
-}
-
-v8::Handle<v8::Value> V8HTMLFormElement::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLFormElement.NamedPropertyGetter");
- HTMLFormElement* imp = V8HTMLFormElement::toNative(info.Holder());
- AtomicString v = v8StringToAtomicWebCoreString(name);
-
- // Call getNamedElements twice, first time check if it has a value
- // and let HTMLFormElement update its cache.
- // See issue: 867404
- {
- Vector<RefPtr<Node> > elements;
- imp->getNamedElements(v, elements);
- if (elements.isEmpty())
- return notHandledByInterceptor();
- }
-
- // Second call may return different results from the first call,
- // but if the first the size cannot be zero.
- Vector<RefPtr<Node> > elements;
- imp->getNamedElements(v, elements);
- ASSERT(!elements.isEmpty());
-
- if (elements.size() == 1)
- return toV8(elements.at(0).release());
-
- return toV8(V8NamedNodesCollection::create(elements));
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLFrameElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLFrameElementCustom.cpp
deleted file mode 100644
index 35818af..0000000
--- a/WebCore/bindings/v8/custom/V8HTMLFrameElementCustom.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2007-2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8HTMLFrameElement.h"
-
-#include "HTMLFrameElement.h"
-#include "HTMLNames.h"
-#include "V8Binding.h"
-#include "V8BindingState.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-using namespace HTMLNames;
-
-void V8HTMLFrameElement::locationAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- HTMLFrameElement* frame = V8HTMLFrameElement::toNative(info.Holder());
- String locationValue = toWebCoreStringWithNullCheck(value);
-
- if (!V8BindingSecurity::allowSettingFrameSrcToJavascriptUrl(V8BindingState::Only(), frame, locationValue))
- return;
-
- frame->setLocation(locationValue);
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp
deleted file mode 100644
index 6a45be7..0000000
--- a/WebCore/bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2007-2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8HTMLFrameSetElement.h"
-
-#include "Document.h"
-#include "Frame.h"
-#include "HTMLCollection.h"
-#include "HTMLFrameElement.h"
-#include "HTMLFrameSetElement.h"
-#include "HTMLNames.h"
-#include "Node.h"
-
-#include "V8Binding.h"
-#include "V8DOMWindow.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8HTMLFrameSetElement::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLFrameSetElement.NamedPropertyGetter");
- HTMLFrameSetElement* imp = V8HTMLFrameSetElement::toNative(info.Holder());
- Node* frameNode = imp->children()->namedItem(v8StringToAtomicWebCoreString(name));
- if (frameNode && frameNode->hasTagName(HTMLNames::frameTag)) {
- Document* doc = static_cast<HTMLFrameElement*>(frameNode)->contentDocument();
- if (!doc)
- return v8::Undefined();
- if (Frame* frame = doc->frame())
- return toV8(frame->domWindow());
- }
- return notHandledByInterceptor();
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp b/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
deleted file mode 100644
index 24b1709..0000000
--- a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (C) 2009, 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8HTMLImageElementConstructor.h"
-
-#include "HTMLImageElement.h"
-#include "Document.h"
-#include "Frame.h"
-#include "HTMLNames.h"
-#include "V8Binding.h"
-#include "V8Document.h"
-#include "V8HTMLImageElement.h"
-#include "V8Proxy.h"
-
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-WrapperTypeInfo V8HTMLImageElementConstructor::info = { V8HTMLImageElementConstructor::GetTemplate, 0, 0 };
-
-static v8::Handle<v8::Value> v8HTMLImageElementConstructorCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.HTMLImageElement.Contructor");
-
- if (!args.IsConstructCall())
- return throwError("DOM object constructor cannot be called as a function.");
-
- Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
- if (!frame)
- return throwError("Image constructor associated frame is unavailable", V8Proxy::ReferenceError);
-
- Document* document = frame->document();
- if (!document)
- return throwError("Image constructor associated document is unavailable", V8Proxy::ReferenceError);
-
- // Make sure the document is added to the DOM Node map. Otherwise, the HTMLImageElement instance
- // may end up being the only node in the map and get garbage-ccollected prematurely.
- // FIXME: The correct way to do this would be to make HTMLImageElement derive from
- // ActiveDOMObject and use its interface to keep its wrapper alive. Then we would
- // remove this code and the special case in isObservableThroughDOM.
- toV8(document);
-
- int width;
- int height;
- int* optionalWidth = 0;
- int* optionalHeight = 0;
- if (args.Length() > 0) {
- width = toInt32(args[0]);
- optionalWidth = &width;
- }
- if (args.Length() > 1) {
- height = toInt32(args[1]);
- optionalHeight = &height;
- }
-
- RefPtr<HTMLImageElement> image = HTMLImageElement::createForJSConstructor(document, optionalWidth, optionalHeight);
- V8DOMWrapper::setDOMWrapper(args.Holder(), &V8HTMLImageElementConstructor::info, image.get());
- image->ref();
- V8DOMWrapper::setJSWrapperForDOMNode(image.get(), v8::Persistent<v8::Object>::New(args.Holder()));
- return args.Holder();
-}
-
-v8::Persistent<v8::FunctionTemplate> V8HTMLImageElementConstructor::GetTemplate()
-{
- static v8::Persistent<v8::FunctionTemplate> cachedTemplate;
- if (!cachedTemplate.IsEmpty())
- return cachedTemplate;
-
- v8::HandleScope scope;
- v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(v8HTMLImageElementConstructorCallback);
-
- v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
- instance->SetInternalFieldCount(V8HTMLImageElement::internalFieldCount);
- result->SetClassName(v8::String::New("HTMLImageElement"));
- result->Inherit(V8HTMLImageElement::GetTemplate());
-
- cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(result);
- return cachedTemplate;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.h b/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.h
deleted file mode 100644
index 5db4946..0000000
--- a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8HTMLImageElementConstructor_h
-#define V8HTMLImageElementConstructor_h
-
-#include "WrapperTypeInfo.h"
-
-#include <v8.h>
-
-namespace WebCore {
-
-class V8HTMLImageElementConstructor {
-public:
- static v8::Persistent<v8::FunctionTemplate> GetTemplate();
- static WrapperTypeInfo info;
-};
-
-}
-
-#endif // V8HTMLImageElementConstructor_h
diff --git a/WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp
deleted file mode 100644
index a9ac74c..0000000
--- a/WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8HTMLInputElement.h"
-
-#include "HTMLInputElement.h"
-
-#include "V8Binding.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8HTMLInputElement::selectionStartAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLInputElement.selectionStart._get");
- v8::Handle<v8::Object> holder = info.Holder();
- HTMLInputElement* imp = V8HTMLInputElement::toNative(holder);
-
- if (!imp->canHaveSelection())
- return throwError("Accessing selectionStart on an input element that cannot have a selection.");
-
- int v = imp->selectionStart();
- return v8::Integer::New(v);
-}
-
-void V8HTMLInputElement::selectionStartAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLInputElement.selectionStart._set");
- v8::Handle<v8::Object> holder = info.Holder();
- HTMLInputElement* imp = V8HTMLInputElement::toNative(holder);
-
- if (!imp->canHaveSelection()) {
- throwError("Accessing selectionStart on an input element that cannot have a selection.");
- return;
- }
- imp->setSelectionStart(value->Int32Value());
-}
-
-v8::Handle<v8::Value> V8HTMLInputElement::selectionEndAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLInputElement.selectionEnd._get");
- v8::Handle<v8::Object> holder = info.Holder();
- HTMLInputElement* imp = V8HTMLInputElement::toNative(holder);
-
- if (!imp->canHaveSelection())
- return throwError("Accessing selectionEnd on an input element that cannot have a selection.");
-
- int v = imp->selectionEnd();
- return v8::Integer::New(v);
-}
-
-void V8HTMLInputElement::selectionEndAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLInputElement.selectionEnd._set");
- v8::Handle<v8::Object> holder = info.Holder();
- HTMLInputElement* imp = V8HTMLInputElement::toNative(holder);
-
- if (!imp->canHaveSelection()) {
- throwError("Accessing selectionEnd on an input element that cannot have a selection.");
- return;
- }
-
- imp->setSelectionEnd(value->Int32Value());
-}
-
-v8::Handle<v8::Value> V8HTMLInputElement::setSelectionRangeCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.HTMLInputElement.setSelectionRange");
- v8::Handle<v8::Object> holder = args.Holder();
- HTMLInputElement* imp = V8HTMLInputElement::toNative(holder);
-
- if (!imp->canHaveSelection())
- return throwError("Calling setSelectionRange on an input element that cannot have a selection.");
-
- int start = args[0]->Int32Value();
- int end = args[1]->Int32Value();
-
- imp->setSelectionRange(start, end);
- return v8::Undefined();
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp b/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp
deleted file mode 100644
index 14c80b9..0000000
--- a/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8HTMLOptionElementConstructor.h"
-
-#include "HTMLOptionElement.h"
-#include "Document.h"
-#include "Frame.h"
-#include "HTMLNames.h"
-#include "Text.h"
-#include "V8Binding.h"
-#include "V8HTMLOptionElement.h"
-#include "V8Proxy.h"
-
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-WrapperTypeInfo V8HTMLOptionElementConstructor::info = { V8HTMLOptionElementConstructor::GetTemplate, 0, 0 };
-
-static v8::Handle<v8::Value> v8HTMLOptionElementConstructorCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.HTMLOptionElement.Contructor");
-
- if (!args.IsConstructCall())
- return throwError("DOM object constructor cannot be called as a function.");
-
- Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
- if (!frame)
- return throwError("Option constructor associated frame is unavailable", V8Proxy::ReferenceError);
-
- Document* document = frame->document();
- if (!document)
- return throwError("Option constructor associated document is unavailable", V8Proxy::ReferenceError);
-
- String data;
- String value;
- bool defaultSelected = false;
- bool selected = false;
- if (args.Length() > 0 && !args[0]->IsUndefined())
- data = toWebCoreString(args[0]);
- if (args.Length() > 1 && !args[1]->IsUndefined())
- value = toWebCoreString(args[1]);
- if (args.Length() > 2)
- defaultSelected = args[2]->BooleanValue();
- if (args.Length() > 3)
- selected = args[3]->BooleanValue();
-
- ExceptionCode ec = 0;
- RefPtr<HTMLOptionElement> option = HTMLOptionElement::createForJSConstructor(document, data, value, defaultSelected, selected, ec);
-
- if (ec)
- throwError(ec);
-
- V8DOMWrapper::setDOMWrapper(args.Holder(), &V8HTMLOptionElementConstructor::info, option.get());
- option->ref();
- V8DOMWrapper::setJSWrapperForDOMNode(option.get(), v8::Persistent<v8::Object>::New(args.Holder()));
- return args.Holder();
-}
-
-v8::Persistent<v8::FunctionTemplate> V8HTMLOptionElementConstructor::GetTemplate()
-{
- static v8::Persistent<v8::FunctionTemplate> cachedTemplate;
- if (!cachedTemplate.IsEmpty())
- return cachedTemplate;
-
- v8::HandleScope scope;
- v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(v8HTMLOptionElementConstructorCallback);
-
- v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
- instance->SetInternalFieldCount(V8HTMLOptionElement::internalFieldCount);
- result->SetClassName(v8::String::New("HTMLOptionElement"));
- result->Inherit(V8HTMLOptionElement::GetTemplate());
-
- cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(result);
- return cachedTemplate;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.h b/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.h
deleted file mode 100644
index 2adf0fe..0000000
--- a/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8HTMLOptionElementConstructor_h
-#define V8HTMLOptionElementConstructor_h
-
-#include "WrapperTypeInfo.h"
-
-#include <v8.h>
-
-namespace WebCore {
-
-class V8HTMLOptionElementConstructor {
-public:
- static v8::Persistent<v8::FunctionTemplate> GetTemplate();
- static WrapperTypeInfo info;
-};
-
-}
-
-#endif // V8HTMLOptionElementConstructor_h
diff --git a/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
deleted file mode 100644
index 81bc287..0000000
--- a/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8HTMLOptionsCollection.h"
-
-#include "HTMLOptionsCollection.h"
-#include "HTMLOptionElement.h"
-#include "ExceptionCode.h"
-
-#include "V8Binding.h"
-#include "V8Collection.h"
-#include "V8HTMLOptionElement.h"
-#include "V8HTMLSelectElementCustom.h"
-#include "V8Node.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8HTMLOptionsCollection::removeCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.HTMLOptionsCollection.remove()");
- HTMLOptionsCollection* imp = V8HTMLOptionsCollection::toNative(args.Holder());
- HTMLSelectElement* base = static_cast<HTMLSelectElement*>(imp->base());
- return removeElement(base, args);
-}
-
-v8::Handle<v8::Value> V8HTMLOptionsCollection::addCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.HTMLOptionsCollection.add()");
- if (!V8HTMLOptionElement::HasInstance(args[0])) {
- V8Proxy::setDOMException(TYPE_MISMATCH_ERR);
- return v8::Undefined();
- }
- HTMLOptionsCollection* imp = V8HTMLOptionsCollection::toNative(args.Holder());
- HTMLOptionElement* option = V8HTMLOptionElement::toNative(v8::Handle<v8::Object>(v8::Handle<v8::Object>::Cast(args[0])));
-
- ExceptionCode ec = 0;
- if (args.Length() < 2)
- imp->add(option, ec);
- else {
- bool ok;
- v8::TryCatch try_catch;
- int index = toInt32(args[1], ok);
-
- if (try_catch.HasCaught())
- return v8::Undefined();
-
- if (!ok)
- ec = TYPE_MISMATCH_ERR;
- else
- imp->add(option, index, ec);
- }
-
- if (ec != 0)
- V8Proxy::setDOMException(ec);
-
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8HTMLOptionsCollection::lengthAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLOptionsCollection.length._get");
- HTMLOptionsCollection* imp = V8HTMLOptionsCollection::toNative(info.Holder());
- int v = imp->length();
- return v8::Integer::New(v);
-}
-
-void V8HTMLOptionsCollection::lengthAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLOptionsCollection.length._set");
- HTMLOptionsCollection* imp = V8HTMLOptionsCollection::toNative(info.Holder());
- double v = value->NumberValue();
- unsigned newLength = 0;
- ExceptionCode ec = 0;
- if (!isnan(v) && !isinf(v)) {
- if (v < 0.0)
- ec = INDEX_SIZE_ERR;
- else if (v > static_cast<double>(UINT_MAX))
- newLength = UINT_MAX;
- else
- newLength = static_cast<unsigned>(v);
- }
- if (!ec)
- imp->setLength(value->Uint32Value(), ec);
-
- V8Proxy::setDOMException(ec);
-}
-
-v8::Handle<v8::Value> V8HTMLOptionsCollection::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLOptionsCollection.IndexedPropertyGetter");
- HTMLOptionsCollection* collection = V8HTMLOptionsCollection::toNative(info.Holder());
-
- RefPtr<Node> result = collection->item(index);
- if (!result)
- return notHandledByInterceptor();
-
- return toV8(result.release());
-}
-
-v8::Handle<v8::Value> V8HTMLOptionsCollection::indexedPropertySetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLOptionsCollection.IndexedPropertySetter");
- HTMLOptionsCollection* collection = V8HTMLOptionsCollection::toNative(info.Holder());
- HTMLSelectElement* base = static_cast<HTMLSelectElement*>(collection->base());
- return toOptionsCollectionSetter(index, value, base);
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLOutputElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLOutputElementCustom.cpp
deleted file mode 100644
index ad86dd2..0000000
--- a/WebCore/bindings/v8/custom/V8HTMLOutputElementCustom.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8HTMLOutputElement.h"
-
-#include "HTMLOutputElement.h"
-#include "V8Binding.h"
-#include "V8DOMSettableTokenList.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8HTMLOutputElement::htmlForAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLOutputElement.htmlFor._get");
- HTMLOutputElement* imp = V8HTMLOutputElement::toNative(info.Holder());
- return toV8(imp->htmlFor());
-}
-
-void V8HTMLOutputElement::htmlForAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLOutputElement.htmlFor._set");
- HTMLOutputElement* imp = V8HTMLOutputElement::toNative(info.Holder());
- imp->setFor(toWebCoreString(value));
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp
deleted file mode 100644
index 1c114c5..0000000
--- a/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
-* Copyright (C) 2009 Google 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:
-*
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * 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.
-* * Neither the name of Google Inc. nor the names of its
-* contributors may be used to endorse or promote products derived from
-* this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "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 THE COPYRIGHT
-* OWNER 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.
-*/
-
-#include "config.h"
-#include "HTMLPlugInElement.h"
-
-#include "ScriptInstance.h"
-#include "V8Binding.h"
-#include "V8HTMLAppletElement.h"
-#include "V8HTMLEmbedElement.h"
-#include "V8HTMLObjectElement.h"
-#include "V8NPObject.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-// FIXME: Consider moving getter/setter helpers to V8NPObject and renaming this file to V8PluginElementFunctions
-// to match JSC bindings naming convention.
-
-template <class C>
-static v8::Handle<v8::Value> npObjectNamedGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- HTMLPlugInElement* imp = C::toNative(info.Holder());
- ScriptInstance scriptInstance = imp->getInstance();
- if (!scriptInstance)
- return notHandledByInterceptor();
-
- v8::Local<v8::Object> instance = v8::Local<v8::Object>::New(scriptInstance->instance());
- if (instance.IsEmpty())
- return notHandledByInterceptor();
-
- return npObjectGetNamedProperty(instance, name);
-}
-
-template <class C>
-static v8::Handle<v8::Value> npObjectNamedSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- HTMLPlugInElement* imp = C::toNative(info.Holder());
- ScriptInstance scriptInstance = imp->getInstance();
- if (!scriptInstance)
- return notHandledByInterceptor();
-
- v8::Local<v8::Object> instance = v8::Local<v8::Object>::New(scriptInstance->instance());
- if (instance.IsEmpty())
- return notHandledByInterceptor();
-
- return npObjectSetNamedProperty(instance, name, value);
-}
-
-v8::Handle<v8::Value> V8HTMLAppletElement::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLAppletElement.NamedPropertyGetter");
- return npObjectNamedGetter<V8HTMLAppletElement>(name, info);
-}
-
-v8::Handle<v8::Value> V8HTMLEmbedElement::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLEmbedElement.NamedPropertyGetter");
- return npObjectNamedGetter<V8HTMLEmbedElement>(name, info);
-}
-
-v8::Handle<v8::Value> V8HTMLObjectElement::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLObjectElement.NamedPropertyGetter");
- return npObjectNamedGetter<V8HTMLObjectElement>(name, info);
-}
-
-v8::Handle<v8::Value> V8HTMLAppletElement::namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLAppletElement.NamedPropertySetter");
- return npObjectNamedSetter<V8HTMLAppletElement>(name, value, info);
-}
-
-v8::Handle<v8::Value> V8HTMLEmbedElement::namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLEmbedElement.NamedPropertySetter");
- return npObjectNamedSetter<V8HTMLEmbedElement>(name, value, info);
-}
-
-v8::Handle<v8::Value> V8HTMLObjectElement::namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLObjectElement.NamedPropertySetter");
- return npObjectNamedSetter<V8HTMLObjectElement>(name, value, info);
-}
-
-v8::Handle<v8::Value> V8HTMLAppletElement::callAsFunctionCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.HTMLAppletElement()");
- return npObjectInvokeDefaultHandler(args);
-}
-
-v8::Handle<v8::Value> V8HTMLEmbedElement::callAsFunctionCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.HTMLEmbedElement()");
- return npObjectInvokeDefaultHandler(args);
-}
-
-v8::Handle<v8::Value> V8HTMLObjectElement::callAsFunctionCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.HTMLObjectElement()");
- return npObjectInvokeDefaultHandler(args);
-}
-
-template <class C>
-v8::Handle<v8::Value> npObjectIndexedGetter(uint32_t index, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLPlugInElement.IndexedPropertyGetter");
- HTMLPlugInElement* imp = C::toNative(info.Holder());
- ScriptInstance scriptInstance = imp->getInstance();
- if (!scriptInstance)
- return notHandledByInterceptor();
-
- v8::Local<v8::Object> instance = v8::Local<v8::Object>::New(scriptInstance->instance());
- if (instance.IsEmpty())
- return notHandledByInterceptor();
-
- return npObjectGetIndexedProperty(instance, index);
-}
-
-template <class C>
-v8::Handle<v8::Value> npObjectIndexedSetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLPlugInElement.IndexedPropertySetter");
- HTMLPlugInElement* imp = C::toNative(info.Holder());
- ScriptInstance scriptInstance = imp->getInstance();
- if (!scriptInstance)
- return notHandledByInterceptor();
-
- v8::Local<v8::Object> instance = v8::Local<v8::Object>::New(scriptInstance->instance());
- if (instance.IsEmpty())
- return notHandledByInterceptor();
-
- return npObjectSetIndexedProperty(instance, index, value);
-}
-
-v8::Handle<v8::Value> V8HTMLAppletElement::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLAppletElement.IndexedPropertyGetter");
- return npObjectIndexedGetter<V8HTMLAppletElement>(index, info);
-}
-
-v8::Handle<v8::Value> V8HTMLEmbedElement::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLEmbedElement.IndexedPropertyGetter");
- return npObjectIndexedGetter<V8HTMLEmbedElement>(index, info);
-}
-
-v8::Handle<v8::Value> V8HTMLObjectElement::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLObjectElement.IndexedPropertyGetter");
- return npObjectIndexedGetter<V8HTMLObjectElement>(index, info);
-}
-
-v8::Handle<v8::Value> V8HTMLAppletElement::indexedPropertySetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLAppletElement.IndexedPropertySetter");
- return npObjectIndexedSetter<V8HTMLAppletElement>(index, value, info);
-}
-
-v8::Handle<v8::Value> V8HTMLEmbedElement::indexedPropertySetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLEmbedElement.IndexedPropertySetter");
- return npObjectIndexedSetter<V8HTMLEmbedElement>(index, value, info);
-}
-
-v8::Handle<v8::Value> V8HTMLObjectElement::indexedPropertySetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLObjectElement.IndexedPropertySetter");
- return npObjectIndexedSetter<V8HTMLObjectElement>(index, value, info);
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp
deleted file mode 100644
index 7cd3926..0000000
--- a/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8HTMLSelectElementCustom.h"
-
-#include "HTMLSelectElement.h"
-#include "HTMLOptionElement.h"
-#include "HTMLOptionsCollection.h"
-
-#include "V8Binding.h"
-#include "V8Collection.h"
-#include "V8HTMLOptionElement.h"
-#include "V8HTMLSelectElement.h"
-#include "V8NamedNodesCollection.h"
-#include "V8Node.h"
-#include "V8NodeList.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8HTMLSelectElement::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
-{
- ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));
- RefPtr<Node> result = V8HTMLSelectElement::toNative(info.Holder())->item(index);
- if (!result)
- return notHandledByInterceptor();
-
- return toV8(result.release());
-}
-
-v8::Handle<v8::Value> V8HTMLSelectElement::indexedPropertySetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLSelectElement.IndexedPropertySetter");
- HTMLSelectElement* select = V8HTMLSelectElement::toNative(info.Holder());
- return toOptionsCollectionSetter(index, value, select);
-}
-
-v8::Handle<v8::Value> V8HTMLSelectElement::removeCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.HTMLSelectElement.remove");
- HTMLSelectElement* imp = V8HTMLSelectElement::toNative(args.Holder());
- return removeElement(imp, args);
-}
-
-v8::Handle<v8::Value> removeElement(HTMLSelectElement* imp, const v8::Arguments& args)
-{
- if (V8HTMLOptionElement::HasInstance(args[0])) {
- HTMLOptionElement* element = V8HTMLOptionElement::toNative(v8::Handle<v8::Object>::Cast(args[0]));
- imp->remove(element->index());
- return v8::Undefined();
- }
-
- imp->remove(toInt32(args[0]));
- return v8::Undefined();
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.h b/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.h
deleted file mode 100644
index b956ed8..0000000
--- a/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8HTMLSelectElementCustom_h
-#define V8HTMLSelectElementCustom_h
-
-#include <v8.h>
-
-namespace WebCore {
-
- class HTMLSelectElement;
-
- v8::Handle<v8::Value> removeElement(HTMLSelectElement*, const v8::Arguments&);
-
-} // namespace WebCore
-
-#endif // V8HTMLSelectElementCustom_h
diff --git a/WebCore/bindings/v8/custom/V8HistoryCustom.cpp b/WebCore/bindings/v8/custom/V8HistoryCustom.cpp
deleted file mode 100644
index ad2b9a9..0000000
--- a/WebCore/bindings/v8/custom/V8HistoryCustom.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8History.h"
-
-#include "ExceptionCode.h"
-#include "History.h"
-#include "SerializedScriptValue.h"
-#include "V8Binding.h"
-#include "V8BindingState.h"
-#include "V8DOMWindow.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8History::pushStateCallback(const v8::Arguments& args)
-{
- bool didThrow = false;
- RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(args[0], didThrow);
- if (didThrow)
- return v8::Undefined();
-
- v8::TryCatch tryCatch;
- String title = toWebCoreStringWithNullOrUndefinedCheck(args[1]);
- if (tryCatch.HasCaught())
- return v8::Undefined();
- String url;
- if (args.Length() > 2) {
- url = toWebCoreStringWithNullOrUndefinedCheck(args[2]);
- if (tryCatch.HasCaught())
- return v8::Undefined();
- }
-
- ExceptionCode ec = 0;
- History* history = V8History::toNative(args.Holder());
- history->stateObjectAdded(historyState.release(), title, url, History::StateObjectPush, ec);
- return throwError(ec);
-}
-
-v8::Handle<v8::Value> V8History::replaceStateCallback(const v8::Arguments& args)
-{
- bool didThrow = false;
- RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(args[0], didThrow);
- if (didThrow)
- return v8::Undefined();
-
- v8::TryCatch tryCatch;
- String title = toWebCoreStringWithNullOrUndefinedCheck(args[1]);
- if (tryCatch.HasCaught())
- return v8::Undefined();
- String url;
- if (args.Length() > 2) {
- url = toWebCoreStringWithNullOrUndefinedCheck(args[2]);
- if (tryCatch.HasCaught())
- return v8::Undefined();
- }
-
- ExceptionCode ec = 0;
- History* history = V8History::toNative(args.Holder());
- history->stateObjectAdded(historyState.release(), title, url, History::StateObjectReplace, ec);
- return throwError(ec);
-}
-
-bool V8History::indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::AccessType type, v8::Local<v8::Value>)
-{
- // Only allow same origin access.
- History* history = V8History::toNative(host);
- return V8BindingSecurity::canAccessFrame(V8BindingState::Only(), history->frame(), false);
-}
-
-bool V8History::namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value>)
-{
- // Only allow same origin access.
- History* history = V8History::toNative(host);
- return V8BindingSecurity::canAccessFrame(V8BindingState::Only(), history->frame(), false);
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp b/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp
deleted file mode 100644
index fd6f1a5..0000000
--- a/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(INDEXED_DATABASE)
-
-#include "V8IDBAny.h"
-
-#include "SerializedScriptValue.h"
-#include "V8IDBCursor.h"
-#include "V8IDBDatabase.h"
-#include "V8IDBFactory.h"
-#include "V8IDBIndex.h"
-#include "V8IDBKey.h"
-#include "V8IDBObjectStore.h"
-#include "V8IDBTransaction.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> toV8(IDBAny* impl)
-{
- if (!impl)
- return v8::Null();
-
- switch (impl->type()) {
- case IDBAny::UndefinedType:
- return v8::Undefined();
- case IDBAny::NullType:
- return v8::Null();
- case IDBAny::IDBCursorType:
- return toV8(impl->idbCursor());
- case IDBAny::IDBDatabaseType:
- return toV8(impl->idbDatabase());
- case IDBAny::IDBFactoryType:
- return toV8(impl->idbFactory());
- case IDBAny::IDBIndexType:
- return toV8(impl->idbIndex());
- case IDBAny::IDBKeyType:
- return toV8(impl->idbKey());
- case IDBAny::IDBObjectStoreType:
- return toV8(impl->idbObjectStore());
- case IDBAny::IDBTransactionType:
- return toV8(impl->idbTransaction());
- case IDBAny::SerializedScriptValueType:
- return impl->serializedScriptValue()->deserialize();
- }
-
- ASSERT_NOT_REACHED();
- return v8::Undefined();
-}
-
-#endif // ENABLE(INDEXED_DATABASE)
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8IDBKeyCustom.cpp b/WebCore/bindings/v8/custom/V8IDBKeyCustom.cpp
deleted file mode 100644
index 3805dca..0000000
--- a/WebCore/bindings/v8/custom/V8IDBKeyCustom.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(INDEXED_DATABASE)
-#include "V8IDBAny.h"
-
-#include "IDBBindingUtilities.h"
-#include "IDBKey.h"
-#include "V8Binding.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> toV8(IDBKey* key)
-{
- if (!key)
- return v8::Null();
-
- switch (key->type()) {
- case IDBKey::NullType:
- return v8::Null();
- case IDBKey::NumberType:
- return v8::Number::New(key->number());
- case IDBKey::StringType:
- return v8String(key->string());
- case IDBKey::DateType:
- return v8::Date::New(key->date());
- }
-
- ASSERT_NOT_REACHED();
- return v8::Undefined();
-}
-
-#endif // ENABLE(INDEXED_DATABASE)
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8ImageDataCustom.cpp b/WebCore/bindings/v8/custom/V8ImageDataCustom.cpp
deleted file mode 100644
index b4549e4..0000000
--- a/WebCore/bindings/v8/custom/V8ImageDataCustom.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8ImageData.h"
-
-#include "V8CanvasPixelArray.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> toV8(ImageData* impl)
-{
- if (!impl)
- return v8::Null();
- v8::Handle<v8::Object> wrapper = V8ImageData::wrap(impl);
- if (!wrapper.IsEmpty()) {
- // Create a V8 CanvasPixelArray object.
- v8::Handle<v8::Value> pixelArray = toV8(impl->data());
- // Set the "data" property of the ImageData object to
- // the created v8 object, eliminating the C++ callback
- // when accessing the "data" property.
- if (!pixelArray.IsEmpty()) {
- wrapper->Set(v8::String::NewSymbol("data"),
- pixelArray,
- v8::ReadOnly);
- }
- }
-
- return wrapper;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
deleted file mode 100644
index 81ad955..0000000
--- a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Copyright (C) 2007-2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8InjectedScriptHost.h"
-
-#include "DOMWindow.h"
-#include "Database.h"
-#include "Frame.h"
-#include "InjectedScript.h"
-#include "InjectedScriptHost.h"
-#include "InspectorController.h"
-#include "InspectorValues.h"
-#include "Node.h"
-#include "Page.h"
-#include "ScriptDebugServer.h"
-
-#include "V8Binding.h"
-#include "V8BindingState.h"
-#include "V8DOMWindow.h"
-#include "V8Database.h"
-#include "V8HiddenPropertyName.h"
-#include "V8JavaScriptCallFrame.h"
-#include "V8Node.h"
-#include "V8Proxy.h"
-#include "V8Storage.h"
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-static void WeakReferenceCallback(v8::Persistent<v8::Value> object, void* parameter)
-{
- InjectedScriptHost* nativeObject = static_cast<InjectedScriptHost*>(parameter);
- nativeObject->deref();
- object.Dispose();
-}
-
-static v8::Local<v8::Object> createInjectedScriptHostV8Wrapper(InjectedScriptHost* host)
-{
- v8::Local<v8::Function> function = V8InjectedScriptHost::GetTemplate()->GetFunction();
- if (function.IsEmpty()) {
- // Return if allocation failed.
- return v8::Local<v8::Object>();
- }
- v8::Local<v8::Object> instance = SafeAllocation::newInstance(function);
- if (instance.IsEmpty()) {
- // Avoid setting the wrapper if allocation failed.
- return v8::Local<v8::Object>();
- }
- V8DOMWrapper::setDOMWrapper(instance, &V8InjectedScriptHost::info, host);
- // Create a weak reference to the v8 wrapper of InspectorBackend to deref
- // InspectorBackend when the wrapper is garbage collected.
- host->ref();
- v8::Persistent<v8::Object> weakHandle = v8::Persistent<v8::Object>::New(instance);
- weakHandle.MakeWeak(host, &WeakReferenceCallback);
- return instance;
-}
-
-ScriptObject InjectedScriptHost::createInjectedScript(const String& scriptSource, ScriptState* inspectedScriptState, long id)
-{
- v8::HandleScope scope;
-
- v8::Local<v8::Context> inspectedContext = inspectedScriptState->context();
- v8::Context::Scope contextScope(inspectedContext);
-
- // Call custom code to create InjectedScripHost wrapper specific for the context
- // instead of calling toV8() that would create the
- // wrapper in the current context.
- // FIXME: make it possible to use generic bindings factory for InjectedScriptHost.
- v8::Local<v8::Object> scriptHostWrapper = createInjectedScriptHostV8Wrapper(this);
- if (scriptHostWrapper.IsEmpty())
- return ScriptObject();
-
- v8::Local<v8::Object> windowGlobal = inspectedContext->Global();
-
- // Inject javascript into the context. The compiled script is supposed to evaluate into
- // a single anonymous function(it's anonymous to avoid cluttering the global object with
- // inspector's stuff) the function is called a few lines below with InjectedScriptHost wrapper,
- // injected script id and explicit reference to the inspected global object. The function is expected
- // to create and configure InjectedScript instance that is going to be used by the inspector.
- v8::Local<v8::Script> script = v8::Script::Compile(v8String(scriptSource));
- v8::Local<v8::Value> v = script->Run();
- ASSERT(!v.IsEmpty());
- ASSERT(v->IsFunction());
-
- v8::Handle<v8::Value> args[] = {
- scriptHostWrapper,
- windowGlobal,
- v8::Number::New(id),
- };
- v8::Local<v8::Value> injectedScriptValue = v8::Function::Cast(*v)->Call(windowGlobal, 3, args);
- v8::Local<v8::Object> injectedScript(v8::Object::Cast(*injectedScriptValue));
- return ScriptObject(inspectedScriptState, injectedScript);
-}
-
-void InjectedScriptHost::discardInjectedScript(ScriptState* inspectedScriptState)
-{
- v8::HandleScope handleScope;
- v8::Local<v8::Context> context = inspectedScriptState->context();
- v8::Context::Scope contextScope(context);
-
- v8::Local<v8::Object> global = context->Global();
- // Skip proxy object. The proxy object will survive page navigation while we need
- // an object whose lifetime consides with that of the inspected context.
- global = v8::Local<v8::Object>::Cast(global->GetPrototype());
-
- v8::Handle<v8::String> key = V8HiddenPropertyName::devtoolsInjectedScript();
- global->DeleteHiddenValue(key);
-}
-
-v8::Handle<v8::Value> V8InjectedScriptHost::nodeForIdCallback(const v8::Arguments& args)
-{
- INC_STATS("InjectedScriptHost.nodeForId()");
- if (args.Length() < 1)
- return v8::Undefined();
-
- InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
-
- Node* node = host->nodeForId(args[0]->ToInt32()->Value());
- if (!node)
- return v8::Undefined();
-
- InspectorController* ic = host->inspectorController();
- if (!ic)
- return v8::Undefined();
-
- return toV8(node);
-}
-
-v8::Handle<v8::Value> V8InjectedScriptHost::internalConstructorNameCallback(const v8::Arguments& args)
-{
- INC_STATS("InjectedScriptHost.internalConstructorName()");
- if (args.Length() < 1)
- return v8::Undefined();
-
- if (!args[0]->IsObject())
- return v8::Undefined();
-
- return args[0]->ToObject()->GetConstructorName();
-}
-
-v8::Handle<v8::Value> V8InjectedScriptHost::pushNodePathToFrontendCallback(const v8::Arguments& args)
-{
- INC_STATS("InjectedScriptHost.pushNodePathToFrontend()");
- if (args.Length() < 3)
- return v8::Undefined();
-
- InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
- Node* node = V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0]));
- bool withChildren = args[1]->ToBoolean()->Value();
- bool selectInUI = args[2]->ToBoolean()->Value();
- if (node)
- return v8::Number::New(host->pushNodePathToFrontend(node, withChildren, selectInUI));
-
- return v8::Undefined();
-}
-
-#if ENABLE(JAVASCRIPT_DEBUGGER)
-v8::Handle<v8::Value> V8InjectedScriptHost::currentCallFrameCallback(const v8::Arguments& args)
-{
- INC_STATS("InjectedScriptHost.currentCallFrame()");
- return toV8(ScriptDebugServer::shared().currentCallFrame());
-}
-#endif
-
-#if ENABLE(DATABASE)
-v8::Handle<v8::Value> V8InjectedScriptHost::selectDatabaseCallback(const v8::Arguments& args)
-{
- INC_STATS("InjectedScriptHost.selectDatabase()");
- if (args.Length() < 1)
- return v8::Undefined();
-
- InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
- Database* database = V8Database::toNative(v8::Handle<v8::Object>::Cast(args[0]));
- if (database)
- host->selectDatabase(database);
-
- return v8::Undefined();
-}
-#endif
-
-#if ENABLE(DOM_STORAGE)
-v8::Handle<v8::Value> V8InjectedScriptHost::selectDOMStorageCallback(const v8::Arguments& args)
-{
- INC_STATS("InjectedScriptHost.selectDOMStorage()");
- if (args.Length() < 1)
- return v8::Undefined();
-
- InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
- Storage* storage = V8Storage::toNative(v8::Handle<v8::Object>::Cast(args[0]));
- if (storage)
- host->selectDOMStorage(storage);
-
- return v8::Undefined();
-}
-#endif
-
-InjectedScript InjectedScriptHost::injectedScriptFor(ScriptState* inspectedScriptState)
-{
- v8::HandleScope handleScope;
- v8::Local<v8::Context> context = inspectedScriptState->context();
- v8::Context::Scope contextScope(context);
-
- v8::Local<v8::Object> global = context->Global();
- // Skip proxy object. The proxy object will survive page navigation while we need
- // an object whose lifetime consides with that of the inspected context.
- global = v8::Local<v8::Object>::Cast(global->GetPrototype());
-
- v8::Handle<v8::String> key = V8HiddenPropertyName::devtoolsInjectedScript();
- v8::Local<v8::Value> val = global->GetHiddenValue(key);
- if (!val.IsEmpty() && val->IsObject())
- return InjectedScript(ScriptObject(inspectedScriptState, v8::Local<v8::Object>::Cast(val)));
-
- if (!canAccessInspectedWindow(inspectedScriptState))
- return InjectedScript();
-
- ASSERT(!m_injectedScriptSource.isEmpty());
- pair<long, ScriptObject> injectedScript = injectScript(m_injectedScriptSource, inspectedScriptState);
- InjectedScript result(injectedScript.second);
- m_idToInjectedScript.set(injectedScript.first, result);
- global->SetHiddenValue(key, injectedScript.second.v8Object());
- return result;
-}
-
-bool InjectedScriptHost::canAccessInspectedWindow(ScriptState* scriptState)
-{
- v8::HandleScope handleScope;
- v8::Local<v8::Context> context = scriptState->context();
- v8::Local<v8::Object> global = context->Global();
- if (global.IsEmpty())
- return false;
- v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), global);
- if (holder.IsEmpty())
- return false;
- Frame* frame = V8DOMWindow::toNative(holder)->frame();
-
- v8::Context::Scope contextScope(context);
- return V8BindingSecurity::canAccessFrame(V8BindingState::Only(), frame, false);
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp b/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp
deleted file mode 100644
index 94fa86e..0000000
--- a/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2007-2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8InspectorFrontendHost.h"
-
-#include "InspectorController.h"
-#include "InspectorFrontendHost.h"
-#include "PlatformString.h"
-
-#include "V8Binding.h"
-#include "V8MouseEvent.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8InspectorFrontendHost::platformCallback(const v8::Arguments&)
-{
-#if defined(OS_MACOSX)
- return v8String("mac");
-#elif defined(OS_LINUX)
- return v8String("linux");
-#elif defined(OS_FREEBSD)
- return v8String("freebsd");
-#elif defined(OS_WIN)
- return v8String("windows");
-#else
- return v8String("unknown");
-#endif
-}
-
-v8::Handle<v8::Value> V8InspectorFrontendHost::portCallback(const v8::Arguments&)
-{
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8InspectorFrontendHost::showContextMenuCallback(const v8::Arguments& args)
-{
- if (args.Length() < 2)
- return v8::Undefined();
-
- v8::Local<v8::Object> eventWrapper = v8::Local<v8::Object>::Cast(args[0]);
- if (!V8MouseEvent::info.equals(V8DOMWrapper::domWrapperType(eventWrapper)))
- return v8::Undefined();
-
- Event* event = V8Event::toNative(eventWrapper);
- if (!args[1]->IsArray())
- return v8::Undefined();
-
- v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(args[1]);
- Vector<ContextMenuItem*> items;
-
- for (size_t i = 0; i < array->Length(); ++i) {
- v8::Local<v8::Object> item = v8::Local<v8::Object>::Cast(array->Get(v8::Integer::New(i)));
- v8::Local<v8::Value> type = item->Get(v8::String::New("type"));
- v8::Local<v8::Value> id = item->Get(v8::String::New("id"));
- v8::Local<v8::Value> label = item->Get(v8::String::New("label"));
- v8::Local<v8::Value> enabled = item->Get(v8::String::New("enabled"));
- v8::Local<v8::Value> checked = item->Get(v8::String::New("checked"));
- if (!type->IsString())
- continue;
- String typeString = toWebCoreStringWithNullCheck(type);
- if (typeString == "separator") {
- items.append(new ContextMenuItem(SeparatorType,
- ContextMenuItemCustomTagNoAction,
- String()));
- } else {
- ContextMenuAction typedId = static_cast<ContextMenuAction>(ContextMenuItemBaseCustomTag + id->ToInt32()->Value());
- ContextMenuItem* menuItem = new ContextMenuItem((typeString == "checkbox" ? CheckableActionType : ActionType), typedId, toWebCoreStringWithNullCheck(label));
- if (checked->IsBoolean())
- menuItem->setChecked(checked->ToBoolean()->Value());
- if (enabled->IsBoolean())
- menuItem->setEnabled(enabled->ToBoolean()->Value());
- items.append(menuItem);
- }
- }
-
- InspectorFrontendHost* frontendHost = V8InspectorFrontendHost::toNative(args.Holder());
- frontendHost->showContextMenu(event, items);
-
- return v8::Undefined();
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8Int16ArrayCustom.cpp b/WebCore/bindings/v8/custom/V8Int16ArrayCustom.cpp
deleted file mode 100644
index 244a231..0000000
--- a/WebCore/bindings/v8/custom/V8Int16ArrayCustom.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
-#include "ArrayBuffer.h"
-#include "Int16Array.h"
-
-#include "V8Binding.h"
-#include "V8ArrayBuffer.h"
-#include "V8ArrayBufferViewCustom.h"
-#include "V8Int16Array.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8Int16Array::constructorCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Int16Array.Contructor");
-
- return constructWebGLArray<Int16Array, short>(args, &info, v8::kExternalShortArray);
-}
-
-v8::Handle<v8::Value> V8Int16Array::setCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Int16Array.set()");
- return setWebGLArrayHelper<Int16Array, V8Int16Array>(args);
-}
-
-v8::Handle<v8::Value> toV8(Int16Array* impl)
-{
- if (!impl)
- return v8::Null();
- v8::Handle<v8::Object> wrapper = V8Int16Array::wrap(impl);
- if (!wrapper.IsEmpty())
- wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalShortArray, impl->length());
- return wrapper;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8Int32ArrayCustom.cpp b/WebCore/bindings/v8/custom/V8Int32ArrayCustom.cpp
deleted file mode 100644
index a5001ed..0000000
--- a/WebCore/bindings/v8/custom/V8Int32ArrayCustom.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
-#include "ArrayBuffer.h"
-#include "Int32Array.h"
-
-#include "V8Binding.h"
-#include "V8ArrayBuffer.h"
-#include "V8ArrayBufferViewCustom.h"
-#include "V8Int32Array.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8Int32Array::constructorCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Int32Array.Contructor");
-
- return constructWebGLArray<Int32Array, int>(args, &info, v8::kExternalIntArray);
-}
-
-v8::Handle<v8::Value> V8Int32Array::setCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Int32Array.set()");
- return setWebGLArrayHelper<Int32Array, V8Int32Array>(args);
-}
-
-v8::Handle<v8::Value> toV8(Int32Array* impl)
-{
- if (!impl)
- return v8::Null();
- v8::Handle<v8::Object> wrapper = V8Int32Array::wrap(impl);
- if (!wrapper.IsEmpty())
- wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalIntArray, impl->length());
- return wrapper;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8Int8ArrayCustom.cpp b/WebCore/bindings/v8/custom/V8Int8ArrayCustom.cpp
deleted file mode 100644
index 526d83e..0000000
--- a/WebCore/bindings/v8/custom/V8Int8ArrayCustom.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
-#include "ArrayBuffer.h"
-#include "Int8Array.h"
-
-#include "V8Binding.h"
-#include "V8ArrayBuffer.h"
-#include "V8ArrayBufferViewCustom.h"
-#include "V8Int8Array.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8Int8Array::constructorCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Int8Array.Contructor");
-
- return constructWebGLArray<Int8Array, signed char>(args, &info, v8::kExternalByteArray);
-}
-
-v8::Handle<v8::Value> V8Int8Array::setCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Int8Array.set()");
- return setWebGLArrayHelper<Int8Array, V8Int8Array>(args);
-}
-
-v8::Handle<v8::Value> toV8(Int8Array* impl)
-{
- if (!impl)
- return v8::Null();
- v8::Handle<v8::Object> wrapper = V8Int8Array::wrap(impl);
- if (!wrapper.IsEmpty())
- wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalByteArray, impl->length());
- return wrapper;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp b/WebCore/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp
deleted file mode 100644
index e2a691d..0000000
--- a/WebCore/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8JavaScriptCallFrame.h"
-
-#if ENABLE(JAVASCRIPT_DEBUGGER)
-
-#include "V8Binding.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8JavaScriptCallFrame::evaluateCallback(const v8::Arguments& args)
-{
- INC_STATS("V8JavaScriptCallFrame.evaluateCallback()");
- JavaScriptCallFrame* impl = V8JavaScriptCallFrame::toNative(args.Holder());
- String expression = toWebCoreStringWithNullOrUndefinedCheck(args[0]);
- return impl->evaluate(expression);
-}
-
-v8::Handle<v8::Value> V8JavaScriptCallFrame::scopeChainAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("V8JavaScriptCallFrame.scopeChainAccessorGetter()");
- JavaScriptCallFrame* impl = V8JavaScriptCallFrame::toNative(info.Holder());
- return impl->scopeChain();
-}
-
-v8::Handle<v8::Value> V8JavaScriptCallFrame::scopeTypeCallback(const v8::Arguments& args)
-{
- INC_STATS("V8JavaScriptCallFrame.scopeTypeCallback()");
- JavaScriptCallFrame* impl = V8JavaScriptCallFrame::toNative(args.Holder());
- int scopeIndex = args[0]->Int32Value();
- return v8::Int32::New(impl->scopeType(scopeIndex));
-}
-
-v8::Handle<v8::Value> V8JavaScriptCallFrame::thisObjectAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("V8JavaScriptCallFrame.thisObjectAccessorGetter()");
- JavaScriptCallFrame* impl = V8JavaScriptCallFrame::toNative(info.Holder());
- return impl->thisObject();
-}
-
-v8::Handle<v8::Value> V8JavaScriptCallFrame::typeAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("V8JavaScriptCallFrame.typeAccessorGetter()");
- return v8String("function");
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(JAVASCRIPT_DEBUGGER)
diff --git a/WebCore/bindings/v8/custom/V8LocationCustom.cpp b/WebCore/bindings/v8/custom/V8LocationCustom.cpp
deleted file mode 100644
index 34c7e28..0000000
--- a/WebCore/bindings/v8/custom/V8LocationCustom.cpp
+++ /dev/null
@@ -1,367 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8Location.h"
-
-#include "Document.h"
-#include "Frame.h"
-#include "FrameLoader.h"
-#include "KURL.h"
-#include "Location.h"
-#include "PlatformString.h"
-#include "ScriptController.h"
-#include "V8Binding.h"
-#include "V8BindingState.h"
-#include "V8CustomEventListener.h"
-#include "V8DOMWindow.h"
-#include "V8Location.h"
-#include "V8Utilities.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-// Notes about V8/JSC porting of this file.
-// This class is not very JS-engine specific. If we can move a couple of
-// methods to the scriptController, we should be able to unify the code
-// between JSC and V8:
-// toCallingFrame() - in JSC, this needs an ExecState.
-// isSafeScript()
-// Since JSC and V8 have different mechanisms for getting at the calling frame,
-// we're just making all these custom for now. The functionality is simple
-// and mirrors JSLocationCustom.cpp.
-
-void V8Location::hashAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.Location.hash._set");
- v8::Handle<v8::Object> holder = info.Holder();
- Location* imp = V8Location::toNative(holder);
- String hash = toWebCoreString(value);
-
- Frame* frame = imp->frame();
- if (!frame)
- return;
-
- KURL url = frame->loader()->url();
- String oldRef = url.fragmentIdentifier();
-
- if (hash.startsWith("#"))
- hash = hash.substring(1);
-
- // Note that by parsing the URL and *then* comparing fragments, we are
- // comparing fragments post-canonicalization, and so this handles the
- // cases where fragment identifiers are ignored or invalid.
- url.setFragmentIdentifier(hash);
- String newRef = url.fragmentIdentifier();
- if (oldRef == newRef || (oldRef.isNull() && newRef.isEmpty()))
- return;
-
- navigateIfAllowed(frame, url, false, false);
-}
-
-void V8Location::hostAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.Location.host._set");
- v8::Handle<v8::Object> holder = info.Holder();
- Location* imp = V8Location::toNative(holder);
- String host = toWebCoreString(value);
-
- Frame* frame = imp->frame();
- if (!frame)
- return;
-
- KURL url = frame->loader()->url();
- String newHost = host.left(host.find(":"));
- String newPort = host.substring(host.find(":") + 1);
- url.setHost(newHost);
- url.setPort(newPort.toUInt());
-
- navigateIfAllowed(frame, url, false, false);
-}
-
-void V8Location::hostnameAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.Location.hostname._set");
- v8::Handle<v8::Object> holder = info.Holder();
- Location* imp = V8Location::toNative(holder);
- String hostname = toWebCoreString(value);
-
- Frame* frame = imp->frame();
- if (!frame)
- return;
-
- KURL url = frame->loader()->url();
- url.setHost(hostname);
-
- navigateIfAllowed(frame, url, false, false);
-}
-
-void V8Location::hrefAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.Location.href._set");
- v8::Handle<v8::Object> holder = info.Holder();
- Location* imp = V8Location::toNative(holder);
-
- Frame* frame = imp->frame();
- if (!frame)
- return;
-
- KURL url = completeURL(toWebCoreString(value));
- if (url.isNull())
- return;
-
- if (!shouldAllowNavigation(frame))
- return;
-
- navigateIfAllowed(frame, url, false, false);
-}
-
-void V8Location::pathnameAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.Location.pathname._set");
- v8::Handle<v8::Object> holder = info.Holder();
- Location* imp = V8Location::toNative(holder);
- String pathname = toWebCoreString(value);
-
- Frame* frame = imp->frame();
- if (!frame)
- return;
-
- KURL url = frame->loader()->url();
- url.setPath(pathname);
-
- navigateIfAllowed(frame, url, false, false);
-}
-
-void V8Location::portAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.Location.port._set");
- v8::Handle<v8::Object> holder = info.Holder();
- Location* imp = V8Location::toNative(holder);
- String port = toWebCoreString(value);
-
- Frame* frame = imp->frame();
- if (!frame)
- return;
-
- KURL url = frame->loader()->url();
- url.setPort(port.toUInt());
-
- navigateIfAllowed(frame, url, false, false);
-}
-
-void V8Location::protocolAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.Location.protocol._set");
- v8::Handle<v8::Object> holder = info.Holder();
- Location* imp = V8Location::toNative(holder);
- String protocol = toWebCoreString(value);
-
- Frame* frame = imp->frame();
- if (!frame)
- return;
-
- KURL url = frame->loader()->url();
- if (!url.setProtocol(protocol)) {
- throwError("Can't set protocol", V8Proxy::SyntaxError);
- return;
- }
-
- navigateIfAllowed(frame, url, false, false);
-}
-
-void V8Location::searchAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.Location.search._set");
- v8::Handle<v8::Object> holder = info.Holder();
- Location* imp = V8Location::toNative(holder);
- String query = toWebCoreString(value);
-
- Frame* frame = imp->frame();
- if (!frame)
- return;
-
- KURL url = frame->loader()->url();
- url.setQuery(query);
-
- navigateIfAllowed(frame, url, false, false);
-}
-
-v8::Handle<v8::Value> V8Location::reloadAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.Location.reload._get");
- static v8::Persistent<v8::FunctionTemplate> privateTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::reloadCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
- v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8Location::GetTemplate(), info.This());
- if (holder.IsEmpty()) {
- // can only reach here by 'object.__proto__.func', and it should passed
- // domain security check already
- return privateTemplate->GetFunction();
- }
- Location* imp = V8Location::toNative(holder);
- if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), false)) {
- static v8::Persistent<v8::FunctionTemplate> sharedTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::reloadCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
- return sharedTemplate->GetFunction();
- }
- return privateTemplate->GetFunction();
-}
-
-v8::Handle<v8::Value> V8Location::replaceAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.Location.replace._get");
- static v8::Persistent<v8::FunctionTemplate> privateTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::replaceCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
- v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8Location::GetTemplate(), info.This());
- if (holder.IsEmpty()) {
- // can only reach here by 'object.__proto__.func', and it should passed
- // domain security check already
- return privateTemplate->GetFunction();
- }
- Location* imp = V8Location::toNative(holder);
- if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), false)) {
- static v8::Persistent<v8::FunctionTemplate> sharedTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::replaceCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
- return sharedTemplate->GetFunction();
- }
- return privateTemplate->GetFunction();
-}
-
-v8::Handle<v8::Value> V8Location::assignAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.Location.assign._get");
- static v8::Persistent<v8::FunctionTemplate> privateTemplate =
- v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::assignCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
- v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8Location::GetTemplate(), info.This());
- if (holder.IsEmpty()) {
- // can only reach here by 'object.__proto__.func', and it should passed
- // domain security check already
- return privateTemplate->GetFunction();
- }
- Location* imp = V8Location::toNative(holder);
- if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), false)) {
- static v8::Persistent<v8::FunctionTemplate> sharedTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::assignCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
- return sharedTemplate->GetFunction();
- }
- return privateTemplate->GetFunction();
-}
-
-v8::Handle<v8::Value> V8Location::reloadCallback(const v8::Arguments& args)
-{
- // FIXME: we ignore the "forceget" parameter.
-
- INC_STATS("DOM.Location.reload");
- v8::Handle<v8::Object> holder = args.Holder();
- Location* imp = V8Location::toNative(holder);
-
- Frame* frame = imp->frame();
- if (!frame || !ScriptController::isSafeScript(frame))
- return v8::Undefined();
-
- if (!protocolIsJavaScript(frame->loader()->url()))
- frame->navigationScheduler()->scheduleRefresh();
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Location::replaceCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Location.replace");
- v8::Handle<v8::Object> holder = args.Holder();
- Location* imp = V8Location::toNative(holder);
- V8Binding::Location::replace(V8BindingState::Only(), imp, toWebCoreString(args[0]));
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Location::assignCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Location.assign");
- v8::Handle<v8::Object> holder = args.Holder();
- Location* imp = V8Location::toNative(holder);
-
- Frame* frame = imp->frame();
- if (!frame)
- return v8::Undefined();
-
- KURL url = completeURL(toWebCoreString(args[0]));
- if (url.isNull())
- return v8::Undefined();
-
- if (!shouldAllowNavigation(frame))
- return v8::Undefined();
-
- navigateIfAllowed(frame, url, false, false);
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Location::valueOfCallback(const v8::Arguments& args)
-{
- // Just return the this object the way the normal valueOf function
- // on the Object prototype would. The valueOf function is only
- // added to make sure that it cannot be overwritten on location
- // objects, since that would provide a hook to change the string
- // conversion behavior of location objects.
- return args.This();
-}
-
-v8::Handle<v8::Value> V8Location::toStringCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Location.toString");
- v8::Handle<v8::Object> holder = args.Holder();
- Location* imp = V8Location::toNative(holder);
- if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true))
- return v8::Undefined();
- String result = imp->href();
- return v8String(result);
-}
-
-bool V8Location::indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::AccessType type, v8::Local<v8::Value>)
-{
- // Only allow same origin access
- Location* imp = V8Location::toNative(host);
- return V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), false);
-}
-
-bool V8Location::namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value>)
-{
- // Only allow same origin access
- Location* imp = V8Location::toNative(host);
- return V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), false);
-}
-
-v8::Handle<v8::Value> toV8(Location* impl)
-{
- if (!impl)
- return v8::Null();
- v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(impl);
- if (wrapper.IsEmpty()) {
- wrapper = V8Location::wrap(impl);
- if (!wrapper.IsEmpty())
- V8DOMWrapper::setHiddenWindowReference(impl->frame(), wrapper);
- }
- return wrapper;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp b/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp
deleted file mode 100644
index b966e42..0000000
--- a/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8MessageChannel.h"
-
-#include "Document.h"
-#include "Frame.h"
-#include "MessageChannel.h"
-#include "V8Binding.h"
-#include "V8MessagePort.h"
-#include "V8Proxy.h"
-#include "V8Utilities.h"
-#include "WorkerContext.h"
-#include "WorkerContextExecutionProxy.h"
-
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8MessageChannel::constructorCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.MessageChannel.Constructor");
- // FIXME: The logic here is almost exact duplicate of V8::constructDOMObject.
- // Consider refactoring to reduce duplication.
- if (!args.IsConstructCall())
- return throwError("DOM object constructor cannot be called as a function.");
-
- // Get the ScriptExecutionContext (WorkerContext or Document)
- ScriptExecutionContext* context = getScriptExecutionContext();
- if (!context)
- return v8::Undefined();
-
- // Note: it's OK to let this RefPtr go out of scope because we also call
- // SetDOMWrapper(), which effectively holds a reference to obj.
- RefPtr<MessageChannel> obj = MessageChannel::create(context);
-
- v8::Local<v8::Object> messageChannel = args.Holder();
-
- // Create references from the MessageChannel wrapper to the two
- // MessagePort wrappers to make sure that the MessagePort wrappers
- // stay alive as long as the MessageChannel wrapper is around.
- V8DOMWrapper::setHiddenReference(messageChannel, toV8(obj->port1()));
- V8DOMWrapper::setHiddenReference(messageChannel, toV8(obj->port2()));
-
- // Setup the standard wrapper object internal fields.
- V8DOMWrapper::setDOMWrapper(messageChannel, &info, obj.get());
- return toV8(obj.release(), messageChannel);
-}
-
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp b/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp
deleted file mode 100644
index cca4a24..0000000
--- a/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8MessageEvent.h"
-
-#include "MessageEvent.h"
-#include "SerializedScriptValue.h"
-
-#include "V8Binding.h"
-#include "V8DOMWindow.h"
-#include "V8MessagePort.h"
-#include "V8MessagePortCustom.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8MessageEvent::portsAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.MessageEvent.ports");
- MessageEvent* event = V8MessageEvent::toNative(info.Holder());
-
- MessagePortArray* ports = event->ports();
- if (!ports || ports->isEmpty())
- return v8::Null();
-
- v8::Local<v8::Array> portArray = v8::Array::New(ports->size());
- for (size_t i = 0; i < ports->size(); ++i)
- portArray->Set(v8::Integer::New(i), toV8((*ports)[i].get()));
-
- return portArray;
-}
-
-v8::Handle<v8::Value> V8MessageEvent::initMessageEventCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.MessageEvent.initMessageEvent");
- MessageEvent* event = V8MessageEvent::toNative(args.Holder());
- String typeArg = v8ValueToWebCoreString(args[0]);
- bool canBubbleArg = args[1]->BooleanValue();
- bool cancelableArg = args[2]->BooleanValue();
- RefPtr<SerializedScriptValue> dataArg = SerializedScriptValue::create(args[3]);
- String originArg = v8ValueToWebCoreString(args[4]);
- String lastEventIdArg = v8ValueToWebCoreString(args[5]);
-
- DOMWindow* sourceArg = 0;
- if (args[6]->IsObject()) {
- v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(args[6]);
- v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), wrapper);
- if (!window.IsEmpty())
- sourceArg = V8DOMWindow::toNative(window);
- }
- OwnPtr<MessagePortArray> portArray;
-
- if (!isUndefinedOrNull(args[7])) {
- portArray = new MessagePortArray();
- if (!getMessagePortArray(args[7], *portArray))
- return v8::Undefined();
- }
- event->initMessageEvent(typeArg, canBubbleArg, cancelableArg, dataArg.release(), originArg, lastEventIdArg, sourceArg, portArray.release());
- v8::PropertyAttribute dataAttr = static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly);
- SerializedScriptValue::deserializeAndSetProperty(args.Holder(), "data", dataAttr, event->data());
- return v8::Undefined();
- }
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp b/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp
deleted file mode 100644
index c41ed38..0000000
--- a/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#include "ExceptionCode.h"
-#include "MessagePort.h"
-#include "SerializedScriptValue.h"
-#include "V8Binding.h"
-#include "V8MessagePortCustom.h"
-#include "V8MessagePort.h"
-#include "V8Proxy.h"
-#include "V8Utilities.h"
-#include "WorkerContextExecutionProxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8MessagePort::postMessageCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.MessagePort.postMessage");
- MessagePort* messagePort = V8MessagePort::toNative(args.Holder());
- bool didThrow = false;
- RefPtr<SerializedScriptValue> message = SerializedScriptValue::create(args[0], didThrow);
- if (didThrow)
- return v8::Undefined();
- MessagePortArray portArray;
- if (args.Length() > 1) {
- if (!getMessagePortArray(args[1], portArray))
- return v8::Undefined();
- }
- ExceptionCode ec = 0;
- messagePort->postMessage(message.release(), &portArray, ec);
- return throwError(ec);
-}
-
-bool getMessagePortArray(v8::Local<v8::Value> value, MessagePortArray& portArray)
-{
- if (isUndefinedOrNull(value)) {
- portArray.resize(0);
- return true;
- }
-
- if (!value->IsObject()) {
- throwError("MessagePortArray argument must be an object");
- return false;
- }
- uint32_t length = 0;
- v8::Local<v8::Object> ports = v8::Local<v8::Object>::Cast(value);
-
- if (value->IsArray()) {
- v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(value);
- length = array->Length();
- } else {
- // Sequence-type object - get the length attribute
- v8::Local<v8::Value> sequenceLength = ports->Get(v8::String::New("length"));
- if (!sequenceLength->IsNumber()) {
- throwError("MessagePortArray argument has no length attribute");
- return false;
- }
- length = sequenceLength->Uint32Value();
- }
- portArray.resize(length);
-
- for (unsigned int i = 0; i < length; ++i) {
- v8::Local<v8::Value> port = ports->Get(v8::Integer::New(i));
- // Validation of non-null objects, per HTML5 spec 8.3.3.
- if (isUndefinedOrNull(port)) {
- throwError(INVALID_STATE_ERR);
- return false;
- }
- // Validation of Objects implementing an interface, per WebIDL spec 4.1.15.
- if (!V8MessagePort::HasInstance(port)) {
- throwError("MessagePortArray argument must contain only MessagePorts");
- return false;
- }
- portArray[i] = V8MessagePort::toNative(v8::Handle<v8::Object>::Cast(port));
- }
- return true;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8MessagePortCustom.h b/WebCore/bindings/v8/custom/V8MessagePortCustom.h
deleted file mode 100644
index 7ab502b..0000000
--- a/WebCore/bindings/v8/custom/V8MessagePortCustom.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8MessagePortCustom_h
-#define V8MessagePortCustom_h
-
-#include <v8.h>
-
-#include "MessagePort.h"
-
-namespace WebCore {
-
- // Helper function which pulls the values out of a JS sequence and into a MessagePortArray.
- // Also validates the elements per sections 4.1.13 and 4.1.15 of the WebIDL spec and section 8.3.3 of the HTML5 spec and generates exceptions as appropriate.
- // Returns true if the array was filled, or false if the passed value was not of an appropriate type.
- bool getMessagePortArray(v8::Local<v8::Value>, MessagePortArray&);
-
-} // namespace WebCore
-
-#endif // V8MessagePortCustom_h
diff --git a/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp b/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp
deleted file mode 100644
index d9e1de0..0000000
--- a/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2007-2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8NamedNodeMap.h"
-
-#include "NamedNodeMap.h"
-#include "V8Attr.h"
-#include "V8Binding.h"
-#include "V8BindingState.h"
-#include "V8Element.h"
-#include "V8Node.h"
-#include "V8Proxy.h"
-
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8NamedNodeMap::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.NamedNodeMap.IndexedPropertyGetter");
- NamedNodeMap* imp = V8NamedNodeMap::toNative(info.Holder());
- RefPtr<Node> result = imp->item(index);
- if (!result)
- return notHandledByInterceptor();
-
- return toV8(result.release());
-}
-
-v8::Handle<v8::Value> V8NamedNodeMap::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.NamedNodeMap.NamedPropertyGetter");
- // Search the prototype chain first.
- v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototypeChain(name);
- if (!value.IsEmpty())
- return value;
-
- // Then look for IDL defined properties on the object itself.
- if (info.Holder()->HasRealNamedCallbackProperty(name))
- return notHandledByInterceptor();
-
- // Finally, search the DOM.
- NamedNodeMap* imp = V8NamedNodeMap::toNative(info.Holder());
- RefPtr<Node> result = imp->getNamedItem(toWebCoreString(name));
- if (!result)
- return notHandledByInterceptor();
-
- return toV8(result.release());
-}
-
-v8::Handle<v8::Value> toV8(NamedNodeMap* impl)
-{
- if (!impl)
- return v8::Null();
- v8::Handle<v8::Object> wrapper = V8NamedNodeMap::wrap(impl);
- // Add a hidden reference from named node map to its owner node.
- Element* element = impl->element();
- if (!wrapper.IsEmpty() && element)
- V8DOMWrapper::setHiddenReference(wrapper, toV8(element));
- return wrapper;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8NamedNodesCollection.cpp b/WebCore/bindings/v8/custom/V8NamedNodesCollection.cpp
deleted file mode 100644
index d9da174..0000000
--- a/WebCore/bindings/v8/custom/V8NamedNodesCollection.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2008, Google 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:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * 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.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "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 THE COPYRIGHT
-// OWNER 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.
-
-#include "config.h"
-#include "V8NamedNodesCollection.h"
-
-#include "Element.h"
-#include "NamedNodeMap.h"
-
-namespace WebCore {
-
-Node* V8NamedNodesCollection::item(unsigned index) const
-{
- if (index < m_nodes.size())
- return m_nodes[index].get();
- return 0;
-}
-
-Node* V8NamedNodesCollection::itemWithName(const AtomicString& id) const
-{
- for (unsigned i = 0; i < m_nodes.size(); ++i) {
- Node* node = m_nodes[i].get();
- if (node->hasID() && static_cast<Element*>(node)->getIdAttribute() == id)
- return node;
- }
- return 0;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8NamedNodesCollection.h b/WebCore/bindings/v8/custom/V8NamedNodesCollection.h
deleted file mode 100644
index 0372de1..0000000
--- a/WebCore/bindings/v8/custom/V8NamedNodesCollection.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-* Copyright (C) 2009 Google 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:
-*
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * 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.
-* * Neither the name of Google Inc. nor the names of its
-* contributors may be used to endorse or promote products derived from
-* this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "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 THE COPYRIGHT
-* OWNER 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 V8NamedNodesCollection_h
-#define V8NamedNodesCollection_h
-
-#include "Node.h"
-#include "NodeList.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
- class V8NamedNodesCollection : public NodeList {
- public:
- static PassRefPtr<NodeList> create(const Vector<RefPtr<Node> >& nodes)
- {
- return adoptRef(new V8NamedNodesCollection(nodes));
- }
-
- virtual unsigned length() const { return m_nodes.size(); }
- virtual Node* item(unsigned) const;
- virtual Node* itemWithName(const AtomicString&) const;
-
- private:
- explicit V8NamedNodesCollection(const Vector<RefPtr<Node> >& nodes)
- : m_nodes(nodes) { }
-
- Vector<RefPtr<Node> > m_nodes;
- };
-
-} // namespace WebCore
-
-#endif // V8NamedNodesCollection_h
diff --git a/WebCore/bindings/v8/custom/V8NodeCustom.cpp b/WebCore/bindings/v8/custom/V8NodeCustom.cpp
deleted file mode 100644
index 50b9899..0000000
--- a/WebCore/bindings/v8/custom/V8NodeCustom.cpp
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Copyright (C) 2007-2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "Node.h"
-
-#include "Document.h"
-#include "EventListener.h"
-
-#include "V8AbstractEventListener.h"
-#include "V8Attr.h"
-#include "V8Binding.h"
-#include "V8BindingState.h"
-#include "V8CDATASection.h"
-#include "V8Comment.h"
-#include "V8CustomEventListener.h"
-#include "V8Document.h"
-#include "V8DocumentFragment.h"
-#include "V8DocumentType.h"
-#include "V8Element.h"
-#include "V8Entity.h"
-#include "V8EntityReference.h"
-#include "V8Node.h"
-#include "V8Notation.h"
-#include "V8ProcessingInstruction.h"
-#include "V8Proxy.h"
-#include "V8Text.h"
-
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-// This function is customized to take advantage of the optional 4th argument: shouldLazyAttach
-v8::Handle<v8::Value> V8Node::insertBeforeCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Node.insertBefore");
- v8::Handle<v8::Object> holder = args.Holder();
- Node* imp = V8Node::toNative(holder);
- ExceptionCode ec = 0;
- Node* newChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
- Node* refChild = V8Node::HasInstance(args[1]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0;
- bool success = imp->insertBefore(newChild, refChild, ec, true);
- if (ec) {
- V8Proxy::setDOMException(ec);
- return v8::Handle<v8::Value>();
- }
- if (success)
- return args[0];
- return v8::Null();
-}
-
-// This function is customized to take advantage of the optional 4th argument: shouldLazyAttach
-v8::Handle<v8::Value> V8Node::replaceChildCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Node.replaceChild");
- v8::Handle<v8::Object> holder = args.Holder();
- Node* imp = V8Node::toNative(holder);
- ExceptionCode ec = 0;
- Node* newChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
- Node* oldChild = V8Node::HasInstance(args[1]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0;
- bool success = imp->replaceChild(newChild, oldChild, ec, true);
- if (ec) {
- V8Proxy::setDOMException(ec);
- return v8::Handle<v8::Value>();
- }
- if (success)
- return args[1];
- return v8::Null();
-}
-
-v8::Handle<v8::Value> V8Node::removeChildCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Node.removeChild");
- v8::Handle<v8::Object> holder = args.Holder();
- Node* imp = V8Node::toNative(holder);
- ExceptionCode ec = 0;
- Node* oldChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
- bool success = imp->removeChild(oldChild, ec);
- if (ec) {
- V8Proxy::setDOMException(ec);
- return v8::Handle<v8::Value>();
- }
- if (success)
- return args[0];
- return v8::Null();
-}
-
-// This function is customized to take advantage of the optional 4th argument: shouldLazyAttach
-v8::Handle<v8::Value> V8Node::appendChildCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Node.appendChild");
- v8::Handle<v8::Object> holder = args.Holder();
- Node* imp = V8Node::toNative(holder);
- ExceptionCode ec = 0;
- Node* newChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
- bool success = imp->appendChild(newChild, ec, true );
- if (ec) {
- V8Proxy::setDOMException(ec);
- return v8::Handle<v8::Value>();
- }
- if (success)
- return args[0];
- return v8::Null();
-}
-
-v8::Handle<v8::Value> toV8Slow(Node* impl, bool forceNewObject)
-{
- if (!impl)
- return v8::Null();
-
- if (!forceNewObject) {
- v8::Handle<v8::Value> wrapper = V8DOMWrapper::getWrapper(impl);
- if (!wrapper.IsEmpty())
- return wrapper;
- }
- switch (impl->nodeType()) {
- case Node::ELEMENT_NODE:
- return toV8(static_cast<Element*>(impl), forceNewObject);
- case Node::ATTRIBUTE_NODE:
- return toV8(static_cast<Attr*>(impl), forceNewObject);
- case Node::TEXT_NODE:
- return toV8(static_cast<Text*>(impl), forceNewObject);
- case Node::CDATA_SECTION_NODE:
- return toV8(static_cast<CDATASection*>(impl), forceNewObject);
- case Node::ENTITY_REFERENCE_NODE:
- return toV8(static_cast<EntityReference*>(impl), forceNewObject);
- case Node::ENTITY_NODE:
- return toV8(static_cast<Entity*>(impl), forceNewObject);
- case Node::PROCESSING_INSTRUCTION_NODE:
- return toV8(static_cast<ProcessingInstruction*>(impl), forceNewObject);
- case Node::COMMENT_NODE:
- return toV8(static_cast<Comment*>(impl), forceNewObject);
- case Node::DOCUMENT_NODE:
- return toV8(static_cast<Document*>(impl), forceNewObject);
- case Node::DOCUMENT_TYPE_NODE:
- return toV8(static_cast<DocumentType*>(impl), forceNewObject);
- case Node::DOCUMENT_FRAGMENT_NODE:
- return toV8(static_cast<DocumentFragment*>(impl), forceNewObject);
- case Node::NOTATION_NODE:
- return toV8(static_cast<Notation*>(impl), forceNewObject);
- default: break; // XPATH_NAMESPACE_NODE
- }
- return V8Node::wrap(impl, forceNewObject);
-}
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8NodeListCustom.cpp b/WebCore/bindings/v8/custom/V8NodeListCustom.cpp
deleted file mode 100644
index 8cc3983..0000000
--- a/WebCore/bindings/v8/custom/V8NodeListCustom.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2007-2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8NodeList.h"
-
-#include "NodeList.h"
-#include "V8Binding.h"
-#include "V8Node.h"
-#include "V8Proxy.h"
-
-#include <wtf/RefPtr.h>
-#include <wtf/StdLibExtras.h>
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8NodeList::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.NodeList.NamedPropertyGetter");
- NodeList* list = V8NodeList::toNative(info.Holder());
- AtomicString key = v8ValueToAtomicWebCoreString(name);
-
- // Length property cannot be overridden.
- DEFINE_STATIC_LOCAL(const AtomicString, length, ("length"));
- if (key == length)
- return v8::Integer::New(list->length());
-
- RefPtr<Node> result = list->itemWithName(key);
- if (!result)
- return notHandledByInterceptor();
-
- return toV8(result.release());
-}
-
-// Need to support call so that list(0) works.
-v8::Handle<v8::Value> V8NodeList::callAsFunctionCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.NodeList.callAsFunction()");
- if (args.Length() < 1)
- return v8::Undefined();
-
- NodeList* list = V8NodeList::toNative(args.Holder());
-
- // The first argument must be a number.
- v8::Local<v8::Uint32> index = args[0]->ToArrayIndex();
- if (index.IsEmpty())
- return v8::Undefined();
-
- RefPtr<Node> result = list->item(index->Uint32Value());
- return toV8(result.release());
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp b/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp
deleted file mode 100644
index 340f0a8..0000000
--- a/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(NOTIFICATIONS)
-#include "V8NotificationCenter.h"
-
-#include "NotImplemented.h"
-#include "Notification.h"
-#include "NotificationCenter.h"
-#include "V8Binding.h"
-#include "V8CustomEventListener.h"
-#include "V8CustomVoidCallback.h"
-#include "V8Notification.h"
-#include "V8Proxy.h"
-#include "V8Utilities.h"
-#include "WorkerContext.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8NotificationCenter::createHTMLNotificationCallback(const v8::Arguments& args)
-{
- INC_STATS(L"DOM.NotificationCenter.CreateHTMLNotification()");
- NotificationCenter* notificationCenter = V8NotificationCenter::toNative(args.Holder());
-
- ExceptionCode ec = 0;
- String url = toWebCoreString(args[0]);
- RefPtr<Notification> notification = notificationCenter->createHTMLNotification(url, ec);
-
- if (ec)
- return throwError(ec);
-
- notification->ref();
- return toV8(notification.get());
-}
-
-v8::Handle<v8::Value> V8NotificationCenter::createNotificationCallback(const v8::Arguments& args)
-{
- INC_STATS(L"DOM.NotificationCenter.CreateNotification()");
- NotificationCenter* notificationCenter = V8NotificationCenter::toNative(args.Holder());
-
- ExceptionCode ec = 0;
- RefPtr<Notification> notification = notificationCenter->createNotification(toWebCoreString(args[0]), toWebCoreString(args[1]), toWebCoreString(args[2]), ec);
-
- if (ec)
- return throwError(ec);
-
- notification->ref();
- return toV8(notification.get());
-}
-
-v8::Handle<v8::Value> V8NotificationCenter::requestPermissionCallback(const v8::Arguments& args)
-{
- INC_STATS(L"DOM.NotificationCenter.RequestPermission()");
- NotificationCenter* notificationCenter = V8NotificationCenter::toNative(args.Holder());
- ScriptExecutionContext* context = notificationCenter->context();
-
- // Make sure that script execution context is valid.
- if (!context)
- return throwError(INVALID_STATE_ERR);
-
- // Requesting permission is only valid from a page context.
- if (context->isWorkerContext())
- return throwError(NOT_SUPPORTED_ERR);
-
- RefPtr<V8CustomVoidCallback> callback;
- if (args.Length() > 0) {
- if (!args[0]->IsObject())
- return throwError("Callback must be of valid type.", V8Proxy::TypeError);
-
- callback = V8CustomVoidCallback::create(args[0], context);
- }
-
- notificationCenter->requestPermission(callback.release());
- return v8::Undefined();
-}
-
-
-} // namespace WebCore
-
-#endif // ENABLE(NOTIFICATIONS)
diff --git a/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp b/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp
deleted file mode 100644
index 58f34bf..0000000
--- a/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8PopStateEvent.h"
-
-#include "PopStateEvent.h"
-#include "SerializedScriptValue.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8PopStateEvent::stateAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.PopStateEvent.state");
-
- PopStateEvent* event = V8PopStateEvent::toNative(info.Holder());
- SerializedScriptValue* state = event->state();
- if (!state)
- return v8::Null();
-
- return state->deserialize();
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp b/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp
deleted file mode 100644
index 63d0a97..0000000
--- a/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(DATABASE)
-#include "V8SQLResultSetRowList.h"
-
-#include "SQLResultSetRowList.h"
-#include "V8Binding.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8SQLResultSetRowList::itemCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.SQLResultSetRowList.item()");
-
- if (args.Length() == 0) {
- V8Proxy::throwError(V8Proxy::SyntaxError, "Item index is required.");
- return v8::Undefined();
- }
-
- if (!args[0]->IsNumber()) {
- V8Proxy::throwError(V8Proxy::TypeError, "Item index must be a number.");
- return v8::Undefined();
- }
-
- SQLResultSetRowList* rowList = V8SQLResultSetRowList::toNative(args.Holder());
-
- unsigned long index = args[0]->IntegerValue();
- if (index >= rowList->length()) {
- V8Proxy::throwError(V8Proxy::RangeError, "Item index is out of range.");
- return v8::Undefined();
- }
-
- v8::Local<v8::Object> item = v8::Object::New();
- unsigned numColumns = rowList->columnNames().size();
- unsigned valuesIndex = index * numColumns;
-
- for (unsigned i = 0; i < numColumns; ++i) {
- const SQLValue& sqlValue = rowList->values()[valuesIndex + i];
- v8::Handle<v8::Value> value;
- switch(sqlValue.type()) {
- case SQLValue::StringValue:
- value = v8String(sqlValue.string());
- break;
- case SQLValue::NullValue:
- value = v8::Null();
- break;
- case SQLValue::NumberValue:
- value = v8::Number::New(sqlValue.number());
- break;
- default:
- ASSERT_NOT_REACHED();
- }
-
- item->Set(v8String(rowList->columnNames()[i]), value, static_cast<v8::PropertyAttribute>(v8::DontDelete|v8::ReadOnly));
- }
-
- return item;
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp b/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp
deleted file mode 100644
index af4185b..0000000
--- a/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(DATABASE)
-
-#include "V8SQLTransaction.h"
-
-#include "Database.h"
-#include "ExceptionCode.h"
-#include "SQLValue.h"
-#include "V8Binding.h"
-#include "V8BindingMacros.h"
-#include "V8SQLStatementCallback.h"
-#include "V8SQLStatementErrorCallback.h"
-#include "V8Proxy.h"
-#include <wtf/Vector.h>
-
-using namespace WTF;
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8SQLTransaction::executeSqlCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.SQLTransaction.executeSql()");
-
- if (args.Length() == 0)
- return throwError(SYNTAX_ERR);
-
- STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, statement, args[0]);
-
- Vector<SQLValue> sqlValues;
-
- if (args.Length() > 1 && !isUndefinedOrNull(args[1])) {
- if (!args[1]->IsObject())
- return throwError(TYPE_MISMATCH_ERR);
-
- uint32_t sqlArgsLength = 0;
- v8::Local<v8::Object> sqlArgsObject = args[1]->ToObject();
- EXCEPTION_BLOCK(v8::Local<v8::Value>, length, sqlArgsObject->Get(v8::String::New("length")));
-
- if (isUndefinedOrNull(length))
- sqlArgsLength = sqlArgsObject->GetPropertyNames()->Length();
- else
- sqlArgsLength = length->Uint32Value();
-
- for (unsigned int i = 0; i < sqlArgsLength; ++i) {
- v8::Local<v8::Integer> key = v8::Integer::New(i);
- EXCEPTION_BLOCK(v8::Local<v8::Value>, value, sqlArgsObject->Get(key));
-
- if (value.IsEmpty() || value->IsNull())
- sqlValues.append(SQLValue());
- else if (value->IsNumber()) {
- EXCEPTION_BLOCK(double, sqlValue, value->NumberValue());
- sqlValues.append(SQLValue(sqlValue));
- } else {
- STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, sqlValue, value);
- sqlValues.append(SQLValue(sqlValue));
- }
- }
- }
-
- SQLTransaction* transaction = V8SQLTransaction::toNative(args.Holder());
-
- ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext();
- if (!scriptExecutionContext)
- return v8::Undefined();
-
- RefPtr<SQLStatementCallback> callback;
- if (args.Length() > 2 && !isUndefinedOrNull(args[2])) {
- if (!args[2]->IsObject())
- return throwError(TYPE_MISMATCH_ERR);
- callback = V8SQLStatementCallback::create(args[2], scriptExecutionContext);
- }
-
- RefPtr<SQLStatementErrorCallback> errorCallback;
- if (args.Length() > 3 && !isUndefinedOrNull(args[3])) {
- if (!args[3]->IsObject())
- return throwError(TYPE_MISMATCH_ERR);
- errorCallback = V8SQLStatementErrorCallback::create(args[3], scriptExecutionContext);
- }
-
- ExceptionCode ec = 0;
- transaction->executeSQL(statement, sqlValues, callback, errorCallback, ec);
- V8Proxy::setDOMException(ec);
-
- return v8::Undefined();
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/WebCore/bindings/v8/custom/V8SQLTransactionSyncCustom.cpp b/WebCore/bindings/v8/custom/V8SQLTransactionSyncCustom.cpp
deleted file mode 100644
index 8a57a9a..0000000
--- a/WebCore/bindings/v8/custom/V8SQLTransactionSyncCustom.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(DATABASE)
-
-#include "V8SQLTransactionSync.h"
-
-#include "DatabaseSync.h"
-#include "ExceptionCode.h"
-#include "SQLResultSet.h"
-#include "SQLValue.h"
-#include "V8Binding.h"
-#include "V8BindingMacros.h"
-#include "V8Proxy.h"
-#include "V8SQLResultSet.h"
-#include <wtf/Vector.h>
-
-using namespace WTF;
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8SQLTransactionSync::executeSqlCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.SQLTransactionSync.executeSql()");
-
- if (!args.Length())
- return throwError(SYNTAX_ERR);
-
- STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, statement, args[0]);
-
- Vector<SQLValue> sqlValues;
-
- if (args.Length() > 1 && !isUndefinedOrNull(args[1])) {
- if (!args[1]->IsObject())
- return throwError(TYPE_MISMATCH_ERR);
-
- uint32_t sqlArgsLength = 0;
- v8::Local<v8::Object> sqlArgsObject = args[1]->ToObject();
- EXCEPTION_BLOCK(v8::Local<v8::Value>, length, sqlArgsObject->Get(v8::String::New("length")));
-
- if (isUndefinedOrNull(length))
- sqlArgsLength = sqlArgsObject->GetPropertyNames()->Length();
- else
- sqlArgsLength = length->Uint32Value();
-
- for (unsigned int i = 0; i < sqlArgsLength; ++i) {
- v8::Local<v8::Integer> key = v8::Integer::New(i);
- EXCEPTION_BLOCK(v8::Local<v8::Value>, value, sqlArgsObject->Get(key));
-
- if (value.IsEmpty() || value->IsNull())
- sqlValues.append(SQLValue());
- else if (value->IsNumber()) {
- EXCEPTION_BLOCK(double, sqlValue, value->NumberValue());
- sqlValues.append(SQLValue(sqlValue));
- } else {
- STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, sqlValue, value);
- sqlValues.append(SQLValue(sqlValue));
- }
- }
- }
-
- SQLTransactionSync* transaction = V8SQLTransactionSync::toNative(args.Holder());
-
- ExceptionCode ec = 0;
- v8::Handle<v8::Value> result = toV8(transaction->executeSQL(statement, sqlValues, ec));
- V8Proxy::setDOMException(ec);
-
- return result;
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/WebCore/bindings/v8/custom/V8SVGDocumentCustom.cpp b/WebCore/bindings/v8/custom/V8SVGDocumentCustom.cpp
deleted file mode 100644
index 8dce61b..0000000
--- a/WebCore/bindings/v8/custom/V8SVGDocumentCustom.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(SVG)
-#include "V8SVGDocument.h"
-
-#include "V8IsolatedContext.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> toV8(SVGDocument* impl, bool forceNewObject)
-{
- if (!impl)
- return v8::Null();
- v8::Handle<v8::Object> wrapper = V8SVGDocument::wrap(impl, forceNewObject);
- if (wrapper.IsEmpty())
- return wrapper;
- if (!V8IsolatedContext::getEntered()) {
- if (V8Proxy* proxy = V8Proxy::retrieve(impl->frame()))
- proxy->windowShell()->updateDocumentWrapper(wrapper);
- }
- return wrapper;
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/WebCore/bindings/v8/custom/V8SVGElementCustom.cpp b/WebCore/bindings/v8/custom/V8SVGElementCustom.cpp
deleted file mode 100644
index 7ad5f41..0000000
--- a/WebCore/bindings/v8/custom/V8SVGElementCustom.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms") return toV8(static_cast<SVGwith or without
- * modification") return toV8(static_cast<SVGare permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice") return toV8(static_cast<SVGthis list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice") return toV8(static_cast<SVGthis list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES") return toV8(static_cast<SVGINCLUDING") return toV8(static_cast<SVGBUT NOT
- * LIMITED TO") return toV8(static_cast<SVGTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT") return toV8(static_cast<SVGINDIRECT") return toV8(static_cast<SVGINCIDENTAL,
- * SPECIAL") return toV8(static_cast<SVGEXEMPLARY") return toV8(static_cast<SVGOR CONSEQUENTIAL DAMAGES (INCLUDING") return toV8(static_cast<SVGBUT NOT
- * LIMITED TO") return toV8(static_cast<SVGPROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA") return toV8(static_cast<SVGOR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY") return toV8(static_cast<SVGWHETHER IN CONTRACT") return toV8(static_cast<SVGSTRICT LIABILITY") return toV8(static_cast<SVGOR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE") return toV8(static_cast<SVGEVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(SVG)
-
-#include "V8SVGElement.h"
-#include "V8SVGElementWrapperFactory.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> toV8(SVGElement* impl, bool forceNewObject)
-{
- if (!impl)
- return v8::Null();
- return createV8SVGWrapper(impl, forceNewObject);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(SVG)
diff --git a/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp b/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp
deleted file mode 100644
index 58f26fd..0000000
--- a/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include <config.h>
-
-#if ENABLE(SVG)
-#include "V8SVGLength.h"
-
-#include "SVGPropertyTearOff.h"
-#include "V8Binding.h"
-#include "V8BindingMacros.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8SVGLength::valueAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.SVGLength.value._get");
- SVGPropertyTearOff<SVGLength>* wrapper = V8SVGLength::toNative(info.Holder());
- SVGLength& imp = wrapper->propertyReference();
- ExceptionCode ec = 0;
- float value = imp.value(wrapper->contextElement(), ec);
- if (UNLIKELY(ec)) {
- V8Proxy::setDOMException(ec);
- return v8::Handle<v8::Value>();
- }
- return v8::Number::New(value);
-}
-
-void V8SVGLength::valueAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.SVGLength.value._set");
- SVGPropertyTearOff<SVGLength>* wrapper = V8SVGLength::toNative(info.Holder());
- if (wrapper->role() == AnimValRole) {
- V8Proxy::setDOMException(NO_MODIFICATION_ALLOWED_ERR);
- return;
- }
-
- if (!isUndefinedOrNull(value) && !value->IsNumber() && !value->IsBoolean()) {
- V8Proxy::throwTypeError();
- return;
- }
-
- SVGLength& imp = wrapper->propertyReference();
- ExceptionCode ec = 0;
- imp.setValue(static_cast<float>(value->NumberValue()), wrapper->contextElement(), ec);
- if (UNLIKELY(ec))
- V8Proxy::setDOMException(ec);
- else
- wrapper->commitChange();
-}
-
-v8::Handle<v8::Value> V8SVGLength::convertToSpecifiedUnitsCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.SVGLength.convertToSpecifiedUnits");
- SVGPropertyTearOff<SVGLength>* wrapper = V8SVGLength::toNative(args.Holder());
- if (wrapper->role() == AnimValRole) {
- V8Proxy::setDOMException(NO_MODIFICATION_ALLOWED_ERR);
- return v8::Handle<v8::Value>();
- }
-
- if (args.Length() < 1)
- return throwError("Not enough arguments", V8Proxy::SyntaxError);
-
- SVGLength& imp = wrapper->propertyReference();
- ExceptionCode ec = 0;
- EXCEPTION_BLOCK(int, unitType, toUInt32(args[0]));
- imp.convertToSpecifiedUnits(unitType, wrapper->contextElement(), ec);
- if (UNLIKELY(ec))
- V8Proxy::setDOMException(ec);
- else
- wrapper->commitChange();
- return v8::Handle<v8::Value>();
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/WebCore/bindings/v8/custom/V8SVGPathSegCustom.cpp b/WebCore/bindings/v8/custom/V8SVGPathSegCustom.cpp
deleted file mode 100644
index 5544f83..0000000
--- a/WebCore/bindings/v8/custom/V8SVGPathSegCustom.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(SVG)
-#include "V8SVGPathSeg.h"
-
-#include "V8DOMWindow.h"
-#include "V8DOMWrapper.h"
-#include "V8SVGPathSegArcAbs.h"
-#include "V8SVGPathSegArcRel.h"
-#include "V8SVGPathSegClosePath.h"
-#include "V8SVGPathSegCurvetoCubicAbs.h"
-#include "V8SVGPathSegCurvetoCubicRel.h"
-#include "V8SVGPathSegCurvetoCubicSmoothAbs.h"
-#include "V8SVGPathSegCurvetoCubicSmoothRel.h"
-#include "V8SVGPathSegCurvetoQuadraticAbs.h"
-#include "V8SVGPathSegCurvetoQuadraticRel.h"
-#include "V8SVGPathSegCurvetoQuadraticSmoothAbs.h"
-#include "V8SVGPathSegCurvetoQuadraticSmoothRel.h"
-#include "V8SVGPathSegLinetoAbs.h"
-#include "V8SVGPathSegLinetoHorizontalAbs.h"
-#include "V8SVGPathSegLinetoHorizontalRel.h"
-#include "V8SVGPathSegLinetoRel.h"
-#include "V8SVGPathSegLinetoVerticalAbs.h"
-#include "V8SVGPathSegLinetoVerticalRel.h"
-#include "V8SVGPathSegMovetoAbs.h"
-#include "V8SVGPathSegMovetoRel.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> toV8(SVGPathSeg* impl)
-{
- if (!impl)
- return v8::Null();
- switch (impl->pathSegType()) {
- case SVGPathSeg::PATHSEG_CLOSEPATH:
- return toV8(static_cast<SVGPathSegClosePath*>(impl));
- case SVGPathSeg::PATHSEG_MOVETO_ABS:
- return toV8(static_cast<SVGPathSegMovetoAbs*>(impl));
- case SVGPathSeg::PATHSEG_MOVETO_REL:
- return toV8(static_cast<SVGPathSegMovetoRel*>(impl));
- case SVGPathSeg::PATHSEG_LINETO_ABS:
- return toV8(static_cast<SVGPathSegLinetoAbs*>(impl));
- case SVGPathSeg::PATHSEG_LINETO_REL:
- return toV8(static_cast<SVGPathSegLinetoRel*>(impl));
- case SVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS:
- return toV8(static_cast<SVGPathSegCurvetoCubicAbs*>(impl));
- case SVGPathSeg::PATHSEG_CURVETO_CUBIC_REL:
- return toV8(static_cast<SVGPathSegCurvetoCubicRel*>(impl));
- case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_ABS:
- return toV8(static_cast<SVGPathSegCurvetoQuadraticAbs*>(impl));
- case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_REL:
- return toV8(static_cast<SVGPathSegCurvetoQuadraticRel*>(impl));
- case SVGPathSeg::PATHSEG_ARC_ABS:
- return toV8(static_cast<SVGPathSegArcAbs*>(impl));
- case SVGPathSeg::PATHSEG_ARC_REL:
- return toV8(static_cast<SVGPathSegArcRel*>(impl));
- case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_ABS:
- return toV8(static_cast<SVGPathSegLinetoHorizontalAbs*>(impl));
- case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_REL:
- return toV8(static_cast<SVGPathSegLinetoHorizontalRel*>(impl));
- case SVGPathSeg::PATHSEG_LINETO_VERTICAL_ABS:
- return toV8(static_cast<SVGPathSegLinetoVerticalAbs*>(impl));
- case SVGPathSeg::PATHSEG_LINETO_VERTICAL_REL:
- return toV8(static_cast<SVGPathSegLinetoVerticalRel*>(impl));
- case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
- return toV8(static_cast<SVGPathSegCurvetoCubicSmoothAbs*>(impl));
- case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_REL:
- return toV8(static_cast<SVGPathSegCurvetoCubicSmoothRel*>(impl));
- case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:
- return toV8(static_cast<SVGPathSegCurvetoQuadraticSmoothAbs*>(impl));
- case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:
- return toV8(static_cast<SVGPathSegCurvetoQuadraticSmoothRel*>(impl));
- }
- ASSERT_NOT_REACHED();
- return V8SVGPathSeg::wrap(impl);
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/WebCore/bindings/v8/custom/V8ScriptProfileCustom.cpp b/WebCore/bindings/v8/custom/V8ScriptProfileCustom.cpp
deleted file mode 100644
index ddaabb0..0000000
--- a/WebCore/bindings/v8/custom/V8ScriptProfileCustom.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8ScriptProfile.h"
-
-#include "ScriptProfile.h"
-#include "V8Binding.h"
-#include "V8Proxy.h"
-
-#include <v8-profiler.h>
-
-namespace WebCore {
-
-v8::Handle<v8::Value> toV8(ScriptProfile* impl)
-{
- if (!impl)
- return v8::Null();
- v8::Local<v8::Function> function = V8ScriptProfile::GetTemplate()->GetFunction();
- if (function.IsEmpty()) {
- // Return if allocation failed.
- return v8::Local<v8::Object>();
- }
- v8::Local<v8::Object> instance = SafeAllocation::newInstance(function);
- if (instance.IsEmpty()) {
- // Avoid setting the wrapper if allocation failed.
- return v8::Local<v8::Object>();
- }
- impl->ref();
- V8DOMWrapper::setDOMWrapper(instance, &V8ScriptProfile::info, impl);
- return instance;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8ScriptProfileNodeCustom.cpp b/WebCore/bindings/v8/custom/V8ScriptProfileNodeCustom.cpp
deleted file mode 100644
index a4deeeb..0000000
--- a/WebCore/bindings/v8/custom/V8ScriptProfileNodeCustom.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8ScriptProfileNode.h"
-
-#include "ScriptProfileNode.h"
-#include "V8Binding.h"
-#include "V8Proxy.h"
-
-#include <v8-profiler.h>
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8ScriptProfileNode::childrenAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.ScriptProfileNode.childrenAccessorGetter");
- ScriptProfileNode* imp = V8ScriptProfileNode::toNative(info.Holder());
- const ProfileNodesList& children = imp->children();
- v8::Handle<v8::Array> result = v8::Array::New(children.size());
- int index = 0;
- ProfileNodesList::const_iterator end = children.end();
- for (ProfileNodesList::const_iterator iter = children.begin(); iter != end; ++iter)
- result->Set(v8::Integer::New(index++), toV8(iter->get()));
- return result;
-}
-
-v8::Handle<v8::Value> V8ScriptProfileNode::callUIDAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.ScriptProfileNode.callUIDAccessorGetter");
- ScriptProfileNode* imp = V8ScriptProfileNode::toNative(info.Holder());
- return v8::Number::New(imp->callUID());
-}
-
-v8::Handle<v8::Value> toV8(ScriptProfileNode* impl)
-{
- if (!impl)
- return v8::Null();
- v8::Local<v8::Function> function = V8ScriptProfileNode::GetTemplate()->GetFunction();
- if (function.IsEmpty()) {
- // Return if allocation failed.
- return v8::Local<v8::Object>();
- }
- v8::Local<v8::Object> instance = SafeAllocation::newInstance(function);
- if (instance.IsEmpty()) {
- // Avoid setting the wrapper if allocation failed.
- return v8::Local<v8::Object>();
- }
- impl->ref();
- V8DOMWrapper::setDOMWrapper(instance, &V8ScriptProfileNode::info, impl);
- return instance;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp b/WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp
deleted file mode 100644
index 2d72c37..0000000
--- a/WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(SHARED_WORKERS)
-
-#include "V8SharedWorker.h"
-
-#include "ExceptionCode.h"
-#include "Frame.h"
-#include "V8Binding.h"
-#include "V8Proxy.h"
-#include "V8Utilities.h"
-#include "WorkerContext.h"
-#include "WorkerContextExecutionProxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8SharedWorker::constructorCallback(const v8::Arguments& args)
-{
- INC_STATS(L"DOM.SharedWorker.Constructor");
-
- if (!args.IsConstructCall())
- return throwError("DOM object constructor cannot be called as a function.");
-
- if (!args.Length())
- return throwError("Not enough arguments", V8Proxy::SyntaxError);
-
- v8::TryCatch tryCatch;
- v8::Handle<v8::String> scriptUrl = args[0]->ToString();
- String name;
- if (args.Length() > 1)
- name = toWebCoreString(args[1]->ToString());
-
- if (tryCatch.HasCaught())
- return throwError(tryCatch.Exception());
-
- if (scriptUrl.IsEmpty())
- return v8::Undefined();
-
- // Get the script execution context.
- ScriptExecutionContext* context = getScriptExecutionContext();
- if (!context)
- return v8::Undefined();
-
- // Create the SharedWorker object.
- // Note: it's OK to let this RefPtr go out of scope because we also call SetDOMWrapper(), which effectively holds a reference to obj.
- ExceptionCode ec = 0;
- RefPtr<SharedWorker> obj = SharedWorker::create(toWebCoreString(scriptUrl), name, context, ec);
- if (ec)
- return throwError(ec);
-
- // Setup the standard wrapper object internal fields.
- v8::Handle<v8::Object> wrapperObject = args.Holder();
- V8DOMWrapper::setDOMWrapper(wrapperObject, &info, obj.get());
-
- obj->ref();
- V8DOMWrapper::setJSWrapperForActiveDOMObject(obj.get(), v8::Persistent<v8::Object>::New(wrapperObject));
-
- return wrapperObject;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(SHARED_WORKERS)
diff --git a/WebCore/bindings/v8/custom/V8StorageCustom.cpp b/WebCore/bindings/v8/custom/V8StorageCustom.cpp
deleted file mode 100755
index d0a0d92..0000000
--- a/WebCore/bindings/v8/custom/V8StorageCustom.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
-* Copyright (C) 2009 Google 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:
-*
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * 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.
-* * Neither the name of Google Inc. nor the names of its
-* contributors may be used to endorse or promote products derived from
-* this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "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 THE COPYRIGHT
-* OWNER 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.
-*/
-
-#include "config.h"
-
-#if ENABLE(DOM_STORAGE)
-#include "V8Storage.h"
-
-#include "Storage.h"
-#include "V8Binding.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-// Get an array containing the names of indexed properties in a collection.
-v8::Handle<v8::Array> V8Storage::namedPropertyEnumerator(const v8::AccessorInfo& info)
-{
- Storage* storage = V8Storage::toNative(info.Holder());
- unsigned int length = storage->length();
- v8::Handle<v8::Array> properties = v8::Array::New(length);
- for (unsigned int i = 0; i < length; ++i) {
- String key = storage->key(i);
- ASSERT(!key.isNull());
- String val = storage->getItem(key);
- properties->Set(v8::Integer::New(i), v8String(key));
- }
-
- return properties;
-}
-
-static v8::Handle<v8::Value> storageGetter(v8::Local<v8::String> v8Name, const v8::AccessorInfo& info)
-{
- Storage* storage = V8Storage::toNative(info.Holder());
- String name = toWebCoreString(v8Name);
-
- if (storage->contains(name) && name != "length")
- return v8String(storage->getItem(name));
-
- return notHandledByInterceptor();
-}
-
-v8::Handle<v8::Value> V8Storage::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.Storage.IndexedPropertyGetter");
- v8::Local<v8::Integer> indexV8 = v8::Integer::New(index);
- return storageGetter(indexV8->ToString(), info);
-}
-
-v8::Handle<v8::Value> V8Storage::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.Storage.NamedPropertyGetter");
- return storageGetter(name, info);
-}
-
-v8::Handle<v8::Integer> V8Storage::namedPropertyQuery(v8::Local<v8::String> v8Name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.Storage.NamedPropertyQuery");
-
- Storage* storage = V8Storage::toNative(info.Holder());
- String name = toWebCoreString(v8Name);
-
- if (storage->contains(name) && name != "length")
- return v8::Integer::New(v8::None);
-
- return v8::Handle<v8::Integer>();
-}
-
-static v8::Handle<v8::Value> storageSetter(v8::Local<v8::String> v8Name, v8::Local<v8::Value> v8Value, const v8::AccessorInfo& info)
-{
- Storage* storage = V8Storage::toNative(info.Holder());
- String name = toWebCoreString(v8Name);
- String value = toWebCoreString(v8Value);
-
- // Silently ignore length (rather than letting the bindings raise an exception).
- if (name == "length")
- return v8Value;
-
- v8::Handle<v8::Value> prototypeValue = info.Holder()->GetRealNamedPropertyInPrototypeChain(v8Name);
- if (!prototypeValue.IsEmpty())
- return notHandledByInterceptor();
-
- ExceptionCode ec = 0;
- storage->setItem(name, value, ec);
- if (ec)
- return throwError(ec);
-
- return v8Value;
-}
-
-v8::Handle<v8::Value> V8Storage::indexedPropertySetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.Storage.NamedPropertyGetter");
- v8::Local<v8::Integer> indexV8 = v8::Integer::New(index);
- return storageSetter(indexV8->ToString(), value, info);
-}
-
-v8::Handle<v8::Value> V8Storage::namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.Storage.NamedPropertySetter");
- return storageSetter(name, value, info);
-}
-
-static v8::Handle<v8::Boolean> storageDeleter(v8::Local<v8::String> v8Name, const v8::AccessorInfo& info)
-{
- Storage* storage = V8Storage::toNative(info.Holder());
- String name = toWebCoreString(v8Name);
-
- if (storage->contains(name)) {
- storage->removeItem(name);
- return v8::True();
- }
-
- return deletionNotHandledByInterceptor();
-}
-
-v8::Handle<v8::Boolean> V8Storage::indexedPropertyDeleter(uint32_t index, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.Storage.IndexedPropertyDeleter");
- v8::Local<v8::Integer> indexV8 = v8::Integer::New(index);
- return storageDeleter(indexV8->ToString(), info);
-}
-
-v8::Handle<v8::Boolean> V8Storage::namedPropertyDeleter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.Storage.NamedPropertyDeleter");
- return storageDeleter(name, info);
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/WebCore/bindings/v8/custom/V8StyleSheetCustom.cpp b/WebCore/bindings/v8/custom/V8StyleSheetCustom.cpp
deleted file mode 100644
index b3f6ff7..0000000
--- a/WebCore/bindings/v8/custom/V8StyleSheetCustom.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8StyleSheet.h"
-
-#include "V8DOMWrapper.h"
-#include "V8CSSStyleSheet.h"
-#include "V8Node.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> toV8(StyleSheet* impl)
-{
- if (!impl)
- return v8::Null();
- if (impl->isCSSStyleSheet())
- return toV8(static_cast<CSSStyleSheet*>(impl));
- v8::Handle<v8::Object> wrapper = V8StyleSheet::wrap(impl);
- // Add a hidden reference from stylesheet object to its owner node.
- Node* ownerNode = impl->ownerNode();
- if (ownerNode && !wrapper.IsEmpty())
- V8DOMWrapper::setHiddenReference(wrapper, toV8(ownerNode));
- return wrapper;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8StyleSheetListCustom.cpp b/WebCore/bindings/v8/custom/V8StyleSheetListCustom.cpp
deleted file mode 100644
index cee1838..0000000
--- a/WebCore/bindings/v8/custom/V8StyleSheetListCustom.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2007-2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8StyleSheetList.h"
-
-#include "HTMLStyleElement.h"
-#include "StyleSheetList.h"
-#include "V8Binding.h"
-#include "V8Proxy.h"
-#include "V8StyleSheet.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8StyleSheetList::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.StyleSheetList.NamedPropertyGetter");
-
- if (info.Holder()->HasRealNamedProperty(name))
- return notHandledByInterceptor();
-
- // Search style sheet.
- StyleSheetList* imp = V8StyleSheetList::toNative(info.Holder());
- HTMLStyleElement* item = imp->getNamedItem(toWebCoreString(name));
- if (!item)
- return notHandledByInterceptor();
-
- return toV8(item->sheet());
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8Uint16ArrayCustom.cpp b/WebCore/bindings/v8/custom/V8Uint16ArrayCustom.cpp
deleted file mode 100644
index e3ae263..0000000
--- a/WebCore/bindings/v8/custom/V8Uint16ArrayCustom.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
-#include "ArrayBuffer.h"
-#include "Uint16Array.h"
-
-#include "V8Binding.h"
-#include "V8ArrayBuffer.h"
-#include "V8ArrayBufferViewCustom.h"
-#include "V8Uint16Array.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8Uint16Array::constructorCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Uint16Array.Contructor");
-
- return constructWebGLArray<Uint16Array, unsigned short>(args, &info, v8::kExternalUnsignedShortArray);
-}
-
-v8::Handle<v8::Value> V8Uint16Array::setCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Uint16Array.set()");
- return setWebGLArrayHelper<Uint16Array, V8Uint16Array>(args);
-}
-
-v8::Handle<v8::Value> toV8(Uint16Array* impl)
-{
- if (!impl)
- return v8::Null();
- v8::Handle<v8::Object> wrapper = V8Uint16Array::wrap(impl);
- if (!wrapper.IsEmpty())
- wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalUnsignedShortArray, impl->length());
- return wrapper;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8Uint32ArrayCustom.cpp b/WebCore/bindings/v8/custom/V8Uint32ArrayCustom.cpp
deleted file mode 100644
index 6c60283..0000000
--- a/WebCore/bindings/v8/custom/V8Uint32ArrayCustom.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
-#include "ArrayBuffer.h"
-#include "Uint32Array.h"
-
-#include "V8Binding.h"
-#include "V8ArrayBuffer.h"
-#include "V8ArrayBufferViewCustom.h"
-#include "V8Uint32Array.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8Uint32Array::constructorCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Uint32Array.Contructor");
-
- return constructWebGLArray<Uint32Array, unsigned int>(args, &info, v8::kExternalUnsignedIntArray);
-}
-
-v8::Handle<v8::Value> V8Uint32Array::setCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Uint32Array.set()");
- return setWebGLArrayHelper<Uint32Array, V8Uint32Array>(args);
-}
-
-v8::Handle<v8::Value> toV8(Uint32Array* impl)
-{
- if (!impl)
- return v8::Null();
- v8::Handle<v8::Object> wrapper = V8Uint32Array::wrap(impl);
- if (!wrapper.IsEmpty())
- wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalUnsignedIntArray, impl->length());
- return wrapper;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8Uint8ArrayCustom.cpp b/WebCore/bindings/v8/custom/V8Uint8ArrayCustom.cpp
deleted file mode 100644
index ea9f421..0000000
--- a/WebCore/bindings/v8/custom/V8Uint8ArrayCustom.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
-#include "ArrayBuffer.h"
-#include "Uint8Array.h"
-
-#include "V8Binding.h"
-#include "V8ArrayBuffer.h"
-#include "V8ArrayBufferViewCustom.h"
-#include "V8Uint8Array.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8Uint8Array::constructorCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Uint8Array.Contructor");
-
- return constructWebGLArray<Uint8Array, unsigned char>(args, &info, v8::kExternalUnsignedByteArray);
-}
-
-v8::Handle<v8::Value> V8Uint8Array::setCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Uint8Array.set()");
- return setWebGLArrayHelper<Uint8Array, V8Uint8Array>(args);
-}
-
-v8::Handle<v8::Value> toV8(Uint8Array* impl)
-{
- if (!impl)
- return v8::Null();
- v8::Handle<v8::Object> wrapper = V8Uint8Array::wrap(impl);
- if (!wrapper.IsEmpty())
- wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalUnsignedByteArray, impl->length());
- return wrapper;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
deleted file mode 100644
index 048cef5..0000000
--- a/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
+++ /dev/null
@@ -1,768 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(3D_CANVAS)
-
-#include "V8WebGLRenderingContext.h"
-
-#include "ExceptionCode.h"
-
-#include "NotImplemented.h"
-
-#include <wtf/FastMalloc.h>
-
-#include "V8Binding.h"
-#include "V8BindingMacros.h"
-#include "V8ArrayBufferView.h"
-#include "V8WebGLBuffer.h"
-#include "V8Int8Array.h"
-#include "V8Float32Array.h"
-#include "V8WebGLFramebuffer.h"
-#include "V8Int32Array.h"
-#include "V8WebGLProgram.h"
-#include "V8WebGLRenderbuffer.h"
-#include "V8WebGLShader.h"
-#include "V8Int16Array.h"
-#include "V8WebGLTexture.h"
-#include "V8WebGLUniformLocation.h"
-#include "V8Uint8Array.h"
-#include "V8Uint32Array.h"
-#include "V8Uint16Array.h"
-#include "V8HTMLCanvasElement.h"
-#include "V8HTMLImageElement.h"
-#include "V8HTMLVideoElement.h"
-#include "V8ImageData.h"
-#include "V8OESTextureFloat.h"
-#include "V8Proxy.h"
-#include "WebGLRenderingContext.h"
-
-namespace WebCore {
-
-// Allocates new storage via tryFastMalloc.
-// Returns NULL if array failed to convert for any reason.
-static float* jsArrayToFloatArray(v8::Handle<v8::Array> array, uint32_t len)
-{
- // Convert the data element-by-element.
- float* data;
- if (!tryFastMalloc(len * sizeof(float)).getValue(data))
- return 0;
- for (uint32_t i = 0; i < len; i++) {
- v8::Local<v8::Value> val = array->Get(v8::Integer::New(i));
- if (!val->IsNumber()) {
- fastFree(data);
- return 0;
- }
- data[i] = toFloat(val);
- }
- return data;
-}
-
-// Allocates new storage via tryFastMalloc.
-// Returns NULL if array failed to convert for any reason.
-static int* jsArrayToIntArray(v8::Handle<v8::Array> array, uint32_t len)
-{
- // Convert the data element-by-element.
- int* data;
- if (!tryFastMalloc(len * sizeof(int)).getValue(data))
- return 0;
- for (uint32_t i = 0; i < len; i++) {
- v8::Local<v8::Value> val = array->Get(v8::Integer::New(i));
- bool ok;
- int ival = toInt32(val, ok);
- if (!ok) {
- fastFree(data);
- return 0;
- }
- data[i] = ival;
- }
- return data;
-}
-
-static v8::Handle<v8::Value> toV8Object(const WebGLGetInfo& info)
-{
- switch (info.getType()) {
- case WebGLGetInfo::kTypeBool:
- return v8::Boolean::New(info.getBool());
- case WebGLGetInfo::kTypeBoolArray: {
- const Vector<bool>& value = info.getBoolArray();
- v8::Local<v8::Array> array = v8::Array::New(value.size());
- for (size_t ii = 0; ii < value.size(); ++ii)
- array->Set(v8::Integer::New(ii), v8::Boolean::New(value[ii]));
- return array;
- }
- case WebGLGetInfo::kTypeFloat:
- return v8::Number::New(info.getFloat());
- case WebGLGetInfo::kTypeLong:
- return v8::Integer::New(info.getLong());
- case WebGLGetInfo::kTypeNull:
- return v8::Null();
- case WebGLGetInfo::kTypeString:
- return v8::String::New(fromWebCoreString(info.getString()), info.getString().length());
- case WebGLGetInfo::kTypeUnsignedLong:
- return v8::Integer::NewFromUnsigned(info.getUnsignedLong());
- case WebGLGetInfo::kTypeWebGLBuffer:
- return toV8(info.getWebGLBuffer());
- case WebGLGetInfo::kTypeWebGLFloatArray:
- return toV8(info.getWebGLFloatArray());
- case WebGLGetInfo::kTypeWebGLFramebuffer:
- return toV8(info.getWebGLFramebuffer());
- case WebGLGetInfo::kTypeWebGLIntArray:
- return toV8(info.getWebGLIntArray());
- // FIXME: implement WebGLObjectArray
- // case WebGLGetInfo::kTypeWebGLObjectArray:
- case WebGLGetInfo::kTypeWebGLProgram:
- return toV8(info.getWebGLProgram());
- case WebGLGetInfo::kTypeWebGLRenderbuffer:
- return toV8(info.getWebGLRenderbuffer());
- case WebGLGetInfo::kTypeWebGLTexture:
- return toV8(info.getWebGLTexture());
- case WebGLGetInfo::kTypeWebGLUnsignedByteArray:
- return toV8(info.getWebGLUnsignedByteArray());
- default:
- notImplemented();
- return v8::Undefined();
- }
-}
-
-static v8::Handle<v8::Value> toV8Object(WebGLExtension* extension, v8::Handle<v8::Object> contextObject)
-{
- if (!extension)
- return v8::Null();
- v8::Handle<v8::Value> extensionObject;
- switch (extension->getName()) {
- case WebGLExtension::OESTextureFloatName:
- extensionObject = toV8(static_cast<OESTextureFloat*>(extension));
- break;
- }
- ASSERT(!extensionObject.IsEmpty());
- V8DOMWrapper::setHiddenReference(contextObject, extensionObject);
- return extensionObject;
-}
-
-enum ObjectType {
- kBuffer, kRenderbuffer, kTexture, kVertexAttrib
-};
-
-static v8::Handle<v8::Value> getObjectParameter(const v8::Arguments& args, ObjectType objectType)
-{
- if (args.Length() != 2) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
-
- ExceptionCode ec = 0;
- WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
- unsigned target = toInt32(args[0]);
- unsigned pname = toInt32(args[1]);
- WebGLGetInfo info;
- switch (objectType) {
- case kBuffer:
- info = context->getBufferParameter(target, pname, ec);
- break;
- case kRenderbuffer:
- info = context->getRenderbufferParameter(target, pname, ec);
- break;
- case kTexture:
- info = context->getTexParameter(target, pname, ec);
- break;
- case kVertexAttrib:
- // target => index
- info = context->getVertexAttrib(target, pname, ec);
- break;
- default:
- notImplemented();
- break;
- }
- if (ec) {
- V8Proxy::setDOMException(ec);
- return v8::Undefined();
- }
- return toV8Object(info);
-}
-
-static WebGLUniformLocation* toWebGLUniformLocation(v8::Handle<v8::Value> value, bool& ok)
-{
- ok = false;
- WebGLUniformLocation* location = 0;
- if (V8WebGLUniformLocation::HasInstance(value)) {
- location = V8WebGLUniformLocation::toNative(value->ToObject());
- ok = true;
- }
- return location;
-}
-
-enum WhichProgramCall {
- kProgramParameter, kUniform
-};
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::getAttachedShadersCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.getAttachedShaders()");
-
- if (args.Length() < 1) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
-
- ExceptionCode ec = 0;
- WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
- if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLProgram::HasInstance(args[0])) {
- V8Proxy::throwTypeError();
- return notHandledByInterceptor();
- }
- WebGLProgram* program = V8WebGLProgram::HasInstance(args[0]) ? V8WebGLProgram::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
- Vector<WebGLShader*> shaders;
- bool succeed = context->getAttachedShaders(program, shaders, ec);
- if (ec) {
- V8Proxy::setDOMException(ec);
- return v8::Null();
- }
- if (!succeed)
- return v8::Null();
- v8::Local<v8::Array> array = v8::Array::New(shaders.size());
- for (size_t ii = 0; ii < shaders.size(); ++ii)
- array->Set(v8::Integer::New(ii), toV8(shaders[ii]));
- return array;
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::getBufferParameterCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.getBufferParameter()");
- return getObjectParameter(args, kBuffer);
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::getExtensionCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.getExtensionCallback()");
- WebGLRenderingContext* imp = V8WebGLRenderingContext::toNative(args.Holder());
- if (args.Length() < 1) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, name, args[0]);
- WebGLExtension* extension = imp->getExtension(name);
- return toV8Object(extension, args.Holder());
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::getFramebufferAttachmentParameterCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.getFramebufferAttachmentParameter()");
-
- if (args.Length() != 3) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
-
- ExceptionCode ec = 0;
- WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
- unsigned target = toInt32(args[0]);
- unsigned attachment = toInt32(args[1]);
- unsigned pname = toInt32(args[2]);
- WebGLGetInfo info = context->getFramebufferAttachmentParameter(target, attachment, pname, ec);
- if (ec) {
- V8Proxy::setDOMException(ec);
- return v8::Undefined();
- }
- return toV8Object(info);
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::getParameterCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.getParameter()");
-
- if (args.Length() != 1) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
-
- ExceptionCode ec = 0;
- WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
- unsigned pname = toInt32(args[0]);
- WebGLGetInfo info = context->getParameter(pname, ec);
- if (ec) {
- V8Proxy::setDOMException(ec);
- return v8::Undefined();
- }
- return toV8Object(info);
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::getProgramParameterCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.getProgramParameter()");
-
- if (args.Length() != 2) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
-
- ExceptionCode ec = 0;
- WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
- if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLProgram::HasInstance(args[0])) {
- V8Proxy::throwTypeError();
- return notHandledByInterceptor();
- }
- WebGLProgram* program = V8WebGLProgram::HasInstance(args[0]) ? V8WebGLProgram::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
- unsigned pname = toInt32(args[1]);
- WebGLGetInfo info = context->getProgramParameter(program, pname, ec);
- if (ec) {
- V8Proxy::setDOMException(ec);
- return v8::Undefined();
- }
- return toV8Object(info);
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::getRenderbufferParameterCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.getRenderbufferParameter()");
- return getObjectParameter(args, kRenderbuffer);
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::getShaderParameterCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.getShaderParameter()");
-
- if (args.Length() != 2) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
-
- ExceptionCode ec = 0;
- WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
- if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLShader::HasInstance(args[0])) {
- V8Proxy::throwTypeError();
- return notHandledByInterceptor();
- }
- WebGLShader* shader = V8WebGLShader::HasInstance(args[0]) ? V8WebGLShader::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
- unsigned pname = toInt32(args[1]);
- WebGLGetInfo info = context->getShaderParameter(shader, pname, ec);
- if (ec) {
- V8Proxy::setDOMException(ec);
- return v8::Undefined();
- }
- return toV8Object(info);
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::getSupportedExtensionsCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.getSupportedExtensionsCallback()");
- WebGLRenderingContext* imp = V8WebGLRenderingContext::toNative(args.Holder());
- Vector<String> value = imp->getSupportedExtensions();
- v8::Local<v8::Array> array = v8::Array::New(value.size());
- for (size_t ii = 0; ii < value.size(); ++ii)
- array->Set(v8::Integer::New(ii), v8::String::New(fromWebCoreString(value[ii]), value[ii].length()));
- return array;
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::getTexParameterCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.getTexParameter()");
- return getObjectParameter(args, kTexture);
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::getUniformCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.getUniform()");
-
- if (args.Length() != 2) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
-
- ExceptionCode ec = 0;
- WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
- if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLProgram::HasInstance(args[0])) {
- V8Proxy::throwTypeError();
- return notHandledByInterceptor();
- }
- WebGLProgram* program = V8WebGLProgram::HasInstance(args[0]) ? V8WebGLProgram::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
-
- if (args.Length() > 1 && !isUndefinedOrNull(args[1]) && !V8WebGLUniformLocation::HasInstance(args[1])) {
- V8Proxy::throwTypeError();
- return notHandledByInterceptor();
- }
- bool ok = false;
- WebGLUniformLocation* location = toWebGLUniformLocation(args[1], ok);
-
- WebGLGetInfo info = context->getUniform(program, location, ec);
- if (ec) {
- V8Proxy::setDOMException(ec);
- return v8::Undefined();
- }
- return toV8Object(info);
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::getVertexAttribCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.getVertexAttrib()");
- return getObjectParameter(args, kVertexAttrib);
-}
-
-enum FunctionToCall {
- kUniform1v, kUniform2v, kUniform3v, kUniform4v,
- kVertexAttrib1v, kVertexAttrib2v, kVertexAttrib3v, kVertexAttrib4v
-};
-
-bool isFunctionToCallForAttribute(FunctionToCall functionToCall)
-{
- switch (functionToCall) {
- case kVertexAttrib1v:
- case kVertexAttrib2v:
- case kVertexAttrib3v:
- case kVertexAttrib4v:
- return true;
- default:
- break;
- }
- return false;
-}
-
-static v8::Handle<v8::Value> vertexAttribAndUniformHelperf(const v8::Arguments& args,
- FunctionToCall functionToCall) {
- // Forms:
- // * glUniform1fv(WebGLUniformLocation location, Array data);
- // * glUniform1fv(WebGLUniformLocation location, Float32Array data);
- // * glUniform2fv(WebGLUniformLocation location, Array data);
- // * glUniform2fv(WebGLUniformLocation location, Float32Array data);
- // * glUniform3fv(WebGLUniformLocation location, Array data);
- // * glUniform3fv(WebGLUniformLocation location, Float32Array data);
- // * glUniform4fv(WebGLUniformLocation location, Array data);
- // * glUniform4fv(WebGLUniformLocation location, Float32Array data);
- // * glVertexAttrib1fv(GLint index, Array data);
- // * glVertexAttrib1fv(GLint index, Float32Array data);
- // * glVertexAttrib2fv(GLint index, Array data);
- // * glVertexAttrib2fv(GLint index, Float32Array data);
- // * glVertexAttrib3fv(GLint index, Array data);
- // * glVertexAttrib3fv(GLint index, Float32Array data);
- // * glVertexAttrib4fv(GLint index, Array data);
- // * glVertexAttrib4fv(GLint index, Float32Array data);
-
- if (args.Length() != 2) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
-
- bool ok = false;
- int index = -1;
- WebGLUniformLocation* location = 0;
-
- if (isFunctionToCallForAttribute(functionToCall))
- index = toInt32(args[0]);
- else {
- if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLUniformLocation::HasInstance(args[0])) {
- V8Proxy::throwTypeError();
- return notHandledByInterceptor();
- }
- location = toWebGLUniformLocation(args[0], ok);
- }
-
- WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
-
- if (V8Float32Array::HasInstance(args[1])) {
- Float32Array* array = V8Float32Array::toNative(args[1]->ToObject());
- ASSERT(array != NULL);
- ExceptionCode ec = 0;
- switch (functionToCall) {
- case kUniform1v: context->uniform1fv(location, array, ec); break;
- case kUniform2v: context->uniform2fv(location, array, ec); break;
- case kUniform3v: context->uniform3fv(location, array, ec); break;
- case kUniform4v: context->uniform4fv(location, array, ec); break;
- case kVertexAttrib1v: context->vertexAttrib1fv(index, array); break;
- case kVertexAttrib2v: context->vertexAttrib2fv(index, array); break;
- case kVertexAttrib3v: context->vertexAttrib3fv(index, array); break;
- case kVertexAttrib4v: context->vertexAttrib4fv(index, array); break;
- default: ASSERT_NOT_REACHED(); break;
- }
- if (ec)
- V8Proxy::setDOMException(ec);
- return v8::Undefined();
- }
-
- if (args[1].IsEmpty() || !args[1]->IsArray()) {
- V8Proxy::throwTypeError();
- return notHandledByInterceptor();
- }
- v8::Handle<v8::Array> array =
- v8::Local<v8::Array>::Cast(args[1]);
- uint32_t len = array->Length();
- float* data = jsArrayToFloatArray(array, len);
- if (!data) {
- // FIXME: consider different / better exception type.
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- ExceptionCode ec = 0;
- switch (functionToCall) {
- case kUniform1v: context->uniform1fv(location, data, len, ec); break;
- case kUniform2v: context->uniform2fv(location, data, len, ec); break;
- case kUniform3v: context->uniform3fv(location, data, len, ec); break;
- case kUniform4v: context->uniform4fv(location, data, len, ec); break;
- case kVertexAttrib1v: context->vertexAttrib1fv(index, data, len); break;
- case kVertexAttrib2v: context->vertexAttrib2fv(index, data, len); break;
- case kVertexAttrib3v: context->vertexAttrib3fv(index, data, len); break;
- case kVertexAttrib4v: context->vertexAttrib4fv(index, data, len); break;
- default: ASSERT_NOT_REACHED(); break;
- }
- fastFree(data);
- if (ec)
- V8Proxy::setDOMException(ec);
- return v8::Undefined();
-}
-
-static v8::Handle<v8::Value> uniformHelperi(const v8::Arguments& args,
- FunctionToCall functionToCall) {
- // Forms:
- // * glUniform1iv(GLUniformLocation location, Array data);
- // * glUniform1iv(GLUniformLocation location, Int32Array data);
- // * glUniform2iv(GLUniformLocation location, Array data);
- // * glUniform2iv(GLUniformLocation location, Int32Array data);
- // * glUniform3iv(GLUniformLocation location, Array data);
- // * glUniform3iv(GLUniformLocation location, Int32Array data);
- // * glUniform4iv(GLUniformLocation location, Array data);
- // * glUniform4iv(GLUniformLocation location, Int32Array data);
-
- if (args.Length() != 2) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
-
- WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
- if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLUniformLocation::HasInstance(args[0])) {
- V8Proxy::throwTypeError();
- return notHandledByInterceptor();
- }
- bool ok = false;
- WebGLUniformLocation* location = toWebGLUniformLocation(args[0], ok);
-
- if (V8Int32Array::HasInstance(args[1])) {
- Int32Array* array = V8Int32Array::toNative(args[1]->ToObject());
- ASSERT(array != NULL);
- ExceptionCode ec = 0;
- switch (functionToCall) {
- case kUniform1v: context->uniform1iv(location, array, ec); break;
- case kUniform2v: context->uniform2iv(location, array, ec); break;
- case kUniform3v: context->uniform3iv(location, array, ec); break;
- case kUniform4v: context->uniform4iv(location, array, ec); break;
- default: ASSERT_NOT_REACHED(); break;
- }
- if (ec)
- V8Proxy::setDOMException(ec);
- return v8::Undefined();
- }
-
- if (args[1].IsEmpty() || !args[1]->IsArray()) {
- V8Proxy::throwTypeError();
- return notHandledByInterceptor();
- }
- v8::Handle<v8::Array> array =
- v8::Local<v8::Array>::Cast(args[1]);
- uint32_t len = array->Length();
- int* data = jsArrayToIntArray(array, len);
- if (!data) {
- // FIXME: consider different / better exception type.
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- ExceptionCode ec = 0;
- switch (functionToCall) {
- case kUniform1v: context->uniform1iv(location, data, len, ec); break;
- case kUniform2v: context->uniform2iv(location, data, len, ec); break;
- case kUniform3v: context->uniform3iv(location, data, len, ec); break;
- case kUniform4v: context->uniform4iv(location, data, len, ec); break;
- default: ASSERT_NOT_REACHED(); break;
- }
- fastFree(data);
- if (ec)
- V8Proxy::setDOMException(ec);
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::uniform1fvCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.uniform1fv()");
- return vertexAttribAndUniformHelperf(args, kUniform1v);
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::uniform1ivCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.uniform1iv()");
- return uniformHelperi(args, kUniform1v);
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::uniform2fvCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.uniform2fv()");
- return vertexAttribAndUniformHelperf(args, kUniform2v);
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::uniform2ivCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.uniform2iv()");
- return uniformHelperi(args, kUniform2v);
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::uniform3fvCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.uniform3fv()");
- return vertexAttribAndUniformHelperf(args, kUniform3v);
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::uniform3ivCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.uniform3iv()");
- return uniformHelperi(args, kUniform3v);
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::uniform4fvCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.uniform4fv()");
- return vertexAttribAndUniformHelperf(args, kUniform4v);
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::uniform4ivCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.uniform4iv()");
- return uniformHelperi(args, kUniform4v);
-}
-
-static v8::Handle<v8::Value> uniformMatrixHelper(const v8::Arguments& args,
- int matrixSize)
-{
- // Forms:
- // * glUniformMatrix2fv(GLint location, GLboolean transpose, Array data);
- // * glUniformMatrix2fv(GLint location, GLboolean transpose, Float32Array data);
- // * glUniformMatrix3fv(GLint location, GLboolean transpose, Array data);
- // * glUniformMatrix3fv(GLint location, GLboolean transpose, Float32Array data);
- // * glUniformMatrix4fv(GLint location, GLboolean transpose, Array data);
- // * glUniformMatrix4fv(GLint location, GLboolean transpose, Float32Array data);
- //
- // FIXME: need to change to accept Float32Array as well.
- if (args.Length() != 3) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
-
- WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
-
- if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLUniformLocation::HasInstance(args[0])) {
- V8Proxy::throwTypeError();
- return notHandledByInterceptor();
- }
- bool ok = false;
- WebGLUniformLocation* location = toWebGLUniformLocation(args[0], ok);
-
- bool transpose = args[1]->BooleanValue();
- if (V8Float32Array::HasInstance(args[2])) {
- Float32Array* array = V8Float32Array::toNative(args[2]->ToObject());
- ASSERT(array != NULL);
- ExceptionCode ec = 0;
- switch (matrixSize) {
- case 2: context->uniformMatrix2fv(location, transpose, array, ec); break;
- case 3: context->uniformMatrix3fv(location, transpose, array, ec); break;
- case 4: context->uniformMatrix4fv(location, transpose, array, ec); break;
- default: ASSERT_NOT_REACHED(); break;
- }
- if (ec)
- V8Proxy::setDOMException(ec);
- return v8::Undefined();
- }
-
- if (args[2].IsEmpty() || !args[2]->IsArray()) {
- V8Proxy::throwTypeError();
- return notHandledByInterceptor();
- }
- v8::Handle<v8::Array> array =
- v8::Local<v8::Array>::Cast(args[2]);
- uint32_t len = array->Length();
- float* data = jsArrayToFloatArray(array, len);
- if (!data) {
- // FIXME: consider different / better exception type.
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- ExceptionCode ec = 0;
- switch (matrixSize) {
- case 2: context->uniformMatrix2fv(location, transpose, data, len, ec); break;
- case 3: context->uniformMatrix3fv(location, transpose, data, len, ec); break;
- case 4: context->uniformMatrix4fv(location, transpose, data, len, ec); break;
- default: ASSERT_NOT_REACHED(); break;
- }
- fastFree(data);
- if (ec)
- V8Proxy::setDOMException(ec);
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::uniformMatrix2fvCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.uniformMatrix2fv()");
- return uniformMatrixHelper(args, 2);
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::uniformMatrix3fvCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.uniformMatrix3fv()");
- return uniformMatrixHelper(args, 3);
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::uniformMatrix4fvCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.uniformMatrix4fv()");
- return uniformMatrixHelper(args, 4);
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::vertexAttrib1fvCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.vertexAttrib1fv()");
- return vertexAttribAndUniformHelperf(args, kVertexAttrib1v);
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::vertexAttrib2fvCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.vertexAttrib2fv()");
- return vertexAttribAndUniformHelperf(args, kVertexAttrib2v);
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::vertexAttrib3fvCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.vertexAttrib3fv()");
- return vertexAttribAndUniformHelperf(args, kVertexAttrib3v);
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::vertexAttrib4fvCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.vertexAttrib4fv()");
- return vertexAttribAndUniformHelperf(args, kVertexAttrib4v);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(3D_CANVAS)
diff --git a/WebCore/bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp b/WebCore/bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp
deleted file mode 100644
index b97d0e8..0000000
--- a/WebCore/bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8WebKitCSSMatrix.h"
-
-#include "Document.h"
-#include "DocumentFragment.h"
-#include "Node.h"
-
-#include "V8Binding.h"
-#include "V8Document.h"
-#include "V8Node.h"
-#include "V8Proxy.h"
-
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8WebKitCSSMatrix::constructorCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebKitCSSMatrix.Constructor");
-
- if (!args.IsConstructCall())
- return throwError("DOM object constructor cannot be called as a function.");
-
- // FIXME: The logic here is almost exact duplicate of V8::constructDOMObject.
- // Consider refactoring to reduce duplication.
- String cssValue;
- if (args.Length() >= 1)
- cssValue = toWebCoreString(args[0]);
-
- ExceptionCode ec = 0;
- RefPtr<WebKitCSSMatrix> matrix = WebKitCSSMatrix::create(cssValue, ec);
- if (ec)
- throwError(ec);
-
- // Transform the holder into a wrapper object for the matrix.
- V8DOMWrapper::setDOMWrapper(args.Holder(), &info, matrix.get());
- return toV8(matrix.release(), args.Holder());
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp b/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp
deleted file mode 100755
index cb29f82..0000000
--- a/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2007, 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8WebKitPoint.h"
-
-#include "V8Binding.h"
-#include "V8DOMWrapper.h"
-#include "V8Proxy.h"
-#include "WrapperTypeInfo.h"
-
-#include <wtf/MathExtras.h>
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8WebKitPoint::constructorCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebKitPoint.Constructor");
-
- if (!args.IsConstructCall())
- return throwError("DOM object constructor cannot be called as a function.");
-
- float x = 0;
- float y = 0;
- if (args.Length() > 1) {
- if (!args[0]->IsUndefined()) {
- x = toFloat(args[0]);
- if (isnan(x))
- x = 0;
- }
- if (!args[1]->IsUndefined()) {
- y = toFloat(args[1]);
- if (isnan(y))
- y = 0;
- }
- }
- PassRefPtr<WebKitPoint> point = WebKitPoint::create(x, y);
- point->ref();
- V8DOMWrapper::setDOMWrapper(args.Holder(), &info, point.get());
- return args.Holder();
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp b/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp
deleted file mode 100644
index 5e15dab..0000000
--- a/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(WEB_SOCKETS)
-
-#include "V8WebSocket.h"
-
-#include "Frame.h"
-#include "Settings.h"
-#include "V8Binding.h"
-#include "V8Proxy.h"
-#include "V8Utilities.h"
-#include "WebSocket.h"
-#include "WorkerContext.h"
-#include "WorkerContextExecutionProxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8WebSocket::constructorCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebSocket.Constructor");
-
- if (!args.IsConstructCall())
- return throwError("DOM object custructor cannot be called as a function.");
- if (args.Length() == 0)
- return throwError("Not enough arguments", V8Proxy::SyntaxError);
-
- v8::TryCatch tryCatch;
- v8::Handle<v8::String> urlstring = args[0]->ToString();
- if (tryCatch.HasCaught())
- return throwError(tryCatch.Exception());
- if (urlstring.IsEmpty())
- return throwError("Empty URL", V8Proxy::SyntaxError);
-
- // Get the script execution context.
- ScriptExecutionContext* context = getScriptExecutionContext();
- if (!context)
- return throwError("WebSocket constructor's associated frame is not available", V8Proxy::ReferenceError);
-
- const KURL& url = context->completeURL(toWebCoreString(urlstring));
-
- RefPtr<WebSocket> webSocket = WebSocket::create(context);
- ExceptionCode ec = 0;
-
- if (args.Length() < 2)
- webSocket->connect(url, ec);
- else {
- v8::TryCatch tryCatchProtocol;
- v8::Handle<v8::String> protocol = args[1]->ToString();
- if (tryCatchProtocol.HasCaught())
- return throwError(tryCatchProtocol.Exception());
- webSocket->connect(url, toWebCoreString(protocol), ec);
- }
- if (ec)
- return throwError(ec);
-
- // Setup the standard wrapper object internal fields.
- V8DOMWrapper::setDOMWrapper(args.Holder(), &info, webSocket.get());
-
- // Add object to the wrapper map.
- webSocket->ref();
- V8DOMWrapper::setJSWrapperForActiveDOMObject(webSocket.get(), v8::Persistent<v8::Object>::New(args.Holder()));
-
- return args.Holder();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_SOCKETS)
diff --git a/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp b/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp
deleted file mode 100755
index 53d731d..0000000
--- a/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(WORKERS)
-#include "V8WorkerContext.h"
-
-#include "DOMTimer.h"
-#include "ExceptionCode.h"
-#include "ScheduledAction.h"
-#include "V8Binding.h"
-#include "V8BindingMacros.h"
-#include "V8Proxy.h"
-#include "V8Utilities.h"
-#include "V8WorkerContextEventListener.h"
-#include "WebSocket.h"
-#include "WorkerContext.h"
-#include "WorkerContextExecutionProxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> SetTimeoutOrInterval(const v8::Arguments& args, bool singleShot)
-{
- WorkerContext* workerContext = V8WorkerContext::toNative(args.Holder());
-
- int argumentCount = args.Length();
- if (argumentCount < 1)
- return v8::Undefined();
-
- v8::Handle<v8::Value> function = args[0];
- int32_t timeout = argumentCount >= 2 ? args[1]->Int32Value() : 0;
- int timerId;
-
- WorkerContextExecutionProxy* proxy = workerContext->script()->proxy();
- if (!proxy)
- return v8::Undefined();
-
- v8::Handle<v8::Context> v8Context = proxy->context();
- if (function->IsString()) {
- WTF::String stringFunction = toWebCoreString(function);
- timerId = DOMTimer::install(workerContext, new ScheduledAction(v8Context, stringFunction, workerContext->url()), timeout, singleShot);
- } else if (function->IsFunction()) {
- size_t paramCount = argumentCount >= 2 ? argumentCount - 2 : 0;
- v8::Local<v8::Value>* params = 0;
- if (paramCount > 0) {
- params = new v8::Local<v8::Value>[paramCount];
- for (size_t i = 0; i < paramCount; ++i)
- params[i] = args[i+2];
- }
- // ScheduledAction takes ownership of actual params and releases them in its destructor.
- ScheduledAction* action = new ScheduledAction(v8Context, v8::Handle<v8::Function>::Cast(function), paramCount, params);
- delete [] params;
- timerId = DOMTimer::install(workerContext, action, timeout, singleShot);
- } else
- return v8::Undefined();
-
- return v8::Integer::New(timerId);
-}
-
-v8::Handle<v8::Value> V8WorkerContext::importScriptsCallback(const v8::Arguments& args)
-{
- INC_STATS(L"DOM.WorkerContext.importScripts()");
- if (!args.Length())
- return v8::Undefined();
-
- Vector<String> urls;
- for (int i = 0; i < args.Length(); i++) {
- v8::TryCatch tryCatch;
- v8::Handle<v8::String> scriptUrl = args[i]->ToString();
- if (tryCatch.HasCaught() || scriptUrl.IsEmpty())
- return v8::Undefined();
- urls.append(toWebCoreString(scriptUrl));
- }
-
- WorkerContext* workerContext = V8WorkerContext::toNative(args.Holder());
-
- ExceptionCode ec = 0;
- workerContext->importScripts(urls, ec);
-
- if (ec)
- return throwError(ec);
-
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8WorkerContext::setTimeoutCallback(const v8::Arguments& args)
-{
- INC_STATS(L"DOM.WorkerContext.setTimeout()");
- return SetTimeoutOrInterval(args, true);
-}
-
-v8::Handle<v8::Value> V8WorkerContext::setIntervalCallback(const v8::Arguments& args)
-{
- INC_STATS(L"DOM.WorkerContext.setInterval()");
- return SetTimeoutOrInterval(args, false);
-}
-
-v8::Handle<v8::Value> toV8(WorkerContext* impl)
-{
- if (!impl)
- return v8::Null();
-
- WorkerContextExecutionProxy* proxy = impl->script()->proxy();
- if (!proxy)
- return v8::Null();
-
- v8::Handle<v8::Object> global = proxy->context()->Global();
- ASSERT(!global.IsEmpty());
- return global;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WORKERS)
diff --git a/WebCore/bindings/v8/custom/V8WorkerCustom.cpp b/WebCore/bindings/v8/custom/V8WorkerCustom.cpp
deleted file mode 100755
index fdc6815..0000000
--- a/WebCore/bindings/v8/custom/V8WorkerCustom.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-
-#if ENABLE(WORKERS)
-#include "V8Worker.h"
-
-#include "Worker.h"
-
-#include "ExceptionCode.h"
-#include "Frame.h"
-#include "SerializedScriptValue.h"
-#include "V8Binding.h"
-#include "V8MessagePortCustom.h"
-#include "V8Proxy.h"
-#include "V8Utilities.h"
-#include "WorkerContext.h"
-#include "WorkerContextExecutionProxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8Worker::constructorCallback(const v8::Arguments& args)
-{
- INC_STATS(L"DOM.Worker.Constructor");
-
- if (!args.IsConstructCall())
- return throwError("DOM object constructor cannot be called as a function.");
-
- if (!args.Length())
- return throwError("Not enough arguments", V8Proxy::SyntaxError);
-
- v8::TryCatch tryCatch;
- v8::Handle<v8::String> scriptUrl = args[0]->ToString();
- if (tryCatch.HasCaught())
- return throwError(tryCatch.Exception());
-
- if (scriptUrl.IsEmpty())
- return v8::Undefined();
-
- // Get the script execution context.
- ScriptExecutionContext* context = getScriptExecutionContext();
- if (!context)
- return v8::Undefined();
-
- // Create the worker object.
- // Note: it's OK to let this RefPtr go out of scope because we also call setDOMWrapper(), which effectively holds a reference to obj.
- ExceptionCode ec = 0;
- RefPtr<Worker> obj = Worker::create(toWebCoreString(scriptUrl), context, ec);
- if (ec)
- return throwError(ec);
-
- // Setup the standard wrapper object internal fields.
- v8::Handle<v8::Object> wrapperObject = args.Holder();
- V8DOMWrapper::setDOMWrapper(wrapperObject, &info, obj.get());
-
- obj->ref();
- V8DOMWrapper::setJSWrapperForActiveDOMObject(obj.get(), v8::Persistent<v8::Object>::New(wrapperObject));
-
- return wrapperObject;
-}
-
-v8::Handle<v8::Value> V8Worker::postMessageCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Worker.postMessage");
- Worker* worker = V8Worker::toNative(args.Holder());
- bool didThrow = false;
- RefPtr<SerializedScriptValue> message = SerializedScriptValue::create(args[0], didThrow);
- if (didThrow)
- return v8::Undefined();
- MessagePortArray portArray;
- if (args.Length() > 1) {
- if (!getMessagePortArray(args[1], portArray))
- return v8::Undefined();
- }
- ExceptionCode ec = 0;
- worker->postMessage(message.release(), &portArray, ec);
- return throwError(ec);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WORKERS)
diff --git a/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp b/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp
deleted file mode 100644
index 6b5b64f..0000000
--- a/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2008, 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8XMLHttpRequest.h"
-
-#include "Frame.h"
-#include "V8Binding.h"
-#include "V8Proxy.h"
-#include "V8Utilities.h"
-#include "WorkerContext.h"
-#include "WorkerContextExecutionProxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8XMLHttpRequest::constructorCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.XMLHttpRequest.Constructor");
-
- if (!args.IsConstructCall())
- return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
-
- // Expect no parameters.
- // Allocate a XMLHttpRequest object as its internal field.
- ScriptExecutionContext* context = getScriptExecutionContext();
- if (!context)
- return throwError("XMLHttpRequest constructor's associated context is not available", V8Proxy::ReferenceError);
- RefPtr<XMLHttpRequest> xmlHttpRequest = XMLHttpRequest::create(context);
- V8DOMWrapper::setDOMWrapper(args.Holder(), &info, xmlHttpRequest.get());
-
- // Add object to the wrapper map.
- xmlHttpRequest->ref();
- V8DOMWrapper::setJSWrapperForActiveDOMObject(xmlHttpRequest.get(), v8::Persistent<v8::Object>::New(args.Holder()));
- return args.Holder();
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp b/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
deleted file mode 100644
index 6a571ae..0000000
--- a/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Copyright (C) 2008, 2009, 2010 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8XMLHttpRequest.h"
-
-#include "ArrayBuffer.h"
-#include "Frame.h"
-#include "InspectorInstrumentation.h"
-#include "V8ArrayBuffer.h"
-#include "V8Binding.h"
-#include "V8Blob.h"
-#include "V8DOMFormData.h"
-#include "V8Document.h"
-#include "V8HTMLDocument.h"
-#include "V8Proxy.h"
-#include "V8Utilities.h"
-#include "WorkerContext.h"
-#include "WorkerContextExecutionProxy.h"
-#include "XMLHttpRequest.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8XMLHttpRequest::responseTextAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.XMLHttpRequest.responsetext._get");
- XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(info.Holder());
- ExceptionCode ec = 0;
- const String& text = xmlHttpRequest->responseText(ec);
- if (ec)
- return throwError(ec);
- return v8String(text);
-}
-
-v8::Handle<v8::Value> V8XMLHttpRequest::responseAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.XMLHttpRequest.response._get");
- XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(info.Holder());
-
- switch (xmlHttpRequest->responseTypeCode()) {
- case XMLHttpRequest::ResponseTypeDefault:
- case XMLHttpRequest::ResponseTypeText:
- return responseTextAccessorGetter(name, info);
-
- case XMLHttpRequest::ResponseTypeDocument:
- {
- ExceptionCode ec = 0;
- Document* document = xmlHttpRequest->responseXML(ec);
- if (ec) {
- V8Proxy::setDOMException(ec);
- return v8::Undefined();
- }
- return toV8(document);
- }
-
- case XMLHttpRequest::ResponseTypeBlob:
-#if ENABLE(XHR_RESPONSE_BLOB)
- {
- ExceptionCode ec = 0;
- Blob* blob = xmlHttpRequest->responseBlob(ec);
- if (ec) {
- V8Proxy::setDOMException(ec);
- return v8::Undefined();
- }
- return toV8(blob);
- }
-#else
- return v8::Undefined();
-#endif
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
- case XMLHttpRequest::ResponseTypeArrayBuffer:
- {
- ExceptionCode ec = 0;
- ArrayBuffer* arrayBuffer = xmlHttpRequest->responseArrayBuffer(ec);
- if (ec) {
- V8Proxy::setDOMException(ec);
- return v8::Undefined();
- }
- return toV8(arrayBuffer);
- }
-#endif
- }
-
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8XMLHttpRequest::openCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.XMLHttpRequest.open()");
- // Four cases:
- // open(method, url)
- // open(method, url, async)
- // open(method, url, async, user)
- // open(method, url, async, user, passwd)
-
- if (args.Length() < 2)
- return throwError("Not enough arguments", V8Proxy::SyntaxError);
-
- XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(args.Holder());
-
- String method = toWebCoreString(args[0]);
- String urlstring = toWebCoreString(args[1]);
- ScriptExecutionContext* context = getScriptExecutionContext();
- if (!context)
- return v8::Undefined();
-
- KURL url = context->completeURL(urlstring);
-
- ExceptionCode ec = 0;
-
- if (args.Length() >= 3) {
- bool async = args[2]->BooleanValue();
-
- if (args.Length() >= 4 && !args[3]->IsUndefined()) {
- String user = toWebCoreStringWithNullCheck(args[3]);
-
- if (args.Length() >= 5 && !args[4]->IsUndefined()) {
- String passwd = toWebCoreStringWithNullCheck(args[4]);
- xmlHttpRequest->open(method, url, async, user, passwd, ec);
- } else
- xmlHttpRequest->open(method, url, async, user, ec);
- } else
- xmlHttpRequest->open(method, url, async, ec);
- } else
- xmlHttpRequest->open(method, url, ec);
-
- if (ec)
- return throwError(ec);
-
- return v8::Undefined();
-}
-
-static bool isDocumentType(v8::Handle<v8::Value> value)
-{
- // FIXME: add other document types.
- return V8Document::HasInstance(value) || V8HTMLDocument::HasInstance(value);
-}
-
-v8::Handle<v8::Value> V8XMLHttpRequest::sendCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.XMLHttpRequest.send()");
- XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(args.Holder());
-
- InspectorInstrumentation::willSendXMLHttpRequest(xmlHttpRequest->scriptExecutionContext(), xmlHttpRequest->url());
-
- ExceptionCode ec = 0;
- if (args.Length() < 1)
- xmlHttpRequest->send(ec);
- else {
- v8::Handle<v8::Value> arg = args[0];
- if (isUndefinedOrNull(arg))
- xmlHttpRequest->send(ec);
- else if (isDocumentType(arg)) {
- v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg);
- Document* document = V8Document::toNative(object);
- ASSERT(document);
- xmlHttpRequest->send(document, ec);
- } else if (V8Blob::HasInstance(arg)) {
- v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg);
- Blob* blob = V8Blob::toNative(object);
- ASSERT(blob);
- xmlHttpRequest->send(blob, ec);
- } else if (V8DOMFormData::HasInstance(arg)) {
- v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg);
- DOMFormData* domFormData = V8DOMFormData::toNative(object);
- ASSERT(domFormData);
- xmlHttpRequest->send(domFormData, ec);
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
- } else if (V8ArrayBuffer::HasInstance(arg)) {
- v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg);
- ArrayBuffer* arrayBuffer = V8ArrayBuffer::toNative(object);
- ASSERT(arrayBuffer);
- xmlHttpRequest->send(arrayBuffer, ec);
-#endif
- } else
- xmlHttpRequest->send(toWebCoreStringWithNullCheck(arg), ec);
- }
-
- if (ec)
- return throwError(ec);
-
- return v8::Undefined();
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp b/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp
deleted file mode 100644
index b624fcf..0000000
--- a/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8XSLTProcessor.h"
-
-#include "Document.h"
-#include "DocumentFragment.h"
-#include "Node.h"
-
-#include "V8Binding.h"
-#include "V8Document.h"
-#include "V8DocumentFragment.h"
-#include "V8Node.h"
-#include "V8Proxy.h"
-#include "XSLTProcessor.h"
-
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8XSLTProcessor::constructorCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.XSLTProcessor.Constructor");
- return V8Proxy::constructDOMObject<XSLTProcessor>(args, &info);
-}
-
-
-v8::Handle<v8::Value> V8XSLTProcessor::importStylesheetCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.XSLTProcessor.importStylesheet");
- if (!V8Node::HasInstance(args[0]))
- return v8::Undefined();
-
- XSLTProcessor* imp = V8XSLTProcessor::toNative(args.Holder());
-
- Node* node = V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0]));
- imp->importStylesheet(node);
- return v8::Undefined();
-}
-
-
-v8::Handle<v8::Value> V8XSLTProcessor::transformToFragmentCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.XSLTProcessor.transformToFragment");
- if (!V8Node::HasInstance(args[0]) || !V8Document::HasInstance(args[1]))
- return v8::Undefined();
-
- XSLTProcessor* imp = V8XSLTProcessor::toNative(args.Holder());
-
- Node* source = V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0]));
- Document* owner = V8Document::toNative(v8::Handle<v8::Object>::Cast(args[1]));
- RefPtr<DocumentFragment> result = imp->transformToFragment(source, owner);
- return toV8(result.release());
-}
-
-
-v8::Handle<v8::Value> V8XSLTProcessor::transformToDocumentCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.XSLTProcessor.transformToDocument");
-
- if (!V8Node::HasInstance(args[0]))
- return v8::Undefined();
-
- XSLTProcessor* imp = V8XSLTProcessor::toNative(args.Holder());
-
- Node* source = V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0]));
- if (!source)
- return v8::Undefined();
-
- RefPtr<Document> result = imp->transformToDocument(source);
- if (!result)
- return v8::Undefined();
-
- return toV8(result.release());
-}
-
-
-v8::Handle<v8::Value> V8XSLTProcessor::setParameterCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.XSLTProcessor.setParameter");
- if (isUndefinedOrNull(args[1]) || isUndefinedOrNull(args[2]))
- return v8::Undefined();
-
- XSLTProcessor* imp = V8XSLTProcessor::toNative(args.Holder());
-
- String namespaceURI = toWebCoreString(args[0]);
- String localName = toWebCoreString(args[1]);
- String value = toWebCoreString(args[2]);
- imp->setParameter(namespaceURI, localName, value);
-
- return v8::Undefined();
-}
-
-
-v8::Handle<v8::Value> V8XSLTProcessor::getParameterCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.XSLTProcessor.getParameter");
- if (isUndefinedOrNull(args[1]))
- return v8::Undefined();
-
- XSLTProcessor* imp = V8XSLTProcessor::toNative(args.Holder());
-
- String namespaceURI = toWebCoreString(args[0]);
- String localName = toWebCoreString(args[1]);
- String result = imp->getParameter(namespaceURI, localName);
- if (result.isNull())
- return v8::Undefined();
-
- return v8String(result);
-}
-
-v8::Handle<v8::Value> V8XSLTProcessor::removeParameterCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.XSLTProcessor.removeParameter");
- if (isUndefinedOrNull(args[1]))
- return v8::Undefined();
-
- XSLTProcessor* imp = V8XSLTProcessor::toNative(args.Holder());
-
- String namespaceURI = toWebCoreString(args[0]);
- String localName = toWebCoreString(args[1]);
- imp->removeParameter(namespaceURI, localName);
- return v8::Undefined();
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/npruntime.cpp b/WebCore/bindings/v8/npruntime.cpp
deleted file mode 100644
index 836456a..0000000
--- a/WebCore/bindings/v8/npruntime.cpp
+++ /dev/null
@@ -1,455 +0,0 @@
-/*
- * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
- * Copyright (C) 2007-2009 Google, 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.
- */
-
-#include "config.h"
-
-#include "NPV8Object.h"
-#include "npruntime_impl.h"
-#include "npruntime_priv.h"
-#include "V8NPObject.h"
-
-#include <wtf/HashMap.h>
-#include <wtf/HashSet.h>
-#include <wtf/Assertions.h>
-
-using namespace WebCore;
-
-// FIXME: Consider removing locks if we're singlethreaded already.
-// The static initializer here should work okay, but we want to avoid
-// static initialization in general.
-
-namespace npruntime {
-
-// We use StringKey here as the key-type to avoid a string copy to
-// construct the map key and for faster comparisons than strcmp.
-class StringKey {
-public:
- explicit StringKey(const char* str) : m_string(str), m_length(strlen(str)) { }
- StringKey() : m_string(0), m_length(0) { }
- explicit StringKey(WTF::HashTableDeletedValueType) : m_string(hashTableDeletedValue()), m_length(0) { }
-
- StringKey& operator=(const StringKey& other)
- {
- this->m_string = other.m_string;
- this->m_length = other.m_length;
- return *this;
- }
-
- bool isHashTableDeletedValue() const
- {
- return m_string == hashTableDeletedValue();
- }
-
- const char* m_string;
- size_t m_length;
-
-private:
- const char* hashTableDeletedValue() const
- {
- return reinterpret_cast<const char*>(-1);
- }
-};
-
-inline bool operator==(const StringKey& x, const StringKey& y)
-{
- if (x.m_length != y.m_length)
- return false;
- if (x.m_string == y.m_string)
- return true;
-
- ASSERT(!x.isHashTableDeletedValue() && !y.isHashTableDeletedValue());
- return !memcmp(x.m_string, y.m_string, y.m_length);
-}
-
-// Implement WTF::DefaultHash<StringKey>::Hash interface.
-struct StringKeyHash {
- static unsigned hash(const StringKey& key)
- {
- // Compute string hash.
- unsigned hash = 0;
- size_t len = key.m_length;
- const char* str = key.m_string;
- for (size_t i = 0; i < len; i++) {
- char c = str[i];
- hash += c;
- hash += (hash << 10);
- hash ^= (hash >> 6);
- }
- hash += (hash << 3);
- hash ^= (hash >> 11);
- hash += (hash << 15);
- if (hash == 0)
- hash = 27;
- return hash;
- }
-
- static bool equal(const StringKey& x, const StringKey& y)
- {
- return x == y;
- }
-
- static const bool safeToCompareToEmptyOrDeleted = true;
-};
-
-} // namespace npruntime
-
-using npruntime::StringKey;
-using npruntime::StringKeyHash;
-
-// Implement HashTraits<StringKey>
-struct StringKeyHashTraits : WTF::GenericHashTraits<StringKey> {
- static void constructDeletedValue(StringKey& slot)
- {
- new (&slot) StringKey(WTF::HashTableDeletedValue);
- }
-
- static bool isDeletedValue(const StringKey& value)
- {
- return value.isHashTableDeletedValue();
- }
-};
-
-typedef WTF::HashMap<StringKey, PrivateIdentifier*, StringKeyHash, StringKeyHashTraits> StringIdentifierMap;
-
-static StringIdentifierMap* getStringIdentifierMap()
-{
- static StringIdentifierMap* stringIdentifierMap = 0;
- if (!stringIdentifierMap)
- stringIdentifierMap = new StringIdentifierMap();
- return stringIdentifierMap;
-}
-
-typedef WTF::HashMap<int, PrivateIdentifier*> IntIdentifierMap;
-
-static IntIdentifierMap* getIntIdentifierMap()
-{
- static IntIdentifierMap* intIdentifierMap = 0;
- if (!intIdentifierMap)
- intIdentifierMap = new IntIdentifierMap();
- return intIdentifierMap;
-}
-
-extern "C" {
-
-NPIdentifier _NPN_GetStringIdentifier(const NPUTF8* name)
-{
- ASSERT(name);
-
- if (name) {
-
- StringKey key(name);
- StringIdentifierMap* identMap = getStringIdentifierMap();
- StringIdentifierMap::iterator iter = identMap->find(key);
- if (iter != identMap->end())
- return static_cast<NPIdentifier>(iter->second);
-
- size_t nameLen = key.m_length;
-
- // We never release identifiers, so this dictionary will grow.
- PrivateIdentifier* identifier = static_cast<PrivateIdentifier*>(malloc(sizeof(PrivateIdentifier) + nameLen + 1));
- char* nameStorage = reinterpret_cast<char*>(identifier + 1);
- memcpy(nameStorage, name, nameLen + 1);
- identifier->isString = true;
- identifier->value.string = reinterpret_cast<NPUTF8*>(nameStorage);
- key.m_string = nameStorage;
- identMap->set(key, identifier);
- return (NPIdentifier)identifier;
- }
-
- return 0;
-}
-
-void _NPN_GetStringIdentifiers(const NPUTF8** names, int32_t nameCount, NPIdentifier* identifiers)
-{
- ASSERT(names);
- ASSERT(identifiers);
-
- if (names && identifiers) {
- for (int i = 0; i < nameCount; i++)
- identifiers[i] = _NPN_GetStringIdentifier(names[i]);
- }
-}
-
-NPIdentifier _NPN_GetIntIdentifier(int32_t intId)
-{
- // Special case for -1 and 0, both cannot be used as key in HashMap.
- if (!intId || intId == -1) {
- static PrivateIdentifier* minusOneOrZeroIds[2];
- PrivateIdentifier* id = minusOneOrZeroIds[intId + 1];
- if (!id) {
- id = reinterpret_cast<PrivateIdentifier*>(malloc(sizeof(PrivateIdentifier)));
- id->isString = false;
- id->value.number = intId;
- minusOneOrZeroIds[intId + 1] = id;
- }
- return (NPIdentifier) id;
- }
-
- IntIdentifierMap* identMap = getIntIdentifierMap();
- IntIdentifierMap::iterator iter = identMap->find(intId);
- if (iter != identMap->end())
- return static_cast<NPIdentifier>(iter->second);
-
- // We never release identifiers, so this dictionary will grow.
- PrivateIdentifier* identifier = reinterpret_cast<PrivateIdentifier*>(malloc(sizeof(PrivateIdentifier)));
- identifier->isString = false;
- identifier->value.number = intId;
- identMap->set(intId, identifier);
- return (NPIdentifier)identifier;
-}
-
-bool _NPN_IdentifierIsString(NPIdentifier identifier)
-{
- PrivateIdentifier* privateIdentifier = reinterpret_cast<PrivateIdentifier*>(identifier);
- return privateIdentifier->isString;
-}
-
-NPUTF8 *_NPN_UTF8FromIdentifier(NPIdentifier identifier)
-{
- PrivateIdentifier* privateIdentifier = reinterpret_cast<PrivateIdentifier*>(identifier);
- if (!privateIdentifier->isString || !privateIdentifier->value.string)
- return 0;
-
- return (NPUTF8*) strdup(privateIdentifier->value.string);
-}
-
-int32_t _NPN_IntFromIdentifier(NPIdentifier identifier)
-{
- PrivateIdentifier* privateIdentifier = reinterpret_cast<PrivateIdentifier*>(identifier);
- if (privateIdentifier->isString)
- return 0;
- return privateIdentifier->value.number;
-}
-
-void _NPN_ReleaseVariantValue(NPVariant* variant)
-{
- ASSERT(variant);
-
- if (variant->type == NPVariantType_Object) {
- _NPN_ReleaseObject(variant->value.objectValue);
- variant->value.objectValue = 0;
- } else if (variant->type == NPVariantType_String) {
- free((void*)variant->value.stringValue.UTF8Characters);
- variant->value.stringValue.UTF8Characters = 0;
- variant->value.stringValue.UTF8Length = 0;
- }
-
- variant->type = NPVariantType_Void;
-}
-
-NPObject *_NPN_CreateObject(NPP npp, NPClass* npClass)
-{
- ASSERT(npClass);
-
- if (npClass) {
- NPObject* npObject;
- if (npClass->allocate != 0)
- npObject = npClass->allocate(npp, npClass);
- else
- npObject = reinterpret_cast<NPObject*>(malloc(sizeof(NPObject)));
-
- npObject->_class = npClass;
- npObject->referenceCount = 1;
- return npObject;
- }
-
- return 0;
-}
-
-NPObject* _NPN_RetainObject(NPObject* npObject)
-{
- ASSERT(npObject);
- ASSERT(npObject->referenceCount > 0);
-
- if (npObject)
- npObject->referenceCount++;
-
- return npObject;
-}
-
-// _NPN_DeallocateObject actually deletes the object. Technically,
-// callers should use _NPN_ReleaseObject. Webkit exposes this function
-// to kill objects which plugins may not have properly released.
-void _NPN_DeallocateObject(NPObject* npObject)
-{
- ASSERT(npObject);
-
- if (npObject) {
- // NPObjects that remain in pure C++ may never have wrappers.
- // Hence, if it's not already alive, don't unregister it.
- // If it is alive, unregister it as the *last* thing we do
- // so that it can do as much cleanup as possible on its own.
- if (_NPN_IsAlive(npObject))
- _NPN_UnregisterObject(npObject);
-
- npObject->referenceCount = -1;
- if (npObject->_class->deallocate)
- npObject->_class->deallocate(npObject);
- else
- free(npObject);
- }
-}
-
-#if PLATFORM(ANDROID)
-// Android uses NPN_ReleaseObject (the 'public' version of _NPN_ReleaseObject)
-// in WebCoreFrameBridge.cpp. See http://trac.webkit.org/changeset/47021.
-// TODO: Upstream this to webkit.org.
-void NPN_ReleaseObject(NPObject *obj)
-{
- _NPN_ReleaseObject(obj);
-}
-#endif
-void _NPN_ReleaseObject(NPObject* npObject)
-{
- ASSERT(npObject);
- ASSERT(npObject->referenceCount >= 1);
-
- if (npObject && npObject->referenceCount >= 1) {
- if (!--npObject->referenceCount)
- _NPN_DeallocateObject(npObject);
- }
-}
-
-void _NPN_InitializeVariantWithStringCopy(NPVariant* variant, const NPString* value)
-{
- variant->type = NPVariantType_String;
- variant->value.stringValue.UTF8Length = value->UTF8Length;
- variant->value.stringValue.UTF8Characters = reinterpret_cast<NPUTF8*>(malloc(sizeof(NPUTF8) * value->UTF8Length));
- memcpy((void*)variant->value.stringValue.UTF8Characters, value->UTF8Characters, sizeof(NPUTF8) * value->UTF8Length);
-}
-
-
-// NPN_Registry
-//
-// The registry is designed for quick lookup of NPObjects.
-// JS needs to be able to quickly lookup a given NPObject to determine
-// if it is alive or not.
-// The browser needs to be able to quickly lookup all NPObjects which are
-// "owned" by an object.
-//
-// The liveObjectMap is a hash table of all live objects to their owner
-// objects. Presence in this table is used primarily to determine if
-// objects are live or not.
-//
-// The rootObjectMap is a hash table of root objects to a set of
-// objects that should be deactivated in sync with the root. A
-// root is defined as a top-level owner object. This is used on
-// Frame teardown to deactivate all objects associated
-// with a particular plugin.
-
-typedef WTF::HashSet<NPObject*> NPObjectSet;
-typedef WTF::HashMap<NPObject*, NPObject*> NPObjectMap;
-typedef WTF::HashMap<NPObject*, NPObjectSet*> NPRootObjectMap;
-
-// A map of live NPObjects with pointers to their Roots.
-NPObjectMap liveObjectMap;
-
-// A map of the root objects and the list of NPObjects
-// associated with that object.
-NPRootObjectMap rootObjectMap;
-
-void _NPN_RegisterObject(NPObject* npObject, NPObject* owner)
-{
- ASSERT(npObject);
-
- // Check if already registered.
- if (liveObjectMap.find(npObject) != liveObjectMap.end())
- return;
-
- if (!owner) {
- // Registering a new owner object.
- ASSERT(rootObjectMap.find(npObject) == rootObjectMap.end());
- rootObjectMap.set(npObject, new NPObjectSet());
- } else {
- // Always associate this object with it's top-most parent.
- // Since we always flatten, we only have to look up one level.
- NPObjectMap::iterator ownerEntry = liveObjectMap.find(owner);
- NPObject* parent = 0;
- if (liveObjectMap.end() != ownerEntry)
- parent = ownerEntry->second;
-
- if (parent)
- owner = parent;
- ASSERT(rootObjectMap.find(npObject) == rootObjectMap.end());
- if (rootObjectMap.find(owner) != rootObjectMap.end())
- rootObjectMap.get(owner)->add(npObject);
- }
-
- ASSERT(liveObjectMap.find(npObject) == liveObjectMap.end());
- liveObjectMap.set(npObject, owner);
-}
-
-void _NPN_UnregisterObject(NPObject* npObject)
-{
- ASSERT(npObject);
- ASSERT(liveObjectMap.find(npObject) != liveObjectMap.end());
-
- NPObject* owner = 0;
- if (liveObjectMap.find(npObject) != liveObjectMap.end())
- owner = liveObjectMap.find(npObject)->second;
-
- if (!owner) {
- // Unregistering a owner object; also unregister it's descendants.
- ASSERT(rootObjectMap.find(npObject) != rootObjectMap.end());
- NPObjectSet* set = rootObjectMap.get(npObject);
- while (set->size() > 0) {
-#ifndef NDEBUG
- int size = set->size();
-#endif
- NPObject* sub_object = *(set->begin());
- // The sub-object should not be a owner!
- ASSERT(rootObjectMap.find(sub_object) == rootObjectMap.end());
-
- // First, unregister the object.
- set->remove(sub_object);
- liveObjectMap.remove(sub_object);
-
- // Remove the JS references to the object.
- forgetV8ObjectForNPObject(sub_object);
-
- ASSERT(set->size() < size);
- }
- delete set;
- rootObjectMap.remove(npObject);
- } else {
- NPRootObjectMap::iterator ownerEntry = rootObjectMap.find(owner);
- if (ownerEntry != rootObjectMap.end()) {
- NPObjectSet* list = ownerEntry->second;
- ASSERT(list->find(npObject) != list->end());
- list->remove(npObject);
- }
- }
-
- liveObjectMap.remove(npObject);
- forgetV8ObjectForNPObject(npObject);
-}
-
-bool _NPN_IsAlive(NPObject* npObject)
-{
- return liveObjectMap.find(npObject) != liveObjectMap.end();
-}
-
-} // extern "C"
diff --git a/WebCore/bindings/v8/npruntime_impl.h b/WebCore/bindings/v8/npruntime_impl.h
deleted file mode 100644
index d2377eb..0000000
--- a/WebCore/bindings/v8/npruntime_impl.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 npruntime_impl_h
-#define npruntime_impl_h
-
-#if PLATFORM(CHROMIUM)
-#include <bindings/npruntime.h>
-#else
-#include "npruntime.h"
-#endif
-
-// This file exists to support WebCore, which expects to be able to call upon
-// portions of the NPRuntime implementation.
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-NPIdentifier _NPN_GetStringIdentifier(const NPUTF8* name);
-void _NPN_GetStringIdentifiers(const NPUTF8** names, int32_t nameCount, NPIdentifier*);
-NPIdentifier _NPN_GetIntIdentifier(int32_t intId);
-bool _NPN_IdentifierIsString(NPIdentifier);
-NPUTF8 *_NPN_UTF8FromIdentifier(NPIdentifier);
-int32_t _NPN_IntFromIdentifier(NPIdentifier);
-void _NPN_ReleaseVariantValue(NPVariant*);
-NPObject *_NPN_CreateObject(NPP, NPClass*);
-NPObject* _NPN_RetainObject(NPObject*);
-void _NPN_ReleaseObject(NPObject*);
-bool _NPN_Invoke(NPP, NPObject*, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result);
-bool _NPN_InvokeDefault(NPP, NPObject*, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result);
-bool _NPN_Evaluate(NPP, NPObject*, NPString* npScript, NPVariant* result);
-bool _NPN_EvaluateHelper(NPP, bool popupsAllowed, NPObject*, NPString* npScript, NPVariant* result);
-bool _NPN_GetProperty(NPP, NPObject*, NPIdentifier propertyName, NPVariant* result);
-bool _NPN_SetProperty(NPP, NPObject*, NPIdentifier propertyName, const NPVariant* value);
-bool _NPN_RemoveProperty(NPP, NPObject*, NPIdentifier propertyName);
-bool _NPN_HasProperty(NPP, NPObject*, NPIdentifier propertyName);
-bool _NPN_HasMethod(NPP, NPObject*, NPIdentifier methodName);
-void _NPN_SetException(NPObject*, const NPUTF8 *message);
-bool _NPN_Enumerate(NPP, NPObject*, NPIdentifier**, uint32_t* count);
-bool _NPN_Construct(NPP, NPObject*, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result);
-
-#ifdef __cplusplus
-} /* end extern "C" */
-#endif
-
-#endif
diff --git a/WebCore/bindings/v8/npruntime_internal.h b/WebCore/bindings/v8/npruntime_internal.h
deleted file mode 100644
index 40d639f..0000000
--- a/WebCore/bindings/v8/npruntime_internal.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2007 Collabora, Ltd. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
- * This is a internal include header for npapi.h
- *
- * Some of the #defines which are in X11 headers conflict with type and enum
- * names in JavaScriptCore and WebCore
- * This header #undefs those defines to fix the conflicts
- * If you need to include npapi.h or npruntime.h when building on X11,
- * include this file instead of the actual npapi.h or npruntime.h
- */
-
-#include "npapi.h"
-#include "npruntime.h"
-#include "npfunctions.h"
-
-#ifdef XP_UNIX
- #include <X11/Xresource.h>
-
- #undef None
- #undef Above
- #undef Below
- #undef Auto
- #undef Complex
- #undef Status
- #undef CursorShape
- #undef FocusIn
- #undef FocusOut
- #undef KeyPress
- #undef KeyRelease
- #undef Unsorted
- #undef Bool
- #undef FontChange
- #undef GrayScale
- #undef NormalState
- #undef True
- #undef False
-#endif
diff --git a/WebCore/bindings/v8/npruntime_priv.h b/WebCore/bindings/v8/npruntime_priv.h
deleted file mode 100644
index e5ac0e0..0000000
--- a/WebCore/bindings/v8/npruntime_priv.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2003, 2006 Apple Computer, 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 npruntime_priv_h
-#define npruntime_priv_h
-
-#if PLATFORM(CHROMIUM)
-#include <bindings/npruntime.h>
-#else
-#include "npruntime.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- _NPN_InitializeVariantWithStringCopy() will copy string data. The string data
- will be deallocated by calls to NPReleaseVariantValue().
-*/
-void _NPN_InitializeVariantWithStringCopy(NPVariant*, const NPString*);
-void _NPN_DeallocateObject(NPObject*);
-
-// The following routines allow the browser to aggressively cleanup NPObjects
-// on a per plugin basis. All NPObjects used through the NPRuntime API should
-// be "registered" while they are alive. After an object has been
-// deleted, it is possible for Javascript to have a reference to that object
-// which has not yet been garbage collected. Javascript access to NPObjects
-// will reference this registry to determine if the object is accessible or
-// not.
-
-// Windows introduces an additional complication for objects created by the
-// plugin. Plugins load inside of a DLL. Each DLL has it's own heap. If
-// the browser unloads the plugin DLL, all objects created within the DLL's
-// heap instantly become invalid. Normally, when WebKit drops the reference
-// on the top-level plugin object, it tells the plugin manager that the
-// plugin can be destroyed, which can unload the DLL. So, we must eliminate
-// all pointers to any object ever created by the plugin.
-
-// We generally associate NPObjects with an owner. The owner of an NPObject
-// is an NPObject which, when destroyed, also destroys all objects it owns.
-// For example, if an NPAPI plugin creates 10 sub-NPObjects, all 11 objects
-// (the NPAPI plugin + its 10 sub-objects) should become inaccessible
-// simultaneously.
-
-// The ownership hierarchy is flat, and not a tree. Imagine the following
-// object creation:
-// PluginObject
-// |
-// +-- Creates -----> Object1
-// |
-// +-- Creates -----> Object2
-//
-// PluginObject will be the "owner" for both Object1 and Object2.
-
-// Register an NPObject with the runtime. If the owner is NULL, the
-// object is treated as an owning object. If owner is not NULL,
-// this object will be registered as owned by owner's top-level owner.
-void _NPN_RegisterObject(NPObject*, NPObject* owner);
-
-// Unregister an NPObject with the runtime. If obj is an owning
-// object, this call will also unregister all of the owned objects.
-void _NPN_UnregisterObject(NPObject*);
-
-// Check to see if an object is registered with the runtime.
-// Return true if registered, false otherwise.
-bool _NPN_IsAlive(NPObject*);
-
-#ifdef __cplusplus
-} /* end extern "C" */
-#endif
-
-#endif // npruntime_priv_h
diff --git a/WebCore/bindings/v8/specialization/V8BindingDOMWindow.h b/WebCore/bindings/v8/specialization/V8BindingDOMWindow.h
deleted file mode 100644
index 0c4069f..0000000
--- a/WebCore/bindings/v8/specialization/V8BindingDOMWindow.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8BindingDOMWindow_h
-#define V8BindingDOMWindow_h
-
-#include "BindingDOMWindow.h"
-#include "GenericBinding.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-class V8Binding;
-
-class V8BindingDOMWindow : public BindingDOMWindow<V8Binding> {
-public:
- static void storeDialogArgs(State<V8Binding>*, Frame* newFrame, v8::Handle<v8::Value> dialogArgs)
- {
- // Set dialog arguments on the global object of the new frame.
- if (!dialogArgs.IsEmpty()) {
- v8::Local<v8::Context> context = V8Proxy::context(newFrame);
- if (!context.IsEmpty()) {
- v8::Context::Scope scope(context);
- context->Global()->Set(v8::String::New("dialogArguments"), dialogArgs);
- }
- }
- }
-};
-
-} // namespace WebCore
-
-#endif // V8BindingDOMWindow_h
diff --git a/WebCore/bindings/v8/specialization/V8BindingState.cpp b/WebCore/bindings/v8/specialization/V8BindingState.cpp
deleted file mode 100644
index 891272c..0000000
--- a/WebCore/bindings/v8/specialization/V8BindingState.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#include "config.h"
-#include "V8BindingState.h"
-
-#include "Frame.h"
-#include "ScriptController.h"
-#include "V8Proxy.h"
-#include <wtf/StdLibExtras.h>
-
-namespace WebCore {
-
-State<V8Binding>* State<V8Binding>::Only()
-{
- DEFINE_STATIC_LOCAL(State, globalV8BindingState, ());
- return &globalV8BindingState;
-}
-
-DOMWindow* State<V8Binding>::activeWindow()
-{
- v8::Local<v8::Context> activeContext = v8::Context::GetCalling();
- if (activeContext.IsEmpty()) {
- // There is a single activation record on the stack, so that must
- // be the activeContext.
- activeContext = v8::Context::GetCurrent();
- }
- return V8Proxy::retrieveWindow(activeContext);
-}
-
-DOMWindow* State<V8Binding>::firstWindow()
-{
- return V8Proxy::retrieveWindow(v8::Context::GetEntered());
-}
-
-Frame* State<V8Binding>::activeFrame()
-{
- Frame* frame = V8Proxy::retrieveFrameForCallingContext();
- if (!frame) {
- // Unfortunately, when processing script from a plug-in, we might not
- // have a calling context. In those cases, we fall back to the
- // entered context for security checks.
- // FIXME: We need a better API for retrieving frames that abstracts
- // away this concern.
- frame = V8Proxy::retrieveFrameForEnteredContext();
- }
- return frame;
-}
-
-Frame* State<V8Binding>::firstFrame()
-{
- return V8Proxy::retrieveFrameForEnteredContext();
-}
-
-void State<V8Binding>::immediatelyReportUnsafeAccessTo(Frame* target)
-{
- V8Proxy::reportUnsafeAccessTo(target, V8Proxy::ReportNow);
-}
-
-bool State<V8Binding>::processingUserGesture()
-{
- return ScriptController::processingUserGesture();
-}
-
-bool State<V8Binding>::allowsAccessFromFrame(Frame* frame)
-{
- return ScriptController::isSafeScript(frame);
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/specialization/V8BindingState.h b/WebCore/bindings/v8/specialization/V8BindingState.h
deleted file mode 100644
index c472484..0000000
--- a/WebCore/bindings/v8/specialization/V8BindingState.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2009 Google 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "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 THE COPYRIGHT
- * OWNER 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 V8BindingState_h
-#define V8BindingState_h
-
-#include "GenericBinding.h"
-#include "V8Binding.h"
-
-namespace WebCore {
-
-class Frame;
-
-// Singleton implementation of State<V8Binding>. Uses V8's global data
-// structures to return information about relevant execution state.
-template <>
-class State<V8Binding> : public State<GenericBinding> {
-public:
- // Singleton
- static State* Only();
-
- // Reports an error message (without delay) if the security check fails.
- static void immediatelyReportUnsafeAccessTo(Frame*);
-
- DOMWindow* activeWindow();
- DOMWindow* firstWindow();
-
- Frame* activeFrame();
- Frame* firstFrame();
-
- bool processingUserGesture();
-
- // FIXME: This should be shared in BindingSecurity
- bool allowsAccessFromFrame(Frame*);
-
-private:
- explicit State() {}
- ~State();
-};
-
-typedef State<V8Binding> V8BindingState;
-
-}
-
-#endif // V8BindingState_h