diff options
Diffstat (limited to 'Source/WebCore/bindings')
122 files changed, 494 insertions, 500 deletions
diff --git a/Source/WebCore/bindings/js/JSMessagePortCustom.cpp b/Source/WebCore/bindings/js/JSMessagePortCustom.cpp index f44bbb7b4..7a439d360 100644 --- a/Source/WebCore/bindings/js/JSMessagePortCustom.cpp +++ b/Source/WebCore/bindings/js/JSMessagePortCustom.cpp @@ -90,15 +90,20 @@ void fillMessagePortArray(JSC::ExecState* exec, JSC::JSValue value, MessagePortA return; // Validation of non-null objects, per HTML5 spec 10.3.3. if (value.isUndefinedOrNull()) { - setDOMException(exec, DATA_CLONE_ERR); + setDOMException(exec, INVALID_STATE_ERR); return; } // Validation of Objects implementing an interface, per WebIDL spec 4.1.15. RefPtr<MessagePort> port = toMessagePort(value); - if (port) + if (port) { + // Check for duplicate ports. + if (portArray.contains(port)) { + setDOMException(exec, INVALID_STATE_ERR); + return; + } portArray.append(port.release()); - else { + } else { RefPtr<ArrayBuffer> arrayBuffer = toArrayBuffer(value); if (arrayBuffer) arrayBuffers.append(arrayBuffer); diff --git a/Source/WebCore/bindings/js/JSUndoManagerCustom.cpp b/Source/WebCore/bindings/js/JSUndoManagerCustom.cpp index 94cc0b60f..8fc09c511 100644 --- a/Source/WebCore/bindings/js/JSUndoManagerCustom.cpp +++ b/Source/WebCore/bindings/js/JSUndoManagerCustom.cpp @@ -38,6 +38,12 @@ JSValue JSUndoManager::transact(ExecState*) return jsUndefined(); } +JSValue JSUndoManager::item(ExecState*) +{ + // FIXME: implement JSC bindings + return jsUndefined(); +} + } #endif diff --git a/Source/WebCore/bindings/objc/DOM.mm b/Source/WebCore/bindings/objc/DOM.mm index abc529892..5c77da5c2 100644 --- a/Source/WebCore/bindings/objc/DOM.mm +++ b/Source/WebCore/bindings/objc/DOM.mm @@ -34,6 +34,7 @@ #import "DOMNodeInternal.h" #import "DOMPrivate.h" #import "DOMRangeInternal.h" +#import "Font.h" #import "Frame.h" #import "HTMLElement.h" #import "HTMLNames.h" diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm index 300a365be..5969d2d47 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -3352,24 +3352,23 @@ END END } - my $proxyInit; + AddToImplIncludes("Frame.h"); + my $frame = "0"; if (IsNodeSubType($dataNode)) { - AddToImplIncludes("Frame.h"); - $proxyInit = "impl->document()->frame() ? impl->document()->frame()->script()->proxy() : 0"; # DocumentType nodes are the only nodes that may have a NULL document. if ($interfaceName eq "DocumentType") { - $proxyInit = "impl->document() ? ($proxyInit) : 0"; + $frame = "impl->document() ? impl->document()->frame() : 0"; + } else { + $frame = "impl->document()->frame()"; } - } else { - $proxyInit = "0"; } push(@implContent, <<END); - V8Proxy* proxy = $proxyInit; + Frame* frame = $frame; END if (IsSubType($dataNode, "Document")) { push(@implContent, <<END); - if (proxy && proxy->windowShell()->context().IsEmpty() && proxy->windowShell()->initContextIfNeeded()) { + if (frame && frame->script()->windowShell()->context().IsEmpty() && frame->script()->windowShell()->initContextIfNeeded()) { // initContextIfNeeded may have created a wrapper for the object, retry from the start. return ${className}::wrap(impl.get(), isolate); } @@ -3383,8 +3382,8 @@ END AddToImplIncludes("Frame.h"); push(@implContent, <<END); if (impl->frame()) { - proxy = impl->frame()->script()->proxy(); - proxy->windowShell()->initContextIfNeeded(); + frame = impl->frame(); + frame->script()->windowShell()->initContextIfNeeded(); } END } @@ -3394,10 +3393,10 @@ END // Enter the node's context and create the wrapper in that context. v8::Handle<v8::Context> context; - if (proxy && !proxy->matchesCurrentContext()) { + if (frame && !frame->script()->matchesCurrentContext()) { // For performance, we enter the context only if the currently running context // is different from the context that we are about to enter. - context = proxy->context(); + context = frame->script()->currentWorldContext(); if (!context.IsEmpty()) context->Enter(); } @@ -3405,7 +3404,7 @@ END } push(@implContent, <<END); - wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl.get()); + wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); END if (IsNodeSubType($dataNode) || IsVisibleAcrossOrigins($dataNode)) { push(@implContent, <<END); @@ -3815,7 +3814,7 @@ sub JSValueToNative } if ($type eq "XPathNSResolver") { - return "V8DOMWrapper::getXPathNSResolver($value)"; + return "toXPathNSResolver($value)"; } my $arrayType = $codeGenerator->GetArrayType($type); diff --git a/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp b/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp index d033908e8..c93730d3a 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp @@ -24,6 +24,7 @@ #include "BindingState.h" #include "ContextFeatures.h" #include "ExceptionCode.h" +#include "Frame.h" #include "RuntimeEnabledFeatures.h" #include "V8ArrayBufferView.h" #include "V8ArrayBufferViewCustom.h" @@ -151,8 +152,8 @@ v8::Handle<v8::Object> V8Float64Array::wrapSlow(PassRefPtr<Float64Array> impl, v { v8::Handle<v8::Object> wrapper; ASSERT(static_cast<void*>(static_cast<ArrayBufferView*>(impl.get())) == static_cast<void*>(impl.get())); - V8Proxy* proxy = 0; - wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl.get()); + Frame* frame = 0; + wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); if (UNLIKELY(wrapper.IsEmpty())) return wrapper; v8::Persistent<v8::Object> wrapperHandle = V8DOMWrapper::setJSWrapperForDOMObject(impl, wrapper, isolate); diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp index 653eb1e42..23872e961 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp @@ -180,22 +180,22 @@ bool V8TestActiveDOMObject::HasInstance(v8::Handle<v8::Value> value) v8::Handle<v8::Object> V8TestActiveDOMObject::wrapSlow(PassRefPtr<TestActiveDOMObject> impl, v8::Isolate* isolate) { v8::Handle<v8::Object> wrapper; - V8Proxy* proxy = 0; + Frame* frame = 0; if (impl->frame()) { - proxy = impl->frame()->script()->proxy(); - proxy->windowShell()->initContextIfNeeded(); + frame = impl->frame(); + frame->script()->windowShell()->initContextIfNeeded(); } // Enter the node's context and create the wrapper in that context. v8::Handle<v8::Context> context; - if (proxy && !proxy->matchesCurrentContext()) { + if (frame && !frame->script()->matchesCurrentContext()) { // For performance, we enter the context only if the currently running context // is different from the context that we are about to enter. - context = proxy->context(); + context = frame->script()->currentWorldContext(); if (!context.IsEmpty()) context->Enter(); } - wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl.get()); + wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); // Exit the node's context if it was entered. if (!context.IsEmpty()) context->Exit(); diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp index 0f9e64ac7..e568d57ae 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp @@ -24,6 +24,7 @@ #include "BindingState.h" #include "ContextFeatures.h" #include "ExceptionCode.h" +#include "Frame.h" #include "RuntimeEnabledFeatures.h" #include "V8Binding.h" #include "V8DOMWrapper.h" @@ -113,8 +114,8 @@ bool V8TestCustomNamedGetter::HasInstance(v8::Handle<v8::Value> value) v8::Handle<v8::Object> V8TestCustomNamedGetter::wrapSlow(PassRefPtr<TestCustomNamedGetter> impl, v8::Isolate* isolate) { v8::Handle<v8::Object> wrapper; - V8Proxy* proxy = 0; - wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl.get()); + Frame* frame = 0; + wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); if (UNLIKELY(wrapper.IsEmpty())) return wrapper; v8::Persistent<v8::Object> wrapperHandle = V8DOMWrapper::setJSWrapperForDOMObject(impl, wrapper, isolate); diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp index 32e13aa03..dacbd1d8d 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp @@ -24,6 +24,7 @@ #include "BindingState.h" #include "ContextFeatures.h" #include "Dictionary.h" +#include "Frame.h" #include "RuntimeEnabledFeatures.h" #include "V8Binding.h" #include "V8DOMWrapper.h" @@ -150,8 +151,8 @@ bool V8TestEventConstructor::HasInstance(v8::Handle<v8::Value> value) v8::Handle<v8::Object> V8TestEventConstructor::wrapSlow(PassRefPtr<TestEventConstructor> impl, v8::Isolate* isolate) { v8::Handle<v8::Object> wrapper; - V8Proxy* proxy = 0; - wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl.get()); + Frame* frame = 0; + wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); if (UNLIKELY(wrapper.IsEmpty())) return wrapper; v8::Persistent<v8::Object> wrapperHandle = V8DOMWrapper::setJSWrapperForDOMObject(impl, wrapper, isolate); diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp index 427f1d533..b10b607a9 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp @@ -24,6 +24,7 @@ #include "BindingState.h" #include "ContextFeatures.h" #include "ExceptionCode.h" +#include "Frame.h" #include "RuntimeEnabledFeatures.h" #include "V8Binding.h" #include "V8Collection.h" @@ -174,8 +175,8 @@ bool V8TestEventTarget::HasInstance(v8::Handle<v8::Value> value) v8::Handle<v8::Object> V8TestEventTarget::wrapSlow(PassRefPtr<TestEventTarget> impl, v8::Isolate* isolate) { v8::Handle<v8::Object> wrapper; - V8Proxy* proxy = 0; - wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl.get()); + Frame* frame = 0; + wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); if (UNLIKELY(wrapper.IsEmpty())) return wrapper; v8::Persistent<v8::Object> wrapperHandle = V8DOMWrapper::setJSWrapperForDOMObject(impl, wrapper, isolate); diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp index 99eb522fa..ffb49fd4b 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp @@ -23,6 +23,7 @@ #include "BindingState.h" #include "ContextFeatures.h" +#include "Frame.h" #include "RuntimeEnabledFeatures.h" #include "V8Binding.h" #include "V8DOMWrapper.h" @@ -104,8 +105,8 @@ bool V8TestException::HasInstance(v8::Handle<v8::Value> value) v8::Handle<v8::Object> V8TestException::wrapSlow(PassRefPtr<TestException> impl, v8::Isolate* isolate) { v8::Handle<v8::Object> wrapper; - V8Proxy* proxy = 0; - wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl.get()); + Frame* frame = 0; + wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); if (UNLIKELY(wrapper.IsEmpty())) return wrapper; v8::Persistent<v8::Object> wrapperHandle = V8DOMWrapper::setJSWrapperForDOMObject(impl, wrapper, isolate); diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp index 96cfd7a79..d4b8161af 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp @@ -26,6 +26,7 @@ #include "BindingState.h" #include "ContextFeatures.h" #include "ExceptionCode.h" +#include "Frame.h" #include "RuntimeEnabledFeatures.h" #include "TestSupplemental.h" #include "V8Binding.h" @@ -347,8 +348,8 @@ ActiveDOMObject* V8TestInterface::toActiveDOMObject(v8::Handle<v8::Object> objec v8::Handle<v8::Object> V8TestInterface::wrapSlow(PassRefPtr<TestInterface> impl, v8::Isolate* isolate) { v8::Handle<v8::Object> wrapper; - V8Proxy* proxy = 0; - wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl.get()); + Frame* frame = 0; + wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); if (UNLIKELY(wrapper.IsEmpty())) return wrapper; v8::Persistent<v8::Object> wrapperHandle = V8DOMWrapper::setJSWrapperForActiveDOMObject(impl, wrapper, isolate); diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp index 2ede10bda..ab66706d6 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp @@ -24,6 +24,7 @@ #include "BindingState.h" #include "ContextFeatures.h" #include "ExceptionCode.h" +#include "Frame.h" #include "MediaQueryListListener.h" #include "RuntimeEnabledFeatures.h" #include "V8Binding.h" @@ -113,8 +114,8 @@ bool V8TestMediaQueryListListener::HasInstance(v8::Handle<v8::Value> value) v8::Handle<v8::Object> V8TestMediaQueryListListener::wrapSlow(PassRefPtr<TestMediaQueryListListener> impl, v8::Isolate* isolate) { v8::Handle<v8::Object> wrapper; - V8Proxy* proxy = 0; - wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl.get()); + Frame* frame = 0; + wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); if (UNLIKELY(wrapper.IsEmpty())) return wrapper; v8::Persistent<v8::Object> wrapperHandle = V8DOMWrapper::setJSWrapperForDOMObject(impl, wrapper, isolate); diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp index 29892806b..d37f46dc0 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp @@ -158,8 +158,8 @@ ActiveDOMObject* V8TestNamedConstructor::toActiveDOMObject(v8::Handle<v8::Object v8::Handle<v8::Object> V8TestNamedConstructor::wrapSlow(PassRefPtr<TestNamedConstructor> impl, v8::Isolate* isolate) { v8::Handle<v8::Object> wrapper; - V8Proxy* proxy = 0; - wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl.get()); + Frame* frame = 0; + wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); if (UNLIKELY(wrapper.IsEmpty())) return wrapper; v8::Persistent<v8::Object> wrapperHandle = V8DOMWrapper::setJSWrapperForActiveDOMObject(impl, wrapper, isolate); diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp index c2a109f05..9a3cef794 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp @@ -114,18 +114,18 @@ v8::Handle<v8::Object> V8TestNode::wrapSlow(PassRefPtr<TestNode> impl, v8::Isola { v8::Handle<v8::Object> wrapper; ASSERT(static_cast<void*>(static_cast<Node*>(impl.get())) == static_cast<void*>(impl.get())); - V8Proxy* proxy = impl->document()->frame() ? impl->document()->frame()->script()->proxy() : 0; + Frame* frame = impl->document()->frame(); // Enter the node's context and create the wrapper in that context. v8::Handle<v8::Context> context; - if (proxy && !proxy->matchesCurrentContext()) { + if (frame && !frame->script()->matchesCurrentContext()) { // For performance, we enter the context only if the currently running context // is different from the context that we are about to enter. - context = proxy->context(); + context = frame->script()->currentWorldContext(); if (!context.IsEmpty()) context->Enter(); } - wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl.get()); + wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); // Exit the node's context if it was entered. if (!context.IsEmpty()) context->Exit(); diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp index a8b18c832..3f0b324f0 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp @@ -26,6 +26,7 @@ #include "DOMStringList.h" #include "Dictionary.h" #include "ExceptionCode.h" +#include "Frame.h" #include "HTMLNames.h" #include "IDBBindingUtilities.h" #include "IDBKey.h" @@ -2320,8 +2321,8 @@ void V8TestObj::installPerContextProperties(v8::Handle<v8::Object> instance, Tes v8::Handle<v8::Object> V8TestObj::wrapSlow(PassRefPtr<TestObj> impl, v8::Isolate* isolate) { v8::Handle<v8::Object> wrapper; - V8Proxy* proxy = 0; - wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl.get()); + Frame* frame = 0; + wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); if (UNLIKELY(wrapper.IsEmpty())) return wrapper; installPerContextProperties(wrapper, impl.get()); diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp index 0f7b87b12..45ace2076 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp @@ -26,6 +26,7 @@ #include "BindingState.h" #include "ContextFeatures.h" #include "ExceptionCode.h" +#include "Frame.h" #include "MessagePort.h" #include "RuntimeEnabledFeatures.h" #include "SerializedScriptValue.h" @@ -296,8 +297,8 @@ bool V8TestSerializedScriptValueInterface::HasInstance(v8::Handle<v8::Value> val v8::Handle<v8::Object> V8TestSerializedScriptValueInterface::wrapSlow(PassRefPtr<TestSerializedScriptValueInterface> impl, v8::Isolate* isolate) { v8::Handle<v8::Object> wrapper; - V8Proxy* proxy = 0; - wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl.get()); + Frame* frame = 0; + wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); if (UNLIKELY(wrapper.IsEmpty())) return wrapper; v8::Persistent<v8::Object> wrapperHandle = V8DOMWrapper::setJSWrapperForDOMObject(impl, wrapper, isolate); diff --git a/Source/WebCore/bindings/v8/DOMTransaction.cpp b/Source/WebCore/bindings/v8/DOMTransaction.cpp index d6e36ad1b..225e5abb6 100644 --- a/Source/WebCore/bindings/v8/DOMTransaction.cpp +++ b/Source/WebCore/bindings/v8/DOMTransaction.cpp @@ -96,17 +96,29 @@ void DOMTransaction::reapply() m_undoManager->registerUndoStep(this); } -v8::Handle<v8::Function> DOMTransaction::getFunction(const char* propertyName) +v8::Handle<v8::Value> DOMTransaction::data() { v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(toV8(this)); if (wrapper.IsEmpty()) - return v8::Handle<v8::Function>(); + return v8::Handle<v8::Value>(); + return wrapper->GetHiddenValue(V8HiddenPropertyName::domTransactionData()); +} - v8::Local<v8::Value> data = wrapper->GetHiddenValue(V8HiddenPropertyName::domTransactionData()); - if (data.IsEmpty() || !data->IsObject()) - return v8::Handle<v8::Function>(); +void DOMTransaction::setData(v8::Handle<v8::Value> newData) +{ + v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(toV8(this)); + if (wrapper.IsEmpty()) + return; + wrapper->SetHiddenValue(V8HiddenPropertyName::domTransactionData(), newData); +} - v8::Local<v8::Value> function = v8::Local<v8::Object>::Cast(data)->Get(v8::String::NewSymbol(propertyName)); +v8::Handle<v8::Function> DOMTransaction::getFunction(const char* propertyName) +{ + v8::Handle<v8::Value> dictionary = data(); + if (dictionary.IsEmpty() || !dictionary->IsObject()) + return v8::Handle<v8::Function>(); + + v8::Local<v8::Value> function = v8::Handle<v8::Object>::Cast(dictionary)->Get(v8::String::NewSymbol(propertyName)); if (function.IsEmpty() || !function->IsFunction()) return v8::Handle<v8::Function>(); diff --git a/Source/WebCore/bindings/v8/DOMTransaction.h b/Source/WebCore/bindings/v8/DOMTransaction.h index 88fb30db8..96a1f1d2e 100644 --- a/Source/WebCore/bindings/v8/DOMTransaction.h +++ b/Source/WebCore/bindings/v8/DOMTransaction.h @@ -47,6 +47,9 @@ public: virtual EditAction editingAction() const OVERRIDE { return EditActionUnspecified; } virtual bool isDOMTransaction() const OVERRIDE { return true; } + v8::Handle<v8::Value> data(); + void setData(v8::Handle<v8::Value>); + UndoManager* undoManager() const { return m_undoManager; } void setUndoManager(UndoManager* undoManager) { m_undoManager = undoManager; } diff --git a/Source/WebCore/bindings/v8/NPV8Object.cpp b/Source/WebCore/bindings/v8/NPV8Object.cpp index af7d99e7e..a32b44ea5 100644 --- a/Source/WebCore/bindings/v8/NPV8Object.cpp +++ b/Source/WebCore/bindings/v8/NPV8Object.cpp @@ -39,7 +39,6 @@ #include "V8Binding.h" #include "V8GCController.h" #include "V8NPUtils.h" -#include "V8Proxy.h" #include "WrapperTypeInfo.h" #include "npruntime_impl.h" #include "npruntime_priv.h" @@ -69,15 +68,6 @@ static v8::Local<v8::Context> toV8Context(NPP npp, NPObject* npObject) return ScriptController::mainWorldContext(object->rootObject->frame()); } -static V8Proxy* toV8Proxy(NPObject* npObject) -{ - V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject); - Frame* frame = object->rootObject->frame(); - if (!frame) - return 0; - return frame->script()->proxy(); -} - static V8NPObjectMap* staticV8NPObjectMap() { DEFINE_STATIC_LOCAL(V8NPObjectMap, v8npObjectMap, ()); @@ -335,9 +325,6 @@ bool _NPN_EvaluateHelper(NPP npp, bool popupsAllowed, NPObject* npObject, NPStri if (context.IsEmpty()) return false; - V8Proxy* proxy = toV8Proxy(npObject); - ASSERT(proxy); - v8::Context::Scope scope(context); ExceptionCatcher exceptionCatcher; @@ -346,10 +333,14 @@ bool _NPN_EvaluateHelper(NPP npp, bool popupsAllowed, NPObject* npObject, NPStri if (!popupsAllowed) filename = "npscript"; + V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject); + Frame* frame = v8NpObject->rootObject->frame(); + ASSERT(frame); + String script = String::fromUTF8(npScript->UTF8Characters, npScript->UTF8Length); UserGestureIndicator gestureIndicator(popupsAllowed ? DefinitelyProcessingUserGesture : PossiblyProcessingUserGesture); - v8::Local<v8::Value> v8result = proxy->evaluate(ScriptSourceCode(script, KURL(ParsedURLString, filename)), 0); + v8::Local<v8::Value> v8result = frame->script()->compileAndRunScript(ScriptSourceCode(script, KURL(ParsedURLString, filename))); if (v8result.IsEmpty()) return false; diff --git a/Source/WebCore/bindings/v8/OwnHandle.h b/Source/WebCore/bindings/v8/OwnHandle.h index 17c551cd6..668f5d414 100644 --- a/Source/WebCore/bindings/v8/OwnHandle.h +++ b/Source/WebCore/bindings/v8/OwnHandle.h @@ -35,45 +35,41 @@ namespace WebCore { - template<typename T> - class OwnHandle { - public: - OwnHandle() { } - explicit OwnHandle(v8::Handle<T> handle) : m_handle(v8::Persistent<T>::New(handle)) { } - ~OwnHandle() { clear(); } +template<typename T> +class OwnHandle { +public: + OwnHandle() { } - v8::Handle<T> get() const { return m_handle; } - void set(v8::Handle<T> handle) { clear(); m_handle = v8::Persistent<T>::New(handle); } + explicit OwnHandle(v8::Handle<T> handle) + : 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(); - } + ~OwnHandle() + { + 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); - } + v8::Handle<T> get() const { return m_handle; } - private: - static void weakCallback(v8::Persistent<v8::Value> object, void* ownHandle) - { - OwnHandle<T>* handle = static_cast<OwnHandle<T>*>(ownHandle); - handle->clear(); - } + void set(v8::Handle<T> handle) + { + clear(); + m_handle = v8::Persistent<T>::New(handle); + } - v8::Persistent<T> m_handle; - }; + // Note: This is clear in the OwnPtr sense, not the v8::Handle sense. + void clear() + { + if (m_handle.IsEmpty()) + return; + m_handle.Dispose(); + m_handle.Clear(); + } + +private: + v8::Persistent<T> m_handle; +}; } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/PageScriptDebugServer.cpp b/Source/WebCore/bindings/v8/PageScriptDebugServer.cpp index 04169fc3d..b4857b453 100755 --- a/Source/WebCore/bindings/v8/PageScriptDebugServer.cpp +++ b/Source/WebCore/bindings/v8/PageScriptDebugServer.cpp @@ -39,7 +39,6 @@ #include "ScriptDebugListener.h" #include "V8Binding.h" #include "V8DOMWindow.h" -#include "V8Proxy.h" #include "V8RecursionScope.h" #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> diff --git a/Source/WebCore/bindings/v8/ScheduledAction.cpp b/Source/WebCore/bindings/v8/ScheduledAction.cpp index d56f677a0..2a5f89d2d 100644 --- a/Source/WebCore/bindings/v8/ScheduledAction.cpp +++ b/Source/WebCore/bindings/v8/ScheduledAction.cpp @@ -42,7 +42,6 @@ #include "ScriptController.h" #include "V8Binding.h" -#include "V8Proxy.h" #include "V8RecursionScope.h" #include "WorkerContext.h" #include "WorkerContextExecutionProxy.h" @@ -132,7 +131,7 @@ void ScheduledAction::execute(ScriptController* script) if (!m_function.IsEmpty() && m_function->IsFunction()) script->callFunction(v8::Persistent<v8::Function>::Cast(m_function), v8Context->Global(), m_argc, m_argv); else - script->proxy()->evaluate(m_code, 0); + script->compileAndRunScript(m_code); // The 'proxy' may be invalid at this point since JS could have released the owning Frame. } diff --git a/Source/WebCore/bindings/v8/ScriptController.cpp b/Source/WebCore/bindings/v8/ScriptController.cpp index 9955ca907..1fb36b374 100644 --- a/Source/WebCore/bindings/v8/ScriptController.cpp +++ b/Source/WebCore/bindings/v8/ScriptController.cpp @@ -50,6 +50,7 @@ #include "PlatformSupport.h" #include "ScriptCallStack.h" #include "ScriptCallStackFactory.h" +#include "ScriptRunner.h" #include "ScriptSourceCode.h" #include "ScriptableDocumentParser.h" #include "SecurityOrigin.h" @@ -62,7 +63,6 @@ #include "V8HTMLEmbedElement.h" #include "V8IsolatedContext.h" #include "V8NPObject.h" -#include "V8Proxy.h" #include "V8RecursionScope.h" #include "Widget.h" #include <wtf/StdLibExtras.h> @@ -154,12 +154,12 @@ void ScriptController::clearScriptObjects() void ScriptController::resetIsolatedWorlds() { - for (IsolatedWorldMap::iterator iter = m_proxy->isolatedWorlds().begin(); - iter != m_proxy->isolatedWorlds().end(); ++iter) { + for (IsolatedWorldMap::iterator iter = m_isolatedWorlds.begin(); + iter != m_isolatedWorlds.end(); ++iter) { iter->second->destroy(); } - m_proxy->isolatedWorlds().clear(); - m_proxy->isolatedWorldSecurityOrigins().clear(); + m_isolatedWorlds.clear(); + m_isolatedWorldSecurityOrigins.clear(); } void ScriptController::clearForClose() @@ -198,12 +198,6 @@ v8::Local<v8::Value> ScriptController::callFunction(v8::Handle<v8::Function> fun return ScriptController::callFunctionWithInstrumentation(m_frame ? m_frame->document() : 0, function, receiver, argc, args); } -static v8::Local<v8::Value> handleMaxRecursionDepthExceeded() -{ - throwError(RangeError, "Maximum call stack size exceeded."); - return v8::Local<v8::Value>(); -} - static inline void resourceInfo(const v8::Handle<v8::Function> function, String& resourceName, int& lineNumber) { v8::ScriptOrigin origin = function->GetScriptOrigin(); @@ -262,6 +256,73 @@ ScriptValue ScriptController::callFunctionEvenIfScriptDisabled(v8::Handle<v8::Fu return ScriptValue(callFunction(function, receiver, argc, argv)); } +v8::Local<v8::Value> ScriptController::compileAndRunScript(const ScriptSourceCode& source) +{ + 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) + TRACE_EVENT_BEGIN0("v8", "v8.compile"); +#endif + OwnPtr<v8::ScriptData> scriptData = ScriptSourceCode::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 = ScriptSourceCode::compileScript(code, source.url(), source.startPosition(), scriptData.get()); +#if PLATFORM(CHROMIUM) + TRACE_EVENT_END0("v8", "v8.compile"); + TRACE_EVENT0("v8", "v8.run"); +#endif + + // Keep Frame (and therefore ScriptController) alive. + RefPtr<Frame> protect(m_frame); + result = ScriptRunner::runCompiledScript(script, m_frame->document()); + } + + InspectorInstrumentation::didEvaluateScript(cookie); + + return result; +} + +ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode) +{ + String sourceURL = sourceCode.url(); + const String* savedSourceURL = m_sourceURL; + m_sourceURL = &sourceURL; + + v8::HandleScope handleScope; + v8::Handle<v8::Context> v8Context = ScriptController::mainWorldContext(m_frame); + if (v8Context.IsEmpty()) + return ScriptValue(); + + v8::Context::Scope scope(v8Context); + + RefPtr<Frame> protect(m_frame); + + v8::Local<v8::Value> object = compileAndRunScript(sourceCode); + + m_sourceURL = savedSourceURL; + + if (object.IsEmpty()) + return ScriptValue(); + + return ScriptValue(object); +} + void ScriptController::evaluateInIsolatedWorld(unsigned worldID, const Vector<ScriptSourceCode>& sources, Vector<ScriptValue>* results) { evaluateInIsolatedWorld(worldID, sources, 0, results); @@ -280,8 +341,8 @@ void ScriptController::evaluateInIsolatedWorld(unsigned worldID, const Vector<Sc v8::HandleScope evaluateHandleScope; V8IsolatedContext* isolatedContext = 0; if (worldID > 0) { - IsolatedWorldMap::iterator iter = m_proxy->isolatedWorlds().find(worldID); - if (iter != m_proxy->isolatedWorlds().end()) + IsolatedWorldMap::iterator iter = m_isolatedWorlds.find(worldID); + if (iter != m_isolatedWorlds.end()) isolatedContext = iter->second; else { isolatedContext = new V8IsolatedContext(m_frame, extensionGroup, worldID); @@ -291,11 +352,11 @@ void ScriptController::evaluateInIsolatedWorld(unsigned worldID, const Vector<Sc } // FIXME: We should change this to using window shells to match JSC. - m_proxy->isolatedWorlds().set(worldID, isolatedContext); + m_isolatedWorlds.set(worldID, isolatedContext); } - IsolatedWorldSecurityOriginMap::iterator securityOriginIter = m_proxy->isolatedWorldSecurityOrigins().find(worldID); - if (securityOriginIter != m_proxy->isolatedWorldSecurityOrigins().end()) + IsolatedWorldSecurityOriginMap::iterator securityOriginIter = m_isolatedWorldSecurityOrigins.find(worldID); + if (securityOriginIter != m_isolatedWorldSecurityOrigins.end()) isolatedContext->setSecurityOrigin(securityOriginIter->second); } else { isolatedContext = new V8IsolatedContext(m_frame, extensionGroup, worldID); @@ -310,7 +371,7 @@ void ScriptController::evaluateInIsolatedWorld(unsigned worldID, const Vector<Sc v8::Local<v8::Array> resultArray = v8::Array::New(sources.size()); for (size_t i = 0; i < sources.size(); ++i) { - v8::Local<v8::Value> evaluationResult = m_proxy->evaluate(sources[i], 0); + v8::Local<v8::Value> evaluationResult = compileAndRunScript(sources[i]); if (evaluationResult.IsEmpty()) evaluationResult = v8::Local<v8::Value>::New(v8::Undefined()); resultArray->Set(i, evaluationResult); @@ -331,38 +392,12 @@ void ScriptController::evaluateInIsolatedWorld(unsigned worldID, const Vector<Sc void ScriptController::setIsolatedWorldSecurityOrigin(int worldID, PassRefPtr<SecurityOrigin> securityOrigin) { ASSERT(worldID); - m_proxy->isolatedWorldSecurityOrigins().set(worldID, securityOrigin); - IsolatedWorldMap::iterator iter = m_proxy->isolatedWorlds().find(worldID); - if (iter != m_proxy->isolatedWorlds().end()) + m_isolatedWorldSecurityOrigins.set(worldID, securityOrigin); + IsolatedWorldMap::iterator iter = m_isolatedWorlds.find(worldID); + if (iter != m_isolatedWorlds.end()) iter->second->setSecurityOrigin(securityOrigin); } -// Evaluate a script file in the environment of this proxy. -ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode) -{ - String sourceURL = sourceCode.url(); - const String* savedSourceURL = m_sourceURL; - m_sourceURL = &sourceURL; - - v8::HandleScope handleScope; - v8::Handle<v8::Context> v8Context = ScriptController::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); - - m_sourceURL = savedSourceURL; - - if (object.IsEmpty()) - return ScriptValue(); - - return ScriptValue(object); -} - TextPosition ScriptController::eventHandlerPosition() const { ScriptableDocumentParser* parser = m_frame->document()->scriptableDocumentParser(); @@ -373,7 +408,17 @@ TextPosition ScriptController::eventHandlerPosition() const void ScriptController::finishedWithEvent(Event* event) { - m_proxy->finishedWithEvent(event); +} + +v8::Local<v8::Context> ScriptController::currentWorldContext() +{ + if (V8IsolatedContext* isolatedContext = V8IsolatedContext::getEntered()) { + RefPtr<SharedPersistent<v8::Context> > context = isolatedContext->sharedContext(); + if (m_frame != toFrameIfNotDetached(context->get())) + return v8::Local<v8::Context>(); + return v8::Local<v8::Context>::New(context->get()); + } + return mainWorldContext(); } v8::Local<v8::Context> ScriptController::mainWorldContext() @@ -390,6 +435,24 @@ v8::Local<v8::Context> ScriptController::mainWorldContext(Frame* frame) return frame->script()->mainWorldContext(); } +bool ScriptController::matchesCurrentContext() +{ + // This method is equivalent to 'return v8::Context::GetCurrent() == contextForCurrentWorld()', + // but is written without using contextForCurrentWorld(). + // Given that this method is used by a hot call path of DOM object constructor, + // we want to avoid the overhead of contextForCurrentWorld() creating Local<Context> every time. + v8::Handle<v8::Context> context; + if (V8IsolatedContext* isolatedContext = V8IsolatedContext::getEntered()) { + context = isolatedContext->sharedContext()->get(); + if (m_frame != toFrameIfNotDetached(context)) + return false; + } else { + windowShell()->initContextIfNeeded(); + context = windowShell()->context(); + } + return context == v8::Context::GetCurrent(); +} + // Create a V8 object with an interceptor of NPObjectPropertyGetter. void ScriptController::bindToWindowObject(Frame* frame, const String& key, NPObject* object) { @@ -598,7 +661,7 @@ void ScriptController::setCaptureCallStackForUncaughtExceptions(bool value) void ScriptController::collectIsolatedContexts(Vector<std::pair<ScriptState*, SecurityOrigin*> >& result) { v8::HandleScope handleScope; - for (IsolatedWorldMap::iterator it = m_proxy->isolatedWorlds().begin(); it != m_proxy->isolatedWorlds().end(); ++it) { + for (IsolatedWorldMap::iterator it = m_isolatedWorlds.begin(); it != m_isolatedWorlds.end(); ++it) { V8IsolatedContext* isolatedContext = it->second; if (!isolatedContext->securityOrigin()) continue; diff --git a/Source/WebCore/bindings/v8/ScriptController.h b/Source/WebCore/bindings/v8/ScriptController.h index d67836030..ca59838ac 100644 --- a/Source/WebCore/bindings/v8/ScriptController.h +++ b/Source/WebCore/bindings/v8/ScriptController.h @@ -88,7 +88,10 @@ public: // 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. + v8::Local<v8::Value> compileAndRunScript(const ScriptSourceCode&); + + // Evaluate JavaScript in the main world. + // The caller must hold an execution context. ScriptValue evaluate(const ScriptSourceCode&); // Evaluate JavaScript in a new isolated world. The script gets its own @@ -154,10 +157,13 @@ public: // V8Proxy::retrieveFrameForEnteredContext() for more information. static Frame* retrieveFrameForCurrentContext(); - // Returns V8 Context of a frame. If none exists, creates - // a new context. It is potentially slow and consumes memory. + // Returns V8 Context. If none exists, creates a new context. + // It is potentially slow and consumes memory. static v8::Local<v8::Context> mainWorldContext(Frame*); v8::Local<v8::Context> mainWorldContext(); + v8::Local<v8::Context> currentWorldContext(); + + bool matchesCurrentContext(); // Pass command-line flags to the JS engine. static void setFlags(const char* string, int length); @@ -212,6 +218,13 @@ private: // For the moment, we have one of these. Soon we will have one per DOMWrapperWorld. RefPtr<V8DOMWindowShell> m_windowShell; + // 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(). + IsolatedWorldMap m_isolatedWorlds; + + IsolatedWorldSecurityOriginMap m_isolatedWorldSecurityOrigins; + bool m_paused; OwnPtr<V8Proxy> m_proxy; diff --git a/Source/WebCore/bindings/v8/ScriptInstance.cpp b/Source/WebCore/bindings/v8/ScriptInstance.cpp index 645b1daf2..1f407d0f5 100644 --- a/Source/WebCore/bindings/v8/ScriptInstance.cpp +++ b/Source/WebCore/bindings/v8/ScriptInstance.cpp @@ -31,9 +31,7 @@ #include "config.h" #include "ScriptInstance.h" -#ifndef NDEBUG -#include "V8Proxy.h" -#endif +#include "V8GCController.h" #include <wtf/Assertions.h> namespace WebCore { diff --git a/Source/WebCore/bindings/v8/ScriptObject.cpp b/Source/WebCore/bindings/v8/ScriptObject.cpp index 0266df48e..8154d9705 100644 --- a/Source/WebCore/bindings/v8/ScriptObject.cpp +++ b/Source/WebCore/bindings/v8/ScriptObject.cpp @@ -39,7 +39,6 @@ #include "V8Binding.h" #include "V8InjectedScriptHost.h" #include "V8InspectorFrontendHost.h" -#include "V8Proxy.h" #include <v8.h> diff --git a/Source/WebCore/bindings/v8/ScriptRunner.cpp b/Source/WebCore/bindings/v8/ScriptRunner.cpp new file mode 100644 index 000000000..04f8ea304 --- /dev/null +++ b/Source/WebCore/bindings/v8/ScriptRunner.cpp @@ -0,0 +1,73 @@ +/* + * 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: + * 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 "ScriptRunner.h" + +#include "ScriptExecutionContext.h" +#include "V8Binding.h" +#include "V8GCController.h" +#include "V8RecursionScope.h" + +namespace WebCore { + +v8::Local<v8::Value> ScriptRunner::runCompiledScript(v8::Handle<v8::Script> script, ScriptExecutionContext* context) +{ + if (script.IsEmpty()) + return v8::Local<v8::Value>(); + + V8GCController::checkMemoryUsage(); + if (V8RecursionScope::recursionLevel() >= kMaxRecursionDepth) + return handleMaxRecursionDepthExceeded(); + + if (handleOutOfMemory()) + ASSERT(script.IsEmpty()); + + // Run the script and keep track of the current recursion depth. + v8::Local<v8::Value> result; + v8::TryCatch tryCatch; + tryCatch.SetVerbose(true); + { + V8RecursionScope recursionScope(context); + result = script->Run(); + } + + if (handleOutOfMemory()) + ASSERT(result.IsEmpty()); + + // Handle V8 internal error situation. + if (tryCatch.HasCaught()) { + ASSERT(result.IsEmpty()); + return v8::Local<v8::Value>(); + } + + if (result.IsEmpty()) + return v8::Local<v8::Value>(); + + crashIfV8IsDead(); + return result; +} + +} // namespace WebCore diff --git a/Source/WebCore/bindings/v8/ScriptRunner.h b/Source/WebCore/bindings/v8/ScriptRunner.h new file mode 100644 index 000000000..381576cdd --- /dev/null +++ b/Source/WebCore/bindings/v8/ScriptRunner.h @@ -0,0 +1,42 @@ +/* + * 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: + * 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. + */ + +#ifndef ScriptRunner_h +#define ScriptRunner_h + +#include <v8.h> + +namespace WebCore { + +class ScriptExecutionContext; + +class ScriptRunner { +public: + static v8::Local<v8::Value> runCompiledScript(v8::Handle<v8::Script>, ScriptExecutionContext*); +}; + +} // namespace WebCore + +#endif // ScriptRunner_h diff --git a/Source/WebCore/bindings/v8/ScriptSourceCode.cpp b/Source/WebCore/bindings/v8/ScriptSourceCode.cpp index a478e6817..efff63e17 100644 --- a/Source/WebCore/bindings/v8/ScriptSourceCode.cpp +++ b/Source/WebCore/bindings/v8/ScriptSourceCode.cpp @@ -26,10 +26,34 @@ #include "config.h" #include "ScriptSourceCode.h" +#include "CachedMetadata.h" +#include "CachedScript.h" #include "V8Binding.h" namespace WebCore { +PassOwnPtr<v8::ScriptData> ScriptSourceCode::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 nullptr; + + CachedMetadata* cachedMetadata = cachedScript->cachedMetadata(dataTypeID); + if (cachedMetadata) + return adoptPtr(v8::ScriptData::New(cachedMetadata->data(), cachedMetadata->size())); + + OwnPtr<v8::ScriptData> scriptData = adoptPtr(v8::ScriptData::PreCompile(code)); + cachedScript->setCachedMetadata(dataTypeID, scriptData->Data(), scriptData->Length()); + + return scriptData.release(); +} + v8::Handle<v8::Script> ScriptSourceCode::compileScript(v8::Handle<v8::String> code, const String& fileName, const TextPosition& scriptStartPosition, v8::ScriptData* scriptData) { v8::Handle<v8::String> name = v8String(fileName); diff --git a/Source/WebCore/bindings/v8/ScriptSourceCode.h b/Source/WebCore/bindings/v8/ScriptSourceCode.h index a6543ca81..32f855da7 100644 --- a/Source/WebCore/bindings/v8/ScriptSourceCode.h +++ b/Source/WebCore/bindings/v8/ScriptSourceCode.h @@ -36,6 +36,7 @@ #include "KURL.h" #include "PlatformString.h" #include <v8.h> +#include <wtf/PassOwnPtr.h> #include <wtf/text/TextPosition.h> namespace WebCore { @@ -73,6 +74,7 @@ public: int startLine() const { return m_startPosition.m_line.oneBasedInt(); } const TextPosition& startPosition() const { return m_startPosition; } + static PassOwnPtr<v8::ScriptData> precompileScript(v8::Handle<v8::String>, CachedScript*); static v8::Handle<v8::Script> compileScript(v8::Handle<v8::String>, const String&, const TextPosition&, v8::ScriptData* = 0); private: diff --git a/Source/WebCore/bindings/v8/SerializedScriptValue.cpp b/Source/WebCore/bindings/v8/SerializedScriptValue.cpp index 83bb8f0b3..a9b39ce11 100644 --- a/Source/WebCore/bindings/v8/SerializedScriptValue.cpp +++ b/Source/WebCore/bindings/v8/SerializedScriptValue.cpp @@ -54,7 +54,6 @@ #include "V8Int32Array.h" #include "V8Int8Array.h" #include "V8MessagePort.h" -#include "V8Proxy.h" #include "V8Uint16Array.h" #include "V8Uint32Array.h" #include "V8Uint8Array.h" diff --git a/Source/WebCore/bindings/v8/V8AbstractEventListener.cpp b/Source/WebCore/bindings/v8/V8AbstractEventListener.cpp index bc47766f9..04f399163 100644 --- a/Source/WebCore/bindings/v8/V8AbstractEventListener.cpp +++ b/Source/WebCore/bindings/v8/V8AbstractEventListener.cpp @@ -41,7 +41,6 @@ #include "V8Event.h" #include "V8EventListenerList.h" #include "V8HiddenPropertyName.h" -#include "V8Proxy.h" #include "V8Utilities.h" #include "WorkerContext.h" #include "WorkerContextExecutionProxy.h" diff --git a/Source/WebCore/bindings/v8/V8Binding.cpp b/Source/WebCore/bindings/v8/V8Binding.cpp index 83f126cb9..bf57f8286 100644 --- a/Source/WebCore/bindings/v8/V8Binding.cpp +++ b/Source/WebCore/bindings/v8/V8Binding.cpp @@ -43,8 +43,10 @@ #include "V8DOMWindow.h" #include "V8Element.h" #include "V8ObjectConstructor.h" +#include "V8XPathNSResolver.h" #include "WorkerContext.h" #include "WorkerContextExecutionProxy.h" +#include "XPathNSResolver.h" #include <wtf/MathExtras.h> #include <wtf/MainThread.h> @@ -240,6 +242,16 @@ PassRefPtr<DOMStringList> toDOMStringList(v8::Handle<v8::Value> value) return ret.release(); } +PassRefPtr<XPathNSResolver> toXPathNSResolver(v8::Handle<v8::Value> value) +{ + 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; +} + DOMWindow* toDOMWindow(v8::Handle<v8::Context> context) { v8::Handle<v8::Object> global = context->Global(); @@ -307,6 +319,12 @@ bool handleOutOfMemory() return true; } +v8::Local<v8::Value> handleMaxRecursionDepthExceeded() +{ + throwError(RangeError, "Maximum call stack size exceeded."); + return v8::Local<v8::Value>(); +} + void crashIfV8IsDead() { if (v8::V8::IsDead()) { diff --git a/Source/WebCore/bindings/v8/V8Binding.h b/Source/WebCore/bindings/v8/V8Binding.h index 5bb4c0154..2333cede0 100644 --- a/Source/WebCore/bindings/v8/V8Binding.h +++ b/Source/WebCore/bindings/v8/V8Binding.h @@ -40,7 +40,6 @@ #include "V8HiddenPropertyName.h" #include "V8ObjectConstructor.h" #include "V8PerIsolateData.h" -#include "V8Proxy.h" #include "V8StringResource.h" #include "V8ThrowException.h" #include "V8ValueCache.h" @@ -51,6 +50,10 @@ namespace WebCore { class DOMStringList; + class ScriptExecutionContext; + class WorldContextHandle; + + const int kMaxRecursionDepth = 22; // Schedule a DOM exception to be thrown, if the exception code is different // from zero. @@ -348,6 +351,7 @@ namespace WebCore { v8::Persistent<v8::FunctionTemplate> createRawTemplate(); PassRefPtr<DOMStringList> toDOMStringList(v8::Handle<v8::Value>); + PassRefPtr<XPathNSResolver> toXPathNSResolver(v8::Handle<v8::Value>); // Returns the window object associated with a context. DOMWindow* toDOMWindow(v8::Handle<v8::Context>); @@ -365,6 +369,7 @@ namespace WebCore { // If the current context causes out of memory, JavaScript setting // is disabled and it returns true. bool handleOutOfMemory(); + v8::Local<v8::Value> handleMaxRecursionDepthExceeded(); void crashIfV8IsDead(); diff --git a/Source/WebCore/bindings/v8/V8BindingMacros.h b/Source/WebCore/bindings/v8/V8BindingMacros.h index 0e3802244..f4cab8b85 100644 --- a/Source/WebCore/bindings/v8/V8BindingMacros.h +++ b/Source/WebCore/bindings/v8/V8BindingMacros.h @@ -33,6 +33,12 @@ namespace WebCore { +#if defined(ENABLE_DOM_STATS_COUNTERS) && PLATFORM(CHROMIUM) +#define INC_STATS(name) StatsCounter::incrementStatsCounter(name) +#else +#define INC_STATS(name) +#endif + enum ParameterDefaultPolicy { DefaultIsUndefined, DefaultIsNullString diff --git a/Source/WebCore/bindings/v8/V8Collection.h b/Source/WebCore/bindings/v8/V8Collection.h index 281f8ec62..5dff6e7f0 100644 --- a/Source/WebCore/bindings/v8/V8Collection.h +++ b/Source/WebCore/bindings/v8/V8Collection.h @@ -35,7 +35,6 @@ #include "HTMLSelectElement.h" #include "V8Binding.h" #include "V8Node.h" -#include "V8Proxy.h" #include <v8.h> namespace WebCore { diff --git a/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp b/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp index 80204668f..3e6a78e24 100644 --- a/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp +++ b/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp @@ -61,7 +61,6 @@ #include "V8Location.h" #include "V8ObjectConstructor.h" #include "V8PerContextData.h" -#include "V8Proxy.h" #include "WorkerContextExecutionProxy.h" #include <algorithm> diff --git a/Source/WebCore/bindings/v8/V8DOMWrapper.cpp b/Source/WebCore/bindings/v8/V8DOMWrapper.cpp index 31ff31da3..f51b67bbe 100644 --- a/Source/WebCore/bindings/v8/V8DOMWrapper.cpp +++ b/Source/WebCore/bindings/v8/V8DOMWrapper.cpp @@ -52,15 +52,12 @@ #include "V8NodeList.h" #include "V8ObjectConstructor.h" #include "V8PerContextData.h" -#include "V8Proxy.h" #include "V8StyleSheet.h" #include "V8WorkerContextEventListener.h" -#include "V8XPathNSResolver.h" #include "WebGLContextAttributes.h" #include "WebGLUniformLocation.h" #include "WorkerContextExecutionProxy.h" #include "WrapperTypeInfo.h" -#include "XPathNSResolver.h" #include <algorithm> #include <utility> #include <v8-debug.h> @@ -110,12 +107,6 @@ v8::Local<v8::Function> V8DOMWrapper::constructorForType(WrapperTypeInfo* type, } #endif -V8PerContextData* V8DOMWrapper::perContextData(V8Proxy* proxy) -{ - V8DOMWindowShell* shell = proxy->windowShell(); - return shell ? shell->perContextData() : 0; -} - #if ENABLE(WORKERS) V8PerContextData* V8DOMWrapper::perContextData(WorkerContext*) { @@ -135,7 +126,7 @@ void V8DOMWrapper::setNamedHiddenWindowReference(Frame* frame, const char* name, // Get DOMWindow if (!frame) return; // Object might be detached from window - v8::Handle<v8::Context> context = V8Proxy::context(frame); + v8::Handle<v8::Context> context = frame->script()->currentWorldContext(); if (context.IsEmpty()) return; @@ -166,23 +157,19 @@ PassRefPtr<NodeFilter> V8DOMWrapper::wrapNativeNodeFilter(v8::Handle<v8::Value> return NodeFilter::create(V8NodeFilterCondition::create(filter)); } -v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(V8Proxy* proxy, WrapperTypeInfo* type, void* impl) +v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(Frame* frame, WrapperTypeInfo* type, void* impl) { #if ENABLE(WORKERS) WorkerContext* workerContext = 0; #endif - V8PerContextData* contextData = 0; - V8IsolatedContext* isolatedContext; - if (UNLIKELY(!!(isolatedContext = V8IsolatedContext::getEntered()))) { - contextData = isolatedContext->perContextData(); - } else if (!proxy) { + if (!frame) { 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 (isWrapperOfType(globalPrototype, &V8DOMWindow::info)) { - Frame* frame = V8DOMWindow::toNative(globalPrototype)->frame(); - if (frame && frame->script()->canExecuteScripts(NotAboutToExecuteScript)) - proxy = frame->script()->proxy(); + Frame* globalFrame = V8DOMWindow::toNative(globalPrototype)->frame(); + if (globalFrame && globalFrame->script()->canExecuteScripts(NotAboutToExecuteScript)) + frame = globalFrame; } #if ENABLE(WORKERS) else if (isWrapperOfType(globalPrototype, &V8WorkerContext::info)) @@ -191,23 +178,21 @@ v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(V8Proxy* proxy, WrapperT } } - v8::Local<v8::Object> instance; - if (!contextData) { - if (proxy) - contextData = perContextData(proxy); + V8PerContextData* contextData = 0; + if (frame) + contextData = perContextDataForCurrentWorld(frame); #if ENABLE(WORKERS) - else if (workerContext) - contextData = perContextData(workerContext); + else if (workerContext) + contextData = perContextData(workerContext); #endif - } + v8::Local<v8::Object> instance; if (contextData) instance = contextData->createWrapperFromCache(type); else { v8::Local<v8::Function> function = type->getTemplate()->GetFunction(); instance = V8ObjectConstructor::newInstance(function); } - if (!instance.IsEmpty()) { // Avoid setting the DOM wrapper for failed allocations. setDOMWrapper(instance, type, impl); @@ -293,16 +278,4 @@ PassRefPtr<EventListener> V8DOMWrapper::getEventListener(v8::Local<v8::Value> va #endif } -// 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; -} - - } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/V8DOMWrapper.h b/Source/WebCore/bindings/v8/V8DOMWrapper.h index d9e8059e4..f66e89e49 100644 --- a/Source/WebCore/bindings/v8/V8DOMWrapper.h +++ b/Source/WebCore/bindings/v8/V8DOMWrapper.h @@ -93,9 +93,6 @@ namespace WebCore { static PassRefPtr<EventListener> getEventListener(v8::Local<v8::Value> value, bool isAttribute, ListenerLookupType lookup); - // XPath-related utilities - static RefPtr<XPathNSResolver> getXPathNSResolver(v8::Handle<v8::Value> value, V8Proxy* proxy = 0); - // Wrap JS node filter in C++. static PassRefPtr<NodeFilter> wrapNativeNodeFilter(v8::Handle<v8::Value>); @@ -125,7 +122,7 @@ namespace WebCore { static void setNamedHiddenReference(v8::Handle<v8::Object> parent, const char* name, v8::Handle<v8::Value> child); static void setNamedHiddenWindowReference(Frame*, const char*, v8::Handle<v8::Value>); - static v8::Local<v8::Object> instantiateV8Object(V8Proxy* proxy, WrapperTypeInfo*, void* impl); + static v8::Local<v8::Object> instantiateV8Object(Frame*, WrapperTypeInfo*, void*); static v8::Handle<v8::Object> getCachedWrapper(Node* node) { @@ -148,7 +145,6 @@ namespace WebCore { return domNodeMap.get(node); } private: - static V8PerContextData* perContextData(V8Proxy*); #if ENABLE(WORKERS) static V8PerContextData* perContextData(WorkerContext*); #endif diff --git a/Source/WebCore/bindings/v8/V8EventListener.cpp b/Source/WebCore/bindings/v8/V8EventListener.cpp index a5eb85e83..e872b17e8 100644 --- a/Source/WebCore/bindings/v8/V8EventListener.cpp +++ b/Source/WebCore/bindings/v8/V8EventListener.cpp @@ -37,7 +37,6 @@ #include "Document.h" #include "Frame.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/V8GCController.cpp b/Source/WebCore/bindings/v8/V8GCController.cpp index 42380ca2a..2a882dc76 100644 --- a/Source/WebCore/bindings/v8/V8GCController.cpp +++ b/Source/WebCore/bindings/v8/V8GCController.cpp @@ -42,6 +42,7 @@ #include "PlatformSupport.h" #include "RetainedDOMInfo.h" #include "RetainedObjectInfo.h" +#include "V8AbstractEventListener.h" #include "V8Binding.h" #include "V8CSSRule.h" #include "V8CSSRuleList.h" diff --git a/Source/WebCore/bindings/v8/V8LazyEventListener.cpp b/Source/WebCore/bindings/v8/V8LazyEventListener.cpp index 91f782888..d548b1607 100644 --- a/Source/WebCore/bindings/v8/V8LazyEventListener.cpp +++ b/Source/WebCore/bindings/v8/V8LazyEventListener.cpp @@ -43,7 +43,6 @@ #include "V8HTMLFormElement.h" #include "V8HiddenPropertyName.h" #include "V8Node.h" -#include "V8Proxy.h" #include "V8RecursionScope.h" #include "WorldContextHandle.h" diff --git a/Source/WebCore/bindings/v8/V8NPObject.cpp b/Source/WebCore/bindings/v8/V8NPObject.cpp index 7bc073b83..a5b3d1deb 100644 --- a/Source/WebCore/bindings/v8/V8NPObject.cpp +++ b/Source/WebCore/bindings/v8/V8NPObject.cpp @@ -41,7 +41,6 @@ #include "V8HTMLObjectElement.h" #include "V8NPUtils.h" #include "V8ObjectConstructor.h" -#include "V8Proxy.h" #include "npruntime_impl.h" #include "npruntime_priv.h" #include <wtf/OwnArrayPtr.h> diff --git a/Source/WebCore/bindings/v8/V8NPUtils.cpp b/Source/WebCore/bindings/v8/V8NPUtils.cpp index 13cd55ef6..dfd751e32 100644 --- a/Source/WebCore/bindings/v8/V8NPUtils.cpp +++ b/Source/WebCore/bindings/v8/V8NPUtils.cpp @@ -39,7 +39,6 @@ #include "NPV8Object.h" #include "V8Binding.h" #include "V8NPObject.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/V8Proxy.cpp b/Source/WebCore/bindings/v8/V8Proxy.cpp index 0c025c176..ed36d8675 100644 --- a/Source/WebCore/bindings/v8/V8Proxy.cpp +++ b/Source/WebCore/bindings/v8/V8Proxy.cpp @@ -45,6 +45,7 @@ #include "PlatformSupport.h" #include "ScriptCallStack.h" #include "ScriptCallStackFactory.h" +#include "ScriptRunner.h" #include "ScriptSourceCode.h" #include "SecurityOrigin.h" #include "Settings.h" @@ -77,13 +78,6 @@ namespace WebCore { -// FIXME: This will be soon removed when we move runScript() to ScriptController. -static v8::Local<v8::Value> handleMaxRecursionDepthExceeded() -{ - throwError(RangeError, "Maximum call stack size exceeded."); - return v8::Local<v8::Value>(); -} - V8Proxy::V8Proxy(Frame* frame) : m_frame(frame) { @@ -94,158 +88,9 @@ V8Proxy::~V8Proxy() windowShell()->destroyGlobal(); } -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 nullptr; - - CachedMetadata* cachedMetadata = cachedScript->cachedMetadata(dataTypeID); - if (cachedMetadata) - return adoptPtr(v8::ScriptData::New(cachedMetadata->data(), cachedMetadata->size())); - - OwnPtr<v8::ScriptData> scriptData = adoptPtr(v8::ScriptData::PreCompile(code)); - cachedScript->setCachedMetadata(dataTypeID, scriptData->Data(), scriptData->Length()); - - return scriptData.release(); -} - -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) - TRACE_EVENT_BEGIN0("v8", "v8.compile"); -#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 = ScriptSourceCode::compileScript(code, source.url(), source.startPosition(), scriptData.get()); -#if PLATFORM(CHROMIUM) - TRACE_EVENT_END0("v8", "v8.compile"); - TRACE_EVENT0("v8", "v8.run"); -#endif - result = runScript(script); - } - - InspectorInstrumentation::didEvaluateScript(cookie); - - return result; -} - -v8::Local<v8::Value> V8Proxy::runScript(v8::Handle<v8::Script> script) -{ - if (script.IsEmpty()) - return v8::Local<v8::Value>(); - - V8GCController::checkMemoryUsage(); - if (V8RecursionScope::recursionLevel() >= kMaxRecursionDepth) - return handleMaxRecursionDepthExceeded(); - - if (handleOutOfMemory()) - ASSERT(script.IsEmpty()); - - // Keep Frame (and therefore ScriptController and V8Proxy) alive. - RefPtr<Frame> protect(frame()); - - // Run the script and keep track of the current recursion depth. - v8::Local<v8::Value> result; - v8::TryCatch tryCatch; - tryCatch.SetVerbose(true); - { - V8RecursionScope recursionScope(frame()->document()); - result = script->Run(); - } - - if (handleOutOfMemory()) - ASSERT(result.IsEmpty()); - - // Handle V8 internal error situation (Out-of-memory). - if (tryCatch.HasCaught()) { - ASSERT(result.IsEmpty()); - return v8::Local<v8::Value>(); - } - - if (result.IsEmpty()) - return v8::Local<v8::Value>(); - - crashIfV8IsDead(); - return result; -} - V8DOMWindowShell* V8Proxy::windowShell() const { return frame()->script()->windowShell(); } -v8::Local<v8::Context> V8Proxy::context(Frame* frame) -{ - v8::Local<v8::Context> context = ScriptController::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 != toFrameIfNotDetached(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 != toFrameIfNotDetached(context->get())) - return v8::Local<v8::Context>(); - return v8::Local<v8::Context>::New(context->get()); - } - return frame()->script()->mainWorldContext(); -} - -v8::Local<v8::Context> V8Proxy::isolatedWorldContext(int worldId) -{ - IsolatedWorldMap::iterator iter = m_isolatedWorlds.find(worldId); - if (iter == m_isolatedWorlds.end()) - return v8::Local<v8::Context>(); - return v8::Local<v8::Context>::New(iter->second->context()); -} - -bool V8Proxy::matchesCurrentContext() -{ - v8::Handle<v8::Context> context; - if (V8IsolatedContext* isolatedContext = V8IsolatedContext::getEntered()) { - context = isolatedContext->sharedContext()->get(); - if (m_frame != toFrameIfNotDetached(context)) - return false; - } else { - windowShell()->initContextIfNeeded(); - context = windowShell()->context(); - } - return context == context->GetCurrent(); -} - } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/V8Proxy.h b/Source/WebCore/bindings/v8/V8Proxy.h index a62a60862..07a7781e2 100644 --- a/Source/WebCore/bindings/v8/V8Proxy.h +++ b/Source/WebCore/bindings/v8/V8Proxy.h @@ -46,12 +46,6 @@ #include <wtf/Vector.h> #include <wtf/text/TextPosition.h> -#if defined(ENABLE_DOM_STATS_COUNTERS) && PLATFORM(CHROMIUM) -#define INC_STATS(name) StatsCounter::incrementStatsCounter(name) -#else -#define INC_STATS(name) -#endif - namespace WebCore { class CachedScript; @@ -67,8 +61,6 @@ namespace WebCore { class V8PerContextData; class WorldContextHandle; - const int kMaxRecursionDepth = 22; - // 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(). @@ -87,46 +79,12 @@ namespace WebCore { Frame* frame() const { return m_frame; } - void finishedWithEvent(Event*) { } - - // 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>); - - // 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*); - - v8::Local<v8::Context> context(); - v8::Local<v8::Context> isolatedWorldContext(int worldId); - bool matchesCurrentContext(); - // FIXME: This should eventually take DOMWrapperWorld argument! // FIXME: This method will be soon removed, as all methods that access windowShell() // will be moved to ScriptController. V8DOMWindowShell* windowShell() const; - - // FIXME: Move m_isolatedWorlds to ScriptController and remove this getter. - IsolatedWorldMap& isolatedWorlds() { return m_isolatedWorlds; } - - // FIXME: Move m_isolatedWorldSecurityOrigins to ScriptController and remove this getter. - IsolatedWorldSecurityOriginMap& isolatedWorldSecurityOrigins() { return m_isolatedWorldSecurityOrigins; } - private: - PassOwnPtr<v8::ScriptData> precompileScript(v8::Handle<v8::String>, CachedScript*); - Frame* m_frame; - - // 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(). - IsolatedWorldMap m_isolatedWorlds; - - IsolatedWorldSecurityOriginMap m_isolatedWorldSecurityOrigins; }; } diff --git a/Source/WebCore/bindings/v8/V8Utilities.cpp b/Source/WebCore/bindings/v8/V8Utilities.cpp index 4cfe531ea..0a45dddf0 100644 --- a/Source/WebCore/bindings/v8/V8Utilities.cpp +++ b/Source/WebCore/bindings/v8/V8Utilities.cpp @@ -41,7 +41,6 @@ #include "V8ArrayBuffer.h" #include "V8Binding.h" #include "V8MessagePort.h" -#include "V8Proxy.h" #include "WorkerContext.h" #include <v8.h> #include <wtf/ArrayBuffer.h> @@ -104,13 +103,19 @@ bool extractTransferables(v8::Local<v8::Value> value, MessagePortArray& ports, A v8::Local<v8::Value> transferrable = transferrables->Get(i); // Validation of non-null objects, per HTML5 spec 10.3.3. if (isUndefinedOrNull(transferrable)) { - setDOMException(DATA_CLONE_ERR, isolate); + setDOMException(INVALID_STATE_ERR, isolate); return false; } // Validation of Objects implementing an interface, per WebIDL spec 4.1.15. - if (V8MessagePort::HasInstance(transferrable)) - ports.append(V8MessagePort::toNative(v8::Handle<v8::Object>::Cast(transferrable))); - else if (V8ArrayBuffer::HasInstance(transferrable)) + if (V8MessagePort::HasInstance(transferrable)) { + RefPtr<MessagePort> port = V8MessagePort::toNative(v8::Handle<v8::Object>::Cast(transferrable)); + // Check for duplicate MessagePorts. + if (ports.contains(port)) { + setDOMException(INVALID_STATE_ERR, isolate); + return false; + } + ports.append(port.release()); + } else if (V8ArrayBuffer::HasInstance(transferrable)) arrayBuffers.append(V8ArrayBuffer::toNative(v8::Handle<v8::Object>::Cast(transferrable))); else { throwTypeError(); diff --git a/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp b/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp index b0f051e8f..e7059fe69 100644 --- a/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp +++ b/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp @@ -45,6 +45,7 @@ #include "V8DOMMap.h" #include "V8DOMWindowShell.h" #include "V8DedicatedWorkerContext.h" +#include "V8GCController.h" #include "V8ObjectConstructor.h" #include "V8PerContextData.h" #include "V8RecursionScope.h" diff --git a/Source/WebCore/bindings/v8/WorkerScriptController.cpp b/Source/WebCore/bindings/v8/WorkerScriptController.cpp index d67895129..917849666 100644 --- a/Source/WebCore/bindings/v8/WorkerScriptController.cpp +++ b/Source/WebCore/bindings/v8/WorkerScriptController.cpp @@ -39,7 +39,6 @@ #include "ScriptSourceCode.h" #include "ScriptValue.h" #include "V8DOMMap.h" -#include "V8Proxy.h" #include "V8WorkerContext.h" #include "WorkerContext.h" #include "WorkerContextExecutionProxy.h" diff --git a/Source/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp b/Source/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp index 672c2ab9d..fb00a1ad7 100644 --- a/Source/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp @@ -37,7 +37,6 @@ #include "ExceptionCode.h" #include "V8ArrayBuffer.h" #include "V8Binding.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h b/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h index 12be5b309..1ce2bebd1 100644 --- a/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h +++ b/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h @@ -37,7 +37,6 @@ #include "V8ArrayBuffer.h" #include "V8ArrayBufferCustom.h" #include "V8Binding.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8AudioBufferSourceNodeCustom.cpp b/Source/WebCore/bindings/v8/custom/V8AudioBufferSourceNodeCustom.cpp index 0fd9506d7..0b024612e 100644 --- a/Source/WebCore/bindings/v8/custom/V8AudioBufferSourceNodeCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8AudioBufferSourceNodeCustom.cpp @@ -33,7 +33,6 @@ #include "ExceptionCode.h" #include "V8AudioBuffer.h" #include "V8Binding.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp b/Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp index 13d0d2699..56b12dcdf 100644 --- a/Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp @@ -35,7 +35,6 @@ #include "V8ArrayBuffer.h" #include "V8AudioBuffer.h" #include "V8Binding.h" -#include "V8Proxy.h" #include <wtf/ArrayBuffer.h> namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8BlobCustom.cpp b/Source/WebCore/bindings/v8/custom/V8BlobCustom.cpp index 6ebcc2d64..1112e5406 100644 --- a/Source/WebCore/bindings/v8/custom/V8BlobCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8BlobCustom.cpp @@ -37,7 +37,6 @@ #include "V8Binding.h" #include "V8Blob.h" #include "V8File.h" -#include "V8Proxy.h" #include "V8Utilities.h" #include "WebKitBlobBuilder.h" #include <wtf/RefPtr.h> diff --git a/Source/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp b/Source/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp index 007bd9ab7..dd0800fbb 100644 --- a/Source/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp @@ -39,7 +39,6 @@ #include "EventTarget.h" #include "V8Binding.h" -#include "V8Proxy.h" #include <wtf/text/StringBuilder.h> #include <wtf/text/StringConcatenate.h> diff --git a/Source/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp b/Source/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp index a27fd01e7..4060096cb 100644 --- a/Source/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp @@ -45,7 +45,6 @@ #include "V8HTMLImageElement.h" #include "V8HTMLVideoElement.h" #include "V8ImageData.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp b/Source/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp index 875f64e68..06635228b 100644 --- a/Source/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp @@ -40,7 +40,6 @@ #include "V8Binding.h" #include "V8Node.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp b/Source/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp index d8a9b1ff2..99d127d6b 100644 --- a/Source/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp @@ -38,7 +38,6 @@ #include "ScriptCallStackFactory.h" #include "V8Binding.h" #include "V8MemoryInfo.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp b/Source/WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp index 8289eb2b2..8238ad6b7 100644 --- a/Source/WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp @@ -28,7 +28,6 @@ #include "Coordinates.h" #include "V8Binding.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp b/Source/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp index fb790b10a..b97f7d76b 100644 --- a/Source/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp +++ b/Source/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp @@ -36,7 +36,6 @@ #include "ScriptExecutionContext.h" #include "V8Callback.h" -#include "V8Proxy.h" #include "V8SQLError.h" #include "V8SQLTransaction.h" #include <wtf/Assertions.h> diff --git a/Source/WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp index ae7e9072f..33be7e99d 100644 --- a/Source/WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp @@ -35,7 +35,6 @@ #include "V8Binding.h" #include "V8Blob.h" #include "V8HTMLFormElement.h" -#include "V8Proxy.h" #include "V8Utilities.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp index b8aa4face..7280d91c5 100644 --- a/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp @@ -61,7 +61,6 @@ #include "V8HiddenPropertyName.h" #include "V8HTMLCollection.h" #include "V8Node.h" -#include "V8Proxy.h" #include "V8Utilities.h" #include "WindowFeatures.h" #include <wtf/ArrayBuffer.h> @@ -121,7 +120,8 @@ v8::Handle<v8::Value> WindowSetTimeoutImpl(const v8::Arguments& args, bool singl } // params is passed to action, and released in action's destructor - OwnPtr<ScheduledAction> action = adoptPtr(new ScheduledAction(V8Proxy::context(imp->frame()), v8::Handle<v8::Function>::Cast(function), paramCount, params)); + ASSERT(imp->frame()); + OwnPtr<ScheduledAction> action = adoptPtr(new ScheduledAction(imp->frame()->script()->currentWorldContext(), v8::Handle<v8::Function>::Cast(function), paramCount, params)); // FIXME: We should use OwnArrayPtr for params. delete[] params; @@ -131,7 +131,8 @@ v8::Handle<v8::Value> WindowSetTimeoutImpl(const v8::Arguments& args, bool singl RefPtr<ScriptCallStack> callStack(createScriptCallStackForInspector()); if (imp->document() && !imp->document()->contentSecurityPolicy()->allowEval(callStack.release())) return v8Integer(0, args.GetIsolate()); - id = DOMTimer::install(scriptContext, adoptPtr(new ScheduledAction(V8Proxy::context(imp->frame()), functionString)), timeout, singleShot); + ASSERT(imp->frame()); + id = DOMTimer::install(scriptContext, adoptPtr(new ScheduledAction(imp->frame()->script()->currentWorldContext(), functionString)), timeout, singleShot); } // Try to do the idle notification before the timeout expires to get better @@ -154,7 +155,8 @@ v8::Handle<v8::Value> V8DOMWindow::eventAccessorGetter(v8::Local<v8::String> nam if (!BindingSecurity::shouldAllowAccessToFrame(BindingState::instance(), frame)) return v8::Undefined(); - v8::Local<v8::Context> context = V8Proxy::context(frame); + ASSERT(frame); + v8::Local<v8::Context> context = frame->script()->currentWorldContext(); if (context.IsEmpty()) return v8::Undefined(); @@ -175,7 +177,8 @@ void V8DOMWindow::eventAccessorSetter(v8::Local<v8::String> name, v8::Local<v8:: if (!BindingSecurity::shouldAllowAccessToFrame(BindingState::instance(), frame)) return; - v8::Local<v8::Context> context = V8Proxy::context(frame); + ASSERT(frame); + v8::Local<v8::Context> context = frame->script()->currentWorldContext(); if (context.IsEmpty()) return; @@ -402,7 +405,7 @@ private: inline void DialogHandler::dialogCreated(DOMWindow* dialogFrame) { - m_dialogContext = V8Proxy::context(dialogFrame->frame()); + m_dialogContext = dialogFrame->frame() ? dialogFrame->frame()->script()->currentWorldContext() : v8::Local<v8::Context>(); if (m_dialogContext.IsEmpty()) return; if (m_dialogArguments.IsEmpty()) @@ -621,7 +624,7 @@ v8::Handle<v8::Value> toV8(DOMWindow* window, v8::Isolate* isolate) } // Otherwise, return the global object associated with this frame. - v8::Handle<v8::Context> context = V8Proxy::context(frame); + v8::Handle<v8::Context> context = frame->script()->currentWorldContext(); if (context.IsEmpty()) return v8Undefined(); diff --git a/Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp index afb207c76..2f12a56b2 100755 --- a/Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp @@ -29,7 +29,6 @@ #include "V8ArrayBufferViewCustom.h" #include "V8Binding.h" #include "V8DataView.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp index 0cb6eca44..d2a24186b 100644 --- a/Source/WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp @@ -37,7 +37,6 @@ #include "DedicatedWorkerContext.h" #include "WorkerContextExecutionProxy.h" #include "V8Binding.h" -#include "V8Proxy.h" #include "V8Utilities.h" #include "V8WorkerContextEventListener.h" diff --git a/Source/WebCore/bindings/v8/custom/V8DeviceMotionEventCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DeviceMotionEventCustom.cpp index 610a34bdc..83ff773b7 100644 --- a/Source/WebCore/bindings/v8/custom/V8DeviceMotionEventCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8DeviceMotionEventCustom.cpp @@ -30,7 +30,6 @@ #include "DeviceMotionData.h" #include "V8Binding.h" -#include "V8Proxy.h" #include <v8.h> diff --git a/Source/WebCore/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp index 128302439..c6861bae9 100644 --- a/Source/WebCore/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp @@ -30,7 +30,6 @@ #include "DeviceOrientationData.h" #include "V8Binding.h" -#include "V8Proxy.h" #include <v8.h> diff --git a/Source/WebCore/bindings/v8/custom/V8DocumentCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DocumentCustom.cpp index ce72b602a..3ef19f255 100644 --- a/Source/WebCore/bindings/v8/custom/V8DocumentCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8DocumentCustom.cpp @@ -48,7 +48,6 @@ #include "V8HTMLDocument.h" #include "V8IsolatedContext.h" #include "V8Node.h" -#include "V8Proxy.h" #include "V8Touch.h" #include "V8TouchList.h" #if ENABLE(WEBGL) @@ -76,7 +75,7 @@ v8::Handle<v8::Value> V8Document::evaluateCallback(const v8::Arguments& args) if (V8Node::HasInstance(args[1])) contextNode = V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])); - RefPtr<XPathNSResolver> resolver = V8DOMWrapper::getXPathNSResolver(args[2]); + RefPtr<XPathNSResolver> resolver = toXPathNSResolver(args[2]); if (!resolver && !args[2]->IsNull() && !args[2]->IsUndefined()) return setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate()); diff --git a/Source/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp index 7613a14b1..304aadd52 100644 --- a/Source/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp @@ -30,7 +30,6 @@ #include "Location.h" #include "V8Binding.h" #include "V8Location.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8EntryCustom.cpp b/Source/WebCore/bindings/v8/custom/V8EntryCustom.cpp index a6179c2e5..ced418558 100644 --- a/Source/WebCore/bindings/v8/custom/V8EntryCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8EntryCustom.cpp @@ -39,7 +39,6 @@ #include "V8DirectoryEntry.h" #include "V8Entry.h" #include "V8FileEntry.h" -#include "V8Proxy.h" #include <wtf/RefPtr.h> namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8EntrySyncCustom.cpp b/Source/WebCore/bindings/v8/custom/V8EntrySyncCustom.cpp index c89e48979..c8cc3809a 100644 --- a/Source/WebCore/bindings/v8/custom/V8EntrySyncCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8EntrySyncCustom.cpp @@ -39,7 +39,6 @@ #include "V8DirectoryEntrySync.h" #include "V8EntrySync.h" #include "V8FileEntrySync.h" -#include "V8Proxy.h" #include <wtf/RefPtr.h> namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8EventCustom.cpp b/Source/WebCore/bindings/v8/custom/V8EventCustom.cpp index 9da52c74f..67f1a73e9 100644 --- a/Source/WebCore/bindings/v8/custom/V8EventCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8EventCustom.cpp @@ -39,7 +39,6 @@ #include "EventNames.h" #include "V8Binding.h" #include "V8Clipboard.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp index 6bcdc71c9..4fdf3adef 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp @@ -37,7 +37,6 @@ #include "V8NamedNodesCollection.h" #include "V8Node.h" #include "V8NodeList.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp index f9e36cb6b..5d268201e 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp @@ -40,7 +40,6 @@ #include "V8Binding.h" #include "V8CanvasRenderingContext2D.h" #include "V8Node.h" -#include "V8Proxy.h" #if ENABLE(WEBGL) #include "InspectorWebGLInstrumentation.h" #include "V8WebGLRenderingContext.h" diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp index eb0fd25d2..45f230e37 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp @@ -38,7 +38,6 @@ #include "V8NamedNodesCollection.h" #include "V8Node.h" #include "V8NodeList.h" -#include "V8Proxy.h" #include "V8RadioNodeList.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp index fb801a761..3f1cbc1ee 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp @@ -44,7 +44,6 @@ #include "V8HTMLCollection.h" #include "V8IsolatedContext.h" #include "V8Node.h" -#include "V8Proxy.h" #include "V8RecursionScope.h" #include <wtf/text/StringBuilder.h> #include <wtf/OwnArrayPtr.h> @@ -142,7 +141,7 @@ v8::Handle<v8::Value> V8HTMLDocument::openCallback(const v8::Arguments& args) if (args.Length() > 2) { if (RefPtr<Frame> frame = htmlDocument->frame()) { // Fetch the global object for the frame. - v8::Local<v8::Context> context = V8Proxy::context(frame.get()); + v8::Local<v8::Context> context = frame->script()->currentWorldContext(); // Bail out if we cannot get the context. if (context.IsEmpty()) return v8::Undefined(); diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp index c650649df..4033629ff 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp @@ -37,7 +37,6 @@ #include "V8NamedNodesCollection.h" #include "V8Node.h" #include "V8NodeList.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLFrameElementCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLFrameElementCustom.cpp index 649cb35a6..3cec8a7ff 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLFrameElementCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLFrameElementCustom.cpp @@ -35,7 +35,6 @@ #include "HTMLFrameElement.h" #include "HTMLNames.h" #include "V8Binding.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp index 0a9693aba..0d993775a 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp @@ -41,7 +41,6 @@ #include "V8Binding.h" #include "V8DOMWindow.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp index 81110b785..05cadeb67 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp @@ -39,7 +39,6 @@ #include "V8Binding.h" #include "V8Document.h" #include "V8HTMLImageElement.h" -#include "V8Proxy.h" #include <wtf/RefPtr.h> namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp index 63825a9b2..72148f026 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp @@ -34,7 +34,6 @@ #include "HTMLInputElement.h" #include "V8Binding.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLLinkElementCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLLinkElementCustom.cpp index 5a3c06fc6..97d4e7324 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLLinkElementCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLLinkElementCustom.cpp @@ -34,7 +34,6 @@ #include "HTMLLinkElement.h" #include "V8Binding.h" #include "V8DOMSettableTokenList.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLMediaElementCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLMediaElementCustom.cpp index ddb517202..bf195b3a1 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLMediaElementCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLMediaElementCustom.cpp @@ -30,7 +30,6 @@ #include "V8HTMLMediaElement.h" #include "V8MediaController.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp index 8ee991d67..215f71fcd 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp @@ -40,7 +40,6 @@ #include "V8HTMLOptionElement.h" #include "V8HTMLSelectElementCustom.h" #include "V8Node.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLOutputElementCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLOutputElementCustom.cpp index 4eeaef639..433da425b 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLOutputElementCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLOutputElementCustom.cpp @@ -34,7 +34,6 @@ #include "HTMLOutputElement.h" #include "V8Binding.h" #include "V8DOMSettableTokenList.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp index 406632574..a40ca22ca 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp @@ -37,7 +37,6 @@ #include "V8HTMLEmbedElement.h" #include "V8HTMLObjectElement.h" #include "V8NPObject.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp index 71473c56c..ca804a747 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp @@ -42,7 +42,6 @@ #include "V8NamedNodesCollection.h" #include "V8Node.h" #include "V8NodeList.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8HistoryCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HistoryCustom.cpp index acdb74972..2198f0cac 100644 --- a/Source/WebCore/bindings/v8/custom/V8HistoryCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HistoryCustom.cpp @@ -38,7 +38,6 @@ #include "V8Binding.h" #include "V8DOMWindow.h" #include "V8HiddenPropertyName.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp index 0fe290b3a..df9d14657 100644 --- a/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp @@ -40,6 +40,7 @@ #include "InspectorValues.h" #include "ScriptDebugServer.h" #include "ScriptValue.h" +#include "V8AbstractEventListener.h" #include "V8Binding.h" #include "V8Database.h" #include "V8Float32Array.h" @@ -52,7 +53,6 @@ #include "V8Int8Array.h" #include "V8NodeList.h" #include "V8Node.h" -#include "V8Proxy.h" #include "V8Storage.h" #include "V8Uint16Array.h" #include "V8Uint32Array.h" diff --git a/Source/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp b/Source/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp index 659fd8b28..95f82261d 100644 --- a/Source/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp @@ -40,7 +40,6 @@ #include "V8Binding.h" #include "V8MouseEvent.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8IntentConstructor.cpp b/Source/WebCore/bindings/v8/custom/V8IntentConstructor.cpp index 848a91656..bd002f7c5 100644 --- a/Source/WebCore/bindings/v8/custom/V8IntentConstructor.cpp +++ b/Source/WebCore/bindings/v8/custom/V8IntentConstructor.cpp @@ -37,7 +37,6 @@ #include "V8DOMWrapper.h" #include "V8Intent.h" #include "V8MessagePort.h" -#include "V8Proxy.h" #include <wtf/ArrayBuffer.h> namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp b/Source/WebCore/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp index 76b5eee31..c17770d4c 100644 --- a/Source/WebCore/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp @@ -34,7 +34,6 @@ #if ENABLE(JAVASCRIPT_DEBUGGER) #include "V8Binding.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8LocationCustom.cpp b/Source/WebCore/bindings/v8/custom/V8LocationCustom.cpp index df9f38527..361b4a5a5 100644 --- a/Source/WebCore/bindings/v8/custom/V8LocationCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8LocationCustom.cpp @@ -42,7 +42,6 @@ #include "V8DOMWindow.h" #include "V8EventListener.h" #include "V8Utilities.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp b/Source/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp index ae355694d..2189aa906 100644 --- a/Source/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp +++ b/Source/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp @@ -36,7 +36,6 @@ #include "MessageChannel.h" #include "V8Binding.h" #include "V8MessagePort.h" -#include "V8Proxy.h" #include "V8Utilities.h" #include "WorkerContext.h" #include "WorkerContextExecutionProxy.h" diff --git a/Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp b/Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp index 922abb153..9200d8ffa 100644 --- a/Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp @@ -39,7 +39,6 @@ #include "V8Blob.h" #include "V8DOMWindow.h" #include "V8MessagePort.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp b/Source/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp index 7fe8faae2..544c7bb2a 100644 --- a/Source/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp @@ -36,7 +36,6 @@ #include "SerializedScriptValue.h" #include "V8Binding.h" #include "V8MessagePort.h" -#include "V8Proxy.h" #include "V8Utilities.h" #include "WorkerContextExecutionProxy.h" diff --git a/Source/WebCore/bindings/v8/custom/V8MutationCallbackCustom.cpp b/Source/WebCore/bindings/v8/custom/V8MutationCallbackCustom.cpp index 7f3095d63..ee3e68022 100644 --- a/Source/WebCore/bindings/v8/custom/V8MutationCallbackCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8MutationCallbackCustom.cpp @@ -39,7 +39,6 @@ #include "V8Callback.h" #include "V8MutationObserver.h" #include "V8MutationRecord.h" -#include "V8Proxy.h" #include <wtf/Assertions.h> #include <wtf/GetPtr.h> #include <wtf/RefCounted.h> diff --git a/Source/WebCore/bindings/v8/custom/V8MutationObserverCustom.cpp b/Source/WebCore/bindings/v8/custom/V8MutationObserverCustom.cpp index 7c9e5250a..d1ce128d9 100644 --- a/Source/WebCore/bindings/v8/custom/V8MutationObserverCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8MutationObserverCustom.cpp @@ -39,7 +39,6 @@ #include "V8Binding.h" #include "V8DOMWrapper.h" #include "V8MutationCallback.h" -#include "V8Proxy.h" #include "V8Utilities.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp b/Source/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp index 6bd2a05b1..667d16810 100644 --- a/Source/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp @@ -37,7 +37,6 @@ #include "V8Binding.h" #include "V8Element.h" #include "V8Node.h" -#include "V8Proxy.h" #include <wtf/RefPtr.h> diff --git a/Source/WebCore/bindings/v8/custom/V8NodeCustom.cpp b/Source/WebCore/bindings/v8/custom/V8NodeCustom.cpp index 3aba2f967..1cab8f12e 100644 --- a/Source/WebCore/bindings/v8/custom/V8NodeCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8NodeCustom.cpp @@ -51,7 +51,6 @@ #include "V8Node.h" #include "V8Notation.h" #include "V8ProcessingInstruction.h" -#include "V8Proxy.h" #include "V8Text.h" #include <wtf/RefPtr.h> diff --git a/Source/WebCore/bindings/v8/custom/V8NodeListCustom.cpp b/Source/WebCore/bindings/v8/custom/V8NodeListCustom.cpp index 595b484ed..e25c128d1 100644 --- a/Source/WebCore/bindings/v8/custom/V8NodeListCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8NodeListCustom.cpp @@ -35,7 +35,6 @@ #include "NodeList.h" #include "V8Binding.h" #include "V8Node.h" -#include "V8Proxy.h" #include <wtf/RefPtr.h> #include <wtf/StdLibExtras.h> diff --git a/Source/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp b/Source/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp index 7626a0b46..3a029d720 100644 --- a/Source/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp @@ -40,7 +40,6 @@ #include "V8Binding.h" #include "V8EventListener.h" #include "V8Notification.h" -#include "V8Proxy.h" #include "V8Utilities.h" #include "V8VoidCallback.h" #include "WorkerContext.h" diff --git a/Source/WebCore/bindings/v8/custom/V8NotificationCustom.cpp b/Source/WebCore/bindings/v8/custom/V8NotificationCustom.cpp index ffc38aa72..7565ffe48 100644 --- a/Source/WebCore/bindings/v8/custom/V8NotificationCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8NotificationCustom.cpp @@ -30,7 +30,6 @@ #include "ExceptionCode.h" #include "V8NotificationPermissionCallback.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp b/Source/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp index 0abf0c043..842a5381f 100644 --- a/Source/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp @@ -36,7 +36,6 @@ #include "SerializedScriptValue.h" #include "V8HiddenPropertyName.h" #include "V8History.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp b/Source/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp index a7c40419b..70911da12 100644 --- a/Source/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp @@ -35,7 +35,6 @@ #include "SQLResultSetRowList.h" #include "V8Binding.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp b/Source/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp index c6622eb43..1ce14c10d 100644 --- a/Source/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp @@ -40,7 +40,6 @@ #include "V8Binding.h" #include "V8SQLStatementCallback.h" #include "V8SQLStatementErrorCallback.h" -#include "V8Proxy.h" #include <wtf/Vector.h> using namespace WTF; diff --git a/Source/WebCore/bindings/v8/custom/V8SQLTransactionSyncCustom.cpp b/Source/WebCore/bindings/v8/custom/V8SQLTransactionSyncCustom.cpp index f6e99d206..83cbf3936 100644 --- a/Source/WebCore/bindings/v8/custom/V8SQLTransactionSyncCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8SQLTransactionSyncCustom.cpp @@ -39,7 +39,6 @@ #include "SQLResultSet.h" #include "SQLValue.h" #include "V8Binding.h" -#include "V8Proxy.h" #include "V8SQLResultSet.h" #include <wtf/Vector.h> diff --git a/Source/WebCore/bindings/v8/custom/V8SVGDocumentCustom.cpp b/Source/WebCore/bindings/v8/custom/V8SVGDocumentCustom.cpp index fa9925bda..797eaabf0 100644 --- a/Source/WebCore/bindings/v8/custom/V8SVGDocumentCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8SVGDocumentCustom.cpp @@ -35,7 +35,6 @@ #include "Frame.h" #include "V8IsolatedContext.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8ScriptProfileCustom.cpp b/Source/WebCore/bindings/v8/custom/V8ScriptProfileCustom.cpp index 2963980b8..0cf56d842 100644 --- a/Source/WebCore/bindings/v8/custom/V8ScriptProfileCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8ScriptProfileCustom.cpp @@ -34,7 +34,6 @@ #include "ScriptProfile.h" #include "V8Binding.h" -#include "V8Proxy.h" #include <v8-profiler.h> diff --git a/Source/WebCore/bindings/v8/custom/V8ScriptProfileNodeCustom.cpp b/Source/WebCore/bindings/v8/custom/V8ScriptProfileNodeCustom.cpp index 845c92471..4f3cb8237 100644 --- a/Source/WebCore/bindings/v8/custom/V8ScriptProfileNodeCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8ScriptProfileNodeCustom.cpp @@ -34,7 +34,6 @@ #include "ScriptProfileNode.h" #include "V8Binding.h" -#include "V8Proxy.h" #include <v8-profiler.h> diff --git a/Source/WebCore/bindings/v8/custom/V8StorageCustom.cpp b/Source/WebCore/bindings/v8/custom/V8StorageCustom.cpp index 5c4dc02d4..cd9fb1632 100644 --- a/Source/WebCore/bindings/v8/custom/V8StorageCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8StorageCustom.cpp @@ -33,7 +33,6 @@ #include "Storage.h" #include "V8Binding.h" -#include "V8Proxy.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8StyleSheetListCustom.cpp b/Source/WebCore/bindings/v8/custom/V8StyleSheetListCustom.cpp index c4e82bb08..904abd4ea 100644 --- a/Source/WebCore/bindings/v8/custom/V8StyleSheetListCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8StyleSheetListCustom.cpp @@ -34,7 +34,6 @@ #include "HTMLStyleElement.h" #include "StyleSheetList.h" #include "V8Binding.h" -#include "V8Proxy.h" #include "V8StyleSheet.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8TrackEventCustom.cpp b/Source/WebCore/bindings/v8/custom/V8TrackEventCustom.cpp index c7c517528..86aaf95ef 100644 --- a/Source/WebCore/bindings/v8/custom/V8TrackEventCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8TrackEventCustom.cpp @@ -36,7 +36,6 @@ #include "TrackBase.h" #include "TrackEvent.h" -#include "V8Proxy.h" #include "V8TextTrack.h" namespace WebCore { diff --git a/Source/WebCore/bindings/v8/custom/V8UndoManagerCustom.cpp b/Source/WebCore/bindings/v8/custom/V8UndoManagerCustom.cpp index c7088bb02..71be095a7 100644 --- a/Source/WebCore/bindings/v8/custom/V8UndoManagerCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8UndoManagerCustom.cpp @@ -31,7 +31,6 @@ #include "DOMTransaction.h" #include "ExceptionCode.h" #include "V8DOMTransaction.h" -#include "V8HiddenPropertyName.h" namespace WebCore { @@ -49,9 +48,7 @@ v8::Handle<v8::Value> V8UndoManager::transactCallback(const v8::Arguments& args) EXCEPTION_BLOCK(bool, merge, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)->BooleanValue()); RefPtr<DOMTransaction> transaction = DOMTransaction::create(WorldContextHandle(UseCurrentWorld)); - v8::Handle<v8::Object> transactionWrapper = v8::Handle<v8::Object>::Cast(toV8(transaction.get())); - - transactionWrapper->SetHiddenValue(V8HiddenPropertyName::domTransactionData(), dictionary); + transaction->setData(dictionary); ExceptionCode ec = 0; imp->transact(transaction, merge, ec); @@ -60,6 +57,37 @@ v8::Handle<v8::Value> V8UndoManager::transactCallback(const v8::Arguments& args) return v8Undefined(); } +v8::Handle<v8::Value> V8UndoManager::itemCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.UndoManager.item"); + if (args.Length() < 1) + return throwNotEnoughArgumentsError(args.GetIsolate()); + UndoManager* imp = V8UndoManager::toNative(args.Holder()); + + EXCEPTION_BLOCK(unsigned, index, toUInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))); + + if (index >= imp->length()) + return v8::Null(args.GetIsolate()); + + const UndoManagerEntry& entry = imp->item(index); + + v8::Handle<v8::Array> result = v8::Array::New(entry.size()); + v8::Isolate* isolate = args.GetIsolate(); + for (size_t index = 0; index < entry.size(); ++index) { + UndoStep* step = entry[index].get(); + if (step->isDOMTransaction()) + result->Set(v8Integer(index, isolate), static_cast<DOMTransaction*>(step)->data()); + else { + // FIXME: We shouldn't be creating new object each time we return. + // Object for the same native editing command should always be the same. + v8::Handle<v8::Object> object = v8::Object::New(); + object->Set(v8::String::NewSymbol("label"), v8::String::New("[Editing command]")); + result->Set(v8Integer(index, isolate), object); + } + } + return result; +} + } // namespace WebCore #endif // ENABLE(UNDO_MANAGER) diff --git a/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp b/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp index 70d780d39..3657cfb1b 100644 --- a/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp @@ -50,7 +50,6 @@ #include "V8OESStandardDerivatives.h" #include "V8OESTextureFloat.h" #include "V8OESVertexArrayObject.h" -#include "V8Proxy.h" #include "V8Uint16Array.h" #include "V8Uint32Array.h" #include "V8Uint8Array.h" diff --git a/Source/WebCore/bindings/v8/custom/V8WebKitAnimationCustom.cpp b/Source/WebCore/bindings/v8/custom/V8WebKitAnimationCustom.cpp index fcbf49d5a..3ec7d9917 100644 --- a/Source/WebCore/bindings/v8/custom/V8WebKitAnimationCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8WebKitAnimationCustom.cpp @@ -27,7 +27,6 @@ #include "V8WebKitAnimation.h" #include "V8Binding.h" -#include "V8Proxy.h" #include "WebKitAnimation.h" #include <v8.h> diff --git a/Source/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp b/Source/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp index de4022a8b..52b04a773 100644 --- a/Source/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp +++ b/Source/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp @@ -33,7 +33,6 @@ #include "V8Binding.h" #include "V8DOMWrapper.h" -#include "V8Proxy.h" #include "WrapperTypeInfo.h" #include <wtf/MathExtras.h> diff --git a/Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp b/Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp index 3d44b5292..7411dac0d 100644 --- a/Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp @@ -41,7 +41,6 @@ #include "V8ArrayBufferView.h" #include "V8Binding.h" #include "V8Blob.h" -#include "V8Proxy.h" #include "V8Utilities.h" #include "WebSocket.h" #include "WebSocketChannel.h" diff --git a/Source/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp b/Source/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp index 57232578c..3a1da47b7 100644 --- a/Source/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp @@ -37,7 +37,6 @@ #include "ExceptionCode.h" #include "ScheduledAction.h" #include "V8Binding.h" -#include "V8Proxy.h" #include "V8Utilities.h" #include "V8WorkerContextEventListener.h" #include "WebSocket.h" diff --git a/Source/WebCore/bindings/v8/custom/V8WorkerCustom.cpp b/Source/WebCore/bindings/v8/custom/V8WorkerCustom.cpp index 945c29ec0..1b4f29c3c 100644 --- a/Source/WebCore/bindings/v8/custom/V8WorkerCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8WorkerCustom.cpp @@ -40,7 +40,6 @@ #include "Frame.h" #include "SerializedScriptValue.h" #include "V8Binding.h" -#include "V8Proxy.h" #include "V8Utilities.h" #include "WorkerContext.h" #include "WorkerContextExecutionProxy.h" diff --git a/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp b/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp index 7bd673082..c0e9c5b92 100644 --- a/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp +++ b/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp @@ -36,7 +36,6 @@ #include "SecurityOrigin.h" #include "V8Binding.h" #include "V8IsolatedContext.h" -#include "V8Proxy.h" #include "V8Utilities.h" #include "WorkerContext.h" #include "WorkerContextExecutionProxy.h" diff --git a/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp b/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp index f89e3c97d..dbeb64432 100644 --- a/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp @@ -42,7 +42,6 @@ #include "V8DOMFormData.h" #include "V8Document.h" #include "V8HTMLDocument.h" -#include "V8Proxy.h" #include "V8Utilities.h" #include "WorkerContext.h" #include "WorkerContextExecutionProxy.h" diff --git a/Source/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp b/Source/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp index 3dc9ef570..87228c9a2 100644 --- a/Source/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp @@ -42,7 +42,6 @@ #include "V8Document.h" #include "V8DocumentFragment.h" #include "V8Node.h" -#include "V8Proxy.h" #include "XSLTProcessor.h" #include <wtf/RefPtr.h> |