2009-06-26 Nate Chapin <japhet@chromium.org>
authorjaphet@chromium.org <japhet@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Jun 2009 22:22:02 +0000 (22:22 +0000)
committerjaphet@chromium.org <japhet@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Jun 2009 22:22:02 +0000 (22:22 +0000)
        Reviewed by David Levin.

        Upstream V8Proxy.  This involved updating a lot of function and variable names to match WebKit style, hence the large size.

        https://bugs.webkit.org/show_bug.cgi?id=26623

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@45288 268f45cc-cd09-0410-ab3c-d52691b4dbfc

84 files changed:
WebCore/ChangeLog
WebCore/bindings/v8/ScheduledAction.cpp
WebCore/bindings/v8/ScriptCallStack.cpp
WebCore/bindings/v8/ScriptController.cpp
WebCore/bindings/v8/ScriptInstance.cpp
WebCore/bindings/v8/ScriptObject.cpp
WebCore/bindings/v8/ScriptObjectQuarantine.cpp
WebCore/bindings/v8/ScriptScope.cpp
WebCore/bindings/v8/ScriptValue.h
WebCore/bindings/v8/V8AbstractEventListener.cpp
WebCore/bindings/v8/V8Collection.cpp
WebCore/bindings/v8/V8Collection.h
WebCore/bindings/v8/V8DOMMap.cpp
WebCore/bindings/v8/V8Helpers.cpp
WebCore/bindings/v8/V8IsolatedWorld.h
WebCore/bindings/v8/V8LazyEventListener.cpp
WebCore/bindings/v8/V8NodeFilterCondition.cpp
WebCore/bindings/v8/V8ObjectEventListener.cpp
WebCore/bindings/v8/V8Proxy.cpp [new file with mode: 0644]
WebCore/bindings/v8/V8Proxy.h
WebCore/bindings/v8/V8Utilities.h
WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
WebCore/bindings/v8/custom/V8AttrCustom.cpp
WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp
WebCore/bindings/v8/custom/V8CanvasPixelArrayCustom.cpp
WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
WebCore/bindings/v8/custom/V8ClientRectListCustom.cpp
WebCore/bindings/v8/custom/V8ClipboardCustom.cpp
WebCore/bindings/v8/custom/V8CustomBinding.cpp
WebCore/bindings/v8/custom/V8CustomEventListener.cpp
WebCore/bindings/v8/custom/V8CustomSQLStatementCallback.cpp
WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp
WebCore/bindings/v8/custom/V8CustomSQLTransactionCallback.cpp
WebCore/bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp
WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp
WebCore/bindings/v8/custom/V8CustomXPathNSResolver.cpp
WebCore/bindings/v8/custom/V8DOMParserConstructor.cpp
WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
WebCore/bindings/v8/custom/V8DatabaseCustom.cpp
WebCore/bindings/v8/custom/V8DocumentCustom.cpp
WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp
WebCore/bindings/v8/custom/V8ElementCustom.cpp
WebCore/bindings/v8/custom/V8EventCustom.cpp
WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp
WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp
WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp
WebCore/bindings/v8/custom/V8HTMLFrameElementCustom.cpp
WebCore/bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp
WebCore/bindings/v8/custom/V8HTMLIFrameElementCustom.cpp
WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp
WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp
WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp
WebCore/bindings/v8/custom/V8HTMLSelectElementCollectionCustom.cpp
WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp
WebCore/bindings/v8/custom/V8InspectorControllerCustom.cpp
WebCore/bindings/v8/custom/V8LocationCustom.cpp
WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp
WebCore/bindings/v8/custom/V8MessagePortCustom.cpp
WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp
WebCore/bindings/v8/custom/V8NavigatorCustom.cpp
WebCore/bindings/v8/custom/V8NodeCustom.cpp
WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp
WebCore/bindings/v8/custom/V8NodeListCustom.cpp
WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp
WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp
WebCore/bindings/v8/custom/V8SVGElementInstanceCustom.cpp
WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp
WebCore/bindings/v8/custom/V8SVGMatrixCustom.cpp
WebCore/bindings/v8/custom/V8StyleSheetListCustom.cpp
WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp
WebCore/bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp
WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp
WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp
WebCore/bindings/v8/custom/V8WorkerCustom.cpp
WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp
WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
WebCore/bindings/v8/custom/V8XMLHttpRequestUploadCustom.cpp
WebCore/bindings/v8/custom/V8XMLSerializerConstructor.cpp
WebCore/bindings/v8/custom/V8XPathEvaluatorConstructor.cpp
WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp

index 644e7c28892d9d33e567330f4b0372c8c553a7e4..6f2da85ac9daaacd37965eb3b893c7f350f0a53b 100644 (file)
@@ -1,3 +1,303 @@
+2009-06-26  Nate Chapin  <japhet@chromium.org>
+
+        Reviewed by David Levin.
+
+        Upstream V8Proxy.  This involved updating a lot of function and variable names to match WebKit style, hence the large size.
+
+        https://bugs.webkit.org/show_bug.cgi?id=26623
+
+        * bindings/v8/ScheduledAction.cpp:
+        (WebCore::ScheduledAction::ScheduledAction):
+        (WebCore::ScheduledAction::~ScheduledAction):
+        (WebCore::ScheduledAction::execute):
+        * bindings/v8/ScriptCallStack.cpp:
+        (WebCore::ScriptCallStack::ScriptCallStack):
+        * bindings/v8/ScriptController.cpp:
+        (WebCore::ScriptController::isSafeScript):
+        (WebCore::ScriptController::gcProtectJSWrapper):
+        (WebCore::ScriptController::gcUnprotectJSWrapper):
+        (WebCore::ScriptController::processingUserGesture):
+        (WebCore::ScriptController::evaluate):
+        (WebCore::ScriptController::setEventHandlerLineNumber):
+        (WebCore::ScriptController::bindToWindowObject):
+        (WebCore::ScriptController::collectGarbage):
+        (WebCore::ScriptController::haveInterpreter):
+        (WebCore::createScriptObject):
+        (WebCore::ScriptController::createScriptObjectForPluginElement):
+        * bindings/v8/ScriptInstance.cpp:
+        (WebCore::V8ScriptInstance::clear):
+        (WebCore::V8ScriptInstance::set):
+        * bindings/v8/ScriptObject.cpp:
+        (WebCore::ScriptGlobalObject::set):
+        * bindings/v8/ScriptObjectQuarantine.cpp:
+        (WebCore::getQuarantinedScriptObject):
+        * bindings/v8/ScriptScope.cpp:
+        (WebCore::ScriptScope::ScriptScope):
+        * bindings/v8/ScriptValue.h:
+        (WebCore::ScriptValue::ScriptValue):
+        (WebCore::ScriptValue::operator=):
+        (WebCore::ScriptValue::clear):
+        * bindings/v8/V8AbstractEventListener.cpp:
+        (WebCore::V8AbstractEventListener::invokeEventHandler):
+        (WebCore::V8AbstractEventListener::handleEvent):
+        (WebCore::V8AbstractEventListener::disposeListenerObject):
+        (WebCore::V8AbstractEventListener::getReceiverObject):
+        * bindings/v8/V8Collection.cpp:
+        (WebCore::toOptionsCollectionSetter):
+        * bindings/v8/V8Collection.h:
+        (WebCore::getV8Object):
+        (WebCore::getNamedPropertyOfCollection):
+        (WebCore::nodeCollectionNamedPropertyGetter):
+        (WebCore::getIndexedPropertyOfCollection):
+        (WebCore::nodeCollectionIndexedPropertyGetter):
+        (WebCore::nodeCollectionIndexedPropertyEnumerator):
+        (WebCore::collectionIndexedPropertyEnumerator):
+        (WebCore::collectionStringOrNullIndexedPropertyGetter):
+        * bindings/v8/V8DOMMap.cpp:
+        (WebCore::weakDOMObjectCallback):
+        (WebCore::DOMData::removeObjectsFromWrapperMap):
+        * bindings/v8/V8Helpers.cpp:
+        (WebCore::wrapNPObject):
+        (WebCore::toV8Context):
+        * bindings/v8/V8LazyEventListener.cpp:
+        (WebCore::V8LazyEventListener::~V8LazyEventListener):
+        (WebCore::V8LazyEventListener::getListenerFunction):
+        (WebCore::V8LazyEventListener::callListenerFunction):
+        (WebCore::V8LazyEventListener::getWrappedListenerFunction):
+        * bindings/v8/V8NodeFilterCondition.cpp:
+        (WebCore::V8NodeFilterCondition::V8NodeFilterCondition):
+        (WebCore::V8NodeFilterCondition::~V8NodeFilterCondition):
+        (WebCore::V8NodeFilterCondition::acceptNode):
+        * bindings/v8/V8ObjectEventListener.cpp:
+        (WebCore::weakObjectEventListenerCallback):
+        (WebCore::V8ObjectEventListener::~V8ObjectEventListener):
+        * bindings/v8/V8Proxy.cpp: Added.
+        * bindings/v8/V8Proxy.h:
+        (WebCore::):
+        (WebCore::GlobalHandleInfo::GlobalHandleInfo):
+        (WebCore::V8Proxy::):
+        (WebCore::V8Proxy::V8Proxy):
+        (WebCore::V8Proxy::frame):
+        (WebCore::V8Proxy::inlineCode):
+        (WebCore::V8Proxy::setInlineCode):
+        (WebCore::V8Proxy::timerCallback):
+        (WebCore::V8Proxy::setTimerCallback):
+        (WebCore::V8Proxy::setEventHandlerLineNumber):
+        (WebCore::V8Proxy::finishedWithEvent):
+        (WebCore::V8Proxy::wrapCPointer):
+        (WebCore::V8Proxy::extractCPointer):
+        (WebCore::V8Proxy::convertDOMWrapperToNative):
+        (WebCore::V8Proxy::convertDOMWrapperToNode):
+        (WebCore::V8Proxy::convertToV8Object):
+        (WebCore::V8Proxy::convertToNativeObject):
+        (WebCore::V8Proxy::convertToNativeEvent):
+        (WebCore::V8Proxy::context):
+        (WebCore::V8Proxy::extractCPointerImpl):
+        (WebCore::V8Proxy::utilityContext):
+        (WebCore::V8Proxy::constructDOMObject):
+        (WebCore::throwError):
+        (WebCore::toV8):
+        * bindings/v8/V8Utilities.h:
+        * bindings/v8/WorkerContextExecutionProxy.cpp:
+        (WebCore::WorkerContextExecutionProxy::retrieve):
+        (WebCore::WorkerContextExecutionProxy::initContextIfNeeded):
+        (WebCore::WorkerContextExecutionProxy::GetConstructor):
+        (WebCore::WorkerContextExecutionProxy::ToV8Object):
+        (WebCore::WorkerContextExecutionProxy::EventToV8Object):
+        (WebCore::WorkerContextExecutionProxy::toV8):
+        (WebCore::WorkerContextExecutionProxy::forgetV8EventObject):
+        (WebCore::WorkerContextExecutionProxy::evaluate):
+        (WebCore::WorkerContextExecutionProxy::runScript):
+        * bindings/v8/custom/V8AttrCustom.cpp:
+        (WebCore::ACCESSOR_SETTER):
+        * bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp:
+        (WebCore::NAMED_PROPERTY_GETTER):
+        (WebCore::NAMED_PROPERTY_SETTER):
+        * bindings/v8/custom/V8CanvasPixelArrayCustom.cpp:
+        (WebCore::INDEXED_PROPERTY_GETTER):
+        (WebCore::INDEXED_PROPERTY_SETTER):
+        * bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp:
+        (WebCore::toV8):
+        (WebCore::toCanvasStyle):
+        (WebCore::ACCESSOR_GETTER):
+        (WebCore::ACCESSOR_SETTER):
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8ClientRectListCustom.cpp:
+        (WebCore::INDEXED_PROPERTY_GETTER):
+        * bindings/v8/custom/V8ClipboardCustom.cpp:
+        (WebCore::ACCESSOR_GETTER):
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8CustomBinding.cpp:
+        (WebCore::allowSettingFrameSrcToJavascriptUrl):
+        (WebCore::ACCESSOR_GETTER):
+        (WebCore::INDEXED_ACCESS_CHECK):
+        (WebCore::NAMED_ACCESS_CHECK):
+        (WebCore::V8Custom::GetTargetFrame):
+        * bindings/v8/custom/V8CustomEventListener.cpp:
+        (WebCore::V8EventListener::V8EventListener):
+        (WebCore::V8EventListener::~V8EventListener):
+        (WebCore::V8EventListener::callListenerFunction):
+        * bindings/v8/custom/V8CustomSQLStatementCallback.cpp:
+        (WebCore::V8CustomSQLStatementCallback::handleEvent):
+        * bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp:
+        (WebCore::V8CustomSQLStatementErrorCallback::handleEvent):
+        * bindings/v8/custom/V8CustomSQLTransactionCallback.cpp:
+        (WebCore::V8CustomSQLTransactionCallback::handleEvent):
+        * bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp:
+        (WebCore::V8CustomSQLTransactionErrorCallback::handleEvent):
+        * bindings/v8/custom/V8CustomVoidCallback.cpp:
+        (WebCore::V8CustomVoidCallback::handleEvent):
+        (WebCore::invokeCallback):
+        * bindings/v8/custom/V8CustomXPathNSResolver.cpp:
+        (WebCore::V8CustomXPathNSResolver::lookupNamespaceURI):
+        * bindings/v8/custom/V8DOMParserConstructor.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8DOMWindowCustom.cpp:
+        (WebCore::V8Custom::WindowSetTimeoutImpl):
+        (WebCore::convertBase64):
+        (WebCore::ACCESSOR_SETTER):
+        (WebCore::CALLBACK_FUNC_DECL):
+        (WebCore::ACCESSOR_GETTER):
+        (WebCore::createWindow):
+        (WebCore::INDEXED_PROPERTY_GETTER):
+        (WebCore::NAMED_PROPERTY_GETTER):
+        (WebCore::V8Custom::ClearTimeoutImpl):
+        (WebCore::NAMED_ACCESS_CHECK):
+        (WebCore::INDEXED_ACCESS_CHECK):
+        * bindings/v8/custom/V8DatabaseCustom.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8DocumentCustom.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8DocumentLocationCustom.cpp:
+        (WebCore::ACCESSOR_GETTER):
+        (WebCore::ACCESSOR_SETTER):
+        * bindings/v8/custom/V8ElementCustom.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        (WebCore::ACCESSOR_SETTER):
+        (WebCore::ACCESSOR_GETTER):
+        * bindings/v8/custom/V8EventCustom.cpp:
+        (WebCore::ACCESSOR_SETTER):
+        (WebCore::ACCESSOR_GETTER):
+        * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8HTMLCollectionCustom.cpp:
+        (WebCore::getNamedItems):
+        (WebCore::getItem):
+        (WebCore::NAMED_PROPERTY_GETTER):
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8HTMLDocumentCustom.cpp:
+        (WebCore::NAMED_PROPERTY_GETTER):
+        (WebCore::CALLBACK_FUNC_DECL):
+        (WebCore::ACCESSOR_GETTER):
+        * bindings/v8/custom/V8HTMLFormElementCustom.cpp:
+        (WebCore::INDEXED_PROPERTY_GETTER):
+        (WebCore::NAMED_PROPERTY_GETTER):
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8HTMLFrameElementCustom.cpp:
+        (WebCore::ACCESSOR_SETTER):
+        * bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp:
+        (WebCore::NAMED_PROPERTY_GETTER):
+        * bindings/v8/custom/V8HTMLIFrameElementCustom.cpp:
+        (WebCore::ACCESSOR_SETTER):
+        * bindings/v8/custom/V8HTMLImageElementConstructor.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8HTMLInputElementCustom.cpp:
+        (WebCore::ACCESSOR_GETTER):
+        (WebCore::ACCESSOR_SETTER):
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8HTMLOptionElementConstructor.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        (WebCore::ACCESSOR_GETTER):
+        (WebCore::ACCESSOR_SETTER):
+        (WebCore::INDEXED_PROPERTY_GETTER):
+        (WebCore::INDEXED_PROPERTY_SETTER):
+        * bindings/v8/custom/V8HTMLPlugInElementCustom.cpp:
+        (WebCore::NAMED_PROPERTY_GETTER):
+        (WebCore::NAMED_PROPERTY_SETTER):
+        (WebCore::INDEXED_PROPERTY_GETTER):
+        (WebCore::INDEXED_PROPERTY_SETTER):
+        * bindings/v8/custom/V8HTMLSelectElementCollectionCustom.cpp:
+        (WebCore::NAMED_PROPERTY_GETTER):
+        (WebCore::INDEXED_PROPERTY_SETTER):
+        * bindings/v8/custom/V8HTMLSelectElementCustom.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        (WebCore::removeElement):
+        * bindings/v8/custom/V8InspectorControllerCustom.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8LocationCustom.cpp:
+        (WebCore::ACCESSOR_SETTER):
+        (WebCore::ACCESSOR_GETTER):
+        (WebCore::CALLBACK_FUNC_DECL):
+        (WebCore::INDEXED_ACCESS_CHECK):
+        (WebCore::NAMED_ACCESS_CHECK):
+        * bindings/v8/custom/V8MessageChannelConstructor.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8MessagePortCustom.cpp:
+        (WebCore::ACCESSOR_GETTER):
+        (WebCore::ACCESSOR_SETTER):
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8NamedNodeMapCustom.cpp:
+        (WebCore::INDEXED_PROPERTY_GETTER):
+        (WebCore::NAMED_PROPERTY_GETTER):
+        * bindings/v8/custom/V8NavigatorCustom.cpp:
+        (WebCore::ACCESSOR_GETTER):
+        * bindings/v8/custom/V8NodeCustom.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8NodeIteratorCustom.cpp:
+        (WebCore::toV8):
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8NodeListCustom.cpp:
+        (WebCore::NAMED_PROPERTY_GETTER):
+        * bindings/v8/custom/V8SQLResultSetRowListCustom.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8SQLTransactionCustom.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8SVGElementInstanceCustom.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8SVGLengthCustom.cpp:
+        (WebCore::ACCESSOR_GETTER):
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8SVGMatrixCustom.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8StyleSheetListCustom.cpp:
+        (WebCore::NAMED_PROPERTY_GETTER):
+        * bindings/v8/custom/V8TreeWalkerCustom.cpp:
+        (WebCore::toV8):
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8WebKitPointConstructor.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8WorkerContextCustom.cpp:
+        (WebCore::ACCESSOR_GETTER):
+        (WebCore::ACCESSOR_SETTER):
+        (WebCore::SetTimeoutOrInterval):
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8WorkerCustom.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        (WebCore::getEventListener):
+        (WebCore::ACCESSOR_GETTER):
+        (WebCore::ACCESSOR_SETTER):
+        * bindings/v8/custom/V8XMLHttpRequestConstructor.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
+        (WebCore::getEventListener):
+        (WebCore::ACCESSOR_GETTER):
+        (WebCore::ACCESSOR_SETTER):
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8XMLHttpRequestUploadCustom.cpp:
+        (WebCore::ACCESSOR_GETTER):
+        (WebCore::ACCESSOR_SETTER):
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8XMLSerializerConstructor.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8XPathEvaluatorConstructor.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8XSLTProcessorCustom.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+
 2009-06-26  Kevin McCullough  <kmccullough@apple.com>
 
         Reviewed by Tim Hatcher.
index ab51600b59fa36ee474673143a58679c8be82894..af2ede6726134417adaff0d41d9f0d16862952f4 100644 (file)
@@ -50,7 +50,7 @@ ScheduledAction::ScheduledAction(v8::Handle<v8::Function> func, int argc, v8::Ha
     m_function = v8::Persistent<v8::Function>::New(func);
 
 #ifndef NDEBUG
-    V8Proxy::RegisterGlobalHandle(SCHEDULED_ACTION, this, m_function);
+    V8Proxy::registerGlobalHandle(SCHEDULED_ACTION, this, m_function);
 #endif
 
     m_argc = argc;
@@ -60,7 +60,7 @@ ScheduledAction::ScheduledAction(v8::Handle<v8::Function> func, int argc, v8::Ha
             m_argv[i] = v8::Persistent<v8::Value>::New(argv[i]);
 
 #ifndef NDEBUG
-    V8Proxy::RegisterGlobalHandle(SCHEDULED_ACTION, this, m_argv[i]);
+    V8Proxy::registerGlobalHandle(SCHEDULED_ACTION, this, m_argv[i]);
 #endif
         }
     } else
@@ -73,13 +73,13 @@ ScheduledAction::~ScheduledAction()
         return;
 
 #ifndef NDEBUG
-    V8Proxy::UnregisterGlobalHandle(this, m_function);
+    V8Proxy::unregisterGlobalHandle(this, m_function);
 #endif
     m_function.Dispose();
 
     for (int i = 0; i < m_argc; i++) {
 #ifndef NDEBUG
-        V8Proxy::UnregisterGlobalHandle(this, m_argv[i]);
+        V8Proxy::unregisterGlobalHandle(this, m_argv[i]);
 #endif
         m_argv[i].Dispose();
     }
@@ -106,7 +106,7 @@ void ScheduledAction::execute(V8Proxy* proxy)
     ASSERT(proxy);
 
     v8::HandleScope handleScope;
-    v8::Local<v8::Context> v8Context = proxy->GetContext();
+    v8::Local<v8::Context> v8Context = proxy->context();
     if (v8Context.IsEmpty())
         return; // JS may not be enabled.
 
@@ -116,7 +116,7 @@ void ScheduledAction::execute(V8Proxy* proxy)
 
     // FIXME: Need to implement timeouts for preempting a long-running script.
     if (!m_function.IsEmpty() && m_function->IsFunction()) {
-        proxy->CallFunction(v8::Persistent<v8::Function>::Cast(m_function), v8Context->Global(), m_argc, m_argv);
+        proxy->callFunction(v8::Persistent<v8::Function>::Cast(m_function), v8Context->Global(), m_argc, m_argv);
         Document::updateStyleForAllDocuments();
     } else
         proxy->evaluate(m_code, 0);
index 1294b916b0854bf4551849214a41cbb1d2e5cb10..33d6e78da34f4902df22288586baa801146fb5b5 100644 (file)
@@ -39,7 +39,7 @@
 namespace WebCore {
 
 ScriptCallStack::ScriptCallStack(const v8::Arguments& arguments, unsigned skipArgumentCount)
-    : m_lastCaller(String(), V8Proxy::GetSourceName(), V8Proxy::GetSourceLineNumber() + 1, arguments, skipArgumentCount)
+    : m_lastCaller(String(), V8Proxy::sourceName(), V8Proxy::sourceLineNumber() + 1, arguments, skipArgumentCount)
     , m_scriptState(new ScriptState(V8Proxy::retrieveFrame()))
 {
 }
index 61a327ea5c6d03c718bd109c9682035321f5da60..9da8604fb8a04452d934f0ba3d9f1d0e6e771d58 100644 (file)
@@ -72,17 +72,17 @@ Frame* ScriptController::retrieveFrameForCurrentContext()
 
 bool ScriptController::isSafeScript(Frame* target)
 {
-    return V8Proxy::CanAccessFrame(target, true);
+    return V8Proxy::canAccessFrame(target, true);
 }
 
 void ScriptController::gcProtectJSWrapper(void* domObject)
 {
-    V8Proxy::GCProtect(domObject);
+    V8Proxy::gcProtect(domObject);
 }
 
 void ScriptController::gcUnprotectJSWrapper(void* domObject)
 {
-    V8Proxy::GCUnprotect(domObject);
+    V8Proxy::gcUnprotect(domObject);
 }
 
 ScriptController::ScriptController(Frame* frame)
@@ -144,18 +144,18 @@ bool ScriptController::processingUserGesture() const
     V8Proxy* activeProxy = activeFrame->script()->proxy();
 
     v8::HandleScope handleScope;
-    v8::Handle<v8::Context> context = V8Proxy::GetContext(activeFrame);
+    v8::Handle<v8::Context> v8Context = V8Proxy::context(activeFrame);
     // FIXME: find all cases context can be empty:
     //  1) JS is disabled;
     //  2) page is NULL;
-    if (context.IsEmpty())
+    if (v8Context.IsEmpty())
         return true;
 
-    v8::Context::Scope scope(context);
+    v8::Context::Scope scope(v8Context);
 
-    v8::Handle<v8::Object> global = context->Global();
+    v8::Handle<v8::Object> global = v8Context->Global();
     v8::Handle<v8::Value> jsEvent = global->Get(v8::String::NewSymbol("event"));
-    Event* event = V8Proxy::ToNativeEvent(jsEvent);
+    Event* event = V8Proxy::convertToNativeEvent(jsEvent);
 
     // Based on code from kjs_bindings.cpp.
     // Note: This is more liberal than Firefox's implementation.
@@ -199,11 +199,11 @@ ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode)
     }
 
     v8::HandleScope handleScope;
-    v8::Handle<v8::Context> context = V8Proxy::GetContext(m_proxy->frame());
-    if (context.IsEmpty())
+    v8::Handle<v8::Context> v8Context = V8Proxy::context(m_proxy->frame());
+    if (v8Context.IsEmpty())
         return ScriptValue();
 
-    v8::Context::Scope scope(context);
+    v8::Context::Scope scope(v8Context);
 
     RefPtr<Frame> protect(m_frame);
 
@@ -221,7 +221,7 @@ ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode)
 
 void ScriptController::setEventHandlerLineNumber(int lineNumber)
 {
-    m_proxy->setEventHandlerLineno(lineNumber);
+    m_proxy->setEventHandlerLineNumber(lineNumber);
 }
 
 void ScriptController::finishedWithEvent(Event* event)
@@ -234,34 +234,34 @@ void ScriptController::bindToWindowObject(Frame* frame, const String& key, NPObj
 {
     v8::HandleScope handleScope;
 
-    v8::Handle<v8::Context> context = V8Proxy::GetContext(frame);
-    if (context.IsEmpty())
+    v8::Handle<v8::Context> v8Context = V8Proxy::context(frame);
+    if (v8Context.IsEmpty())
         return;
 
-    v8::Context::Scope scope(context);
+    v8::Context::Scope scope(v8Context);
 
     v8::Handle<v8::Object> value = CreateV8ObjectForNPObject(object, 0);
 
     // Attach to the global object.
-    v8::Handle<v8::Object> global = context->Global();
+    v8::Handle<v8::Object> global = v8Context->Global();
     global->Set(v8String(key), value);
 }
 
 void ScriptController::collectGarbage()
 {
     v8::HandleScope handleScope;
-    v8::Handle<v8::Context> context = V8Proxy::GetContext(m_proxy->frame());
-    if (context.IsEmpty())
+    v8::Handle<v8::Context> v8Context = V8Proxy::context(m_proxy->frame());
+    if (v8Context.IsEmpty())
         return;
 
-    v8::Context::Scope scope(context);
+    v8::Context::Scope scope(v8Context);
 
     m_proxy->evaluate(ScriptSourceCode("if (window.gc) void(gc());"), 0);
 }
 
 bool ScriptController::haveInterpreter() const
 {
-    return m_proxy->ContextInitialized();
+    return m_proxy->isContextInitialized();
 }
 
 bool ScriptController::isEnabled() const
@@ -331,13 +331,13 @@ static NPObject* createNoScriptObject()
 static NPObject* createScriptObject(Frame* frame)
 {
     v8::HandleScope handleScope;
-    v8::Handle<v8::Context> context = V8Proxy::GetContext(frame);
-    if (context.IsEmpty())
+    v8::Handle<v8::Context> v8Context = V8Proxy::context(frame);
+    if (v8Context.IsEmpty())
         return createNoScriptObject();
 
-    v8::Context::Scope scope(context);
+    v8::Context::Scope scope(v8Context);
     DOMWindow* window = frame->domWindow();
-    v8::Handle<v8::Value> global = V8Proxy::ToV8Object(V8ClassIndex::DOMWINDOW, window);
+    v8::Handle<v8::Value> global = V8Proxy::convertToV8Object(V8ClassIndex::DOMWINDOW, window);
     ASSERT(global->IsObject());
     return npCreateV8ScriptObject(0, v8::Handle<v8::Object>::Cast(global), window);
 }
@@ -368,13 +368,13 @@ NPObject* ScriptController::createScriptObjectForPluginElement(HTMLPlugInElement
         return createNoScriptObject();
 
     v8::HandleScope handleScope;
-    v8::Handle<v8::Context> context = V8Proxy::GetContext(m_frame);
-    if (context.IsEmpty())
+    v8::Handle<v8::Context> v8Context = V8Proxy::context(m_frame);
+    if (v8Context.IsEmpty())
         return createNoScriptObject();
-    v8::Context::Scope scope(context);
+    v8::Context::Scope scope(v8Context);
 
     DOMWindow* window = m_frame->domWindow();
-    v8::Handle<v8::Value> v8plugin = V8Proxy::ToV8Object(V8ClassIndex::HTMLEMBEDELEMENT, plugin);
+    v8::Handle<v8::Value> v8plugin = V8Proxy::convertToV8Object(V8ClassIndex::HTMLEMBEDELEMENT, plugin);
     if (!v8plugin->IsObject())
         return createNoScriptObject();
 
index aa4a3964a58ac01586ff1eac52d2339b5559e7ee..43ac2f8702b2e79dee79f9e6e08eaa419036748b 100644 (file)
@@ -62,7 +62,7 @@ void V8ScriptInstance::clear()
     if (m_instance.IsEmpty())
         return;
 #ifndef NDEBUG
-    V8Proxy::UnregisterGlobalHandle(this, m_instance);
+    V8Proxy::unregisterGlobalHandle(this, m_instance);
 #endif
     m_instance.Dispose();
     m_instance.Clear();
@@ -76,7 +76,7 @@ void V8ScriptInstance::set(v8::Handle<v8::Object> instance)
 
     m_instance = v8::Persistent<v8::Object>::New(instance);
 #ifndef NDEBUG
-    V8Proxy::RegisterGlobalHandle(SCRIPTINSTANCE, this, m_instance);
+    V8Proxy::registerGlobalHandle(SCRIPTINSTANCE, this, m_instance);
 #endif
 }
 
index dd44acbfaef8775080171287b519d06f4af5785a..e3e4f290ee2860587d018cebf6f5a8b2359844f4 100644 (file)
@@ -119,7 +119,7 @@ bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, const S
 bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, InspectorController* value)
 {
     ScriptScope scope(scriptState);
-    scope.global()->Set(v8::String::New(name), V8Proxy::ToV8Object(V8ClassIndex::INSPECTORCONTROLLER, value));
+    scope.global()->Set(v8::String::New(name), V8Proxy::convertToV8Object(V8ClassIndex::INSPECTORCONTROLLER, value));
     return scope.success();
 }
 
index 8a7715ed031a061b9cfdb4e4ae5a318f751894e1..e08ca1ebc523d54b468591c68b8f694ce0e2bc44 100644 (file)
@@ -77,10 +77,10 @@ bool getQuarantinedScriptObject(Node* node, ScriptObject& quarantinedObject)
     ASSERT(node);
 
     v8::HandleScope handleScope;
-    v8::Local<v8::Context> context = V8Proxy::GetContext(node->document()->page()->mainFrame());
+    v8::Local<v8::Context> context = V8Proxy::context(node->document()->page()->mainFrame());
     v8::Context::Scope scope(context);
 
-    v8::Handle<v8::Value> v8Node = V8Proxy::NodeToV8Object(node);
+    v8::Handle<v8::Value> v8Node = V8Proxy::convertNodeToV8Object(node);
     quarantinedObject = ScriptObject(v8::Local<v8::Object>(v8::Object::Cast(*v8Node)));
 
     return true;
@@ -91,10 +91,10 @@ bool getQuarantinedScriptObject(DOMWindow* domWindow, ScriptObject& quarantinedO
     ASSERT(domWindow);
 
     v8::HandleScope handleScope;
-    v8::Local<v8::Context> context = V8Proxy::GetContext(domWindow->frame());
+    v8::Local<v8::Context> context = V8Proxy::context(domWindow->frame());
     v8::Context::Scope scope(context);
 
-    v8::Handle<v8::Value> v8DomWindow = V8Proxy::ToV8Object(V8ClassIndex::DOMWINDOW, domWindow);
+    v8::Handle<v8::Value> v8DomWindow = V8Proxy::convertToV8Object(V8ClassIndex::DOMWINDOW, domWindow);
     quarantinedObject = ScriptObject(v8::Local<v8::Object>(v8::Object::Cast(*v8DomWindow)));
 
     return true;
index 937f6649f3b5bef8876ce3f1a31a96df84d3c11c..52cab10bf01d7e27495a3ca315765455c529170f 100644 (file)
@@ -43,7 +43,7 @@
 namespace WebCore {
 
 ScriptScope::ScriptScope(ScriptState* scriptState, bool reportExceptions)
-    : m_context(V8Proxy::GetContext(scriptState->frame()))
+    : m_context(V8Proxy::context(scriptState->frame()))
     , m_scope(m_context)
     , m_scriptState(scriptState)
     , m_reportExceptions(reportExceptions)
index 04e881963a06424837391c47f792ff2262578f08..f5daf895a07a4cbec73a6e9f539b7238ec07652b 100644 (file)
@@ -53,7 +53,7 @@ public:
 
         m_value = v8::Persistent<v8::Value>::New(value);
 #ifndef NDEBUG
-        V8Proxy::RegisterGlobalHandle(SCRIPTVALUE, this, m_value);
+        V8Proxy::registerGlobalHandle(SCRIPTVALUE, this, m_value);
 #endif
     }
 
@@ -64,7 +64,7 @@ public:
 
         m_value = v8::Persistent<v8::Value>::New(value.m_value);
 #ifndef NDEBUG
-        V8Proxy::RegisterGlobalHandle(SCRIPTVALUE, this, m_value);
+        V8Proxy::registerGlobalHandle(SCRIPTVALUE, this, m_value);
 #endif
     }
 
@@ -80,7 +80,7 @@ public:
 
         m_value = v8::Persistent<v8::Value>::New(value.m_value);
 #ifndef NDEBUG
-        V8Proxy::RegisterGlobalHandle(SCRIPTVALUE, this, m_value);
+        V8Proxy::registerGlobalHandle(SCRIPTVALUE, this, m_value);
 #endif
 
         return *this;
@@ -122,7 +122,7 @@ public:
             return;
 
 #ifndef NDEBUG
-        V8Proxy::UnregisterGlobalHandle(this, m_value);
+        V8Proxy::unregisterGlobalHandle(this, m_value);
 #endif
         m_value.Dispose();
         m_value.Clear();
index 462a72940b53590d732351728071cd64e3e44e36..3a03eb2eca557f918bfa84e14c780a58967552e4 100644 (file)
@@ -55,7 +55,7 @@ V8AbstractEventListener::V8AbstractEventListener(Frame* frame, bool isAttribute)
     }
 }
 
-void V8AbstractEventListener::invokeEventHandler(v8::Handle<v8::Context> context, Event* event, v8::Handle<v8::Value> jsEvent, bool isWindowEvent)
+void V8AbstractEventListener::invokeEventHandler(v8::Handle<v8::Context> v8Context, Event* event, v8::Handle<v8::Value> jsEvent, bool isWindowEvent)
 {
     // We push the event being processed into the global object, so that it can be exposed by DOMWindow's bindings.
     v8::Local<v8::String> eventSymbol = v8::String::NewSymbol("event");
@@ -67,11 +67,11 @@ void V8AbstractEventListener::invokeEventHandler(v8::Handle<v8::Context> context
         tryCatch.SetVerbose(true);
 
         // Save the old 'event' property so we can restore it later.
-        v8::Local<v8::Value> savedEvent = context->Global()->GetHiddenValue(eventSymbol);
+        v8::Local<v8::Value> savedEvent = v8Context->Global()->GetHiddenValue(eventSymbol);
         tryCatch.Reset();
 
         // Make the event available in the global object, so DOMWindow can expose it.
-        context->Global()->SetHiddenValue(eventSymbol, jsEvent);
+        v8Context->Global()->SetHiddenValue(eventSymbol, jsEvent);
         tryCatch.Reset();
 
         // Call the event handler.
@@ -80,13 +80,13 @@ void V8AbstractEventListener::invokeEventHandler(v8::Handle<v8::Context> context
 
         // Restore the old event. This must be done for all exit paths through this method.
         if (savedEvent.IsEmpty())
-            context->Global()->SetHiddenValue(eventSymbol, v8::Undefined());
+            v8Context->Global()->SetHiddenValue(eventSymbol, v8::Undefined());
         else
-            context->Global()->SetHiddenValue(eventSymbol, savedEvent);
+            v8Context->Global()->SetHiddenValue(eventSymbol, savedEvent);
         tryCatch.Reset();
     }
 
-    ASSERT(!V8Proxy::HandleOutOfMemory() || returnValue.IsEmpty());
+    ASSERT(!V8Proxy::handleOutOfMemory() || returnValue.IsEmpty());
 
     if (returnValue.IsEmpty())
         return;
@@ -112,20 +112,20 @@ void V8AbstractEventListener::handleEvent(Event* event, bool isWindowEvent)
 
     v8::HandleScope handleScope;
 
-    v8::Handle<v8::Context> context = V8Proxy::GetContext(m_frame);
-    if (context.IsEmpty())
+    v8::Handle<v8::Context> v8Context = V8Proxy::context(m_frame);
+    if (v8Context.IsEmpty())
         return;
 
     // m_frame can removed by the callback function, protect it until the callback function returns.
     RefPtr<Frame> protectFrame(m_frame);
 
     // Enter the V8 context in which to perform the event handling.
-    v8::Context::Scope scope(context);
+    v8::Context::Scope scope(v8Context);
 
     // Get the V8 wrapper for the event object.
-    v8::Handle<v8::Value> jsEvent = V8Proxy::EventToV8Object(event);
+    v8::Handle<v8::Value> jsEvent = V8Proxy::convertEventToV8Object(event);
 
-    invokeEventHandler(context, event, jsEvent, isWindowEvent);
+    invokeEventHandler(v8Context, event, jsEvent, isWindowEvent);
 
     Document::updateStyleForAllDocuments();
 }
@@ -134,7 +134,7 @@ void V8AbstractEventListener::disposeListenerObject()
 {
     if (!m_listener.IsEmpty()) {
 #ifndef NDEBUG
-        V8Proxy::UnregisterGlobalHandle(this, m_listener);
+        V8Proxy::unregisterGlobalHandle(this, m_listener);
 #endif
         m_listener.Dispose();
         m_listener.Clear();
@@ -150,7 +150,7 @@ v8::Local<v8::Object> V8AbstractEventListener::getReceiverObject(Event* event, b
         return v8::Context::GetCurrent()->Global();
 
     EventTarget* target = event->currentTarget();
-    v8::Handle<v8::Value> value = V8Proxy::EventTargetToV8Object(target);
+    v8::Handle<v8::Value> value = V8Proxy::convertEventTargetToV8Object(target);
     if (value.IsEmpty())
         return v8::Local<v8::Object>();
     return v8::Local<v8::Object>::New(v8::Handle<v8::Object>::Cast(value));
index 861f68af31a1c452432d82fe13ed0dd90cf115da..15e234b24d93ad1eb050ffb681ab8f1261e8bf73 100644 (file)
@@ -48,14 +48,14 @@ v8::Handle<v8::Value> toOptionsCollectionSetter(uint32_t index, v8::Handle<v8::V
 
     // Check that the value is an HTMLOptionElement.  If not, throw a TYPE_MISMATCH_ERR DOMException.
     if (!V8HTMLOptionElement::HasInstance(value)) {
-        V8Proxy::SetDOMException(TYPE_MISMATCH_ERR);
+        V8Proxy::setDOMException(TYPE_MISMATCH_ERR);
         return value;
     }
 
-    HTMLOptionElement* element = V8Proxy::DOMWrapperToNode<HTMLOptionElement>(v8::Handle<v8::Object>::Cast(value));
+    HTMLOptionElement* element = V8Proxy::convertDOMWrapperToNode<HTMLOptionElement>(v8::Handle<v8::Object>::Cast(value));
     base->setOption(index, element, ec);
 
-    V8Proxy::SetDOMException(ec);
+    V8Proxy::setDOMException(ec);
     return value;
 }
 
index 1731f9c93ced98518958f23d3211f072165f86ea..2ea7d51410881559fd62b18a3ba3f76255497c76 100644 (file)
@@ -47,8 +47,8 @@ namespace WebCore {
             return v8::Handle<v8::Value>();
         V8ClassIndex::V8WrapperType type = V8ClassIndex::FromInt(implementationType->Int32Value());
         if (type == V8ClassIndex::NODE)
-            return V8Proxy::NodeToV8Object(static_cast<Node*>(implementation));
-        return V8Proxy::ToV8Object(type, implementation);
+            return V8Proxy::convertNodeToV8Object(static_cast<Node*>(implementation));
+        return V8Proxy::convertToV8Object(type, implementation);
     }
 
     template<class T> static v8::Handle<v8::Value> getV8Object(PassRefPtr<T> implementation, v8::Local<v8::Value> implementationType)
@@ -61,10 +61,10 @@ namespace WebCore {
                                                                                                          v8::Local<v8::Value> implementationType)
     {
         // FIXME: assert object is a collection type
-        ASSERT(V8Proxy::MaybeDOMWrapper(object));
-        V8ClassIndex::V8WrapperType wrapperType = V8Proxy::GetDOMWrapperType(object);
+        ASSERT(V8Proxy::maybeDOMWrapper(object));
+        V8ClassIndex::V8WrapperType wrapperType = V8Proxy::domWrapperType(object);
         ASSERT(wrapperType != V8ClassIndex::NODE);
-        Collection* collection = V8Proxy::ToNativeObject<Collection>(wrapperType, object);
+        Collection* collection = V8Proxy::convertToNativeObject<Collection>(wrapperType, object);
         String propertyName = toWebCoreString(name);
         return getV8Object<ItemType>(collection->namedItem(propertyName), implementationType);
     }
@@ -87,8 +87,8 @@ namespace WebCore {
     // A template of named property accessor of HTMLSelectElement and HTMLFormElement.
     template<class Collection> static v8::Handle<v8::Value> nodeCollectionNamedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
     {
-        ASSERT(V8Proxy::MaybeDOMWrapper(info.Holder()));
-        ASSERT(V8Proxy::GetDOMWrapperType(info.Holder()) == V8ClassIndex::NODE);
+        ASSERT(V8Proxy::maybeDOMWrapper(info.Holder()));
+        ASSERT(V8Proxy::domWrapperType(info.Holder()) == V8ClassIndex::NODE);
         v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototypeChain(name);
 
         if (!value.IsEmpty())
@@ -109,10 +109,10 @@ namespace WebCore {
                                                                                                            v8::Local<v8::Value> implementationType)
     {
         // FIXME: Assert that object must be a collection type.
-        ASSERT(V8Proxy::MaybeDOMWrapper(object));
-        V8ClassIndex::V8WrapperType wrapperType = V8Proxy::GetDOMWrapperType(object);
+        ASSERT(V8Proxy::maybeDOMWrapper(object));
+        V8ClassIndex::V8WrapperType wrapperType = V8Proxy::domWrapperType(object);
         ASSERT(wrapperType != V8ClassIndex::NODE);
-        Collection* collection = V8Proxy::ToNativeObject<Collection>(wrapperType, object);
+        Collection* collection = V8Proxy::convertToNativeObject<Collection>(wrapperType, object);
         return getV8Object<ItemType>(collection->item(index), implementationType);
     }
 
@@ -125,9 +125,9 @@ namespace WebCore {
     // A template of index interceptor of HTMLSelectElement and HTMLFormElement.
     template<class Collection> static v8::Handle<v8::Value> nodeCollectionIndexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
     {
-        ASSERT(V8Proxy::MaybeDOMWrapper(info.Holder()));
-        ASSERT(V8Proxy::GetDOMWrapperType(info.Holder()) == V8ClassIndex::NODE);
-        Collection* collection = V8Proxy::DOMWrapperToNode<Collection>(info.Holder());
+        ASSERT(V8Proxy::maybeDOMWrapper(info.Holder()));
+        ASSERT(V8Proxy::domWrapperType(info.Holder()) == V8ClassIndex::NODE);
+        Collection* collection = V8Proxy::convertDOMWrapperToNode<Collection>(info.Holder());
         void* implementation = collection->item(index);
         return getV8Object(implementation, info.Data());
     }
@@ -135,9 +135,9 @@ namespace WebCore {
     // Get an array containing the names of indexed properties of HTMLSelectElement and HTMLFormElement.
     template<class Collection> static v8::Handle<v8::Array> nodeCollectionIndexedPropertyEnumerator(const v8::AccessorInfo& info)
     {
-        ASSERT(V8Proxy::MaybeDOMWrapper(info.Holder()));
-        ASSERT(V8Proxy::GetDOMWrapperType(info.Holder()) == V8ClassIndex::NODE);
-        Collection* collection = V8Proxy::DOMWrapperToNode<Collection>(info.Holder());
+        ASSERT(V8Proxy::maybeDOMWrapper(info.Holder()));
+        ASSERT(V8Proxy::domWrapperType(info.Holder()) == V8ClassIndex::NODE);
+        Collection* collection = V8Proxy::convertDOMWrapperToNode<Collection>(info.Holder());
         int length = collection->length();
         v8::Handle<v8::Array> properties = v8::Array::New(length);
         for (int i = 0; i < length; ++i) {
@@ -151,9 +151,9 @@ namespace WebCore {
     // Get an array containing the names of indexed properties in a collection.
     template<class Collection> static v8::Handle<v8::Array> collectionIndexedPropertyEnumerator(const v8::AccessorInfo& info)
     {
-        ASSERT(V8Proxy::MaybeDOMWrapper(info.Holder()));
-        V8ClassIndex::V8WrapperType wrapperType = V8Proxy::GetDOMWrapperType(info.Holder());
-        Collection* collection = V8Proxy::ToNativeObject<Collection>(wrapperType, info.Holder());
+        ASSERT(V8Proxy::maybeDOMWrapper(info.Holder()));
+        V8ClassIndex::V8WrapperType wrapperType = V8Proxy::domWrapperType(info.Holder());
+        Collection* collection = V8Proxy::convertToNativeObject<Collection>(wrapperType, info.Holder());
         int length = collection->length();
         v8::Handle<v8::Array> properties = v8::Array::New(length);
         for (int i = 0; i < length; ++i) {
@@ -169,9 +169,9 @@ namespace WebCore {
     template<class Collection> static v8::Handle<v8::Value> collectionStringOrNullIndexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
     {
         // FIXME: assert that object must be a collection type
-        ASSERT(V8Proxy::MaybeDOMWrapper(info.Holder()));
-        V8ClassIndex::V8WrapperType wrapperType = V8Proxy::GetDOMWrapperType(info.Holder());
-        Collection* collection = V8Proxy::ToNativeObject<Collection>(wrapperType, info.Holder());
+        ASSERT(V8Proxy::maybeDOMWrapper(info.Holder()));
+        V8ClassIndex::V8WrapperType wrapperType = V8Proxy::domWrapperType(info.Holder());
+        Collection* collection = V8Proxy::convertToNativeObject<Collection>(wrapperType, info.Holder());
         String result = collection->item(index);
         return v8StringOrNull(result);
     }
index 65970ee61ec6c631cb1dec4906ec822a4af5c074..9b1dbe354209d0fbba10827f2feac07dda55a052 100644 (file)
@@ -461,7 +461,7 @@ void DOMData::handleWeakObject(DOMDataStore::DOMWrapperMapType mapType, v8::Hand
         if (*wrapper == *v8Object) {
             // Clear the JS reference.
             domMap->forgetOnly(domObject);
-            store->domData()->ensureDeref(V8Proxy::GetDOMWrapperType(v8Object), domObject);
+            store->domData()->ensureDeref(V8Proxy::domWrapperType(v8Object), domObject);
         }
     }
 }
@@ -585,7 +585,7 @@ void DOMData::removeObjectsFromWrapperMap(DOMWrapperMap<T>& domMap)
         T* domObject = static_cast<T*>(iter->first);
         v8::Persistent<v8::Object> v8Object(iter->second);
 
-        V8ClassIndex::V8WrapperType type = V8Proxy::GetDOMWrapperType(v8::Handle<v8::Object>::Cast(v8Object));
+        V8ClassIndex::V8WrapperType type = V8Proxy::domWrapperType(v8::Handle<v8::Object>::Cast(v8Object));
 
         // Deref the DOM object.
         derefObject(type, domObject);
index f19fcbe89d9b3751d1dedb9836427ca010e2562d..7b041a69bef66f8090e3353d2e4513f6eaaf38a0 100644 (file)
@@ -40,13 +40,13 @@ namespace WebCore {
 
 void wrapNPObject(v8::Handle<v8::Object> object, NPObject* npObject)
 {
-    V8Proxy::SetDOMWrapper(object, V8ClassIndex::NPOBJECT, npObject);
+    V8Proxy::setDOMWrapper(object, V8ClassIndex::NPOBJECT, npObject);
 }
 
 v8::Local<v8::Context> toV8Context(NPP npp, NPObject* npObject)
 {
     V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject);
-    return V8Proxy::GetContext(object->rootObject->frame());
+    return V8Proxy::context(object->rootObject->frame());
 }
 
 V8Proxy* toV8Proxy(NPObject* npObject)
index f37c0d5fc85190aa50c77c46f34574527c190d2c..ec010b0614d0aee1f0349c3838015689b722571f 100644 (file)
@@ -33,9 +33,9 @@
 
 #include <v8.h>
 
-#include "V8Index.h"
-#include "v8_utility.h"
 #include "V8DOMMap.h"
+#include "V8Index.h"
+#include "V8Utilities.h"
 #include "ScriptSourceCode.h"  // for WebCore::ScriptSourceCode
 
 namespace WebCore {
index f0e81ded905c588046a8233ecf6b995a2e1f4b75..c2336aabf42a6bf930e31a9c3c287884c59f9c82 100644 (file)
@@ -54,7 +54,7 @@ V8LazyEventListener::~V8LazyEventListener()
     // Dispose wrapped function
     if (!m_wrappedFunction.IsEmpty()) {
 #ifndef NDEBUG
-        V8Proxy::UnregisterGlobalHandle(this, m_wrappedFunction);
+        V8Proxy::unregisterGlobalHandle(this, m_wrappedFunction);
 #endif
         m_wrappedFunction.Dispose();
         m_wrappedFunction.Clear();
@@ -77,12 +77,12 @@ v8::Local<v8::Function> V8LazyEventListener::getListenerFunction()
         v8::HandleScope handleScope;
 
         // Use the outer scope to hold context.
-        v8::Handle<v8::Context> context = V8Proxy::GetContext(m_frame);
+        v8::Handle<v8::Context> v8Context = V8Proxy::context(m_frame);
         // Bail out if we could not get the context.
-        if (context.IsEmpty())
+        if (v8Context.IsEmpty())
             return v8::Local<v8::Function>();
 
-        v8::Context::Scope scope(context);
+        v8::Context::Scope scope(v8Context);
 
         // Wrap function around the event code.  The parenthesis around the function are needed so that evaluating the code yields
         // the function value.  Without the parenthesis the function value is thrown away.
@@ -102,11 +102,11 @@ v8::Local<v8::Function> V8LazyEventListener::getListenerFunction()
         code.append("\n})");
 
         v8::Handle<v8::String> codeExternalString = v8ExternalString(code);
-        v8::Handle<v8::Script> script = V8Proxy::CompileScript(codeExternalString, m_frame->document()->url(), m_lineNumber - 1);
+        v8::Handle<v8::Script> script = V8Proxy::compileScript(codeExternalString, m_frame->document()->url(), m_lineNumber - 1);
         if (!script.IsEmpty()) {
             V8Proxy* proxy = V8Proxy::retrieve(m_frame);
             ASSERT(proxy);
-            v8::Local<v8::Value> value = proxy->RunScript(script, false);
+            v8::Local<v8::Value> value = proxy->runScript(script, false);
             if (!value.IsEmpty()) {
                 ASSERT(value->IsFunction());
                 v8::Local<v8::Function> listenerFunction = v8::Local<v8::Function>::Cast(value);
@@ -114,7 +114,7 @@ v8::Local<v8::Function> V8LazyEventListener::getListenerFunction()
 
                 m_listener = v8::Persistent<v8::Function>::New(listenerFunction);
 #ifndef NDEBUG
-                V8Proxy::RegisterGlobalHandle(EVENT_LISTENER, this, m_listener);
+                V8Proxy::registerGlobalHandle(EVENT_LISTENER, this, m_listener);
 #endif
             }
         }
@@ -134,7 +134,7 @@ v8::Local<v8::Value> V8LazyEventListener::callListenerFunction(v8::Handle<v8::Va
     v8::Handle<v8::Value> parameters[1] = { jsEvent };
 
     V8Proxy* proxy = V8Proxy::retrieve(m_frame);
-    return proxy->CallFunction(handlerFunction, receiver, 1, parameters);
+    return proxy->callFunction(handlerFunction, receiver, 1, parameters);
 }
 
 
@@ -158,12 +158,12 @@ v8::Local<v8::Function> V8LazyEventListener::getWrappedListenerFunction()
         v8::HandleScope handleScope;
 
         // Use the outer scope to hold context.
-        v8::Handle<v8::Context> context = V8Proxy::GetContext(m_frame);
+        v8::Handle<v8::Context> v8Context = V8Proxy::context(m_frame);
         // Bail out if we cannot get the context.
-        if (context.IsEmpty())
+        if (v8Context.IsEmpty())
             return v8::Local<v8::Function>();
 
-        v8::Context::Scope scope(context);
+        v8::Context::Scope scope(v8Context);
 
         // FIXME: cache the wrapper function.
 
@@ -184,11 +184,11 @@ v8::Local<v8::Function> V8LazyEventListener::getWrappedListenerFunction()
         // Insert '\n' otherwise //-style comments could break the handler.
         code.append(  "\n}).call(this, evt);}}}})");
         v8::Handle<v8::String> codeExternalString = v8ExternalString(code);
-        v8::Handle<v8::Script> script = V8Proxy::CompileScript(codeExternalString, m_frame->document()->url(), m_lineNumber);
+        v8::Handle<v8::Script> script = V8Proxy::compileScript(codeExternalString, m_frame->document()->url(), m_lineNumber);
         if (!script.IsEmpty()) {
             V8Proxy* proxy = V8Proxy::retrieve(m_frame);
             ASSERT(proxy);
-            v8::Local<v8::Value> value = proxy->RunScript(script, false);
+            v8::Local<v8::Value> value = proxy->runScript(script, false);
             if (!value.IsEmpty()) {
                 ASSERT(value->IsFunction());
 
@@ -218,7 +218,7 @@ v8::Local<v8::Function> V8LazyEventListener::getWrappedListenerFunction()
                 }
 
 #ifndef NDEBUG
-                V8Proxy::RegisterGlobalHandle(EVENT_LISTENER, this, m_wrappedFunction);
+                V8Proxy::registerGlobalHandle(EVENT_LISTENER, this, m_wrappedFunction);
 #endif
                 m_wrappedFunction->SetName(v8::String::New(fromWebCoreString(m_functionName), m_functionName.length()));
             }
index b5ae30c6e97450e19e5e7c2996b83d0ecdb93545..6b5297ecd319bf87c66f680d0d7a6f847ca41068 100644 (file)
@@ -44,14 +44,14 @@ V8NodeFilterCondition::V8NodeFilterCondition(v8::Handle<v8::Value> filter)
     : m_filter(v8::Persistent<v8::Value>::New(filter))
 {
 #ifndef NDEBUG
-    V8Proxy::RegisterGlobalHandle(NODE_FILTER, this, m_filter);
+    V8Proxy::registerGlobalHandle(NODE_FILTER, this, m_filter);
 #endif
 }
 
 V8NodeFilterCondition::~V8NodeFilterCondition()
 {
 #ifndef NDEBUG
-    V8Proxy::UnregisterGlobalHandle(this, m_filter);
+    V8Proxy::unregisterGlobalHandle(this, m_filter);
 #endif
     m_filter.Dispose();
     m_filter.Clear();
@@ -69,12 +69,12 @@ short V8NodeFilterCondition::acceptNode(ScriptState* state, Node* node) const
     v8::Handle<v8::Object> object = v8::Context::GetCurrent()->Global();
     v8::Handle<v8::Function> callback = v8::Handle<v8::Function>::Cast(m_filter);
     OwnArrayPtr<v8::Handle<v8::Value> > args(new v8::Handle<v8::Value>[1]);
-    args[0] = V8Proxy::ToV8Object(V8ClassIndex::NODE, node);
+    args[0] = V8Proxy::convertToV8Object(V8ClassIndex::NODE, node);
 
     V8Proxy* proxy = V8Proxy::retrieve();
     ASSERT(proxy);
 
-    v8::Handle<v8::Value> result = proxy->CallFunction(callback, object, 1, args.get());
+    v8::Handle<v8::Value> result = proxy->callFunction(callback, object, 1, args.get());
 
     if (exceptionCatcher.HasCaught()) {
         state->setException(exceptionCatcher.Exception());
index 584962a3b55c9a54a0c2bf6c66b69ef81e367656..8ec5d40f4fc72cb4f388ab3c890925e3756dd2f9 100644 (file)
@@ -45,7 +45,7 @@ static void weakObjectEventListenerCallback(v8::Persistent<v8::Value>, void* par
     if (frame) {
         V8Proxy* proxy = V8Proxy::retrieve(frame);
         if (proxy)
-            proxy->RemoveObjectEventListener(listener);
+            proxy->removeObjectEventListener(listener);
 
         // Because the listener is no longer in the list, it must be disconnected from the frame to avoid dangling frame pointer
         // in the destructor.
@@ -66,7 +66,7 @@ V8ObjectEventListener::~V8ObjectEventListener()
         ASSERT(!m_listener.IsEmpty());
         V8Proxy* proxy = V8Proxy::retrieve(m_frame);
         if (proxy)
-            proxy->RemoveObjectEventListener(this);
+            proxy->removeObjectEventListener(this);
     }
 
     disposeListenerObject();
diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp
new file mode 100644 (file)
index 0000000..a3ba532
--- /dev/null
@@ -0,0 +1,3258 @@
+/*
+ * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "V8Proxy.h"
+
+#include "ChromiumBridge.h"
+#include "CSSMutableStyleDeclaration.h"
+#include "DOMObjectsInclude.h"
+#include "DocumentLoader.h"
+#include "FrameLoaderClient.h"
+#include "ScriptController.h"
+#include "V8Binding.h"
+#include "V8Collection.h"
+#include "V8CustomBinding.h"
+#include "V8DOMMap.h"
+#include "V8DOMWindow.h"
+#include "V8Index.h"
+#include "V8IsolatedWorld.h"
+#include "WorkerContextExecutionProxy.h"
+
+#include <algorithm>
+#include <utility>
+#include <v8.h>
+#include <v8-debug.h>
+#include <wtf/Assertions.h>
+#include <wtf/OwnArrayPtr.h>
+#include <wtf/StdLibExtras.h>
+#include <wtf/UnusedParam.h>
+
+namespace WebCore {
+
+v8::Persistent<v8::Context> V8Proxy::m_utilityContext;
+
+// Static list of registered extensions
+V8ExtensionList V8Proxy::m_extensions;
+
+const char* V8Proxy::kContextDebugDataType = "type";
+const char* V8Proxy::kContextDebugDataValue = "value";
+
+#ifndef NDEBUG
+// Keeps track of global handles created (not JS wrappers
+// of DOM objects). Often these global handles are source
+// of leaks.
+//
+// If you want to let a C++ object hold a persistent handle
+// to a JS object, you should register the handle here to
+// keep track of leaks.
+//
+// When creating a persistent handle, call:
+//
+// #ifndef NDEBUG
+//    V8Proxy::registerGlobalHandle(type, host, handle);
+// #endif
+//
+// When releasing the handle, call:
+//
+// #ifndef NDEBUG
+//    V8Proxy::unregisterGlobalHandle(type, host, handle);
+// #endif
+//
+typedef HashMap<v8::Value*, GlobalHandleInfo*> GlobalHandleMap;
+
+static GlobalHandleMap& globalHandleMap()
+{
+    DEFINE_STATIC_LOCAL(GlobalHandleMap, staticGlobalHandleMap, ());
+    return staticGlobalHandleMap;
+}
+
+// The function is the place to set the break point to inspect
+// live global handles. Leaks are often come from leaked global handles.
+static void enumerateGlobalHandles()
+{
+    for (GlobalHandleMap::iterator it = globalHandleMap().begin(), end = globalHandleMap().end(); it != end; ++it) {
+        GlobalHandleInfo* info = it->second;
+        UNUSED_PARAM(info);
+        v8::Value* handle = it->first;
+        UNUSED_PARAM(handle);
+    }
+}
+
+void V8Proxy::registerGlobalHandle(GlobalHandleType type, void* host, v8::Persistent<v8::Value> handle)
+{
+    ASSERT(!globalHandleMap().contains(*handle));
+    globalHandleMap().set(*handle, new GlobalHandleInfo(host, type));
+}
+
+void V8Proxy::unregisterGlobalHandle(void* host, v8::Persistent<v8::Value> handle)
+{
+    ASSERT(globalHandleMap().contains(*handle));
+    GlobalHandleInfo* info = globalHandleMap().take(*handle);
+    ASSERT(info->m_host == host);
+    delete info;
+}
+#endif // ifndef NDEBUG
+
+void batchConfigureAttributes(v8::Handle<v8::ObjectTemplate> instance, v8::Handle<v8::ObjectTemplate> proto, const BatchedAttribute* attributes, size_t attributeCount)
+{
+    for (size_t i = 0; i < attributeCount; ++i) {
+        const BatchedAttribute* attribute = &attributes[i];
+        (attribute->onProto ? proto : instance)->SetAccessor(v8::String::New(attribute->name),
+            attribute->getter,
+            attribute->setter,
+            attribute->data == V8ClassIndex::INVALID_CLASS_INDEX ? v8::Handle<v8::Value>() : v8::Integer::New(V8ClassIndex::ToInt(attribute->data)),
+            attribute->settings,
+            attribute->attribute);
+    }
+}
+
+void batchConfigureConstants(v8::Handle<v8::FunctionTemplate> functionDescriptor, v8::Handle<v8::ObjectTemplate> proto, const BatchedConstant* constants, size_t constantCount)
+{
+    for (size_t i = 0; i < constantCount; ++i) {
+        const BatchedConstant* constant = &constants[i];
+        functionDescriptor->Set(v8::String::New(constant->name), v8::Integer::New(constant->value), v8::ReadOnly);
+        proto->Set(v8::String::New(constant->name), v8::Integer::New(constant->value), v8::ReadOnly);
+    }
+}
+
+typedef HashMap<Node*, v8::Object*> DOMNodeMap;
+typedef HashMap<void*, v8::Object*> DOMObjectMap;
+
+#ifndef NDEBUG
+
+static void enumerateDOMObjectMap(DOMObjectMap& wrapperMap)
+{
+    for (DOMObjectMap::iterator it = wrapperMap.begin(), end = wrapperMap.end(); it != end; ++it) {
+        v8::Persistent<v8::Object> wrapper(it->second);
+        V8ClassIndex::V8WrapperType type = V8Proxy::domWrapperType(wrapper);
+        void* object = it->first;
+        UNUSED_PARAM(type);
+        UNUSED_PARAM(object);
+    }
+}
+
+static void enumerateDOMNodeMap(DOMNodeMap& nodeMap)
+{
+    for (DOMNodeMap::iterator it = nodeMap.begin(), end = nodeMap.end(); it != end; ++it) {
+        Node* node = it->first;
+        UNUSED_PARAM(node);
+        ASSERT(v8::Persistent<v8::Object>(it->second).IsWeak());
+    }
+}
+
+class DOMObjectVisitor : public DOMWrapperMap<void>::Visitor {
+public:
+    void visitDOMWrapper(void* object, v8::Persistent<v8::Object> wrapper)
+    {
+        V8ClassIndex::V8WrapperType type = V8Proxy::domWrapperType(wrapper);
+        UNUSED_PARAM(type);
+        UNUSED_PARAM(object);
+    }
+};
+
+class EnsureWeakDOMNodeVisitor : public DOMWrapperMap<Node>::Visitor {
+public:
+    void visitDOMWrapper(Node* object, v8::Persistent<v8::Object> wrapper)
+    {
+        UNUSED_PARAM(object);
+        ASSERT(wrapper.IsWeak());
+    }
+};
+
+#endif // NDEBUG
+
+#if ENABLE(SVG)
+v8::Handle<v8::Value> V8Proxy::convertSVGElementInstanceToV8Object(SVGElementInstance* instance)
+{
+    if (!instance)
+        return v8::Null();
+
+    v8::Handle<v8::Object> existingInstance = getDOMSVGElementInstanceMap().get(instance);
+    if (!existingInstance.IsEmpty())
+        return existingInstance;
+
+    instance->ref();
+
+    // Instantiate the V8 object and remember it
+    v8::Handle<v8::Object> result = instantiateV8Object(V8ClassIndex::SVGELEMENTINSTANCE, V8ClassIndex::SVGELEMENTINSTANCE, instance);
+    if (!result.IsEmpty()) {
+        // Only update the DOM SVG element map if the result is non-empty.
+        getDOMSVGElementInstanceMap().set(instance, v8::Persistent<v8::Object>::New(result));
+    }
+    return result;
+}
+
+// Map of SVG objects with contexts to their contexts
+static HashMap<void*, SVGElement*>& svgObjectToContextMap()
+{
+    typedef HashMap<void*, SVGElement*> SvgObjectToContextMap;
+    DEFINE_STATIC_LOCAL(SvgObjectToContextMap, staticSvgObjectToContextMap, ());
+    return staticSvgObjectToContextMap;
+}
+
+v8::Handle<v8::Value> V8Proxy::convertSVGObjectWithContextToV8Object(V8ClassIndex::V8WrapperType type, void* object)
+{
+    if (!object)
+        return v8::Null();
+
+    v8::Persistent<v8::Object> result = getDOMSVGObjectWithContextMap().get(object);
+    if (!result.IsEmpty())
+        return result;
+
+    // Special case: SVGPathSegs need to be downcast to their real type
+    if (type == V8ClassIndex::SVGPATHSEG)
+        type = V8Custom::DowncastSVGPathSeg(object);
+
+    v8::Local<v8::Object> v8Object = instantiateV8Object(type, type, object);
+    if (!v8Object.IsEmpty()) {
+        result = v8::Persistent<v8::Object>::New(v8Object);
+        switch (type) {
+#define MAKE_CASE(TYPE, NAME)     \
+        case V8ClassIndex::TYPE: static_cast<NAME*>(object)->ref(); break;
+        SVG_OBJECT_TYPES(MAKE_CASE)
+#undef MAKE_CASE
+#define MAKE_CASE(TYPE, NAME)     \
+        case V8ClassIndex::TYPE:    \
+            static_cast<V8SVGPODTypeWrapper<NAME>*>(object)->ref(); break;
+        SVG_POD_NATIVE_TYPES(MAKE_CASE)
+#undef MAKE_CASE
+        default:
+            ASSERT_NOT_REACHED();
+        }
+        getDOMSVGObjectWithContextMap().set(object, result);
+    }
+
+    return result;
+}
+
+void V8Proxy::setSVGContext(void* object, SVGElement* context)
+{
+    if (!object)
+        return;
+
+    SVGElement* oldContext = svgObjectToContextMap().get(object);
+
+    if (oldContext == context)
+        return;
+
+    if (oldContext)
+        oldContext->deref();
+
+    if (context)
+        context->ref();
+
+    svgObjectToContextMap().set(object, context);
+}
+
+SVGElement* V8Proxy::svgContext(void* object)
+{
+    return svgObjectToContextMap().get(object);
+}
+
+#endif
+
+// A map from a DOM node to its JS wrapper, the wrapper
+// is kept as a strong reference to survive GCs.
+static DOMObjectMap& gcProtectedMap()
+{
+    DEFINE_STATIC_LOCAL(DOMObjectMap, staticGcProtectedMap, ());
+    return staticGcProtectedMap;
+}
+
+void V8Proxy::gcProtect(void* domObject)
+{
+    if (!domObject)
+        return;
+    if (gcProtectedMap().contains(domObject))
+        return;
+    if (!getDOMObjectMap().contains(domObject))
+        return;
+
+    // Create a new (strong) persistent handle for the object.
+    v8::Persistent<v8::Object> wrapper = getDOMObjectMap().get(domObject);
+    if (wrapper.IsEmpty())
+        return;
+
+    gcProtectedMap().set(domObject, *v8::Persistent<v8::Object>::New(wrapper));
+}
+
+void V8Proxy::gcUnprotect(void* domObject)
+{
+    if (!domObject)
+        return;
+    if (!gcProtectedMap().contains(domObject))
+        return;
+
+    // Dispose the strong reference.
+    v8::Persistent<v8::Object> wrapper(gcProtectedMap().take(domObject));
+    wrapper.Dispose();
+}
+
+class GCPrologueVisitor : public DOMWrapperMap<void>::Visitor {
+public:
+    void visitDOMWrapper(void* object, v8::Persistent<v8::Object> wrapper)
+    {
+        ASSERT(wrapper.IsWeak());
+        V8ClassIndex::V8WrapperType type = V8Proxy::domWrapperType(wrapper);
+        switch (type) {
+#define MAKE_CASE(TYPE, NAME)                             \
+        case V8ClassIndex::TYPE: {                    \
+            NAME* impl = static_cast<NAME*>(object);  \
+            if (impl->hasPendingActivity())           \
+                wrapper.ClearWeak();                  \
+            break;                                    \
+        }
+    ACTIVE_DOM_OBJECT_TYPES(MAKE_CASE)
+    default:
+        ASSERT_NOT_REACHED();
+#undef MAKE_CASE
+        }
+
+    // Additional handling of message port ensuring that entangled ports also
+    // have their wrappers entangled. This should ideally be handled when the
+    // ports are actually entangled in MessagePort::entangle, but to avoid
+    // forking MessagePort.* this is postponed to GC time. Having this postponed
+    // has the drawback that the wrappers are "entangled/unentangled" for each
+    // GC even though their entaglement most likely is still the same.
+    if (type == V8ClassIndex::MESSAGEPORT) {
+        // Get the port and its entangled port.
+        MessagePort* port1 = static_cast<MessagePort*>(object);
+        MessagePort* port2 = port1->locallyEntangledPort();
+
+        // If we are remotely entangled, then mark this object as reachable
+        // (we can't determine reachability directly as the remote object is
+        // out-of-proc).
+        if (port1->isEntangled() && !port2)
+            wrapper.ClearWeak();
+
+        if (!port2) {
+            // As ports are always entangled in pairs only perform the entanglement
+            // once for each pair (see ASSERT in MessagePort::unentangle()).
+            if (port1 < port2) {
+                v8::Handle<v8::Value> port1Wrapper = V8Proxy::convertToV8Object(V8ClassIndex::MESSAGEPORT, port1);
+                v8::Handle<v8::Value> port2Wrapper = V8Proxy::convertToV8Object(V8ClassIndex::MESSAGEPORT, port2);
+                ASSERT(port1Wrapper->IsObject());
+                v8::Handle<v8::Object>::Cast(port1Wrapper)->SetInternalField(V8Custom::kMessagePortEntangledPortIndex, port2Wrapper);
+                ASSERT(port2Wrapper->IsObject());
+                v8::Handle<v8::Object>::Cast(port2Wrapper)->SetInternalField(V8Custom::kMessagePortEntangledPortIndex, port1Wrapper);
+            }
+        } else {
+            // Remove the wrapper entanglement when a port is not entangled.
+            if (V8Proxy::domObjectHasJSWrapper(port1)) {
+                v8::Handle<v8::Value> wrapper = V8Proxy::convertToV8Object(V8ClassIndex::MESSAGEPORT, port1);
+                ASSERT(wrapper->IsObject());
+                v8::Handle<v8::Object>::Cast(wrapper)->SetInternalField(V8Custom::kMessagePortEntangledPortIndex, v8::Undefined());
+            }
+        }
+    }
+}
+};
+
+class GrouperItem {
+public:
+    GrouperItem(uintptr_t groupId, Node* node, v8::Persistent<v8::Object> wrapper) 
+        : m_groupId(groupId)
+        , m_node(node)
+        , m_wrapper(wrapper) 
+        {
+        }
+
+    uintptr_t groupId() const { return m_groupId; }
+    Node* node() const { return m_node; }
+    v8::Persistent<v8::Object> wrapper() const { return m_wrapper; }
+
+private:
+    uintptr_t m_groupId;
+    Node* m_node;
+    v8::Persistent<v8::Object> m_wrapper;
+};
+
+bool operator<(const GrouperItem& a, const GrouperItem& b)
+{
+    return a.groupId() < b.groupId();
+}
+
+typedef Vector<GrouperItem> GrouperList;
+
+class ObjectGrouperVisitor : public DOMWrapperMap<Node>::Visitor {
+public:
+    ObjectGrouperVisitor()
+    {
+        // FIXME: grouper_.reserveCapacity(node_map.size());  ?
+    }
+
+    void visitDOMWrapper(Node* node, v8::Persistent<v8::Object> wrapper)
+    {
+
+        // If the node is in document, put it in the ownerDocument's object group.
+        //
+        // If an image element was created by JavaScript "new Image",
+        // it is not in a document. However, if the load event has not
+        // been fired (still onloading), it is treated as in the document.
+        //
+        // Otherwise, the node is put in an object group identified by the root
+        // element of the tree to which it belongs.
+        uintptr_t groupId;
+        if (node->inDocument() || (node->hasTagName(HTMLNames::imgTag) && !static_cast<HTMLImageElement*>(node)->haveFiredLoadEvent()))
+            groupId = reinterpret_cast<uintptr_t>(node->document());
+        else {
+            Node* root = node;
+            while (root->parent())
+                root = root->parent();
+
+            // If the node is alone in its DOM tree (doesn't have a parent or any
+            // children) then the group will be filtered out later anyway.
+            if (root == node && !node->hasChildNodes())
+                return;
+
+            groupId = reinterpret_cast<uintptr_t>(root);
+        }
+        m_grouper.append(GrouperItem(groupId, node, wrapper));
+    }
+
+    void applyGrouping()
+    {
+        // Group by sorting by the group id.
+        std::sort(m_grouper.begin(), m_grouper.end());
+
+        // FIXME Should probably work in iterators here, but indexes were easier for my simple mind.
+        for (size_t i = 0; i < m_grouper.size(); ) {
+            // Seek to the next key (or the end of the list).
+            size_t nextKeyIndex = m_grouper.size();
+            for (size_t j = i; j < m_grouper.size(); ++j) {
+                if (m_grouper[i].groupId() != m_grouper[j].groupId()) {
+                    nextKeyIndex = j;
+                    break;
+                }
+            }
+
+            ASSERT(nextKeyIndex > i);
+
+            // We only care about a group if it has more than one object. If it only
+            // has one object, it has nothing else that needs to be kept alive.
+            if (nextKeyIndex - i <= 1) {
+                i = nextKeyIndex;
+                continue;
+            }
+
+            Vector<v8::Persistent<v8::Value> > group;
+            group.reserveCapacity(nextKeyIndex - i);
+            for (; i < nextKeyIndex; ++i) {
+                Node* node = m_grouper[i].node();
+                v8::Persistent<v8::Value> wrapper = m_grouper[i].wrapper();
+                if (!wrapper.IsEmpty())
+                    group.append(wrapper);
+                /* FIXME: Re-enabled this code to avoid GCing these wrappers!
+                             Currently this depends on looking up the wrapper
+                             during a GC, but we don't know which isolated world
+                             we're in, so it's unclear which map to look in...
+
+                // If the node is styled and there is a wrapper for the inline
+                // style declaration, we need to keep that style declaration
+                // wrapper alive as well, so we add it to the object group.
+                if (node->isStyledElement()) {
+                  StyledElement* element = reinterpret_cast<StyledElement*>(node);
+                  CSSStyleDeclaration* style = element->inlineStyleDecl();
+                  if (style != NULL) {
+                    wrapper = getDOMObjectMap().get(style);
+                    if (!wrapper.IsEmpty())
+                      group.append(wrapper);
+                  }
+                }
+                */
+            }
+
+            if (group.size() > 1)
+                v8::V8::AddObjectGroup(&group[0], group.size());
+
+            ASSERT(i == nextKeyIndex);
+        }
+    }
+
+private:
+    GrouperList m_grouper;
+};
+
+// Create object groups for DOM tree nodes.
+static void gcPrologue()
+{
+    v8::HandleScope scope;
+
+#ifndef NDEBUG
+    DOMObjectVisitor domObjectVisitor;
+    visitDOMObjectsInCurrentThread(&domObjectVisitor);
+#endif
+
+    // Run through all objects with possible pending activity making their
+    // wrappers non weak if there is pending activity.
+    GCPrologueVisitor prologueVisitor;
+    visitActiveDOMObjectsInCurrentThread(&prologueVisitor);
+
+    // Create object groups.
+    ObjectGrouperVisitor objectGrouperVisitor;
+    visitDOMNodesInCurrentThread(&objectGrouperVisitor);
+    objectGrouperVisitor.applyGrouping();
+}
+
+class GCEpilogueVisitor : public DOMWrapperMap<void>::Visitor {
+public:
+    void visitDOMWrapper(void* object, v8::Persistent<v8::Object> wrapper)
+    {
+        V8ClassIndex::V8WrapperType type = V8Proxy::domWrapperType(wrapper);
+        switch (type) {
+#define MAKE_CASE(TYPE, NAME)                                           \
+        case V8ClassIndex::TYPE: {                                  \
+          NAME* impl = static_cast<NAME*>(object);                  \
+          if (impl->hasPendingActivity()) {                         \
+            ASSERT(!wrapper.IsWeak());                              \
+            wrapper.MakeWeak(impl, &weakActiveDOMObjectCallback);   \
+          }                                                         \
+          break;                                                    \
+        }
+ACTIVE_DOM_OBJECT_TYPES(MAKE_CASE)
+        default:
+            ASSERT_NOT_REACHED();
+#undef MAKE_CASE
+    }
+}
+};
+
+static void gcEpilogue()
+{
+    v8::HandleScope scope;
+
+    // Run through all objects with pending activity making their wrappers weak
+    // again.
+    GCEpilogueVisitor epilogueVisitor;
+    visitActiveDOMObjectsInCurrentThread(&epilogueVisitor);
+
+#ifndef NDEBUG
+    // Check all survivals are weak.
+    DOMObjectVisitor domObjectVisitor;
+    visitDOMObjectsInCurrentThread(&domObjectVisitor);
+
+    EnsureWeakDOMNodeVisitor weakDOMNodeVisitor;
+    visitDOMNodesInCurrentThread(&weakDOMNodeVisitor);
+
+    enumerateDOMObjectMap(gcProtectedMap());
+    enumerateGlobalHandles();
+#endif
+}
+
+typedef HashMap<int, v8::FunctionTemplate*> FunctionTemplateMap;
+
+bool AllowAllocation::m_current = false;
+
+// JavaScriptConsoleMessages encapsulate everything needed to
+// log messages originating from JavaScript to the Chrome console.
+class JavaScriptConsoleMessage {
+public:
+    JavaScriptConsoleMessage(const String& string, const String& sourceID, unsigned lineNumber)
+        : m_string(string)
+        , m_sourceID(sourceID)
+        , m_lineNumber(lineNumber)
+        { 
+        }
+
+    void addToPage(Page*) const;
+
+private:
+    const String m_string;
+    const String m_sourceID;
+    const unsigned m_lineNumber;
+};
+
+void JavaScriptConsoleMessage::addToPage(Page* page) const
+{
+    ASSERT(page);
+    Console* console = page->mainFrame()->domWindow()->console();
+    console->addMessage(JSMessageSource, ErrorMessageLevel, m_string, m_lineNumber, m_sourceID);
+}
+
+// The ConsoleMessageManager handles all console messages that stem
+// from JavaScript. It keeps a list of messages that have been delayed but
+// it makes sure to add all messages to the console in the right order.
+class ConsoleMessageManager {
+public:
+    // Add a message to the console. May end up calling JavaScript code
+    // indirectly through the inspector so only call this function when
+    // it is safe to do allocations.
+    static void addMessage(Page*, const JavaScriptConsoleMessage&);
+
+    // Add a message to the console but delay the reporting until it
+    // is safe to do so: Either when we leave JavaScript execution or
+    // when adding other console messages. The primary purpose of this
+    // method is to avoid calling into V8 to handle console messages
+    // when the VM is in a state that does not support GCs or allocations.
+    // Delayed messages are always reported in the page corresponding
+    // to the active context.
+    static void addDelayedMessage(const JavaScriptConsoleMessage&);
+
+    // Process any delayed messages. May end up calling JavaScript code
+    // indirectly through the inspector so only call this function when
+    // it is safe to do allocations.
+    static void processDelayedMessages();
+
+private:
+    // All delayed messages are stored in this vector. If the vector
+    // is NULL, there are no delayed messages.
+    static Vector<JavaScriptConsoleMessage>* m_delayed;
+};
+
+Vector<JavaScriptConsoleMessage>* ConsoleMessageManager::m_delayed = 0;
+
+void ConsoleMessageManager::addMessage(Page* page, const JavaScriptConsoleMessage& message)
+{
+    // Process any delayed messages to make sure that messages
+    // appear in the right order in the console.
+    processDelayedMessages();
+    message.addToPage(page);
+}
+
+void ConsoleMessageManager::addDelayedMessage(const JavaScriptConsoleMessage& message)
+{
+    if (!m_delayed) {
+        // Allocate a vector for the delayed messages. Will be
+        // deallocated when the delayed messages are processed
+        // in processDelayedMessages().
+        m_delayed = new Vector<JavaScriptConsoleMessage>();
+    }
+    m_delayed->append(message);
+}
+
+void ConsoleMessageManager::processDelayedMessages()
+{
+    // If we have a delayed vector it cannot be empty.
+    if (!m_delayed)
+        return;
+    ASSERT(!m_delayed->isEmpty());
+
+    // Add the delayed messages to the page of the active
+    // context. If that for some bizarre reason does not
+    // exist, we clear the list of delayed messages to avoid
+    // posting messages. We still deallocate the vector.
+    Frame* frame = V8Proxy::retrieveFrameForEnteredContext();
+    Page* page = 0;
+    if (frame)
+        page = frame->page();
+    if (!page)
+        m_delayed->clear();
+
+    // Iterate through all the delayed messages and add them
+    // to the console.
+    const int size = m_delayed->size();
+    for (int i = 0; i < size; i++)
+        m_delayed->at(i).addToPage(page);
+
+    // Deallocate the delayed vector.
+    delete m_delayed;
+    m_delayed = 0;
+}
+
+// Convenience class for ensuring that delayed messages in the
+// ConsoleMessageManager are processed quickly.
+class ConsoleMessageScope {
+public:
+    ConsoleMessageScope() { ConsoleMessageManager::processDelayedMessages(); }
+    ~ConsoleMessageScope() { ConsoleMessageManager::processDelayedMessages(); }
+};
+
+void logInfo(Frame* frame, const String& message, const String& url)
+{
+    Page* page = frame->page();
+    if (!page)
+        return;
+    JavaScriptConsoleMessage consoleMessage(message, url, 0);
+    ConsoleMessageManager::addMessage(page, consoleMessage);
+}
+
+static void handleConsoleMessage(v8::Handle<v8::Message> message, v8::Handle<v8::Value> data)
+{
+    // Use the frame where JavaScript is called from.
+    Frame* frame = V8Proxy::retrieveFrameForEnteredContext();
+    if (!frame)
+        return;
+
+    Page* page = frame->page();
+    if (!page)
+        return;
+
+    v8::Handle<v8::String> errorMessageString = message->Get();
+    ASSERT(!errorMessageString.IsEmpty());
+    String errorMessage = ToWebCoreString(errorMessageString);
+
+    v8::Handle<v8::Value> resourceName = message->GetScriptResourceName();
+    bool useURL = resourceName.IsEmpty() || !resourceName->IsString();
+    String resourceNameString = useURL ? frame->document()->url() : ToWebCoreString(resourceName);
+    JavaScriptConsoleMessage consoleMessage(errorMessage, resourceNameString, message->GetLineNumber());
+    ConsoleMessageManager::addMessage(page, consoleMessage);
+}
+
+enum DelayReporting {
+    ReportLater,
+    ReportNow
+};
+
+static void reportUnsafeAccessTo(Frame* target, DelayReporting delay)
+{
+    ASSERT(target);
+    Document* targetDocument = target->document();
+    if (!targetDocument)
+        return;
+
+    Frame* source = V8Proxy::retrieveFrameForEnteredContext();
+    if (!source || !source->document())
+        return; // Ignore error if the source document is gone.
+
+    Document* sourceDocument = source->document();
+
+    // FIXME: This error message should contain more specifics of why the same
+    // origin check has failed.
+    String str = String::format("Unsafe JavaScript attempt to access frame "
+                                "with URL %s from frame with URL %s. "
+                                "Domains, protocols and ports must match.\n",
+                                targetDocument->url().string().utf8().data(),
+                                sourceDocument->url().string().utf8().data());
+
+    // Build a console message with fake source ID and line number.
+    const String kSourceID = "";
+    const int kLineNumber = 1;
+    JavaScriptConsoleMessage message(str, kSourceID, kLineNumber);
+
+    if (delay == ReportNow) {
+        // NOTE: Safari prints the message in the target page, but it seems like
+        // it should be in the source page. Even for delayed messages, we put it in
+        // the source page; see ConsoleMessageManager::processDelayedMessages().
+        ConsoleMessageManager::addMessage(source->page(), message);
+
+    } else {
+        ASSERT(delay == ReportLater);
+        // We cannot safely report the message eagerly, because this may cause
+        // allocations and GCs internally in V8 and we cannot handle that at this
+        // point. Therefore we delay the reporting.
+        ConsoleMessageManager::addDelayedMessage(message);
+    }
+}
+
+static void reportUnsafeJavaScriptAccess(v8::Local<v8::Object> host, v8::AccessType type, v8::Local<v8::Value> data)
+{
+    Frame* target = V8Custom::GetTargetFrame(host, data);
+    if (target)
+        reportUnsafeAccessTo(target, ReportLater);
+}
+
+static void handleFatalErrorInV8()
+{
+    // FIXME: We temporarily deal with V8 internal error situations
+    // such as out-of-memory by crashing the renderer.
+    CRASH();
+}
+
+static void reportFatalErrorInV8(const char* location, const char* message)
+{
+    // V8 is shutdown, we cannot use V8 api.
+    // The only thing we can do is to disable JavaScript.
+    // FIXME: clean up V8Proxy and disable JavaScript.
+    printf("V8 error: %s (%s)\n", message, location);
+    handleFatalErrorInV8();
+}
+
+V8Proxy::~V8Proxy()
+{
+    clearForClose();
+    destroyGlobal();
+}
+
+void V8Proxy::destroyGlobal()
+{
+    if (!m_global.IsEmpty()) {
+#ifndef NDEBUG
+        unregisterGlobalHandle(this, m_global);
+#endif
+        m_global.Dispose();
+        m_global.Clear();
+    }
+}
+
+
+bool V8Proxy::domObjectHasJSWrapper(void* object)
+{
+    return getDOMObjectMap().contains(object) || getActiveDOMObjectMap().contains(object);
+}
+
+// The caller must have increased obj's ref count.
+void V8Proxy::setJSWrapperForDOMObject(void* object, v8::Persistent<v8::Object> wrapper)
+{
+    ASSERT(maybeDOMWrapper(wrapper));
+#ifndef NDEBUG
+    V8ClassIndex::V8WrapperType type = V8Proxy::domWrapperType(wrapper);
+    switch (type) {
+#define MAKE_CASE(TYPE, NAME) case V8ClassIndex::TYPE:
+        ACTIVE_DOM_OBJECT_TYPES(MAKE_CASE)
+        ASSERT_NOT_REACHED();
+#undef MAKE_CASE
+    default:
+        break;
+    }
+#endif
+    getDOMObjectMap().set(object, wrapper);
+}
+
+// The caller must have increased obj's ref count.
+void V8Proxy::setJSWrapperForActiveDOMObject(void* object, v8::Persistent<v8::Object> wrapper)
+{
+    ASSERT(maybeDOMWrapper(wrapper));
+#ifndef NDEBUG
+    V8ClassIndex::V8WrapperType type = V8Proxy::domWrapperType(wrapper);
+    switch (type) {
+#define MAKE_CASE(TYPE, NAME) case V8ClassIndex::TYPE: break;
+        ACTIVE_DOM_OBJECT_TYPES(MAKE_CASE)
+    default: 
+        ASSERT_NOT_REACHED();
+#undef MAKE_CASE
+    }
+#endif
+    getActiveDOMObjectMap().set(object, wrapper);
+}
+
+// The caller must have increased node's ref count.
+void V8Proxy::setJSWrapperForDOMNode(Node* node, v8::Persistent<v8::Object> wrapper)
+{
+    ASSERT(maybeDOMWrapper(wrapper));
+    getDOMNodeMap().set(node, wrapper);
+}
+
+// Event listeners
+
+static V8EventListener* findEventListenerInList(V8EventListenerList& list, v8::Local<v8::Value> listener, bool isInline)
+{
+    ASSERT(v8::Context::InContext());
+
+    if (!listener->IsObject())
+        return 0;
+
+    return list.find(listener->ToObject(), isInline);
+}
+
+// Find an existing wrapper for a JS event listener in the map.
+PassRefPtr<V8EventListener> V8Proxy::findV8EventListener(v8::Local<v8::Value> listener, bool isInline)
+{
+    return findEventListenerInList(m_eventListeners, listener, isInline);
+}
+
+PassRefPtr<V8EventListener> V8Proxy::findOrCreateV8EventListener(v8::Local<v8::Value> object, bool isInline)
+{
+    ASSERT(v8::Context::InContext());
+
+    if (!object->IsObject())
+        return 0;
+
+    V8EventListener* wrapper = findEventListenerInList(m_eventListeners, object, isInline);
+    if (wrapper)
+        return wrapper;
+
+    // Create a new one, and add to cache.
+    RefPtr<V8EventListener> newListener = V8EventListener::create(m_frame, v8::Local<v8::Object>::Cast(object), isInline);
+    m_eventListeners.add(newListener.get());
+
+    return newListener;
+}
+
+// Object event listeners (such as XmlHttpRequest and MessagePort) are
+// different from listeners on DOM nodes. An object event listener wrapper
+// only holds a weak reference to the JS function. A strong reference can
+// create a cycle.
+//
+// The lifetime of these objects is bounded by the life time of its JS
+// wrapper. So we can create a hidden reference from the JS wrapper to
+// to its JS function.
+//
+//                          (map)
+//              XHR      <----------  JS_wrapper
+//               |             (hidden) :  ^
+//               V                      V  : (may reachable by closure)
+//           V8_listener  --------> JS_function
+//                         (weak)  <-- may create a cycle if it is strong
+//
+// The persistent reference is made weak in the constructor
+// of V8ObjectEventListener.
+
+PassRefPtr<V8EventListener> V8Proxy::findObjectEventListener( v8::Local<v8::Value> listener, bool isInline)
+{
+    return findEventListenerInList(m_xhrListeners, listener, isInline);
+}
+
+PassRefPtr<V8EventListener> V8Proxy::findOrCreateObjectEventListener(v8::Local<v8::Value> object, bool isInline)
+{
+    ASSERT(v8::Context::InContext());
+
+    if (!object->IsObject())
+        return 0;
+
+    V8EventListener* wrapper = findEventListenerInList(m_xhrListeners, object, isInline);
+    if (wrapper)
+        return wrapper;
+
+    // Create a new one, and add to cache.
+    RefPtr<V8EventListener> newListener = V8ObjectEventListener::create(m_frame, v8::Local<v8::Object>::Cast(object), isInline);
+    m_xhrListeners.add(newListener.get());
+
+    return newListener.release();
+}
+
+
+static void removeEventListenerFromList(V8EventListenerList& list, V8EventListener* listener)
+{
+    list.remove(listener);
+}
+
+void V8Proxy::removeV8EventListener(V8EventListener* listener)
+{
+    removeEventListenerFromList(m_eventListeners, listener);
+}
+
+
+void V8Proxy::removeObjectEventListener(V8ObjectEventListener* listener)
+{
+    removeEventListenerFromList(m_xhrListeners, listener);
+}
+
+static void disconnectEventListenersInList(V8EventListenerList& list)
+{
+    V8EventListenerList::iterator it = list.begin();
+    while (it != list.end()) {
+        (*it)->disconnectFrame();
+        ++it;
+    }
+    list.clear();
+}
+
+
+void V8Proxy::disconnectEventListeners()
+{
+    disconnectEventListenersInList(m_eventListeners);
+    disconnectEventListenersInList(m_xhrListeners);
+}
+
+
+v8::Handle<v8::Script> V8Proxy::compileScript(v8::Handle<v8::String> code, const String& fileName, int baseLine)
+{
+    const uint16_t* fileNameString = FromWebCoreString(fileName);
+    v8::Handle<v8::String> name = v8::String::New(fileNameString, fileName.length());
+    v8::Handle<v8::Integer> line = v8::Integer::New(baseLine);
+    v8::ScriptOrigin origin(name, line);
+    v8::Handle<v8::Script> script = v8::Script::Compile(code, &origin);
+    return script;
+}
+
+bool V8Proxy::handleOutOfMemory()
+{
+    v8::Local<v8::Context> context = v8::Context::GetCurrent();
+
+    if (!context->HasOutOfMemoryException())
+        return false;
+
+    // Warning, error, disable JS for this frame?
+    Frame* frame = V8Proxy::retrieveFrame(context);
+
+    V8Proxy* proxy = V8Proxy::retrieve(frame);
+    if (proxy) {
+        // Clean m_context, and event handlers.
+        proxy->clearForClose();
+
+        proxy->destroyGlobal();
+    }
+
+    ChromiumBridge::notifyJSOutOfMemory(frame);
+
+    // Disable JS.
+    Settings* settings = frame->settings();
+    ASSERT(settings);
+    settings->setJavaScriptEnabled(false);
+
+    return true;
+}
+
+void V8Proxy::evaluateInNewWorld(const Vector<ScriptSourceCode>& sources)
+{
+    initContextIfNeeded();
+    V8IsolatedWorld::evaluate(sources, this);
+}
+
+void V8Proxy::evaluateInNewContext(const Vector<ScriptSourceCode>& sources)
+{
+    initContextIfNeeded();
+
+    v8::HandleScope handleScope;
+
+    // Set up the DOM window as the prototype of the new global object.
+    v8::Handle<v8::Context> windowContext = m_context;
+    v8::Handle<v8::Object> windowGlobal = windowContext->Global();
+    v8::Handle<v8::Value> windowWrapper = V8Proxy::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, windowGlobal);
+
+    ASSERT(V8Proxy::convertDOMWrapperToNative<DOMWindow>(windowWrapper) == m_frame->domWindow());
+
+    v8::Persistent<v8::Context> context = createNewContext(v8::Handle<v8::Object>());
+    v8::Context::Scope contextScope(context);
+
+    // Setup context id for JS debugger.
+    v8::Handle<v8::Object> contextData = v8::Object::New();
+    v8::Handle<v8::Value> windowContextData = windowContext->GetData();
+    if (windowContextData->IsObject()) {
+        v8::Handle<v8::String> propertyName = v8::String::New(kContextDebugDataValue);
+        contextData->Set(propertyName, v8::Object::Cast(*windowContextData)->Get(propertyName));
+    }
+    contextData->Set(v8::String::New(kContextDebugDataType), v8::String::New("injected"));
+    context->SetData(contextData);
+
+    v8::Handle<v8::Object> global = context->Global();
+
+    v8::Handle<v8::String> implicitProtoString = v8::String::New("__proto__");
+    global->Set(implicitProtoString, windowWrapper);
+
+    // Give the code running in the new context a way to get access to the
+    // original context.
+    global->Set(v8::String::New("contentWindow"), windowGlobal);
+
+    // Run code in the new context.
+    for (size_t i = 0; i < sources.size(); ++i)
+        evaluate(sources[i], 0);
+
+    // Using the default security token means that the canAccess is always
+    // called, which is slow.
+    // FIXME: Use tokens where possible. This will mean keeping track of all
+    // created contexts so that they can all be updated when the document domain
+    // changes.
+    context->UseDefaultSecurityToken();
+    context.Dispose();
+}
+
+v8::Local<v8::Value> V8Proxy::evaluate(const ScriptSourceCode& source, Node* node)
+{
+    ASSERT(v8::Context::InContext());
+
+    // Compile the script.
+    v8::Local<v8::String> code = v8ExternalString(source.source());
+    ChromiumBridge::traceEventBegin("v8.compile", node, "");
+
+    // NOTE: For compatibility with WebCore, ScriptSourceCode's line starts at
+    // 1, whereas v8 starts at 0.
+    v8::Handle<v8::Script> script = compileScript(code, source.url(), source.startLine() - 1);
+    ChromiumBridge::traceEventEnd("v8.compile", node, "");
+
+    ChromiumBridge::traceEventBegin("v8.run", node, "");
+    v8::Local<v8::Value> result;
+    {
+        // Isolate exceptions that occur when 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);
+
+        // Set inlineCode to true for <a href="javascript:doSomething()">
+        // and false for <script>doSomething</script>. We make a rough guess at
+        // this based on whether the script source has a URL.
+        result = runScript(script, source.url().string().isNull());
+    }
+    ChromiumBridge::traceEventEnd("v8.run", node, "");
+    return result;
+}
+
+v8::Local<v8::Value> V8Proxy::runScript(v8::Handle<v8::Script> script, bool isInlineCode)
+{
+    if (script.IsEmpty())
+        return notHandledByInterceptor();
+
+    // Compute the source string and prevent against infinite recursion.
+    if (m_recursion >= kMaxRecursionDepth) {
+        v8::Local<v8::String> code = v8ExternalString("throw RangeError('Recursion too deep')");
+        // FIXME: Ideally, we should be able to re-use the origin of the
+        // script passed to us as the argument instead of using an empty string
+        // and 0 baseLine.
+        script = compileScript(code, "", 0);
+    }
+
+    if (handleOutOfMemory())
+        ASSERT(script.IsEmpty());
+
+    if (script.IsEmpty())
+        return notHandledByInterceptor();
+
+    // Save the previous value of the inlineCode flag and update the flag for
+    // the duration of the script invocation.
+    bool previousInlineCode = inlineCode();
+    setInlineCode(isInlineCode);
+
+    // Run the script and keep track of the current recursion depth.
+    v8::Local<v8::Value> result;
+    {
+        ConsoleMessageScope scope;
+        m_recursion++;
+
+        // See comment in V8Proxy::callFunction.
+        m_frame->keepAlive();
+
+        result = script->Run();
+        m_recursion--;
+    }
+
+    if (handleOutOfMemory())
+        ASSERT(result.IsEmpty());
+
+    // Handle V8 internal error situation (Out-of-memory).
+    if (result.IsEmpty())
+        return notHandledByInterceptor();
+
+    // Restore inlineCode flag.
+    setInlineCode(previousInlineCode);
+
+    if (v8::V8::IsDead())
+        handleFatalErrorInV8();
+
+    return result;
+}
+
+v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[])
+{
+    // For now, we don't put any artificial limitations on the depth
+    // of recursion that stems from calling functions. This is in
+    // contrast to the script evaluations.
+    v8::Local<v8::Value> result;
+    {
+        ConsoleMessageScope scope;
+
+        // Evaluating the JavaScript could cause the frame to be deallocated,
+        // so we start the keep alive timer here.
+        // Frame::keepAlive method adds the ref count of the frame and sets a
+        // timer to decrease the ref count. It assumes that the current JavaScript
+        // execution finishs before firing the timer.
+        m_frame->keepAlive();
+
+        result = function->Call(receiver, argc, args);
+    }
+
+    if (v8::V8::IsDead())
+        handleFatalErrorInV8();
+
+    return result;
+}
+
+v8::Local<v8::Value> V8Proxy::newInstance(v8::Handle<v8::Function> constructor, int argc, v8::Handle<v8::Value> args[])
+{
+    // No artificial limitations on the depth of recursion, see comment in
+    // V8Proxy::callFunction.
+    v8::Local<v8::Value> result;
+    {
+        ConsoleMessageScope scope;
+
+        // See comment in V8Proxy::callFunction.
+        m_frame->keepAlive();
+
+        result = constructor->NewInstance(argc, args);
+    }
+
+    if (v8::V8::IsDead())
+        handleFatalErrorInV8();
+
+    return result;
+}
+
+v8::Local<v8::Function> V8Proxy::getConstructor(V8ClassIndex::V8WrapperType type)
+{
+    // A DOM constructor is a function instance created from a DOM constructor
+    // template. There is one instance per context. A DOM constructor is
+    // different from a normal function in two ways:
+    //   1) it cannot be called as constructor (aka, used to create a DOM object)
+    //   2) its __proto__ points to Object.prototype rather than
+    //      Function.prototype.
+    // The reason for 2) is that, in Safari, a DOM constructor is a normal JS
+    // object, but not a function. Hotmail relies on the fact that, in Safari,
+    // HTMLElement.__proto__ == Object.prototype.
+    //
+    // m_objectPrototype is a cache of the original Object.prototype.
+
+    ASSERT(isContextInitialized());
+    // Enter the context of the proxy to make sure that the
+    // function is constructed in the context corresponding to
+    // this proxy.
+    v8::Context::Scope scope(m_context);
+    v8::Handle<v8::FunctionTemplate> functionTemplate = getTemplate(type);
+    // Getting the function might fail if we're running out of
+    // stack or memory.
+    v8::TryCatch tryCatch;
+    v8::Local<v8::Function> value = functionTemplate->GetFunction();
+    if (value.IsEmpty())
+      return v8::Local<v8::Function>();
+    // Hotmail fix, see comments above.
+    value->Set(v8::String::New("__proto__"), m_objectPrototype);
+    return value;
+}
+
+v8::Local<v8::Object> V8Proxy::createWrapperFromCache(V8ClassIndex::V8WrapperType type)
+{
+    int classIndex = V8ClassIndex::ToInt(type);
+    v8::Local<v8::Value> cachedObject = m_wrapperBoilerplates->Get(v8::Integer::New(classIndex));
+    if (cachedObject->IsObject()) {
+        v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(cachedObject);
+        return object->Clone();
+    }
+
+    // Not in cache.
+    initContextIfNeeded();
+    v8::Context::Scope scope(m_context);
+    v8::Local<v8::Function> function = getConstructor(type);
+    v8::Local<v8::Object> instance = SafeAllocation::newInstance(function);
+    if (!instance.IsEmpty()) {
+        m_wrapperBoilerplates->Set(v8::Integer::New(classIndex), instance);
+        return instance->Clone();
+    }
+    return notHandledByInterceptor();
+}
+
+// Get the string 'toString'.
+static v8::Persistent<v8::String> GetToStringName()
+{
+    DEFINE_STATIC_LOCAL(v8::Persistent<v8::String>, value, ());
+    if (value.IsEmpty())
+        value = v8::Persistent<v8::String>::New(v8::String::New("toString"));
+    return value;
+}
+
+static v8::Handle<v8::Value> ConstructorToString(const v8::Arguments& args)
+{
+    // The DOM constructors' toString functions grab the current toString
+    // for Functions by taking the toString function of itself and then
+    // calling it with the constructor as its receiver. This means that
+    // changes to the Function prototype chain or toString function are
+    // reflected when printing DOM constructors. The only wart is that
+    // changes to a DOM constructor's toString's toString will cause the
+    // toString of the DOM constructor itself to change. This is extremely
+    // obscure and unlikely to be a problem.
+    v8::Handle<v8::Value> value = args.Callee()->Get(GetToStringName());
+    if (!value->IsFunction()) 
+        return v8::String::New("");
+    return v8::Handle<v8::Function>::Cast(value)->Call(args.This(), 0, 0);
+}
+
+v8::Persistent<v8::FunctionTemplate> V8Proxy::getTemplate(V8ClassIndex::V8WrapperType type)
+{
+    v8::Persistent<v8::FunctionTemplate>* cacheCell = V8ClassIndex::GetCache(type);
+    if (!cacheCell->IsEmpty())
+        return *cacheCell;
+
+    // Not in the cache.
+    FunctionTemplateFactory factory = V8ClassIndex::GetFactory(type);
+    v8::Persistent<v8::FunctionTemplate> descriptor = factory();
+    // DOM constructors are functions and should print themselves as such.
+    // However, we will later replace their prototypes with Object
+    // prototypes so we need to explicitly override toString on the
+    // instance itself. If we later make DOM constructors full objects
+    // we can give them class names instead and Object.prototype.toString
+    // will work so we can remove this code.
+    DEFINE_STATIC_LOCAL(v8::Persistent<v8::FunctionTemplate>, toStringTemplate, ());
+    if (toStringTemplate.IsEmpty())
+        toStringTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(ConstructorToString));
+    descriptor->Set(GetToStringName(), toStringTemplate);
+    switch (type) {
+    case V8ClassIndex::CSSSTYLEDECLARATION:
+        // The named property handler for style declarations has a
+        // setter. Therefore, the interceptor has to be on the object
+        // itself and not on the prototype object.
+        descriptor->InstanceTemplate()->SetNamedPropertyHandler( USE_NAMED_PROPERTY_GETTER(CSSStyleDeclaration), USE_NAMED_PROPERTY_SETTER(CSSStyleDeclaration));
+        setCollectionStringOrNullIndexedGetter<CSSStyleDeclaration>(descriptor);
+        break;
+    case V8ClassIndex::CSSRULELIST:
+        setCollectionIndexedGetter<CSSRuleList, CSSRule>(descriptor,  V8ClassIndex::CSSRULE);
+        break;
+    case V8ClassIndex::CSSVALUELIST:
+        setCollectionIndexedGetter<CSSValueList, CSSValue>(descriptor, V8ClassIndex::CSSVALUE);
+        break;
+    case V8ClassIndex::CSSVARIABLESDECLARATION:
+        setCollectionStringOrNullIndexedGetter<CSSVariablesDeclaration>(descriptor);
+        break;
+    case V8ClassIndex::WEBKITCSSTRANSFORMVALUE:
+        setCollectionIndexedGetter<WebKitCSSTransformValue, CSSValue>(descriptor, V8ClassIndex::CSSVALUE);
+        break;
+    case V8ClassIndex::UNDETECTABLEHTMLCOLLECTION:
+        descriptor->InstanceTemplate()->MarkAsUndetectable(); // fall through
+    case V8ClassIndex::HTMLCOLLECTION:
+        descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPERTY_GETTER(HTMLCollection));
+        descriptor->InstanceTemplate()->SetCallAsFunctionHandler(USE_CALLBACK(HTMLCollectionCallAsFunction));
+        setCollectionIndexedGetter<HTMLCollection, Node>(descriptor, V8ClassIndex::NODE);
+        break;
+    case V8ClassIndex::HTMLOPTIONSCOLLECTION:
+        descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPERTY_GETTER(HTMLCollection));
+        descriptor->InstanceTemplate()->SetIndexedPropertyHandler(USE_INDEXED_PROPERTY_GETTER(HTMLOptionsCollection), USE_INDEXED_PROPERTY_SETTER(HTMLOptionsCollection));
+        descriptor->InstanceTemplate()->SetCallAsFunctionHandler(USE_CALLBACK(HTMLCollectionCallAsFunction));
+        break;
+    case V8ClassIndex::HTMLSELECTELEMENT:
+        descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPERTY_GETTER(HTMLSelectElementCollection));
+        descriptor->InstanceTemplate()->SetIndexedPropertyHandler(nodeCollectionIndexedPropertyGetter<HTMLSelectElement>, USE_INDEXED_PROPERTY_SETTER(HTMLSelectElementCollection),
+            0, 0, nodeCollectionIndexedPropertyEnumerator<HTMLSelectElement>, v8::Integer::New(V8ClassIndex::NODE));
+        break;
+    case V8ClassIndex::HTMLDOCUMENT: {
+        descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPERTY_GETTER(HTMLDocument), 0, 0, USE_NAMED_PROPERTY_DELETER(HTMLDocument));
+
+        // We add an extra internal field to all Document wrappers for
+        // storing a per document DOMImplementation wrapper.
+        //
+        // Additionally, we add two extra internal fields for
+        // HTMLDocuments to implement temporary shadowing of
+        // document.all. One field holds an object that is used as a
+        // marker. The other field holds the marker object if
+        // document.all is not shadowed and some other value if
+        // document.all is shadowed.
+        v8::Local<v8::ObjectTemplate> instanceTemplate = descriptor->InstanceTemplate();
+        ASSERT(instanceTemplate->InternalFieldCount() == V8Custom::kDefaultWrapperInternalFieldCount);
+        instanceTemplate->SetInternalFieldCount(V8Custom::kHTMLDocumentInternalFieldCount);
+        break;
+    }
+#if ENABLE(SVG)
+    case V8ClassIndex::SVGDOCUMENT:  // fall through
+#endif
+    case V8ClassIndex::DOCUMENT: {
+        // We add an extra internal field to all Document wrappers for
+        // storing a per document DOMImplementation wrapper.
+        v8::Local<v8::ObjectTemplate> instanceTemplate = descriptor->InstanceTemplate();
+        ASSERT(instanceTemplate->InternalFieldCount() == V8Custom::kDefaultWrapperInternalFieldCount);
+        instanceTemplate->SetInternalFieldCount( V8Custom::kDocumentMinimumInternalFieldCount);
+        break;
+    }
+    case V8ClassIndex::HTMLAPPLETELEMENT:  // fall through
+    case V8ClassIndex::HTMLEMBEDELEMENT:  // fall through
+    case V8ClassIndex::HTMLOBJECTELEMENT:
+        // HTMLAppletElement, HTMLEmbedElement and HTMLObjectElement are
+        // inherited from HTMLPlugInElement, and they share the same property
+        // handling code.
+        descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPERTY_GETTER(HTMLPlugInElement), USE_NAMED_PROPERTY_SETTER(HTMLPlugInElement));
+        descriptor->InstanceTemplate()->SetIndexedPropertyHandler(USE_INDEXED_PROPERTY_GETTER(HTMLPlugInElement), USE_INDEXED_PROPERTY_SETTER(HTMLPlugInElement));
+        descriptor->InstanceTemplate()->SetCallAsFunctionHandler(USE_CALLBACK(HTMLPlugInElement));
+        break;
+    case V8ClassIndex::HTMLFRAMESETELEMENT:
+        descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPERTY_GETTER(HTMLFrameSetElement));
+        break;
+    case V8ClassIndex::HTMLFORMELEMENT:
+        descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPERTY_GETTER(HTMLFormElement));
+        descriptor->InstanceTemplate()->SetIndexedPropertyHandler(USE_INDEXED_PROPERTY_GETTER(HTMLFormElement), 0, 0, 0, nodeCollectionIndexedPropertyEnumerator<HTMLFormElement>, v8::Integer::New(V8ClassIndex::NODE));
+        break;
+    case V8ClassIndex::CANVASPIXELARRAY:
+        descriptor->InstanceTemplate()->SetIndexedPropertyHandler(USE_INDEXED_PROPERTY_GETTER(CanvasPixelArray), USE_INDEXED_PROPERTY_SETTER(CanvasPixelArray));
+        break;
+    case V8ClassIndex::STYLESHEET:  // fall through
+    case V8ClassIndex::CSSSTYLESHEET: {
+        // We add an extra internal field to hold a reference to
+        // the owner node.
+        v8::Local<v8::ObjectTemplate> instanceTemplate = descriptor->InstanceTemplate();
+        ASSERT(instanceTemplate->InternalFieldCount() == V8Custom::kDefaultWrapperInternalFieldCount);
+        instanceTemplate->SetInternalFieldCount(V8Custom::kStyleSheetInternalFieldCount);
+        break;
+    }
+    case V8ClassIndex::MEDIALIST:
+        setCollectionStringOrNullIndexedGetter<MediaList>(descriptor);
+        break;
+    case V8ClassIndex::MIMETYPEARRAY:
+        setCollectionIndexedAndNamedGetters<MimeTypeArray, MimeType>(descriptor, V8ClassIndex::MIMETYPE);
+        break;
+    case V8ClassIndex::NAMEDNODEMAP:
+        descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPERTY_GETTER(NamedNodeMap));
+        descriptor->InstanceTemplate()->SetIndexedPropertyHandler(USE_INDEXED_PROPERTY_GETTER(NamedNodeMap), 0, 0, 0, collectionIndexedPropertyEnumerator<NamedNodeMap>, v8::Integer::New(V8ClassIndex::NODE));
+        break;
+#if ENABLE(DOM_STORAGE)
+    case V8ClassIndex::STORAGE:
+        descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPERTY_GETTER(Storage), USE_NAMED_PROPERTY_SETTER(Storage), 0, USE_NAMED_PROPERTY_DELETER(Storage), V8Custom::v8StorageNamedPropertyEnumerator);
+        descriptor->InstanceTemplate()->SetIndexedPropertyHandler(USE_INDEXED_PROPERTY_GETTER(Storage), USE_INDEXED_PROPERTY_SETTER(Storage), 0, USE_INDEXED_PROPERTY_DELETER(Storage));
+        break;
+#endif
+    case V8ClassIndex::NODELIST:
+        setCollectionIndexedGetter<NodeList, Node>(descriptor, V8ClassIndex::NODE);
+        descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPERTY_GETTER(NodeList));
+        break;
+    case V8ClassIndex::PLUGIN:
+        setCollectionIndexedAndNamedGetters<Plugin, MimeType>(descriptor, V8ClassIndex::MIMETYPE);
+        break;
+    case V8ClassIndex::PLUGINARRAY:
+        setCollectionIndexedAndNamedGetters<PluginArray, Plugin>(descriptor, V8ClassIndex::PLUGIN);
+        break;
+    case V8ClassIndex::STYLESHEETLIST:
+        descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPERTY_GETTER(StyleSheetList));
+        setCollectionIndexedGetter<StyleSheetList, StyleSheet>(descriptor, V8ClassIndex::STYLESHEET);
+        break;
+    case V8ClassIndex::DOMWINDOW: {
+        v8::Local<v8::Signature> defaultSignature = v8::Signature::New(descriptor);
+
+        descriptor->PrototypeTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPERTY_GETTER(DOMWindow));
+        descriptor->PrototypeTemplate()->SetIndexedPropertyHandler(USE_INDEXED_PROPERTY_GETTER(DOMWindow));
+
+        descriptor->SetHiddenPrototype(true);
+
+        // Reserve spaces for references to location, history and
+        // navigator objects.
+        v8::Local<v8::ObjectTemplate> instanceTemplate = descriptor->InstanceTemplate();
+        instanceTemplate->SetInternalFieldCount(V8Custom::kDOMWindowInternalFieldCount);
+
+        // Set access check callbacks, but turned off initially.
+        // When a context is detached from a frame, turn on the access check.
+        // Turning on checks also invalidates inline caches of the object.
+        instanceTemplate->SetAccessCheckCallbacks(V8Custom::v8DOMWindowNamedSecurityCheck, V8Custom::v8DOMWindowIndexedSecurityCheck, v8::Integer::New(V8ClassIndex::DOMWINDOW), false);
+        break;
+    }
+    case V8ClassIndex::LOCATION: {
+        // For security reasons, these functions are on the instance
+        // instead of on the prototype object to insure that they cannot
+        // be overwritten.
+        v8::Local<v8::ObjectTemplate> instance = descriptor->InstanceTemplate();
+        instance->SetAccessor(v8::String::New("reload"), V8Custom::v8LocationReloadAccessorGetter, 0, v8::Handle<v8::Value>(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly));
+        instance->SetAccessor(v8::String::New("replace"), V8Custom::v8LocationReplaceAccessorGetter, 0, v8::Handle<v8::Value>(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly));
+        instance->SetAccessor(v8::String::New("assign"), V8Custom::v8LocationAssignAccessorGetter, 0, v8::Handle<v8::Value>(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly));
+        break;
+    }
+    case V8ClassIndex::HISTORY:
+        break;
+
+    case V8ClassIndex::MESSAGECHANNEL: {
+        // Reserve two more internal fields for referencing the port1
+        // and port2 wrappers. This ensures that the port wrappers are
+        // kept alive when the channel wrapper is.
+        descriptor->SetCallHandler(USE_CALLBACK(MessageChannelConstructor));
+        v8::Local<v8::ObjectTemplate> instanceTemplate = descriptor->InstanceTemplate();
+        instanceTemplate->SetInternalFieldCount(V8Custom::kMessageChannelInternalFieldCount);
+        break;
+    }
+
+    case V8ClassIndex::MESSAGEPORT: {
+        // Reserve one more internal field for keeping event listeners.
+        v8::Local<v8::ObjectTemplate> instanceTemplate = descriptor->InstanceTemplate();
+        instanceTemplate->SetInternalFieldCount(V8Custom::kMessagePortInternalFieldCount);
+        break;
+    }
+
+#if ENABLE(WORKERS)
+    case V8ClassIndex::WORKER: {
+        // Reserve one more internal field for keeping event listeners.
+        v8::Local<v8::ObjectTemplate> instanceTemplate = descriptor->InstanceTemplate();
+        instanceTemplate->SetInternalFieldCount(V8Custom::kWorkerInternalFieldCount);
+        descriptor->SetCallHandler(USE_CALLBACK(WorkerConstructor));
+        break;
+    }
+
+    case V8ClassIndex::WORKERCONTEXT: {
+        // Reserve one more internal field for keeping event listeners.
+        v8::Local<v8::ObjectTemplate> instanceTemplate = descriptor->InstanceTemplate();
+        instanceTemplate->SetInternalFieldCount(V8Custom::kWorkerContextInternalFieldCount);
+        break;
+    }
+#endif // WORKERS
+
+    // The following objects are created from JavaScript.
+    case V8ClassIndex::DOMPARSER:
+        descriptor->SetCallHandler(USE_CALLBACK(DOMParserConstructor));
+        break;
+#if ENABLE(VIDEO)
+    case V8ClassIndex::HTMLAUDIOELEMENT:
+        descriptor->SetCallHandler(USE_CALLBACK(HTMLAudioElementConstructor));
+        break;
+#endif
+    case V8ClassIndex::HTMLIMAGEELEMENT:
+        descriptor->SetCallHandler(USE_CALLBACK(HTMLImageElementConstructor));
+        break;
+    case V8ClassIndex::HTMLOPTIONELEMENT:
+        descriptor->SetCallHandler(USE_CALLBACK(HTMLOptionElementConstructor));
+        break;
+    case V8ClassIndex::WEBKITCSSMATRIX:
+        descriptor->SetCallHandler(USE_CALLBACK(WebKitCSSMatrixConstructor));
+        break;
+    case V8ClassIndex::WEBKITPOINT:
+        descriptor->SetCallHandler(USE_CALLBACK(WebKitPointConstructor));
+        break;
+    case V8ClassIndex::XMLSERIALIZER:
+        descriptor->SetCallHandler(USE_CALLBACK(XMLSerializerConstructor));
+        break;
+    case V8ClassIndex::XMLHTTPREQUEST: {
+        // Reserve one more internal field for keeping event listeners.
+        v8::Local<v8::ObjectTemplate> instanceTemplate = descriptor->InstanceTemplate();
+        instanceTemplate->SetInternalFieldCount(V8Custom::kXMLHttpRequestInternalFieldCount);
+        descriptor->SetCallHandler(USE_CALLBACK(XMLHttpRequestConstructor));
+        break;
+    }
+    case V8ClassIndex::XMLHTTPREQUESTUPLOAD: {
+        // Reserve one more internal field for keeping event listeners.
+        v8::Local<v8::ObjectTemplate> instanceTemplate = descriptor->InstanceTemplate();
+        instanceTemplate->SetInternalFieldCount(V8Custom::kXMLHttpRequestInternalFieldCount);
+        break;
+    }
+    case V8ClassIndex::XPATHEVALUATOR:
+        descriptor->SetCallHandler(USE_CALLBACK(XPathEvaluatorConstructor));
+        break;
+    case V8ClassIndex::XSLTPROCESSOR:
+        descriptor->SetCallHandler(USE_CALLBACK(XSLTProcessorConstructor));
+        break;
+    case V8ClassIndex::CLIENTRECTLIST:
+        descriptor->InstanceTemplate()->SetIndexedPropertyHandler(USE_INDEXED_PROPERTY_GETTER(ClientRectList));
+        break;
+    default:
+        break;
+    }
+
+    *cacheCell = descriptor;
+    return descriptor;
+}
+
+bool V8Proxy::isContextInitialized()
+{
+    // m_context, m_global, m_objectPrototype and m_wrapperBoilerplates should
+    // all be non-empty if if m_context is non-empty.
+    ASSERT(m_context.IsEmpty() || !m_global.IsEmpty());
+    ASSERT(m_context.IsEmpty() || !m_objectPrototype.IsEmpty());
+    ASSERT(m_context.IsEmpty() || !m_wrapperBoilerplates.IsEmpty());
+    return !m_context.IsEmpty();
+}
+
+DOMWindow* V8Proxy::retrieveWindow()
+{
+    // FIXME: This seems very fragile. How do we know that the global object
+    // from the current context is something sensible? Do we need to use the
+    // last entered here? Who calls this?
+    return retrieveWindow(v8::Context::GetCurrent());
+}
+
+DOMWindow* V8Proxy::retrieveWindow(v8::Handle<v8::Context> context)
+{
+    v8::Handle<v8::Object> global = context->Global();
+    ASSERT(!global.IsEmpty());
+    global = lookupDOMWrapper(V8ClassIndex::DOMWINDOW, global);
+    ASSERT(!global.IsEmpty());
+    return convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, global);
+}
+
+Frame* V8Proxy::retrieveFrame(v8::Handle<v8::Context> context)
+{
+    return retrieveWindow(context)->frame();
+}
+
+Frame* V8Proxy::retrieveFrameForEnteredContext()
+{
+    v8::Handle<v8::Context> context = v8::Context::GetEntered();
+    if (context.IsEmpty())
+        return 0;
+    return retrieveFrame(context);
+}
+
+Frame* V8Proxy::retrieveFrameForCurrentContext()
+{
+    v8::Handle<v8::Context> context = v8::Context::GetCurrent();
+    if (context.IsEmpty())
+        return 0;
+    return retrieveFrame(context);
+}
+
+Frame* V8Proxy::retrieveFrameForCallingContext()
+{
+    v8::Handle<v8::Context> context = v8::Context::GetCalling();
+    if (context.IsEmpty())
+        return 0;
+    return retrieveFrame(context);
+}
+
+Frame* V8Proxy::retrieveFrame()
+{
+    DOMWindow* window = retrieveWindow();
+    return window ? window->frame() : 0;
+}
+
+V8Proxy* V8Proxy::retrieve()
+{
+    DOMWindow* window = retrieveWindow();
+    ASSERT(window);
+    return retrieve(window->frame());
+}
+
+V8Proxy* V8Proxy::retrieve(Frame* frame)
+{
+    if (!frame)
+        return 0;
+    return frame->script()->isEnabled() ? frame->script()->proxy() : 0;
+}
+
+V8Proxy* V8Proxy::retrieve(ScriptExecutionContext* context)
+{
+    if (!context->isDocument())
+        return 0;
+    return retrieve(static_cast<Document*>(context)->frame());
+}
+
+void V8Proxy::disconnectFrame()
+{
+    disconnectEventListeners();
+}
+
+bool V8Proxy::isEnabled()
+{
+    Settings* settings = m_frame->settings();
+    if (!settings)
+        return false;
+
+    // In the common case, JavaScript is enabled and we're done.
+    if (settings->isJavaScriptEnabled())
+        return true;
+
+    // If JavaScript has been disabled, we need to look at the frame to tell
+    // whether this script came from the web or the embedder. Scripts from the
+    // embedder are safe to run, but scripts from the other sources are
+    // disallowed.
+    Document* document = m_frame->document();
+    if (!document)
+        return false;
+
+    SecurityOrigin* origin = document->securityOrigin();
+    if (origin->protocol().isEmpty())
+        return false; // Uninitialized document
+
+    if (origin->protocol() == "http" || origin->protocol() == "https")
+        return false; // Web site
+
+    // FIXME: the following are application decisions, and they should
+    // not be made at this layer. instead, we should bridge out to the
+    // embedder to allow them to override policy here.
+
+    if (origin->protocol() == ChromiumBridge::uiResourceProtocol())
+        return true;   // Embedder's scripts are ok to run
+
+    // If the scheme is ftp: or file:, an empty file name indicates a directory
+    // listing, which requires JavaScript to function properly.
+    const char* kDirProtocols[] = { "ftp", "file" };
+    for (size_t i = 0; i < arraysize(kDirProtocols); ++i) {
+        if (origin->protocol() == kDirProtocols[i]) {
+            const KURL& url = document->url();
+            return url.pathAfterLastSlash() == url.pathEnd();
+        }
+    }
+
+    return false; // Other protocols fall through to here
+}
+
+void V8Proxy::updateDocumentWrapper(v8::Handle<v8::Value> wrapper)
+{
+    clearDocumentWrapper();
+
+    ASSERT(m_document.IsEmpty());
+    m_document = v8::Persistent<v8::Value>::New(wrapper);
+#ifndef NDEBUG
+    registerGlobalHandle(PROXY, this, m_document);
+#endif
+}
+
+void V8Proxy::clearDocumentWrapper()
+{
+    if (!m_document.IsEmpty()) {
+#ifndef NDEBUG
+        unregisterGlobalHandle(this, m_document);
+#endif
+        m_document.Dispose();
+        m_document.Clear();
+    }
+}
+
+void V8Proxy::updateDocumentWrapperCache()
+{
+    v8::HandleScope handleScope;
+    v8::Context::Scope contextScope(context());
+
+    // If the document has no frame, NodeToV8Object might get the
+    // document wrapper for a document that is about to be deleted.
+    // If the ForceSet below causes a garbage collection, the document
+    // might get deleted and the global handle for the document
+    // wrapper cleared. Using the cleared global handle will lead to
+    // crashes. In this case we clear the cache and let the DOMWindow
+    // accessor handle access to the document.
+    if (!m_frame->document()->frame()) {
+        clearDocumentWrapperCache();
+        return;
+    }
+
+    v8::Handle<v8::Value> documentWrapper = convertNodeToV8Object(m_frame->document());
+
+    // If instantiation of the document wrapper fails, clear the cache
+    // and let the DOMWindow accessor handle access to the document.
+    if (documentWrapper.IsEmpty()) {
+        clearDocumentWrapperCache();
+        return;
+    }
+    m_context->Global()->ForceSet(v8::String::New("document"), documentWrapper, static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete));
+}
+
+void V8Proxy::clearDocumentWrapperCache()
+{
+    ASSERT(!m_context.IsEmpty());
+    m_context->Global()->ForceDelete(v8::String::New("document"));
+}
+
+void V8Proxy::disposeContextHandles()
+{
+    if (!m_context.IsEmpty()) {
+        m_frame->loader()->client()->didDestroyScriptContext();
+        m_context.Dispose();
+        m_context.Clear();
+    }
+
+    if (!m_wrapperBoilerplates.IsEmpty()) {
+#ifndef NDEBUG
+        unregisterGlobalHandle(this, m_wrapperBoilerplates);
+#endif
+        m_wrapperBoilerplates.Dispose();
+        m_wrapperBoilerplates.Clear();
+    }
+
+    if (!m_objectPrototype.IsEmpty()) {
+#ifndef NDEBUG
+        unregisterGlobalHandle(this, m_objectPrototype);
+#endif
+        m_objectPrototype.Dispose();
+        m_objectPrototype.Clear();
+    }
+}
+
+void V8Proxy::clearForClose()
+{
+    if (!m_context.IsEmpty()) {
+        v8::HandleScope handleScope;
+
+        clearDocumentWrapper();
+        disposeContextHandles();
+    }
+}
+
+void V8Proxy::clearForNavigation()
+{
+    disconnectEventListeners();
+
+    if (!m_context.IsEmpty()) {
+        v8::HandleScope handle;
+        clearDocumentWrapper();
+
+        v8::Context::Scope contextScope(m_context);
+
+        // Clear the document wrapper cache before turning on access checks on
+        // the old DOMWindow wrapper. This way, access to the document wrapper
+        // will be protected by the security checks on the DOMWindow wrapper.
+        clearDocumentWrapperCache();
+
+        // Turn on access check on the old DOMWindow wrapper.
+        v8::Handle<v8::Object> wrapper = lookupDOMWrapper(V8ClassIndex::DOMWINDOW, m_global);
+        ASSERT(!wrapper.IsEmpty());
+        wrapper->TurnOnAccessCheck();
+
+        // Separate the context from its global object.
+        m_context->DetachGlobal();
+
+        disposeContextHandles();
+
+        // Reinitialize the context so the global object points to
+        // the new DOM window.
+        initContextIfNeeded();
+    }
+}
+
+void V8Proxy::setSecurityToken()
+{
+    Document* document = m_frame->document();
+    // Setup security origin and security token.
+    if (!document) {
+        m_context->UseDefaultSecurityToken();
+        return;
+    }
+
+    // Ask the document's SecurityOrigin to generate a security token.
+    // If two tokens are equal, then the SecurityOrigins canAccess each other.
+    // If two tokens are not equal, then we have to call canAccess.
+    // Note: we can't use the HTTPOrigin if it was set from the DOM.
+    SecurityOrigin* origin = document->securityOrigin();
+    String token;
+    if (!origin->domainWasSetInDOM())
+        token = document->securityOrigin()->toString();
+
+    // An empty or "null" token means we always have to call
+    // canAccess. The toString method on securityOrigins returns the
+    // string "null" for empty security origins and for security
+    // origins that should only allow access to themselves. In this
+    // case, we use the global object as the security token to avoid
+    // calling canAccess when a script accesses its own objects.
+    if (token.isEmpty() || token == "null") {
+        m_context->UseDefaultSecurityToken();
+        return;
+    }
+
+    CString utf8Token = token.utf8();
+    // NOTE: V8 does identity comparison in fast path, must use a symbol
+    // as the security token.
+    m_context->SetSecurityToken(v8::String::NewSymbol(utf8Token.data(), utf8Token.length()));
+}
+
+void V8Proxy::updateDocument()
+{
+    if (!m_frame->document())
+        return;
+
+    if (m_global.IsEmpty()) {
+        ASSERT(m_context.IsEmpty());
+        return;
+    }
+
+    // We have a new document and we need to update the cache.
+    updateDocumentWrapperCache();
+
+    updateSecurityOrigin();
+}
+
+void V8Proxy::updateSecurityOrigin()
+{
+    v8::HandleScope scope;
+    setSecurityToken();
+}
+
+// Same origin policy implementation:
+//
+// Same origin policy prevents JS code from domain A access JS & DOM objects
+// in a different domain B. There are exceptions and several objects are
+// accessible by cross-domain code. For example, the window.frames object is
+// accessible by code from a different domain, but window.document is not.
+//
+// The binding code sets security check callbacks on a function template,
+// and accessing instances of the template calls the callback function.
+// The callback function checks same origin policy.
+//
+// Callback functions are expensive. V8 uses a security token string to do
+// fast access checks for the common case where source and target are in the
+// same domain. A security token is a string object that represents
+// the protocol/url/port of a domain.
+//
+// There are special cases where a security token matching is not enough.
+// For example, JavaScript can set its domain to a super domain by calling
+// document.setDomain(...). In these cases, the binding code can reset
+// a context's security token to its global object so that the fast access
+// check will always fail.
+
+// Check if the current execution context can access a target frame.
+// First it checks same domain policy using the lexical context
+//
+// This is equivalent to KJS::Window::allowsAccessFrom(ExecState*, String&).
+bool V8Proxy::canAccessPrivate(DOMWindow* targetWindow)
+{
+    ASSERT(targetWindow);
+
+    String message;
+
+    DOMWindow* originWindow = retrieveWindow();
+    if (originWindow == targetWindow)
+        return true;
+
+    if (!originWindow)
+        return false;
+
+    const SecurityOrigin* activeSecurityOrigin = originWindow->securityOrigin();
+    const SecurityOrigin* targetSecurityOrigin = targetWindow->securityOrigin();
+
+    // We have seen crashes were the security origin of the target has not been
+    // initialized. Defend against that.
+    if (!targetSecurityOrigin)
+        return false;
+
+    if (activeSecurityOrigin->canAccess(targetSecurityOrigin))
+        return true;
+
+    // Allow access to a "about:blank" page if the dynamic context is a
+    // detached context of the same frame as the blank page.
+    if (targetSecurityOrigin->isEmpty() && originWindow->frame() == targetWindow->frame())
+        return true;
+
+    return false;
+}
+
+bool V8Proxy::canAccessFrame(Frame* target, bool reportError)
+{
+    // The subject is detached from a frame, deny accesses.
+    if (!target)
+        return false;
+
+    if (!canAccessPrivate(target->domWindow())) {
+        if (reportError)
+            reportUnsafeAccessTo(target, ReportNow);
+        return false;
+    }
+    return true;
+}
+
+bool V8Proxy::checkNodeSecurity(Node* node)
+{
+    if (!node)
+        return false;
+
+    Frame* target = node->document()->frame();
+
+    if (!target)
+        return false;
+
+    return canAccessFrame(target, true);
+}
+
+v8::Persistent<v8::Context> V8Proxy::createNewContext(v8::Handle<v8::Object> global)
+{
+    v8::Persistent<v8::Context> result;
+
+    // Create a new environment using an empty template for the shadow
+    // object. Reuse the global object if one has been created earlier.
+    v8::Persistent<v8::ObjectTemplate> globalTemplate = V8DOMWindow::GetShadowObjectTemplate();
+    if (globalTemplate.IsEmpty())
+        return result;
+
+    // Install a security handler with V8.
+    globalTemplate->SetAccessCheckCallbacks(V8Custom::v8DOMWindowNamedSecurityCheck, V8Custom::v8DOMWindowIndexedSecurityCheck, v8::Integer::New(V8ClassIndex::DOMWINDOW));
+
+    // Dynamically tell v8 about our extensions now.
+    OwnArrayPtr<const char*> extensionNames(new const char*[m_extensions.size()]);
+    int index = 0;
+    for (V8ExtensionList::iterator it = m_extensions.begin(); it != m_extensions.end(); ++it) {
+        // Note: we check the loader URL here instead of the document URL
+        // because we might be currently loading an URL into a blank page.
+        // See http://code.google.com/p/chromium/issues/detail?id=10924
+        if (it->scheme.length() > 0 && (it->scheme != m_frame->loader()->activeDocumentLoader()->url().protocol() || it->scheme != m_frame->page()->mainFrame()->loader()->activeDocumentLoader()->url().protocol()))
+            continue;
+
+        extensionNames[index++] = it->extension->name();
+    }
+    v8::ExtensionConfiguration extensions(index, extensionNames.get());
+    result = v8::Context::New(&extensions, globalTemplate, global);
+
+    return result;
+}
+
+bool V8Proxy::installDOMWindow(v8::Handle<v8::Context> context, DOMWindow* window)
+{
+    v8::Handle<v8::String> implicitProtoString = v8::String::New("__proto__");
+    if (implicitProtoString.IsEmpty())
+        return false;
+
+    // Create a new JS window object and use it as the prototype for the  shadow global object.
+    v8::Handle<v8::Function> windowConstructor = getConstructor(V8ClassIndex::DOMWINDOW);
+    v8::Local<v8::Object> jsWindow = SafeAllocation::newInstance(windowConstructor);
+    // Bail out if allocation failed.
+    if (jsWindow.IsEmpty())
+        return false;
+
+    // Wrap the window.
+    setDOMWrapper(jsWindow, V8ClassIndex::ToInt(V8ClassIndex::DOMWINDOW), window);
+
+    window->ref();
+    V8Proxy::setJSWrapperForDOMObject(window, v8::Persistent<v8::Object>::New(jsWindow));
+
+    // Insert the window instance as the prototype of the shadow object.
+    v8::Handle<v8::Object> v8Global = context->Global();
+    v8Global->Set(implicitProtoString, jsWindow);
+    return true;
+}
+
+// Create a new environment and setup the global object.
+//
+// The global object corresponds to a DOMWindow instance. However, to
+// allow properties of the JS DOMWindow instance to be shadowed, we
+// use a shadow object as the global object and use the JS DOMWindow
+// instance as the prototype for that shadow object. The JS DOMWindow
+// instance is undetectable from javascript code because the __proto__
+// accessors skip that object.
+//
+// The shadow object and the DOMWindow instance are seen as one object
+// from javascript. The javascript object that corresponds to a
+// DOMWindow instance is the shadow object. When mapping a DOMWindow
+// instance to a V8 object, we return the shadow object.
+//
+// To implement split-window, see
+//   1) https://bugs.webkit.org/show_bug.cgi?id=17249
+//   2) https://wiki.mozilla.org/Gecko:SplitWindow
+//   3) https://bugzilla.mozilla.org/show_bug.cgi?id=296639
+// we need to split the shadow object further into two objects:
+// an outer window and an inner window. The inner window is the hidden
+// prototype of the outer window. The inner window is the default
+// global object of the context. A variable declared in the global
+// scope is a property of the inner window.
+//
+// The outer window sticks to a Frame, it is exposed to JavaScript
+// via window.window, window.self, window.parent, etc. The outer window
+// has a security token which is the domain. The outer window cannot
+// have its own properties. window.foo = 'x' is delegated to the
+// inner window.
+//
+// When a frame navigates to a new page, the inner window is cut off
+// the outer window, and the outer window identify is preserved for
+// the frame. However, a new inner window is created for the new page.
+// If there are JS code holds a closure to the old inner window,
+// it won't be able to reach the outer window via its global object.
+void V8Proxy::initContextIfNeeded()
+{
+    // Bail out if the context has already been initialized.
+    if (!m_context.IsEmpty())
+        return;
+
+    // Create a handle scope for all local handles.
+    v8::HandleScope handleScope;
+
+    // Setup the security handlers and message listener. This only has
+    // to be done once.
+    static bool isV8Initialized = false;
+    if (!isV8Initialized) {
+        // Tells V8 not to call the default OOM handler, binding code
+        // will handle it.
+        v8::V8::IgnoreOutOfMemoryException();
+        v8::V8::SetFatalErrorHandler(reportFatalErrorInV8);
+
+        v8::V8::SetGlobalGCPrologueCallback(&gcPrologue);
+        v8::V8::SetGlobalGCEpilogueCallback(&gcEpilogue);
+
+        v8::V8::AddMessageListener(handleConsoleMessage);
+
+        v8::V8::SetFailedAccessCheckCallbackFunction(reportUnsafeJavaScriptAccess);
+
+        isV8Initialized = true;
+    }
+
+    m_context = createNewContext(m_global);
+    if (m_context.IsEmpty())
+        return;
+
+    // Starting from now, use local context only.
+    v8::Local<v8::Context> v8Context = context();
+    v8::Context::Scope contextScope(v8Context);
+
+    // Store the first global object created so we can reuse it.
+    if (m_global.IsEmpty()) {
+        m_global = v8::Persistent<v8::Object>::New(v8Context->Global());
+        // Bail out if allocation of the first global objects fails.
+        if (m_global.IsEmpty()) {
+            disposeContextHandles();
+            return;
+        }
+#ifndef NDEBUG
+        registerGlobalHandle(PROXY, this, m_global);
+#endif
+    }
+
+    // Allocate strings used during initialization.
+    v8::Handle<v8::String> objectString = v8::String::New("Object");
+    v8::Handle<v8::String> prototypeString = v8::String::New("prototype");
+    // Bail out if allocation failed.
+    if (objectString.IsEmpty() || prototypeString.IsEmpty()) {
+        disposeContextHandles();
+        return;
+    }
+
+    // Allocate clone cache and pre-allocated objects
+    v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(m_global->Get(objectString));
+    m_objectPrototype = v8::Persistent<v8::Value>::New(object->Get(prototypeString));
+    m_wrapperBoilerplates = v8::Persistent<v8::Array>::New(v8::Array::New(V8ClassIndex::WRAPPER_TYPE_COUNT));
+    // Bail out if allocation failed.
+    if (m_objectPrototype.IsEmpty()) {
+        disposeContextHandles();
+        return;
+    }
+#ifndef NDEBUG
+    registerGlobalHandle(PROXY, this, m_objectPrototype);
+    registerGlobalHandle(PROXY, this, m_wrapperBoilerplates);
+#endif
+
+    if (!installDOMWindow(v8Context, m_frame->domWindow()))
+        disposeContextHandles();
+
+    updateDocument();
+
+    setSecurityToken();
+
+    m_frame->loader()->client()->didCreateScriptContext();
+    m_frame->loader()->dispatchWindowObjectAvailable();
+}
+
+template <class T>
+void setDOMExceptionHelper(V8ClassIndex::V8WrapperType type, PassRefPtr<T> exception)
+{
+    v8::Handle<v8::Value> v8Exception;
+    if (WorkerContextExecutionProxy::retrieve())
+        v8Exception = WorkerContextExecutionProxy::ToV8Object(type, exception.get());
+    else
+        v8Exception = V8Proxy::convertToV8Object(type, exception.get());
+
+    v8::ThrowException(v8Exception);
+}
+
+void V8Proxy::setDOMException(int exceptionCode)
+{
+    if (exceptionCode <= 0)
+        return;
+
+    ExceptionCodeDescription description;
+    getExceptionCodeDescription(exceptionCode, description);
+
+    v8::Handle<v8::Value> exception;
+    switch (description.type) {
+    case DOMExceptionType:
+        setDOMExceptionHelper(V8ClassIndex::DOMCOREEXCEPTION, DOMCoreException::create(description));
+        break;
+    case RangeExceptionType:
+        setDOMExceptionHelper(V8ClassIndex::RANGEEXCEPTION, RangeException::create(description));
+        break;
+    case EventExceptionType:
+        setDOMExceptionHelper(V8ClassIndex::EVENTEXCEPTION, EventException::create(description));
+        break;
+    case XMLHttpRequestExceptionType:
+        setDOMExceptionHelper(V8ClassIndex::XMLHTTPREQUESTEXCEPTION, XMLHttpRequestException::create(description));
+        break;
+#if ENABLE(SVG)
+    case SVGExceptionType:
+        setDOMExceptionHelper(V8ClassIndex::SVGEXCEPTION, SVGException::create(description));
+        break;
+#endif
+    default:
+        ASSERT_NOT_REACHED();
+        break;
+#if ENABLE(XPATH)
+    case XPathExceptionType:
+        exception = convertToV8Object(V8ClassIndex::XPATHEXCEPTION, XPathException::create(description));
+        break;
+#endif
+    }
+
+    ASSERT(!exception.IsEmpty());
+    v8::ThrowException(exception);
+}
+
+v8::Handle<v8::Value> V8Proxy::throwError(ErrorType type, const char* message)
+{
+    switch (type) {
+    case RangeError:
+        return v8::ThrowException(v8::Exception::RangeError(v8String(message)));
+    case ReferenceError:
+        return v8::ThrowException(v8::Exception::ReferenceError(v8String(message)));
+    case SyntaxError:
+        return v8::ThrowException(v8::Exception::SyntaxError(v8String(message)));
+    case TypeError:
+        return v8::ThrowException(v8::Exception::TypeError(v8String(message)));
+    case GeneralError:
+        return v8::ThrowException(v8::Exception::Error(v8String(message)));
+    default:
+        ASSERT_NOT_REACHED();
+        return notHandledByInterceptor();
+    }
+}
+
+v8::Local<v8::Context> V8Proxy::context(Frame* frame)
+{
+    V8Proxy* proxy = retrieve(frame);
+    if (!proxy)
+        return v8::Local<v8::Context>();
+
+    proxy->initContextIfNeeded();
+    return proxy->context();
+}
+
+v8::Local<v8::Context> V8Proxy::currentContext()
+{
+    return v8::Context::GetCurrent();
+}
+
+v8::Handle<v8::Value> V8Proxy::convertToV8Object(V8ClassIndex::V8WrapperType type, void* impl)
+{
+    ASSERT(type != V8ClassIndex::EVENTLISTENER);
+    ASSERT(type != V8ClassIndex::EVENTTARGET);
+    ASSERT(type != V8ClassIndex::EVENT);
+
+    bool isActiveDomObject = false;
+    switch (type) {
+#define MAKE_CASE(TYPE, NAME) case V8ClassIndex::TYPE:
+        DOM_NODE_TYPES(MAKE_CASE)
+#if ENABLE(SVG)
+        SVG_NODE_TYPES(MAKE_CASE)
+#endif
+        return convertNodeToV8Object(static_cast<Node*>(impl));
+    case V8ClassIndex::CSSVALUE:
+        return convertCSSValueToV8Object(static_cast<CSSValue*>(impl));
+    case V8ClassIndex::CSSRULE:
+        return convertCSSRuleToV8Object(static_cast<CSSRule*>(impl));
+    case V8ClassIndex::STYLESHEET:
+        return convertStyleSheetToV8Object(static_cast<StyleSheet*>(impl));
+    case V8ClassIndex::DOMWINDOW:
+        return convertWindowToV8Object(static_cast<DOMWindow*>(impl));
+#if ENABLE(SVG)
+        SVG_NONNODE_TYPES(MAKE_CASE)
+        if (type == V8ClassIndex::SVGELEMENTINSTANCE)
+            return convertSVGElementInstanceToV8Object(static_cast<SVGElementInstance*>(impl));
+        return convertSVGObjectWithContextToV8Object(type, impl);
+#endif
+
+        ACTIVE_DOM_OBJECT_TYPES(MAKE_CASE)
+        isActiveDomObject = true;
+        break;
+    default:
+        break;
+  }
+
+#undef MAKE_CASE
+
+    if (!impl)
+        return v8::Null();
+
+    // Non DOM node
+    v8::Persistent<v8::Object> result = isActiveDomObject ? getActiveDOMObjectMap().get(impl) : getDOMObjectMap().get(impl);
+    if (result.IsEmpty()) {
+        v8::Local<v8::Object> v8Object = instantiateV8Object(type, type, impl);
+        if (!v8Object.IsEmpty()) {
+            // Go through big switch statement, it has some duplications
+            // that were handled by code above (such as CSSVALUE, CSSRULE, etc).
+            switch (type) {
+#define MAKE_CASE(TYPE, NAME) \
+            case V8ClassIndex::TYPE: static_cast<NAME*>(impl)->ref(); break;
+                DOM_OBJECT_TYPES(MAKE_CASE)
+#undef MAKE_CASE
+            default:
+                ASSERT_NOT_REACHED();
+            }
+            result = v8::Persistent<v8::Object>::New(v8Object);
+            if (isActiveDomObject)
+                setJSWrapperForActiveDOMObject(impl, result);
+            else
+                setJSWrapperForDOMObject(impl, result);
+
+            // Special case for non-node objects associated with a
+            // DOMWindow. Both Safari and FF let the JS wrappers for these
+            // objects survive GC. To mimic their behavior, V8 creates
+            // hidden references from the DOMWindow to these wrapper
+            // objects. These references get cleared when the DOMWindow is
+            // reused by a new page.
+            switch (type) {
+            case V8ClassIndex::CONSOLE:
+                setHiddenWindowReference(static_cast<Console*>(impl)->frame(), V8Custom::kDOMWindowConsoleIndex, result);
+                break;
+            case V8ClassIndex::HISTORY:
+                setHiddenWindowReference(static_cast<History*>(impl)->frame(), V8Custom::kDOMWindowHistoryIndex, result);
+                break;
+            case V8ClassIndex::NAVIGATOR:
+                setHiddenWindowReference(static_cast<Navigator*>(impl)->frame(), V8Custom::kDOMWindowNavigatorIndex, result);
+                break;
+            case V8ClassIndex::SCREEN:
+                setHiddenWindowReference(static_cast<Screen*>(impl)->frame(), V8Custom::kDOMWindowScreenIndex, result);
+                break;
+            case V8ClassIndex::LOCATION:
+                setHiddenWindowReference(static_cast<Location*>(impl)->frame(), V8Custom::kDOMWindowLocationIndex, result);
+                break;
+            case V8ClassIndex::DOMSELECTION:
+                setHiddenWindowReference(static_cast<DOMSelection*>(impl)->frame(), V8Custom::kDOMWindowDOMSelectionIndex, result);
+                break;
+            case V8ClassIndex::BARINFO: {
+                BarInfo* barInfo = static_cast<BarInfo*>(impl);
+                Frame* frame = barInfo->frame();
+                switch (barInfo->type()) {
+                case BarInfo::Locationbar:
+                    setHiddenWindowReference(frame, V8Custom::kDOMWindowLocationbarIndex, result);
+                    break;
+                case BarInfo::Menubar:
+                    setHiddenWindowReference(frame, V8Custom::kDOMWindowMenubarIndex, result);
+                    break;
+                case BarInfo::Personalbar:
+                    setHiddenWindowReference(frame, V8Custom::kDOMWindowPersonalbarIndex, result);
+                    break;
+                case BarInfo::Scrollbars:
+                    setHiddenWindowReference(frame, V8Custom::kDOMWindowScrollbarsIndex, result);
+                    break;
+                case BarInfo::Statusbar:
+                    setHiddenWindowReference(frame, V8Custom::kDOMWindowStatusbarIndex, result);
+                    break;
+                case BarInfo::Toolbar:
+                    setHiddenWindowReference(frame, V8Custom::kDOMWindowToolbarIndex, result);
+                    break;
+                }
+                break;
+            }
+            default:
+                break;
+            }
+        }
+    }
+    return result;
+}
+
+void V8Proxy::setHiddenWindowReference(Frame* frame, const int internalIndex, v8::Handle<v8::Object> jsObject)
+{
+    // Get DOMWindow
+    if (!frame)
+        return; // Object might be detached from window
+    v8::Handle<v8::Context> v8Context = context(frame);
+    if (v8Context.IsEmpty())
+        return;
+
+    ASSERT(internalIndex < V8Custom::kDOMWindowInternalFieldCount);
+
+    v8::Handle<v8::Object> global = v8Context->Global();
+    // Look for real DOM wrapper.
+    global = lookupDOMWrapper(V8ClassIndex::DOMWINDOW, global);
+    ASSERT(!global.IsEmpty());
+    ASSERT(global->GetInternalField(internalIndex)->IsUndefined());
+    global->SetInternalField(internalIndex, jsObject);
+}
+
+V8ClassIndex::V8WrapperType V8Proxy::domWrapperType(v8::Handle<v8::Object> object)
+{
+    ASSERT(maybeDOMWrapper(object));
+    v8::Handle<v8::Value> type = object->GetInternalField(V8Custom::kDOMWrapperTypeIndex);
+    return V8ClassIndex::FromInt(type->Int32Value());
+}
+
+void* V8Proxy::convertToNativeObjectImpl(V8ClassIndex::V8WrapperType type, v8::Handle<v8::Value> object)
+{
+    // Native event listener is per frame, it cannot be handled by this generic function.
+    ASSERT(type != V8ClassIndex::EVENTLISTENER);
+    ASSERT(type != V8ClassIndex::EVENTTARGET);
+
+    ASSERT(maybeDOMWrapper(object));
+
+    switch (type) {
+#define MAKE_CASE(TYPE, NAME) case V8ClassIndex::TYPE:
+        DOM_NODE_TYPES(MAKE_CASE)
+#if ENABLE(SVG)
+        SVG_NODE_TYPES(MAKE_CASE)
+#endif
+        ASSERT_NOT_REACHED();
+        return 0;
+    case V8ClassIndex::XMLHTTPREQUEST:
+        return convertDOMWrapperToNative<XMLHttpRequest>(object);
+    case V8ClassIndex::EVENT:
+        return convertDOMWrapperToNative<Event>(object);
+    case V8ClassIndex::CSSRULE:
+        return convertDOMWrapperToNative<CSSRule>(object);
+    default:
+        break;
+    }
+#undef MAKE_CASE
+
+    return convertDOMWrapperToNative<void>(object);
+}
+
+
+void* V8Proxy::convertToSVGPODTypeImpl(V8ClassIndex::V8WrapperType type, v8::Handle<v8::Value> object)
+{
+    return isWrapperOfType(object, type) ? convertDOMWrapperToNative<void>(object) : 0;
+}
+
+v8::Handle<v8::Object> V8Proxy::lookupDOMWrapper(V8ClassIndex::V8WrapperType type, v8::Handle<v8::Value> value)
+{
+    if (value.IsEmpty())
+        return notHandledByInterceptor();
+
+    v8::Handle<v8::FunctionTemplate> descriptor = V8Proxy::getTemplate(type);
+    while (value->IsObject()) {
+        v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(value);
+        if (descriptor->HasInstance(object))
+            return object;
+
+        value = object->GetPrototype();
+    }
+    return notHandledByInterceptor();
+} 
+
+void* V8Proxy::convertDOMWrapperToNodeHelper(v8::Handle<v8::Value> value)
+{
+    ASSERT(maybeDOMWrapper(value));
+
+    v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(value);
+
+    ASSERT(domWrapperType(object) == V8ClassIndex::NODE);
+
+    v8::Handle<v8::Value> wrapper = object->GetInternalField(V8Custom::kDOMWrapperObjectIndex);
+    return extractCPointer<Node>(wrapper);
+}
+
+PassRefPtr<NodeFilter> V8Proxy::wrapNativeNodeFilter(v8::Handle<v8::Value> filter)
+{
+    // A NodeFilter is used when walking through a DOM tree or iterating tree
+    // nodes.
+    // FIXME: we may want to cache NodeFilterCondition and NodeFilter
+    // object, but it is minor.
+    // NodeFilter is passed to NodeIterator that has a ref counted pointer
+    // to NodeFilter. NodeFilter has a ref counted pointer to NodeFilterCondition.
+    // In NodeFilterCondition, filter object is persisted in its constructor,
+    // and disposed in its destructor.
+    if (!filter->IsFunction())
+        return 0;
+
+    NodeFilterCondition* condition = new V8NodeFilterCondition(filter);
+    return NodeFilter::create(condition);
+}
+
+v8::Local<v8::Object> V8Proxy::instantiateV8Object(V8ClassIndex::V8WrapperType descriptorType, V8ClassIndex::V8WrapperType cptrType, void* impl)
+{
+    // Make a special case for document.all
+    if (descriptorType == V8ClassIndex::HTMLCOLLECTION && static_cast<HTMLCollection*>(impl)->type() == DocAll)
+        descriptorType = V8ClassIndex::UNDETECTABLEHTMLCOLLECTION;
+
+    V8Proxy* proxy = V8Proxy::retrieve();
+    v8::Local<v8::Object> instance;
+    if (proxy)
+        instance = proxy->createWrapperFromCache(descriptorType);
+    else {
+        v8::Local<v8::Function> function = getTemplate(descriptorType)->GetFunction();
+        instance = SafeAllocation::newInstance(function);
+    }
+    if (!instance.IsEmpty()) {
+        // Avoid setting the DOM wrapper for failed allocations.
+        setDOMWrapper(instance, V8ClassIndex::ToInt(cptrType), impl);
+    }
+    return instance;
+}
+
+v8::Handle<v8::Value> V8Proxy::checkNewLegal(const v8::Arguments& args)
+{
+    if (!AllowAllocation::m_current)
+        return throwError(TypeError, "Illegal constructor");
+
+    return args.This();
+}
+
+void V8Proxy::setDOMWrapper(v8::Handle<v8::Object> object, int type, void* cptr)
+{
+    ASSERT(object->InternalFieldCount() >= 2);
+    object->SetInternalField(V8Custom::kDOMWrapperObjectIndex, wrapCPointer(cptr));
+    object->SetInternalField(V8Custom::kDOMWrapperTypeIndex, v8::Integer::New(type));
+}
+
+#ifndef NDEBUG
+bool V8Proxy::maybeDOMWrapper(v8::Handle<v8::Value> value)
+{
+    if (value.IsEmpty() || !value->IsObject())
+        return false;
+
+    v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(value);
+    if (!object->InternalFieldCount())
+        return false;
+
+    ASSERT(object->InternalFieldCount() >= V8Custom::kDefaultWrapperInternalFieldCount);
+
+    v8::Handle<v8::Value> type = object->GetInternalField(V8Custom::kDOMWrapperTypeIndex);
+    ASSERT(type->IsInt32());
+    ASSERT(V8ClassIndex::INVALID_CLASS_INDEX < type->Int32Value() && type->Int32Value() < V8ClassIndex::CLASSINDEX_END);
+
+    v8::Handle<v8::Value> wrapper = object->GetInternalField(V8Custom::kDOMWrapperObjectIndex);
+    ASSERT(wrapper->IsNumber() || wrapper->IsExternal());
+
+    return true;
+}
+#endif
+
+bool V8Proxy::isDOMEventWrapper(v8::Handle<v8::Value> value)
+{
+    // All kinds of events use EVENT as dom type in JS wrappers.
+    // See EventToV8Object
+    return isWrapperOfType(value, V8ClassIndex::EVENT);
+}
+
+bool V8Proxy::isWrapperOfType(v8::Handle<v8::Value> value, V8ClassIndex::V8WrapperType classType)
+{
+    if (value.IsEmpty() || !value->IsObject())
+        return false;
+
+    v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(value);
+    if (!object->InternalFieldCount())
+        return false;
+
+    ASSERT(object->InternalFieldCount() >= V8Custom::kDefaultWrapperInternalFieldCount);
+
+    v8::Handle<v8::Value> wrapper = object->GetInternalField(V8Custom::kDOMWrapperObjectIndex);
+    ASSERT(wrapper->IsNumber() || wrapper->IsExternal());
+
+    v8::Handle<v8::Value> type = object->GetInternalField(V8Custom::kDOMWrapperTypeIndex);
+    ASSERT(type->IsInt32());
+    ASSERT(V8ClassIndex::INVALID_CLASS_INDEX < type->Int32Value() && type->Int32Value() < V8ClassIndex::CLASSINDEX_END);
+
+    return V8ClassIndex::FromInt(type->Int32Value()) == classType;
+}
+
+#if ENABLE(VIDEO)
+#define FOR_EACH_VIDEO_TAG(macro)                  \
+    macro(audio, AUDIO)                            \
+    macro(source, SOURCE)                          \
+    macro(video, VIDEO)
+#else
+#define FOR_EACH_VIDEO_TAG(macro)
+#endif
+
+#define FOR_EACH_TAG(macro)                        \
+    macro(a, ANCHOR)                               \
+    macro(applet, APPLET)                          \
+    macro(area, AREA)                              \
+    macro(base, BASE)                              \
+    macro(basefont, BASEFONT)                      \
+    macro(blockquote, BLOCKQUOTE)                  \
+    macro(body, BODY)                              \
+    macro(br, BR)                                  \
+    macro(button, BUTTON)                          \
+    macro(caption, TABLECAPTION)                   \
+    macro(col, TABLECOL)                           \
+    macro(colgroup, TABLECOL)                      \
+    macro(del, MOD)                                \
+    macro(canvas, CANVAS)                          \
+    macro(dir, DIRECTORY)                          \
+    macro(div, DIV)                                \
+    macro(dl, DLIST)                               \
+    macro(embed, EMBED)                            \
+    macro(fieldset, FIELDSET)                      \
+    macro(font, FONT)                              \
+    macro(form, FORM)                              \
+    macro(frame, FRAME)                            \
+    macro(frameset, FRAMESET)                      \
+    macro(h1, HEADING)                             \
+    macro(h2, HEADING)                             \
+    macro(h3, HEADING)                             \
+    macro(h4, HEADING)                             \
+    macro(h5, HEADING)                             \
+    macro(h6, HEADING)                             \
+    macro(head, HEAD)                              \
+    macro(hr, HR)                                  \
+    macro(html, HTML)                              \
+    macro(img, IMAGE)                              \
+    macro(iframe, IFRAME)                          \
+    macro(image, IMAGE)                            \
+    macro(input, INPUT)                            \
+    macro(ins, MOD)                                \
+    macro(isindex, ISINDEX)                        \
+    macro(keygen, SELECT)                          \
+    macro(label, LABEL)                            \
+    macro(legend, LEGEND)                          \
+    macro(li, LI)                                  \
+    macro(link, LINK)                              \
+    macro(listing, PRE)                            \
+    macro(map, MAP)                                \
+    macro(marquee, MARQUEE)                        \
+    macro(menu, MENU)                              \
+    macro(meta, META)                              \
+    macro(object, OBJECT)                          \
+    macro(ol, OLIST)                               \
+    macro(optgroup, OPTGROUP)                      \
+    macro(option, OPTION)                          \
+    macro(p, PARAGRAPH)                            \
+    macro(param, PARAM)                            \
+    macro(pre, PRE)                                \
+    macro(q, QUOTE)                                \
+    macro(script, SCRIPT)                          \
+    macro(select, SELECT)                          \
+    macro(style, STYLE)                            \
+    macro(table, TABLE)                            \
+    macro(thead, TABLESECTION)                     \
+    macro(tbody, TABLESECTION)                     \
+    macro(tfoot, TABLESECTION)                     \
+    macro(td, TABLECELL)                           \
+    macro(th, TABLECELL)                           \
+    macro(tr, TABLEROW)                            \
+    macro(textarea, TEXTAREA)                      \
+    macro(title, TITLE)                            \
+    macro(ul, ULIST)                               \
+    macro(xmp, PRE)
+
+V8ClassIndex::V8WrapperType V8Proxy::htmlElementType(HTMLElement* element)
+{
+    typedef HashMap<String, V8ClassIndex::V8WrapperType> WrapperTypeMap;
+    DEFINE_STATIC_LOCAL(WrapperTypeMap, wrapperTypeMap, ());
+    if (wrapperTypeMap.isEmpty()) {
+#define ADD_TO_HASH_MAP(tag, name) \
+        wrapperTypeMap.set(#tag, V8ClassIndex::HTML##name##ELEMENT);
+        FOR_EACH_TAG(ADD_TO_HASH_MAP)
+#if ENABLE(VIDEO)
+        if (MediaPlayer::isAvailable()) {
+            FOR_EACH_VIDEO_TAG(ADD_TO_HASH_MAP)
+        }
+#endif
+#undef ADD_TO_HASH_MAP
+    }
+
+    V8ClassIndex::V8WrapperType type = wrapperTypeMap.get(element->localName().impl());
+    if (!type)
+        return V8ClassIndex::HTMLELEMENT;
+    return type;
+}
+#undef FOR_EACH_TAG
+
+#if ENABLE(SVG)
+
+#if ENABLE(SVG_ANIMATION)
+#define FOR_EACH_ANIMATION_TAG(macro) \
+    macro(animateColor, ANIMATECOLOR) \
+    macro(animate, ANIMATE) \
+    macro(animateTransform, ANIMATETRANSFORM) \
+    macro(set, SET)
+#else
+#define FOR_EACH_ANIMATION_TAG(macro)
+#endif
+
+#if ENABLE(SVG_FILTERS)
+#define FOR_EACH_FILTERS_TAG(macro) \
+    macro(feBlend, FEBLEND) \
+    macro(feColorMatrix, FECOLORMATRIX) \
+    macro(feComponentTransfer, FECOMPONENTTRANSFER) \
+    macro(feComposite, FECOMPOSITE) \
+    macro(feDiffuseLighting, FEDIFFUSELIGHTING) \
+    macro(feDisplacementMap, FEDISPLACEMENTMAP) \
+    macro(feDistantLight, FEDISTANTLIGHT) \
+    macro(feFlood, FEFLOOD) \
+    macro(feFuncA, FEFUNCA) \
+    macro(feFuncB, FEFUNCB) \
+    macro(feFuncG, FEFUNCG) \
+    macro(feFuncR, FEFUNCR) \
+    macro(feGaussianBlur, FEGAUSSIANBLUR) \
+    macro(feImage, FEIMAGE) \
+    macro(feMerge, FEMERGE) \
+    macro(feMergeNode, FEMERGENODE) \
+    macro(feOffset, FEOFFSET) \
+    macro(fePointLight, FEPOINTLIGHT) \
+    macro(feSpecularLighting, FESPECULARLIGHTING) \
+    macro(feSpotLight, FESPOTLIGHT) \
+    macro(feTile, FETILE) \
+    macro(feTurbulence, FETURBULENCE) \
+    macro(filter, FILTER)
+#else
+#define FOR_EACH_FILTERS_TAG(macro)
+#endif
+
+#if ENABLE(SVG_FONTS)
+#define FOR_EACH_FONTS_TAG(macro) \
+    macro(definition-src, DEFINITIONSRC) \
+    macro(font-face, FONTFACE) \
+    macro(font-face-format, FONTFACEFORMAT) \
+    macro(font-face-name, FONTFACENAME) \
+    macro(font-face-src, FONTFACESRC) \
+    macro(font-face-uri, FONTFACEURI)
+#else
+#define FOR_EACH_FONTS_TAG(marco)
+#endif
+
+#if ENABLE(SVG_FOREIGN_OBJECT)
+#define FOR_EACH_FOREIGN_OBJECT_TAG(macro) \
+    macro(foreignObject, FOREIGNOBJECT)
+#else
+#define FOR_EACH_FOREIGN_OBJECT_TAG(macro)
+#endif
+
+#if ENABLE(SVG_USE)
+#define FOR_EACH_USE_TAG(macro) \
+    macro(use, USE)
+#else
+#define FOR_EACH_USE_TAG(macro)
+#endif
+
+#define FOR_EACH_TAG(macro) \
+    FOR_EACH_ANIMATION_TAG(macro) \
+    FOR_EACH_FILTERS_TAG(macro) \
+    FOR_EACH_FONTS_TAG(macro) \
+    FOR_EACH_FOREIGN_OBJECT_TAG(macro) \
+    FOR_EACH_USE_TAG(macro) \
+    macro(a, A) \
+    macro(altGlyph, ALTGLYPH) \
+    macro(circle, CIRCLE) \
+    macro(clipPath, CLIPPATH) \
+    macro(cursor, CURSOR) \
+    macro(defs, DEFS) \
+    macro(desc, DESC) \
+    macro(ellipse, ELLIPSE) \
+    macro(g, G) \
+    macro(glyph, GLYPH) \
+    macro(image, IMAGE) \
+    macro(linearGradient, LINEARGRADIENT) \
+    macro(line, LINE) \
+    macro(marker, MARKER) \
+    macro(mask, MASK) \
+    macro(metadata, METADATA) \
+    macro(path, PATH) \
+    macro(pattern, PATTERN) \
+    macro(polyline, POLYLINE) \
+    macro(polygon, POLYGON) \
+    macro(radialGradient, RADIALGRADIENT) \
+    macro(rect, RECT) \
+    macro(script, SCRIPT) \
+    macro(stop, STOP) \
+    macro(style, STYLE) \
+    macro(svg, SVG) \
+    macro(switch, SWITCH) \
+    macro(symbol, SYMBOL) \
+    macro(text, TEXT) \
+    macro(textPath, TEXTPATH) \
+    macro(title, TITLE) \
+    macro(tref, TREF) \
+    macro(tspan, TSPAN) \
+    macro(view, VIEW) \
+    // end of macro
+
+V8ClassIndex::V8WrapperType V8Proxy::svgElementType(SVGElement* element)
+{
+    typedef HashMap<String, V8ClassIndex::V8WrapperType> WrapperTypeMap;
+    DEFINE_STATIC_LOCAL(WrapperTypeMap, wrapperTypeMap, ());
+    if (wrapperTypeMap.isEmpty()) {
+#define ADD_TO_HASH_MAP(tag, name) \
+        wrapperTypeMap.set(#tag, V8ClassIndex::SVG##name##ELEMENT);
+        FOR_EACH_TAG(ADD_TO_HASH_MAP)
+#undef ADD_TO_HASH_MAP
+    }
+
+    V8ClassIndex::V8WrapperType type = wrapperTypeMap.get(element->localName().impl());
+    if (!type)
+        return V8ClassIndex::SVGELEMENT;
+    return type;
+}
+#undef FOR_EACH_TAG
+
+#endif // ENABLE(SVG)
+
+v8::Handle<v8::Value> V8Proxy::convertEventToV8Object(Event* event)
+{
+    if (!event)
+        return v8::Null();
+
+    v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(event);
+    if (!wrapper.IsEmpty())
+        return wrapper;
+
+    V8ClassIndex::V8WrapperType type = V8ClassIndex::EVENT;
+
+    if (event->isUIEvent()) {
+        if (event->isKeyboardEvent())
+            type = V8ClassIndex::KEYBOARDEVENT;
+        else if (event->isTextEvent())
+            type = V8ClassIndex::TEXTEVENT;
+        else if (event->isMouseEvent())
+            type = V8ClassIndex::MOUSEEVENT;
+        else if (event->isWheelEvent())
+            type = V8ClassIndex::WHEELEVENT;
+#if ENABLE(SVG)
+        else if (event->isSVGZoomEvent())
+            type = V8ClassIndex::SVGZOOMEVENT;
+#endif
+        else
+            type = V8ClassIndex::UIEVENT;
+    } else if (event->isMutationEvent())
+        type = V8ClassIndex::MUTATIONEVENT;
+    else if (event->isOverflowEvent())
+        type = V8ClassIndex::OVERFLOWEVENT;
+    else if (event->isMessageEvent())
+        type = V8ClassIndex::MESSAGEEVENT;
+    else if (event->isProgressEvent()) {
+        if (event->isXMLHttpRequestProgressEvent())
+            type = V8ClassIndex::XMLHTTPREQUESTPROGRESSEVENT;
+        else
+            type = V8ClassIndex::PROGRESSEVENT;
+    } else if (event->isWebKitAnimationEvent())
+        type = V8ClassIndex::WEBKITANIMATIONEVENT;
+    else if (event->isWebKitTransitionEvent())
+        type = V8ClassIndex::WEBKITTRANSITIONEVENT;
+
+
+    v8::Handle<v8::Object> result = instantiateV8Object(type, V8ClassIndex::EVENT, event);
+    if (result.IsEmpty()) {
+        // Instantiation failed. Avoid updating the DOM object map and
+        // return null which is already handled by callers of this function
+        // in case the event is NULL.
+        return v8::Null();
+    }
+
+    event->ref(); // fast ref
+    setJSWrapperForDOMObject(event, v8::Persistent<v8::Object>::New(result));
+
+    return result;
+}
+
+// Caller checks node is not null.
+v8::Handle<v8::Value> V8Proxy::convertNodeToV8Object(Node* node)
+{
+    if (!node)
+        return v8::Null();
+
+    // Find the context to which the node belongs and create the wrapper
+    // in that context. If the node is not in a document, the current
+    // context is used.
+    //
+    // Getting the context might initialize the context which can instantiate
+    // a document wrapper. Therefore, we get the context before checking if
+    // the node already has a wrapper.
+    v8::Local<v8::Context> v8Context;
+    Document* document = node->document();
+    if (document)
+        v8Context = V8Proxy::context(document->frame());
+
+    v8::Handle<v8::Object> wrapper = getDOMNodeMap().get(node);
+    if (!wrapper.IsEmpty())
+        return wrapper;
+
+    bool isDocument = false; // document type node has special handling
+    V8ClassIndex::V8WrapperType type;
+
+    switch (node->nodeType()) {
+    case Node::ELEMENT_NODE:
+        if (node->isHTMLElement())
+            type = htmlElementType(static_cast<HTMLElement*>(node));
+#if ENABLE(SVG)
+        else if (node->isSVGElement())
+            type = svgElementType(static_cast<SVGElement*>(node));
+#endif
+        else
+            type = V8ClassIndex::ELEMENT;
+        break;
+    case Node::ATTRIBUTE_NODE:
+        type = V8ClassIndex::ATTR;
+        break;
+    case Node::TEXT_NODE:
+        type = V8ClassIndex::TEXT;
+        break;
+    case Node::CDATA_SECTION_NODE:
+        type = V8ClassIndex::CDATASECTION;
+        break;
+    case Node::ENTITY_NODE:
+        type = V8ClassIndex::ENTITY;
+        break;
+    case Node::PROCESSING_INSTRUCTION_NODE:
+        type = V8ClassIndex::PROCESSINGINSTRUCTION;
+        break;
+    case Node::COMMENT_NODE:
+        type = V8ClassIndex::COMMENT;
+        break;
+    case Node::DOCUMENT_NODE: {
+        isDocument = true;
+        Document* document = static_cast<Document*>(node);
+        if (document->isHTMLDocument())
+            type = V8ClassIndex::HTMLDOCUMENT;
+#if ENABLE(SVG)
+        else if (document->isSVGDocument())
+            type = V8ClassIndex::SVGDOCUMENT;
+#endif
+        else
+            type = V8ClassIndex::DOCUMENT;
+        break;
+    }
+    case Node::DOCUMENT_TYPE_NODE:
+        type = V8ClassIndex::DOCUMENTTYPE;
+        break;
+    case Node::NOTATION_NODE:
+        type = V8ClassIndex::NOTATION;
+        break;
+    case Node::DOCUMENT_FRAGMENT_NODE:
+        type = V8ClassIndex::DOCUMENTFRAGMENT;
+        break;
+    case Node::ENTITY_REFERENCE_NODE:
+        type = V8ClassIndex::ENTITYREFERENCE;
+        break;
+    default:
+        type = V8ClassIndex::NODE;
+    }
+
+    // Enter the node's context and create the wrapper in that context.
+    if (!v8Context.IsEmpty())
+        v8Context->Enter();
+
+    v8::Local<v8::Object> result = instantiateV8Object(type, V8ClassIndex::NODE, node);
+
+    // Exit the node's context if it was entered.
+    if (!v8Context.IsEmpty())
+        v8Context->Exit();
+
+    if (result.IsEmpty()) {
+        // If instantiation failed it's important not to add the result
+        // to the DOM node map. Instead we return an empty handle, which
+        // should already be handled by callers of this function in case
+        // the node is NULL.
+        return result;
+    }
+
+    node->ref();
+    setJSWrapperForDOMNode(node, v8::Persistent<v8::Object>::New(result));
+
+    if (isDocument) {
+        Document* document = static_cast<Document*>(node);
+        V8Proxy* proxy = V8Proxy::retrieve(document->frame());
+        if (proxy)
+            proxy->updateDocumentWrapper(result);
+
+        if (type == V8ClassIndex::HTMLDOCUMENT) {
+            // Create marker object and insert it in two internal fields.
+            // This is used to implement temporary shadowing of
+            // document.all.
+            ASSERT(result->InternalFieldCount() == V8Custom::kHTMLDocumentInternalFieldCount);
+            v8::Local<v8::Object> marker = v8::Object::New();
+            result->SetInternalField(V8Custom::kHTMLDocumentMarkerIndex, marker);
+            result->SetInternalField(V8Custom::kHTMLDocumentShadowIndex, marker);
+        }
+    }
+
+    return result;
+}
+
+// A JS object of type EventTarget can only be the following possible types:
+// 1) EventTargetNode; 2) DOMWindow 3) XMLHttpRequest; 4) MessagePort;
+// 5) XMLHttpRequestUpload
+// check EventTarget.h for new type conversion methods
+v8::Handle<v8::Value> V8Proxy::convertEventTargetToV8Object(EventTarget* target)
+{
+    if (!target)
+        return v8::Null();
+
+#if ENABLE(SVG)
+    SVGElementInstance* instance = target->toSVGElementInstance();
+    if (instance)
+        return convertToV8Object(V8ClassIndex::SVGELEMENTINSTANCE, instance);
+#endif
+
+#if ENABLE(WORKERS)
+    Worker* worker = target->toWorker();
+    if (worker)
+        return convertToV8Object(V8ClassIndex::WORKER, worker);
+#endif // WORKERS
+
+    Node* node = target->toNode();
+    if (node)
+        return convertNodeToV8Object(node);
+
+    if (DOMWindow* domWindow = target->toDOMWindow())
+        return convertToV8Object(V8ClassIndex::DOMWINDOW, domWindow);
+
+    // XMLHttpRequest is created within its JS counterpart.
+    XMLHttpRequest* xmlHttpRequest = target->toXMLHttpRequest();
+    if (xmlHttpRequest) {
+        v8::Handle<v8::Object> wrapper = getActiveDOMObjectMap().get(xmlHttpRequest);
+        ASSERT(!wrapper.IsEmpty());
+        return wrapper;
+    }
+
+    // MessagePort is created within its JS counterpart
+    MessagePort* port = target->toMessagePort();
+    if (port) {
+        v8::Handle<v8::Object> wrapper = getActiveDOMObjectMap().get(port);
+        ASSERT(!wrapper.IsEmpty());
+        return wrapper;
+    }
+
+    XMLHttpRequestUpload* upload = target->toXMLHttpRequestUpload();
+    if (upload) {
+        v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(upload);
+        ASSERT(!wrapper.IsEmpty());
+        return wrapper;
+    }
+
+    ASSERT(0);
+    return notHandledByInterceptor();
+}
+
+v8::Handle<v8::Value> V8Proxy::convertEventListenerToV8Object(EventListener* listener)
+{
+    if (!listener)
+        return v8::Null();
+
+    // FIXME: can a user take a lazy event listener and set to other places?
+    V8AbstractEventListener* v8listener = static_cast<V8AbstractEventListener*>(listener);
+    return v8listener->getListenerObject();
+}
+
+v8::Handle<v8::Value> V8Proxy::convertDOMImplementationToV8Object(DOMImplementation* impl)
+{
+    v8::Handle<v8::Object> result = instantiateV8Object(V8ClassIndex::DOMIMPLEMENTATION, V8ClassIndex::DOMIMPLEMENTATION, impl);
+    if (result.IsEmpty()) {
+        // If the instantiation failed, we ignore it and return null instead
+        // of returning an empty handle.
+        return v8::Null();
+    }
+    return result;
+}
+
+v8::Handle<v8::Value> V8Proxy::convertStyleSheetToV8Object(StyleSheet* sheet)
+{
+    if (!sheet)
+        return v8::Null();
+
+    v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(sheet);
+    if (!wrapper.IsEmpty())
+        return wrapper;
+
+    V8ClassIndex::V8WrapperType type = V8ClassIndex::STYLESHEET;
+    if (sheet->isCSSStyleSheet())
+        type = V8ClassIndex::CSSSTYLESHEET;
+
+    v8::Handle<v8::Object> result = instantiateV8Object(type, V8ClassIndex::STYLESHEET, sheet);
+    if (!result.IsEmpty()) {
+        // Only update the DOM object map if the result is non-empty.
+        sheet->ref();
+        setJSWrapperForDOMObject(sheet, v8::Persistent<v8::Object>::New(result));
+    }
+
+    // Add a hidden reference from stylesheet object to its owner node.
+    Node* ownerNode = sheet->ownerNode();
+    if (ownerNode) {
+        v8::Handle<v8::Object> owner = v8::Handle<v8::Object>::Cast(convertNodeToV8Object(ownerNode));
+        result->SetInternalField(V8Custom::kStyleSheetOwnerNodeIndex, owner);
+    }
+
+    return result;
+}
+
+v8::Handle<v8::Value> V8Proxy::convertCSSValueToV8Object(CSSValue* value)
+{
+    if (!value)
+        return v8::Null();
+
+    v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(value);
+    if (!wrapper.IsEmpty())
+        return wrapper;
+
+    V8ClassIndex::V8WrapperType type;
+
+    if (value->isWebKitCSSTransformValue())
+        type = V8ClassIndex::WEBKITCSSTRANSFORMVALUE;
+    else if (value->isValueList())
+        type = V8ClassIndex::CSSVALUELIST;
+    else if (value->isPrimitiveValue())
+        type = V8ClassIndex::CSSPRIMITIVEVALUE;
+#if ENABLE(SVG)
+    else if (value->isSVGPaint())
+        type = V8ClassIndex::SVGPAINT;
+    else if (value->isSVGColor())
+        type = V8ClassIndex::SVGCOLOR;
+#endif
+    else
+        type = V8ClassIndex::CSSVALUE;
+
+    v8::Handle<v8::Object> result = instantiateV8Object(type, V8ClassIndex::CSSVALUE, value);
+    if (!result.IsEmpty()) {
+        // Only update the DOM object map if the result is non-empty.
+        value->ref();
+        setJSWrapperForDOMObject(value, v8::Persistent<v8::Object>::New(result));
+    }
+
+    return result;
+}
+
+v8::Handle<v8::Value> V8Proxy::convertCSSRuleToV8Object(CSSRule* rule)
+{
+    if (!rule) 
+        return v8::Null();
+
+    v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(rule);
+    if (!wrapper.IsEmpty())
+        return wrapper;
+
+    V8ClassIndex::V8WrapperType type;
+
+    switch (rule->type()) {
+    case CSSRule::STYLE_RULE:
+        type = V8ClassIndex::CSSSTYLERULE;
+        break;
+    case CSSRule::CHARSET_RULE:
+        type = V8ClassIndex::CSSCHARSETRULE;
+        break;
+    case CSSRule::IMPORT_RULE:
+        type = V8ClassIndex::CSSIMPORTRULE;
+        break;
+    case CSSRule::MEDIA_RULE:
+        type = V8ClassIndex::CSSMEDIARULE;
+        break;
+    case CSSRule::FONT_FACE_RULE:
+        type = V8ClassIndex::CSSFONTFACERULE;
+        break;
+    case CSSRule::PAGE_RULE:
+        type = V8ClassIndex::CSSPAGERULE;
+        break;
+    case CSSRule::VARIABLES_RULE:
+        type = V8ClassIndex::CSSVARIABLESRULE;
+        break;
+    case CSSRule::WEBKIT_KEYFRAME_RULE:
+        type = V8ClassIndex::WEBKITCSSKEYFRAMERULE;
+        break;
+    case CSSRule::WEBKIT_KEYFRAMES_RULE:
+        type = V8ClassIndex::WEBKITCSSKEYFRAMESRULE;
+        break;
+    default:  // CSSRule::UNKNOWN_RULE
+        type = V8ClassIndex::CSSRULE;
+        break;
+    }
+
+    v8::Handle<v8::Object> result = instantiateV8Object(type, V8ClassIndex::CSSRULE, rule);
+    if (!result.IsEmpty()) {
+        // Only update the DOM object map if the result is non-empty.
+        rule->ref();
+        setJSWrapperForDOMObject(rule, v8::Persistent<v8::Object>::New(result));
+    }
+    return result;
+}
+
+v8::Handle<v8::Value> V8Proxy::convertWindowToV8Object(DOMWindow* window)
+{
+    if (!window)
+        return v8::Null();
+    // Initializes environment of a frame, and return the global object
+    // of the frame.
+    Frame* frame = window->frame();
+    if (!frame)
+        return v8::Handle<v8::Object>();
+
+    // Special case: Because of evaluateInNewContext() one DOMWindow can have
+    // multiple contexts and multiple global objects associated with it. When
+    // code running in one of those contexts accesses the window object, we
+    // want to return the global object associated with that context, not
+    // necessarily the first global object associated with that DOMWindow.
+    v8::Handle<v8::Context> currentContext = v8::Context::GetCurrent();
+    v8::Handle<v8::Object> currentGlobal = currentContext->Global();
+    v8::Handle<v8::Object> windowWrapper = lookupDOMWrapper(V8ClassIndex::DOMWINDOW, currentGlobal);
+    if (!windowWrapper.IsEmpty()) {
+        if (convertDOMWrapperToNative<DOMWindow>(windowWrapper) == window)
+            return currentGlobal;
+    }
+
+    // Otherwise, return the global object associated with this frame.
+    v8::Handle<v8::Context> v8Context = context(frame);
+    if (v8Context.IsEmpty())
+        return v8::Handle<v8::Object>();
+
+    v8::Handle<v8::Object> global = v8Context->Global();
+    ASSERT(!global.IsEmpty());
+    return global;
+}
+
+void V8Proxy::bindJsObjectToWindow(Frame* frame, const char* name, int type, v8::Handle<v8::FunctionTemplate> descriptor, void* impl)
+{
+    // Get environment.
+    v8::Handle<v8::Context> v8Context = V8Proxy::context(frame);
+    if (v8Context.IsEmpty())
+        return; // JS not enabled.
+
+    v8::Context::Scope scope(v8Context);
+    v8::Handle<v8::Object> instance = descriptor->GetFunction();
+    setDOMWrapper(instance, type, impl);
+
+    v8::Handle<v8::Object> global = v8Context->Global();
+    global->Set(v8::String::New(name), instance);
+}
+
+void V8Proxy::processConsoleMessages()
+{
+    ConsoleMessageManager::processDelayedMessages();
+}
+
+// Create the utility context for holding JavaScript functions used internally
+// which are not visible to JavaScript executing on the page.
+void V8Proxy::createUtilityContext()
+{
+    ASSERT(m_utilityContext.IsEmpty());
+
+    v8::HandleScope scope;
+    v8::Handle<v8::ObjectTemplate> globalTemplate = v8::ObjectTemplate::New();
+    m_utilityContext = v8::Context::New(0, globalTemplate);
+    v8::Context::Scope contextScope(m_utilityContext);
+
+    // Compile JavaScript function for retrieving the source line of the top
+    // JavaScript stack frame.
+    DEFINE_STATIC_LOCAL(const char*, frameSourceLineSource,
+        ("function frameSourceLine(exec_state) {"
+        "  return exec_state.frame(0).sourceLine();"
+        "}"));
+    v8::Script::Compile(v8::String::New(frameSourceLineSource))->Run();
+
+    // Compile JavaScript function for retrieving the source name of the top
+    // JavaScript stack frame.
+    DEFINE_STATIC_LOCAL(const char*, frameSourceNameSource,
+        ("function frameSourceName(exec_state) {"
+        "  var frame = exec_state.frame(0);"
+        "  if (frame.func().resolved() && "
+        "      frame.func().script() && "
+        "      frame.func().script().name()) {"
+        "    return frame.func().script().name();"
+        "  }"
+        "}"));
+    v8::Script::Compile(v8::String::New(frameSourceNameSource))->Run();
+}
+
+int V8Proxy::sourceLineNumber()
+{
+    v8::HandleScope scope;
+    v8::Handle<v8::Context> v8UtilityContext = V8Proxy::utilityContext();
+    if (v8UtilityContext.IsEmpty())
+        return 0;
+    v8::Context::Scope contextScope(v8UtilityContext);
+    v8::Handle<v8::Function> frameSourceLine;
+    frameSourceLine = v8::Local<v8::Function>::Cast(v8UtilityContext->Global()->Get(v8::String::New("frameSourceLine")));
+    if (frameSourceLine.IsEmpty())
+        return 0;
+    v8::Handle<v8::Value> result = v8::Debug::Call(frameSourceLine);
+    if (result.IsEmpty())
+        return 0;
+    return result->Int32Value();
+}
+
+String V8Proxy::sourceName()
+{
+    v8::HandleScope scope;
+    v8::Handle<v8::Context> v8UtilityContext = utilityContext();
+    if (v8UtilityContext.IsEmpty())
+        return String();
+    v8::Context::Scope contextScope(v8UtilityContext);
+    v8::Handle<v8::Function> frameSourceName;
+    frameSourceName = v8::Local<v8::Function>::Cast(v8UtilityContext->Global()->Get(v8::String::New("frameSourceName")));
+    if (frameSourceName.IsEmpty())
+        return String();
+    return ToWebCoreString(v8::Debug::Call(frameSourceName));
+}
+
+void V8Proxy::registerExtension(v8::Extension* extension, const String& schemeRestriction)
+{
+    v8::RegisterExtension(extension);
+    V8ExtensionInfo info = {schemeRestriction, extension};
+    m_extensions.push_back(info);
+}
+
+bool V8Proxy::setContextDebugId(int debugId)
+{
+    ASSERT(debugId > 0);
+    if (m_context.IsEmpty())
+        return false;
+    v8::HandleScope scope;
+    if (!m_context->GetData()->IsUndefined())
+        return false;
+
+    v8::Handle<v8::Object> contextData = v8::Object::New();
+    contextData->Set(v8::String::New(kContextDebugDataType), v8::String::New("page"));
+    contextData->Set(v8::String::New(kContextDebugDataValue), v8::Integer::New(debugId));
+    m_context->SetData(contextData);
+    return true;
+}
+
+int V8Proxy::contextDebugId(v8::Handle<v8::Context> context)
+{
+    v8::HandleScope scope;
+    if (!context->GetData()->IsObject())
+        return -1;
+    v8::Handle<v8::Value> data = context->GetData()->ToObject()->Get( v8::String::New(kContextDebugDataValue));
+    return data->IsInt32() ? data->Int32Value() : -1;
+}
+
+}  // namespace WebCore
index c21e0dd94e7697356b875c13b55141ea6142e6e1..0fefba106aaaff745c8ba20f00fc30207c5a9374 100644 (file)
 #ifndef V8Proxy_h
 #define V8Proxy_h
 
-// FIXME: This is a temporary forwarding header until all bindings have migrated
-// over and v8_proxy actually becomes V8Proxy.
-#include "v8_proxy.h"
+#include "ChromiumBridge.h"
+#include "Node.h"
+#include "NodeFilter.h"
+#include "PlatformString.h" // for WebCore::String
+#include "ScriptSourceCode.h" // for WebCore::ScriptSourceCode
+#include "SecurityOrigin.h" // for WebCore::SecurityOrigin
+#include "V8CustomBinding.h"
+#include "V8DOMMap.h"
+#include "V8EventListenerList.h"
+#include "V8Index.h"
+#include "V8Utilities.h"
+#include <v8.h>
+#include <wtf/Assertions.h>
+#include <wtf/PassRefPtr.h> // so generated bindings don't have to
+#include <wtf/Vector.h>
+
+#include <iterator>
+#include <list>
+
+#ifdef ENABLE_DOM_STATS_COUNTERS
+#define INC_STATS(name) ChromiumBridge::incrementStatsCounter(name)
+#else
+#define INC_STATS(name)
+#endif
 
 namespace WebCore {
 
+    class CSSRule;
+    class CSSRuleList;
+    class CSSStyleDeclaration;
+    class CSSValue;
+    class CSSValueList;
+    class ClientRectList;
+    class DOMImplementation;
+    class DOMWindow;
+    class Document;
+    class Element;
+    class Event;
+    class EventListener;
+    class EventTarget;
+    class Frame;
+    class HTMLCollection;
+    class HTMLDocument;
+    class HTMLElement;
+    class HTMLOptionsCollection;
+    class MediaList;
+    class MimeType;
+    class MimeTypeArray;
+    class NamedNodeMap;
+    class Navigator;
+    class Node;
+    class NodeFilter;
+    class NodeList;
+    class Plugin;
+    class PluginArray;
+    class SVGElement;
+#if ENABLE(SVG)
+    class SVGElementInstance;
+#endif
+    class Screen;
+    class ScriptExecutionContext;
+#if ENABLE(DOM_STORAGE)
+    class Storage;
+    class StorageEvent;
+#endif
+    class String;
+    class StyleSheet;
+    class StyleSheetList;
+    class V8EventListener;
+    class V8ObjectEventListener;
+
+    // FIXME: use standard logging facilities in WebCore.
+    void logInfo(Frame*, const String& message, const String& url);
+
+#ifndef NDEBUG
+
+#define GlobalHandleTypeList(V)   \
+    V(PROXY)                      \
+    V(NPOBJECT)                   \
+    V(SCHEDULED_ACTION)           \
+    V(EVENT_LISTENER)             \
+    V(NODE_FILTER)                \
+    V(SCRIPTINSTANCE)             \
+    V(SCRIPTVALUE)
+
+
+    // Host information of persistent handles.
+    enum GlobalHandleType {
+#define ENUM(name) name,
+        GlobalHandleTypeList(ENUM)
+#undef ENUM
+    };
+
+
+    class GlobalHandleInfo {
+    public:
+        GlobalHandleInfo(void* host, GlobalHandleType type) : m_host(host), m_type(type) { }
+        void* m_host;
+        GlobalHandleType m_type;
+    };
+
+#endif // NDEBUG
+
+    // The following Batch structs and methods are used for setting multiple
+    // properties on an ObjectTemplate, used from the generated bindings
+    // initialization (ConfigureXXXTemplate). This greatly reduces the binary
+    // size by moving from code driven setup to data table driven setup.
+
+    // BatchedAttribute translates into calls to SetAccessor() on either the
+    // instance or the prototype ObjectTemplate, based on |onProto|.
+    struct BatchedAttribute {
+        const char* const name;
+        v8::AccessorGetter getter;
+        v8::AccessorSetter setter;
+        V8ClassIndex::V8WrapperType data;
+        v8::AccessControl settings;
+        v8::PropertyAttribute attribute;
+        bool onProto;
+    };
+
+    void batchConfigureAttributes(v8::Handle<v8::ObjectTemplate>, v8::Handle<v8::ObjectTemplate>, const BatchedAttribute*, size_t attributeCount);
+
+    // BatchedConstant translates into calls to Set() for setting up an object's
+    // constants. It sets the constant on both the FunctionTemplate and the
+    // ObjectTemplate. PropertyAttributes is always ReadOnly.
+    struct BatchedConstant {
+        const char* const name;
+        int value;
+    };
+
+    void batchConfigureConstants(v8::Handle<v8::FunctionTemplate>, v8::Handle<v8::ObjectTemplate>, const BatchedConstant*, size_t constantCount);
+
+    const int kMaxRecursionDepth = 20;
+
+    // Information about an extension that is registered for use with V8. If scheme
+    // is non-empty, it contains the URL scheme the extension should be used with.
+    // Otherwise, the extension is used with all schemes.
+    struct V8ExtensionInfo {
+        String scheme;
+        v8::Extension* extension;
+    };
+    typedef std::list<V8ExtensionInfo> V8ExtensionList;
+
+    class V8Proxy {
+    public:
+        // The types of javascript errors that can be thrown.
+        enum ErrorType {
+            RangeError,
+            ReferenceError,
+            SyntaxError,
+            TypeError,
+            GeneralError
+        };
+
+        explicit V8Proxy(Frame* frame) : m_frame(frame), m_inlineCode(false), m_timerCallback(false), m_recursion(0) { }
+
+        ~V8Proxy();
+
+        Frame* frame() { return m_frame; }
+
+        // Clear page-specific data, but keep the global object identify.
+        void clearForNavigation();
+
+        // Clear page-specific data before shutting down the proxy object.
+        void clearForClose();
+
+        // Update document object of the frame.
+        void updateDocument();
+
+        // Update the security origin of a document
+        // (e.g., after setting docoument.domain).
+        void updateSecurityOrigin();
+
+        // Destroy the global object.
+        void destroyGlobal();
+
+        // FIXME: Need comment. User Gesture related.
+        bool inlineCode() const { return m_inlineCode; }
+        void setInlineCode(bool value) { m_inlineCode = value; }
+
+        bool timerCallback() const { return m_timerCallback; }
+        void setTimerCallback(bool value) { m_timerCallback = value; }
+
+        // Has the context for this proxy been initialized?
+        bool isContextInitialized();
+
+        // Disconnects the proxy from its owner frame,
+        // and clears all timeouts on the DOM window.
+        void disconnectFrame();
+
+        bool isEnabled();
+
+        // Find/Create/Remove event listener wrappers.
+        PassRefPtr<V8EventListener> findV8EventListener(v8::Local<v8::Value> listener, bool isHtml);
+        PassRefPtr<V8EventListener> findOrCreateV8EventListener(v8::Local<v8::Value> listener, bool isHtml);
+
+        PassRefPtr<V8EventListener> findObjectEventListener(v8::Local<v8::Value> listener, bool isHtml);
+        PassRefPtr<V8EventListener> findOrCreateObjectEventListener(v8::Local<v8::Value> listener, bool isHtml);
+
+        void removeV8EventListener(V8EventListener*);
+        void removeObjectEventListener(V8ObjectEventListener*);
+
+        // Protect/Unprotect JS wrappers of a DOM object.
+        static void gcProtect(void* domObject);
+        static void gcUnprotect(void* domObject);
+
+#if ENABLE(SVG)
+        static void setSVGContext(void*, SVGElement*);
+        static SVGElement* svgContext(void*);
+#endif
+
+        void setEventHandlerLineNumber(int lineNumber) { m_handlerLineNumber = lineNumber; }
+        void finishedWithEvent(Event*) { }
+
+        // Evaluate JavaScript in a new isolated world. The script gets its own
+        // global scope, its own prototypes for intrinsic JavaScript objects (String,
+        // Array, and so-on), and its own wrappers for all DOM nodes and DOM
+        // constructors.
+        void evaluateInNewWorld(const Vector<ScriptSourceCode>& sources);
+
+        // Evaluate JavaScript in a new context. The script gets its own global scope
+        // and its own prototypes for intrinsic JavaScript objects (String, Array,
+        // and so-on). It shares the wrappers for all DOM nodes and DOM constructors.
+        void evaluateInNewContext(const Vector<ScriptSourceCode>&);
+
+        // Evaluate a script file in the current execution environment.
+        // The caller must hold an execution context.
+        // If cannot evalute the script, it returns an error.
+        v8::Local<v8::Value> evaluate(const ScriptSourceCode&, Node*);
+
+        // Run an already compiled script.
+        v8::Local<v8::Value> runScript(v8::Handle<v8::Script>, bool isInlineCode);
+
+        // Call the function with the given receiver and arguments.
+        v8::Local<v8::Value> callFunction(v8::Handle<v8::Function>, v8::Handle<v8::Object>, int argc, v8::Handle<v8::Value> argv[]);
+
+        // Call the function as constructor with the given arguments.
+        v8::Local<v8::Value> newInstance(v8::Handle<v8::Function>, int argc, v8::Handle<v8::Value> argv[]);
+
+        // Returns the dom constructor function for the given node type.
+        v8::Local<v8::Function> getConstructor(V8ClassIndex::V8WrapperType);
+
+        // To create JS Wrapper objects, we create a cache of a 'boiler plate'
+        // object, and then simply Clone that object each time we need a new one.
+        // This is faster than going through the full object creation process.
+        v8::Local<v8::Object> createWrapperFromCache(V8ClassIndex::V8WrapperType);
+
+        // Returns the window object of the currently executing context.
+        static DOMWindow* retrieveWindow();
+        // Returns the window object associated with a context.
+        static DOMWindow* retrieveWindow(v8::Handle<v8::Context>);
+        // Returns V8Proxy object of the currently executing context.
+        static V8Proxy* retrieve();
+        // Returns V8Proxy object associated with a frame.
+        static V8Proxy* retrieve(Frame*);
+        // Returns V8Proxy object associated with a script execution context.
+        static V8Proxy* retrieve(ScriptExecutionContext*);
+
+        // Returns the frame object of the window object associated
+        // with the currently executing context.
+        static Frame* retrieveFrame();
+        // Returns the frame object of the window object associated with
+        // a context.
+        static Frame* retrieveFrame(v8::Handle<v8::Context>);
+
+
+        // The three functions below retrieve WebFrame instances relating the
+        // currently executing JavaScript. Since JavaScript can make function calls
+        // across frames, though, we need to be more precise.
+        //
+        // For example, imagine that a JS function in frame A calls a function in
+        // frame B, which calls native code, which wants to know what the 'active'
+        // frame is.
+        //
+        // The 'entered context' is the context where execution first entered the
+        // script engine; the context that is at the bottom of the JS function stack.
+        // RetrieveFrameForEnteredContext() would return Frame A in our example.
+        // This frame is often referred to as the "dynamic global object."
+        //
+        // The 'current context' is the context the JS engine is currently inside of;
+        // the context that is at the top of the JS function stack.
+        // RetrieveFrameForCurrentContext() would return Frame B in our example.
+        // This frame is often referred to as the "lexical global object."
+        //
+        // Finally, the 'calling context' is the context one below the current
+        // context on the JS function stack. For example, if function f calls
+        // function g, then the calling context will be the context associated with
+        // f. This context is commonly used by DOM security checks because they want
+        // to know who called them.
+        //
+        // If you are unsure which of these functions to use, ask abarth.
+        //
+        // NOTE: These cannot be declared as inline function, because VS complains at
+        // linking time.
+        static Frame* retrieveFrameForEnteredContext();
+        static Frame* retrieveFrameForCurrentContext();
+        static Frame* retrieveFrameForCallingContext();
+
+        // Returns V8 Context of a frame. If none exists, creates
+        // a new context. It is potentially slow and consumes memory.
+        static v8::Local<v8::Context> context(Frame*);
+        static v8::Local<v8::Context> currentContext();
+
+        // If the current context causes out of memory, JavaScript setting
+        // is disabled and it returns true.
+        static bool handleOutOfMemory();
+
+        // Check if the active execution context can access the target frame.
+        static bool canAccessFrame(Frame*, bool reportError);
+
+        // Check if it is safe to access the given node from the
+        // current security context.
+        static bool checkNodeSecurity(Node*);
+
+        static v8::Handle<v8::Value> checkNewLegal(const v8::Arguments&);
+
+        // Create a V8 wrapper for a C pointer
+        static v8::Handle<v8::Value> wrapCPointer(void* cptr)
+        {
+            // Represent void* as int
+            int addr = reinterpret_cast<int>(cptr);
+            ASSERT(!(addr & 0x01)); // The address must be aligned.
+            return v8::Integer::New(addr >> 1);
+        }
+
+        // Take C pointer out of a v8 wrapper.
+        template <class C>
+        static C* extractCPointer(v8::Handle<v8::Value> obj)
+        {
+            return static_cast<C*>(extractCPointerImpl(obj));
+        }
+
+        static v8::Handle<v8::Script> compileScript(v8::Handle<v8::String> code, const String& fileName, int baseLine);
+
+#ifndef NDEBUG
+        // Checks if a v8 value can be a DOM wrapper
+        static bool maybeDOMWrapper(v8::Handle<v8::Value>);
+#endif
+
+        // Sets contents of a DOM wrapper.
+        static void setDOMWrapper(v8::Handle<v8::Object>, int type, void* ptr);
+
+        static v8::Handle<v8::Object> lookupDOMWrapper(V8ClassIndex::V8WrapperType, v8::Handle<v8::Value>);
+
+        // A helper function extract native object pointer from a DOM wrapper
+        // and cast to the specified type.
+        template <class C>
+        static C* convertDOMWrapperToNative(v8::Handle<v8::Value> object)
+        {
+            ASSERT(maybeDOMWrapper(object));
+            v8::Handle<v8::Value> ptr = v8::Handle<v8::Object>::Cast(object)->GetInternalField(V8Custom::kDOMWrapperObjectIndex);
+            return extractCPointer<C>(ptr);
+        }
+
+        // A help function extract a node type pointer from a DOM wrapper.
+        // Wrapped pointer must be cast to Node* first.
+        static void* convertDOMWrapperToNodeHelper(v8::Handle<v8::Value>);
+
+        template <class C>
+        static C* convertDOMWrapperToNode(v8::Handle<v8::Value> value)
+        {
+            return static_cast<C*>(convertDOMWrapperToNodeHelper(value));
+        }
+
+        template<typename T>
+        static v8::Handle<v8::Value> convertToV8Object(V8ClassIndex::V8WrapperType type, PassRefPtr<T> imp)
+        {
+            return convertToV8Object(type, imp.get());
+        }
+
+        static v8::Handle<v8::Value> convertToV8Object(V8ClassIndex::V8WrapperType, void*);
+
+        // Fast-path for Node objects.
+        static v8::Handle<v8::Value> convertNodeToV8Object(Node*);
+
+        template <class C>
+        static C* convertToNativeObject(V8ClassIndex::V8WrapperType type, v8::Handle<v8::Value> object)
+        {
+            return static_cast<C*>(convertToNativeObjectImpl(type, object));
+        }
+
+        static V8ClassIndex::V8WrapperType domWrapperType(v8::Handle<v8::Object>);
+
+        // If the exception code is different from zero, a DOM exception is
+        // schedule to be thrown.
+        static void setDOMException(int exceptionCode);
+
+        // Schedule an error object to be thrown.
+        static v8::Handle<v8::Value> throwError(ErrorType, const char* message);
+
+        // Create an instance of a function descriptor and set to the global object
+        // as a named property. Used by v8_test_shell.
+        static void bindJsObjectToWindow(Frame*, const char* name, int type, v8::Handle<v8::FunctionTemplate>, void*);
+
+        static v8::Handle<v8::Value> convertEventToV8Object(Event*);
+
+        static Event* convertToNativeEvent(v8::Handle<v8::Value> jsEvent)
+        {
+            if (!isDOMEventWrapper(jsEvent))
+                return 0;
+            return convertDOMWrapperToNative<Event>(jsEvent);
+        }
+
+        static v8::Handle<v8::Value> convertEventTargetToV8Object(EventTarget*);
+        // Wrap and unwrap JS event listeners.
+        static v8::Handle<v8::Value> convertEventListenerToV8Object(EventListener*);
+
+        // DOMImplementation is a singleton and it is handled in a special
+        // way. A wrapper is generated per document and stored in an
+        // internal field of the document.
+        static v8::Handle<v8::Value> convertDOMImplementationToV8Object(DOMImplementation*);
+
+        // Wrap JS node filter in C++.
+        static PassRefPtr<NodeFilter> wrapNativeNodeFilter(v8::Handle<v8::Value>);
+
+        static v8::Persistent<v8::FunctionTemplate> getTemplate(V8ClassIndex::V8WrapperType);
+
+        template <int tag, typename T>
+        static v8::Handle<v8::Value> constructDOMObject(const v8::Arguments&);
+
+        // Checks whether a DOM object has a JS wrapper.
+        static bool domObjectHasJSWrapper(void*);
+        // Set JS wrapper of a DOM object, the caller in charge of increase ref.
+        static void setJSWrapperForDOMObject(void*, v8::Persistent<v8::Object>);
+        static void setJSWrapperForActiveDOMObject(void*, v8::Persistent<v8::Object>);
+        static void setJSWrapperForDOMNode(Node*, v8::Persistent<v8::Object>);
+
+        // Process any pending JavaScript console messages.
+        static void processConsoleMessages();
+
+#ifndef NDEBUG
+        // For debugging and leak detection purpose.
+        static void registerGlobalHandle(GlobalHandleType, void*, v8::Persistent<v8::Value>);
+        static void unregisterGlobalHandle(void*, v8::Persistent<v8::Value>);
+#endif
+
+        // Check whether a V8 value is a wrapper of type |classType|.
+        static bool isWrapperOfType(v8::Handle<v8::Value>, V8ClassIndex::V8WrapperType);
+
+        // Function for retrieving the line number and source name for the top
+        // JavaScript stack frame.
+        static int sourceLineNumber();
+        static String sourceName();
+
+
+        // Returns a local handle of the context.
+        v8::Local<v8::Context> context()
+        {
+            return v8::Local<v8::Context>::New(m_context);
+        }
+
+        bool setContextDebugId(int id);
+        static int contextDebugId(v8::Handle<v8::Context>);
+
+        // Registers an extension to be available on webpages with a particular scheme
+        // If the scheme argument is empty, the extension is available on all pages.
+        // Will only affect v8 contexts initialized after this call. Takes ownership
+        // of the v8::Extension object passed.
+        static void registerExtension(v8::Extension*, const String& schemeRestriction);
+
+        static void* convertToSVGPODTypeImpl(V8ClassIndex::V8WrapperType, v8::Handle<v8::Value>);
+
+        // FIXME: Separate these concerns from V8Proxy?
+        v8::Persistent<v8::Context> createNewContext(v8::Handle<v8::Object> global);
+        bool installDOMWindow(v8::Handle<v8::Context> context, DOMWindow* window);
+
+    private:
+        static const char* kContextDebugDataType;
+        static const char* kContextDebugDataValue;
+
+        void initContextIfNeeded();
+        void disconnectEventListeners();
+        void setSecurityToken();
+        void clearDocumentWrapper();
+        void updateDocumentWrapper(v8::Handle<v8::Value> wrapper);
+
+        // The JavaScript wrapper for the document object is cached on the global
+        // object for fast access. UpdateDocumentWrapperCache sets the wrapper
+        // for the current document on the global object. ClearDocumentWrapperCache
+        // deletes the document wrapper from the global object.
+        void updateDocumentWrapperCache();
+        void clearDocumentWrapperCache();
+
+        // Dispose global handles of m_contexts and friends.
+        void disposeContextHandles();
+
+        static bool canAccessPrivate(DOMWindow*);
+
+        // Check whether a V8 value is a DOM Event wrapper.
+        static bool isDOMEventWrapper(v8::Handle<v8::Value>);
+
+        static void* convertToNativeObjectImpl(V8ClassIndex::V8WrapperType, v8::Handle<v8::Value>);
+
+        // Take C pointer out of a v8 wrapper.
+        static void* extractCPointerImpl(v8::Handle<v8::Value> object)
+        {
+            ASSERT(object->IsNumber());
+            int addr = object->Int32Value();
+            return reinterpret_cast<void*>(addr << 1);
+        }
+
+
+        static v8::Handle<v8::Value> convertStyleSheetToV8Object(StyleSheet*);
+        static v8::Handle<v8::Value> convertCSSValueToV8Object(CSSValue*);
+        static v8::Handle<v8::Value> convertCSSRuleToV8Object(CSSRule*);
+        // Returns the JS wrapper of a window object, initializes the environment
+        // of the window frame if needed.
+        static v8::Handle<v8::Value> convertWindowToV8Object(DOMWindow*);
+
+#if ENABLE(SVG)
+        static v8::Handle<v8::Value> convertSVGElementInstanceToV8Object(SVGElementInstance*);
+        static v8::Handle<v8::Value> convertSVGObjectWithContextToV8Object(V8ClassIndex::V8WrapperType, void*);
+#endif
+
+        // Set hidden references in a DOMWindow object of a frame.
+        static void setHiddenWindowReference(Frame*, const int internalIndex, v8::Handle<v8::Object>);
+
+        static V8ClassIndex::V8WrapperType htmlElementType(HTMLElement*);
+
+        // The first V8WrapperType specifies the function descriptor
+        // used to create JS object. The second V8WrapperType specifies
+        // the actual type of the void* for type casting.
+        // For example, a HTML element has HTMLELEMENT for the first V8WrapperType, but always
+        // use NODE as the second V8WrapperType. JS wrapper stores the second
+        // V8WrapperType and the void* as internal fields.
+        static v8::Local<v8::Object> instantiateV8Object(V8ClassIndex::V8WrapperType, V8ClassIndex::V8WrapperType, void*);
+
+        static const char* rangeExceptionName(int exceptionCode);
+        static const char* eventExceptionName(int exceptionCode);
+        static const char* xmlHttpRequestExceptionName(int exceptionCode);
+        static const char* domExceptionName(int exceptionCode);
+
+#if ENABLE(XPATH)
+        static const char* xpathExceptionName(int exceptionCode);
+#endif
+
+#if ENABLE(SVG)
+        static V8ClassIndex::V8WrapperType svgElementType(SVGElement*);
+        static const char* svgExceptionName(int exceptionCode);
+#endif
+
+        static void createUtilityContext();
+
+        // Returns a local handle of the utility context.
+        static v8::Local<v8::Context> utilityContext()
+        {
+            if (m_utilityContext.IsEmpty())
+                createUtilityContext();
+            return v8::Local<v8::Context>::New(m_utilityContext);
+        }
+
+        Frame* m_frame;
+
+        v8::Persistent<v8::Context> m_context;
+        // For each possible type of wrapper, we keep a boilerplate object.
+        // The boilerplate is used to create additional wrappers of the same type.
+        // We keep a single persistent handle to an array of the activated
+        // boilerplates.
+        v8::Persistent<v8::Array> m_wrapperBoilerplates;
+        v8::Persistent<v8::Value> m_objectPrototype;
+
+        v8::Persistent<v8::Object> m_global;
+        v8::Persistent<v8::Value> m_document;
+
+        // Utility context holding JavaScript functions used internally.
+        static v8::Persistent<v8::Context> m_utilityContext;
+
+        int m_handlerLineNumber;
+
+        // A list of event listeners created for this frame,
+        // the list gets cleared when removing all timeouts.
+        V8EventListenerList m_eventListeners;
+
+        // A list of event listeners create for XMLHttpRequest object for this frame,
+        // the list gets cleared when removing all timeouts.
+        V8EventListenerList m_xhrListeners;
+
+        // True for <a href="javascript:foo()"> and false for <script>foo()</script>.
+        // Only valid during execution.
+        bool m_inlineCode;
+
+        // True when executing from within a timer callback. Only valid during
+        // execution.
+        bool m_timerCallback;
+
+        // Track the recursion depth to be able to avoid too deep recursion. The V8
+        // engine allows much more recursion than KJS does so we need to guard against
+        // excessive recursion in the binding layer.
+        int m_recursion;
+
+        // List of extensions registered with the context.
+        static V8ExtensionList m_extensions;
+    };
+
+    template <int tag, typename T>
+    v8::Handle<v8::Value> V8Proxy::constructDOMObject(const v8::Arguments& args)
+    {
+        if (!args.IsConstructCall())
+            return throwError(V8Proxy::TypeError, "DOM object constructor cannot be called as a function.");
+
+        // Note: it's OK to let this RefPtr go out of scope because we also call
+        // SetDOMWrapper(), which effectively holds a reference to obj.
+        RefPtr<T> obj = T::create();
+        V8Proxy::setDOMWrapper(args.Holder(), tag, obj.get());
+        obj->ref();
+        V8Proxy::setJSWrapperForDOMObject(obj.get(), v8::Persistent<v8::Object>::New(args.Holder()));
+        return args.Holder();
+    }
+
+
     // Used by an interceptor callback that it hasn't found anything to
     // intercept.
     inline static v8::Local<v8::Object> notHandledByInterceptor()
@@ -48,22 +652,15 @@ namespace WebCore {
     {
         return v8::Local<v8::Boolean>();
     }
-
-    // FIXME: Remove once migration is complete.
-    inline static DOMWrapperMap<void>& domObjectMap()
-    {
-        return GetDOMObjectMap();
-    }
-
-    inline v8::Handle<v8::Primitive> throwError(const char* message, V8Proxy::ErrorType type = V8Proxy::TYPE_ERROR)
+    inline v8::Handle<v8::Primitive> throwError(const char* message, V8Proxy::ErrorType type = V8Proxy::TypeError)
     {
-        V8Proxy::ThrowError(type, message);
+        V8Proxy::throwError(type, message);
         return v8::Undefined();
     }
 
     inline v8::Handle<v8::Primitive> throwError(ExceptionCode ec)
     {
-        V8Proxy::SetDOMException(ec);
+        V8Proxy::setDOMException(ec);
         return v8::Undefined();
     }
 
@@ -76,7 +673,7 @@ namespace WebCore {
     template <class T> inline v8::Handle<v8::Object> toV8(PassRefPtr<T> object, v8::Local<v8::Object> holder)
     {
         object->ref();
-        V8Proxy::SetJSWrapperForDOMObject(object.get(), v8::Persistent<v8::Object>::New(holder));
+        V8Proxy::setJSWrapperForDOMObject(object.get(), v8::Persistent<v8::Object>::New(holder));
         return holder;
     }
 
index 5769910df89dc9227617e5c8be772265cd1781bd..ef26ac826dbbb37c2d548f72da1294ead37e2e73 100644 (file)
@@ -31,9 +31,6 @@
 #ifndef V8Utilities_h
 #define V8Utilities_h
 
-// FIXME: Remove once chromium dependencies on v8_utility.h are removed.
-#define V8UTILITIES_DEFINED 1
-
 #include <v8.h>
 
 namespace WebCore {
@@ -75,11 +72,6 @@ namespace WebCore {
       static inline v8::Local<v8::Object> newInstance(v8::Handle<v8::Function>);
       static inline v8::Local<v8::Object> newInstance(v8::Handle<v8::ObjectTemplate>);
       static inline v8::Local<v8::Object> newInstance(v8::Handle<v8::Function>, int argc, v8::Handle<v8::Value> argv[]);
-
-      // FIXME: These NewInstance functions are here to ease upstreaming. Remove along with V8UTILITIES_DEFINED once chromium dependencies on v8_utility.h are removed.
-      static inline v8::Local<v8::Object> NewInstance(v8::Handle<v8::Function>);
-      static inline v8::Local<v8::Object> NewInstance(v8::Handle<v8::ObjectTemplate>);
-      static inline v8::Local<v8::Object> NewInstance(v8::Handle<v8::Function>, int argc, v8::Handle<v8::Value> argv[]);
     };
 
     v8::Local<v8::Object> SafeAllocation::newInstance(v8::Handle<v8::Function> function)
@@ -106,22 +98,6 @@ namespace WebCore {
         return function->NewInstance(argc, argv);
     }
 
-    // FIXME: These NewInstance functions are here to ease upstreaming. Remove along with V8UTILITIES_DEFINED once chromium dependencies on v8_utility.h are removed.
-    v8::Local<v8::Object> SafeAllocation::NewInstance(v8::Handle<v8::Function> function)
-    {
-        return newInstance(function);
-    }
-
-    v8::Local<v8::Object> SafeAllocation::NewInstance(v8::Handle<v8::ObjectTemplate> objectTemplate)
-    {
-        return newInstance(objectTemplate);
-    }
-
-    v8::Local<v8::Object> SafeAllocation::NewInstance(v8::Handle<v8::Function> function, int argc, v8::Handle<v8::Value> argv[])
-    {
-        return newInstance(function, argc, argv);
-    }
-
 } // namespace WebCore
 
 #endif // V8Utilities_h
index a8fbc0af90b5ddc1b9d54f4914439b9b7388fb24..237ad19a31c4456243473abeff22494c8079990b 100644 (file)
 
 #include "WorkerContextExecutionProxy.h"
 
-#include "V8Binding.h"
-#include "V8Proxy.h"
 #include "DOMCoreException.h"
 #include "Event.h"
 #include "EventException.h"
 #include "RangeException.h"
-#include "XMLHttpRequestException.h"
+#include "V8Binding.h"
+#include "V8DOMMap.h"
+#include "V8Proxy.h"
 #include "V8WorkerContextEventListener.h"
 #include "V8WorkerContextObjectEventListener.h"
 #include "Worker.h"
@@ -49,6 +49,7 @@
 #include "WorkerLocation.h"
 #include "WorkerNavigator.h"
 #include "WorkerScriptController.h"
+#include "XMLHttpRequestException.h"
 
 namespace WebCore {
 
@@ -133,11 +134,11 @@ WorkerContextExecutionProxy* WorkerContextExecutionProxy::retrieve()
 {
     v8::Handle<v8::Context> context = v8::Context::GetCurrent();
     v8::Handle<v8::Object> global = context->Global();
-    global = V8Proxy::LookupDOMWrapper(V8ClassIndex::WORKERCONTEXT, global);
+    global = V8Proxy::lookupDOMWrapper(V8ClassIndex::WORKERCONTEXT, global);
     // Return 0 if the current executing context is not the worker context.
     if (global.IsEmpty())
         return 0;
-    WorkerContext* workerContext = V8Proxy::ToNativeObject<WorkerContext>(V8ClassIndex::WORKERCONTEXT, global);
+    WorkerContext* workerContext = V8Proxy::convertToNativeObject<WorkerContext>(V8ClassIndex::WORKERCONTEXT, global);
     return workerContext->script()->proxy();
 }
 
@@ -185,9 +186,9 @@ void WorkerContextExecutionProxy::initContextIfNeeded()
     }
 
     // Wrap the object.
-    V8Proxy::SetDOMWrapper(jsWorkerContext, V8ClassIndex::ToInt(V8ClassIndex::WORKERCONTEXT), m_workerContext);
+    V8Proxy::setDOMWrapper(jsWorkerContext, V8ClassIndex::ToInt(V8ClassIndex::WORKERCONTEXT), m_workerContext);
 
-    V8Proxy::SetJSWrapperForDOMObject(m_workerContext, v8::Persistent<v8::Object>::New(jsWorkerContext));
+    V8Proxy::setJSWrapperForDOMObject(m_workerContext, v8::Persistent<v8::Object>::New(jsWorkerContext));
     m_workerContext->ref();
 
     // Insert the object instance as the prototype of the shadow object.
@@ -202,7 +203,7 @@ v8::Local<v8::Function> WorkerContextExecutionProxy::GetConstructor(V8ClassIndex
     // Enter the context of the proxy to make sure that the function is
     // constructed in the context corresponding to this proxy.
     v8::Context::Scope scope(m_context);
-    v8::Handle<v8::FunctionTemplate> functionTemplate = V8Proxy::GetTemplate(type);
+    v8::Handle<v8::FunctionTemplate> functionTemplate = V8Proxy::getTemplate(type);
 
     // Getting the function might fail if we're running out of stack or memory.
     v8::TryCatch tryCatch;
@@ -230,12 +231,12 @@ v8::Handle<v8::Value> WorkerContextExecutionProxy::ToV8Object(V8ClassIndex::V8Wr
         if (!object.IsEmpty())
             static_cast<Worker*>(impl)->ref();
         result = v8::Persistent<v8::Object>::New(object);
-        V8Proxy::SetJSWrapperForDOMObject(impl, result);
+        V8Proxy::setJSWrapperForDOMObject(impl, result);
         return result;
     }
 
     // Non DOM node
-    v8::Persistent<v8::Object> result = domObjectMap().get(impl);
+    v8::Persistent<v8::Object> result = getDOMObjectMap().get(impl);
     if (result.IsEmpty()) {
         v8::Local<v8::Object> object = toV8(type, type, impl);
         if (!object.IsEmpty()) {
@@ -262,7 +263,7 @@ v8::Handle<v8::Value> WorkerContextExecutionProxy::ToV8Object(V8ClassIndex::V8Wr
                 ASSERT(false);
             }
             result = v8::Persistent<v8::Object>::New(object);
-            V8Proxy::SetJSWrapperForDOMObject(impl, result);
+            V8Proxy::setJSWrapperForDOMObject(impl, result);
         }
     }
     return result;
@@ -273,7 +274,7 @@ v8::Handle<v8::Value> WorkerContextExecutionProxy::EventToV8Object(Event* event)
     if (!event)
         return v8::Null();
 
-    v8::Handle<v8::Object> wrapper = domObjectMap().get(event);
+    v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(event);
     if (!wrapper.IsEmpty())
         return wrapper;
 
@@ -290,7 +291,7 @@ v8::Handle<v8::Value> WorkerContextExecutionProxy::EventToV8Object(Event* event)
     }
 
     event->ref();  // fast ref
-    V8Proxy::SetJSWrapperForDOMObject(event, v8::Persistent<v8::Object>::New(result));
+    V8Proxy::setJSWrapperForDOMObject(event, v8::Persistent<v8::Object>::New(result));
 
     return result;
 }
@@ -336,20 +337,20 @@ v8::Local<v8::Object> WorkerContextExecutionProxy::toV8(V8ClassIndex::V8WrapperT
     if (proxy)
         function = proxy->GetConstructor(descType);
     else
-        function = V8Proxy::GetTemplate(descType)->GetFunction();
+        function = V8Proxy::getTemplate(descType)->GetFunction();
 
     v8::Local<v8::Object> instance = SafeAllocation::newInstance(function);
     if (!instance.IsEmpty()) {
         // Avoid setting the DOM wrapper for failed allocations.
-        V8Proxy::SetDOMWrapper(instance, V8ClassIndex::ToInt(cptrType), impl);
+        V8Proxy::setDOMWrapper(instance, V8ClassIndex::ToInt(cptrType), impl);
     }
     return instance;
 }
 
 bool WorkerContextExecutionProxy::forgetV8EventObject(Event* event)
 {
-    if (domObjectMap().contains(event)) {
-        domObjectMap().forget(event);
+    if (getDOMObjectMap().contains(event)) {
+        getDOMObjectMap().forget(event);
         return true;
     } else
         return false;
@@ -363,7 +364,7 @@ v8::Local<v8::Value> WorkerContextExecutionProxy::evaluate(const String& script,
     v8::Context::Scope scope(m_context);
 
     v8::Local<v8::String> scriptString = v8ExternalString(script);
-    v8::Handle<v8::Script> compiledScript = V8Proxy::CompileScript(scriptString, fileName, baseLine);
+    v8::Handle<v8::Script> compiledScript = V8Proxy::compileScript(scriptString, fileName, baseLine);
     return runScript(compiledScript);
 }
 
@@ -375,10 +376,10 @@ v8::Local<v8::Value> WorkerContextExecutionProxy::runScript(v8::Handle<v8::Scrip
     // Compute the source string and prevent against infinite recursion.
     if (m_recursion >= kMaxRecursionDepth) {
         v8::Local<v8::String> code = v8ExternalString("throw RangeError('Recursion too deep')");
-        script = V8Proxy::CompileScript(code, "", 0);
+        script = V8Proxy::compileScript(code, "", 0);
     }
 
-    if (V8Proxy::HandleOutOfMemory())
+    if (V8Proxy::handleOutOfMemory())
         ASSERT(script.IsEmpty());
 
     if (script.IsEmpty())
index f34a4415506e0c5bbf68d726f147db7ba71e143a..14663cb405b4474e7b4fed856d02f3ed8682788a 100644 (file)
@@ -42,7 +42,7 @@ namespace WebCore {
 
 ACCESSOR_SETTER(AttrValue)
 {
-    Attr* imp = V8Proxy::DOMWrapperToNode<Attr>(info.Holder());
+    Attr* imp = V8Proxy::convertDOMWrapperToNode<Attr>(info.Holder());
     String attrValue = toWebCoreStringWithNullCheck(value);
     Element* ownerElement = imp->ownerElement();
 
index 1ad0e7a9f835a4600892d6801258467f210b33f5..42e1621773ab0265fc248c301993583dcc05e7c1 100644 (file)
@@ -161,7 +161,7 @@ NAMED_PROPERTY_GETTER(CSSStyleDeclaration)
 
     // Search the style declaration.
     CSSStyleDeclaration* imp =
-        V8Proxy::ToNativeObject<CSSStyleDeclaration>(V8ClassIndex::CSSSTYLEDECLARATION, info.Holder());
+        V8Proxy::convertToNativeObject<CSSStyleDeclaration>(V8ClassIndex::CSSSTYLEDECLARATION, info.Holder());
     CSSPropertyInfo* propInfo = cssPropertyInfo(name);
 
     // Do not handle non-property names.
@@ -195,7 +195,7 @@ NAMED_PROPERTY_SETTER(CSSStyleDeclaration)
 {
     INC_STATS("DOM.CSSStyleDeclaration.NamedPropertySetter");
     CSSStyleDeclaration* imp =
-        V8Proxy::ToNativeObject<CSSStyleDeclaration>(
+        V8Proxy::convertToNativeObject<CSSStyleDeclaration>(
             V8ClassIndex::CSSSTYLEDECLARATION, info.Holder());
     CSSPropertyInfo* propInfo = cssPropertyInfo(name);
     if (!propInfo)
index 28f6b59fb015aca9a11119ffece23109f01662aa..f6e9dcd350639b895b7e5ffccbe9fe0c5cc01ee4 100644 (file)
@@ -41,7 +41,7 @@ namespace WebCore {
 INDEXED_PROPERTY_GETTER(CanvasPixelArray)
 {
     INC_STATS("DOM.CanvasPixelArray.IndexedPropertyGetter");
-    CanvasPixelArray* pixelBuffer = V8Proxy::ToNativeObject<CanvasPixelArray>(V8ClassIndex::CANVASPIXELARRAY, info.Holder());
+    CanvasPixelArray* pixelBuffer = V8Proxy::convertToNativeObject<CanvasPixelArray>(V8ClassIndex::CANVASPIXELARRAY, info.Holder());
 
     if ((index < 0) || (index >= pixelBuffer->length()))
         return v8::Undefined();
@@ -55,7 +55,7 @@ INDEXED_PROPERTY_GETTER(CanvasPixelArray)
 INDEXED_PROPERTY_SETTER(CanvasPixelArray)
 {
     INC_STATS("DOM.CanvasPixelArray.IndexedPropertySetter");
-    CanvasPixelArray* pixelBuffer = V8Proxy::ToNativeObject<CanvasPixelArray>(V8ClassIndex::CANVASPIXELARRAY, info.Holder());
+    CanvasPixelArray* pixelBuffer = V8Proxy::convertToNativeObject<CanvasPixelArray>(V8ClassIndex::CANVASPIXELARRAY, info.Holder());
 
     if ((index >= 0) && (index < pixelBuffer->length()))
         pixelBuffer->set(index, value->NumberValue());
index 26086aba92621ae679d406d5a6eb04f1446cf5b1..e9d81050682ed9583c4bbf06bbc1558f6a59b76f 100644 (file)
@@ -50,10 +50,10 @@ namespace WebCore {
 static v8::Handle<v8::Value> toV8(CanvasStyle* style)
 {
     if (style->canvasGradient())
-        return V8Proxy::ToV8Object(V8ClassIndex::CANVASGRADIENT, style->canvasGradient());
+        return V8Proxy::convertToV8Object(V8ClassIndex::CANVASGRADIENT, style->canvasGradient());
 
     if (style->canvasPattern())
-        return V8Proxy::ToV8Object(V8ClassIndex::CANVASPATTERN, style->canvasPattern());
+        return V8Proxy::convertToV8Object(V8ClassIndex::CANVASPATTERN, style->canvasPattern());
 
     return v8String(style->color());
 }
@@ -64,35 +64,35 @@ static PassRefPtr<CanvasStyle> toCanvasStyle(v8::Handle<v8::Value> value)
         return CanvasStyle::create(toWebCoreString(value));
 
     if (V8CanvasGradient::HasInstance(value))
-        return CanvasStyle::create(V8Proxy::DOMWrapperToNative<CanvasGradient>(value));
+        return CanvasStyle::create(V8Proxy::convertDOMWrapperToNative<CanvasGradient>(value));
 
     if (V8CanvasPattern::HasInstance(value))
-        return CanvasStyle::create(V8Proxy::DOMWrapperToNative<CanvasPattern>(value));
+        return CanvasStyle::create(V8Proxy::convertDOMWrapperToNative<CanvasPattern>(value));
 
     return 0;
 }
 
 ACCESSOR_GETTER(CanvasRenderingContext2DStrokeStyle)
 {
-    CanvasRenderingContext2D* impl = V8Proxy::DOMWrapperToNative<CanvasRenderingContext2D>(info.Holder());
+    CanvasRenderingContext2D* impl = V8Proxy::convertDOMWrapperToNative<CanvasRenderingContext2D>(info.Holder());
     return toV8(impl->strokeStyle());
 }
 
 ACCESSOR_SETTER(CanvasRenderingContext2DStrokeStyle)
 {
-    CanvasRenderingContext2D* impl = V8Proxy::DOMWrapperToNative<CanvasRenderingContext2D>(info.Holder());
+    CanvasRenderingContext2D* impl = V8Proxy::convertDOMWrapperToNative<CanvasRenderingContext2D>(info.Holder());
     impl->setStrokeStyle(toCanvasStyle(value));
 }
 
 ACCESSOR_GETTER(CanvasRenderingContext2DFillStyle)
 {
-    CanvasRenderingContext2D* impl = V8Proxy::DOMWrapperToNative<CanvasRenderingContext2D>(info.Holder());
+    CanvasRenderingContext2D* impl = V8Proxy::convertDOMWrapperToNative<CanvasRenderingContext2D>(info.Holder());
     return toV8(impl->fillStyle());
 }
 
 ACCESSOR_SETTER(CanvasRenderingContext2DFillStyle)
 {
-    CanvasRenderingContext2D* impl = V8Proxy::DOMWrapperToNative<CanvasRenderingContext2D>(info.Holder());
+    CanvasRenderingContext2D* impl = V8Proxy::convertDOMWrapperToNative<CanvasRenderingContext2D>(info.Holder());
     impl->setFillStyle(toCanvasStyle(value));
 }
 
@@ -101,7 +101,7 @@ ACCESSOR_SETTER(CanvasRenderingContext2DFillStyle)
 CALLBACK_FUNC_DECL(CanvasRenderingContext2DSetStrokeColor)
 {
     INC_STATS("DOM.CanvasRenderingContext2D.setStrokeColor()");
-    CanvasRenderingContext2D* context = V8Proxy::ToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
+    CanvasRenderingContext2D* context = V8Proxy::convertToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
     switch (args.Length()) {
     case 1:
         if (args[0]->IsString())
@@ -122,7 +122,7 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DSetStrokeColor)
         context->setStrokeColor(toFloat(args[0]), toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4]));
         break;
     default:
-        V8Proxy::ThrowError(V8Proxy::SYNTAX_ERROR, "setStrokeColor: Invalid number of arguments");
+        V8Proxy::throwError(V8Proxy::SyntaxError, "setStrokeColor: Invalid number of arguments");
         break;
     }
     return v8::Undefined();
@@ -131,7 +131,7 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DSetStrokeColor)
 CALLBACK_FUNC_DECL(CanvasRenderingContext2DSetFillColor)
 {
     INC_STATS("DOM.CanvasRenderingContext2D.setFillColor()");
-    CanvasRenderingContext2D* context = V8Proxy::ToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
+    CanvasRenderingContext2D* context = V8Proxy::convertToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
     switch (args.Length()) {
     case 1:
         if (args[0]->IsString())
@@ -152,7 +152,7 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DSetFillColor)
         context->setFillColor(toFloat(args[0]), toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4]));
         break;
     default:
-        V8Proxy::ThrowError(V8Proxy::SYNTAX_ERROR, "setFillColor: Invalid number of arguments");
+        V8Proxy::throwError(V8Proxy::SyntaxError, "setFillColor: Invalid number of arguments");
         break;
     }
     return v8::Undefined();
@@ -161,13 +161,13 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DSetFillColor)
 CALLBACK_FUNC_DECL(CanvasRenderingContext2DStrokeRect)
 {
     INC_STATS("DOM.CanvasRenderingContext2D.strokeRect()");
-    CanvasRenderingContext2D* context = V8Proxy::ToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
+    CanvasRenderingContext2D* context = V8Proxy::convertToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
     if (args.Length() == 5)
         context->strokeRect(toFloat(args[0]), toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4]));
     else if (args.Length() == 4)
         context->strokeRect(toFloat(args[0]), toFloat(args[1]), toFloat(args[2]), toFloat(args[3]));
     else {
-        V8Proxy::SetDOMException(INDEX_SIZE_ERR);
+        V8Proxy::setDOMException(INDEX_SIZE_ERR);
         return notHandledByInterceptor();
     }
     return v8::Undefined();
@@ -176,7 +176,7 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DStrokeRect)
 CALLBACK_FUNC_DECL(CanvasRenderingContext2DSetShadow)
 {
     INC_STATS("DOM.CanvasRenderingContext2D.setShadow()");
-    CanvasRenderingContext2D* context = V8Proxy::ToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
+    CanvasRenderingContext2D* context = V8Proxy::convertToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
 
     switch (args.Length()) {
     case 3:
@@ -201,7 +201,7 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DSetShadow)
         context->setShadow(toFloat(args[0]), toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4]), toFloat(args[5]), toFloat(args[6]), toFloat(args[7]));
         break;
     default:
-        V8Proxy::ThrowError(V8Proxy::SYNTAX_ERROR, "setShadow: Invalid number of arguments");
+        V8Proxy::throwError(V8Proxy::SyntaxError, "setShadow: Invalid number of arguments");
         break;
     }
 
@@ -211,13 +211,13 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DSetShadow)
 CALLBACK_FUNC_DECL(CanvasRenderingContext2DDrawImage)
 {
     INC_STATS("DOM.CanvasRenderingContext2D.drawImage()");
-    CanvasRenderingContext2D* context = V8Proxy::ToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
+    CanvasRenderingContext2D* context = V8Proxy::convertToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
 
     v8::Handle<v8::Value> arg = args[0];
 
     if (V8HTMLImageElement::HasInstance(arg)) {
         ExceptionCode ec = 0;
-        HTMLImageElement* image_element = V8Proxy::DOMWrapperToNode<HTMLImageElement>(arg);
+        HTMLImageElement* image_element = V8Proxy::convertDOMWrapperToNode<HTMLImageElement>(arg);
         switch (args.Length()) {
         case 3:
             context->drawImage(image_element, toFloat(args[1]), toFloat(args[2]));
@@ -225,7 +225,7 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DDrawImage)
         case 5:
             context->drawImage(image_element, toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4]), ec);
             if (ec != 0) {
-                V8Proxy::SetDOMException(ec);
+                V8Proxy::setDOMException(ec);
                 return notHandledByInterceptor();
             }
             break;
@@ -235,12 +235,12 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DDrawImage)
                 FloatRect(toFloat(args[5]), toFloat(args[6]), toFloat(args[7]), toFloat(args[8])),
                 ec);
             if (ec != 0) {
-                V8Proxy::SetDOMException(ec);
+                V8Proxy::setDOMException(ec);
                 return notHandledByInterceptor();
             }
             break;
         default:
-            V8Proxy::ThrowError(V8Proxy::SYNTAX_ERROR, "drawImage: Invalid number of arguments");
+            V8Proxy::throwError(V8Proxy::SyntaxError, "drawImage: Invalid number of arguments");
             return v8::Undefined();
         }
         return v8::Undefined();
@@ -249,7 +249,7 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DDrawImage)
     // HTMLCanvasElement
     if (V8HTMLCanvasElement::HasInstance(arg)) {
         ExceptionCode ec = 0;
-        HTMLCanvasElement* canvas_element = V8Proxy::DOMWrapperToNode<HTMLCanvasElement>(arg);
+        HTMLCanvasElement* canvas_element = V8Proxy::convertDOMWrapperToNode<HTMLCanvasElement>(arg);
         switch (args.Length()) {
         case 3:
             context->drawImage(canvas_element, toFloat(args[1]), toFloat(args[2]));
@@ -257,7 +257,7 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DDrawImage)
         case 5:
             context->drawImage(canvas_element, toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4]), ec);
             if (ec != 0) {
-                V8Proxy::SetDOMException(ec);
+                V8Proxy::setDOMException(ec);
                 return notHandledByInterceptor();
             }
             break;
@@ -267,33 +267,33 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DDrawImage)
                 FloatRect(toFloat(args[5]), toFloat(args[6]), toFloat(args[7]), toFloat(args[8])),
                 ec);
             if (ec != 0) {
-                V8Proxy::SetDOMException(ec);
+                V8Proxy::setDOMException(ec);
                 return notHandledByInterceptor();
             }
             break;
         default:
-            V8Proxy::ThrowError(V8Proxy::SYNTAX_ERROR, "drawImage: Invalid number of arguments");
+            V8Proxy::throwError(V8Proxy::SyntaxError, "drawImage: Invalid number of arguments");
             return v8::Undefined();
         }
         return v8::Undefined();
     }
 
-    V8Proxy::SetDOMException(TYPE_MISMATCH_ERR);
+    V8Proxy::setDOMException(TYPE_MISMATCH_ERR);
     return notHandledByInterceptor();
 }
 
 CALLBACK_FUNC_DECL(CanvasRenderingContext2DDrawImageFromRect)
 {
     INC_STATS("DOM.CanvasRenderingContext2D.drawImageFromRect()");
-    CanvasRenderingContext2D* context = V8Proxy::ToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
+    CanvasRenderingContext2D* context = V8Proxy::convertToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
 
     v8::Handle<v8::Value> arg = args[0];
 
     if (V8HTMLImageElement::HasInstance(arg)) {
-        HTMLImageElement* image_element = V8Proxy::DOMWrapperToNode<HTMLImageElement>(arg);
+        HTMLImageElement* image_element = V8Proxy::convertDOMWrapperToNode<HTMLImageElement>(arg);
         context->drawImageFromRect(image_element,  toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4]), toFloat(args[5]), toFloat(args[6]), toFloat(args[7]), toFloat(args[8]), ToWebCoreString(args[9]));
     } else
-        V8Proxy::ThrowError(V8Proxy::TYPE_ERROR, "drawImageFromRect: Invalid type of arguments");
+        V8Proxy::throwError(V8Proxy::TypeError, "drawImageFromRect: Invalid type of arguments");
 
     return v8::Undefined();
 }
@@ -301,33 +301,33 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DDrawImageFromRect)
 CALLBACK_FUNC_DECL(CanvasRenderingContext2DCreatePattern)
 {
     INC_STATS("DOM.CanvasRenderingContext2D.createPattern()");
-    CanvasRenderingContext2D* context = V8Proxy::ToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
+    CanvasRenderingContext2D* context = V8Proxy::convertToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
 
     v8::Handle<v8::Value> arg = args[0];
 
     if (V8HTMLImageElement::HasInstance(arg)) {
-        HTMLImageElement* image_element = V8Proxy::DOMWrapperToNode<HTMLImageElement>(arg);
+        HTMLImageElement* image_element = V8Proxy::convertDOMWrapperToNode<HTMLImageElement>(arg);
         ExceptionCode ec = 0;
         RefPtr<CanvasPattern> pattern = context->createPattern(image_element, valueToStringWithNullCheck(args[1]), ec);
         if (ec != 0) {
-            V8Proxy::SetDOMException(ec);
+            V8Proxy::setDOMException(ec);
             return notHandledByInterceptor();
         }
-        return V8Proxy::ToV8Object(V8ClassIndex::CANVASPATTERN, pattern.get());
+        return V8Proxy::convertToV8Object(V8ClassIndex::CANVASPATTERN, pattern.get());
     }
 
     if (V8HTMLCanvasElement::HasInstance(arg)) {
-        HTMLCanvasElement* canvas_element = V8Proxy::DOMWrapperToNode<HTMLCanvasElement>(arg);
+        HTMLCanvasElement* canvas_element = V8Proxy::convertDOMWrapperToNode<HTMLCanvasElement>(arg);
         ExceptionCode ec = 0;
         RefPtr<CanvasPattern> pattern = context->createPattern(canvas_element, valueToStringWithNullCheck(args[1]), ec);
         if (ec != 0) {
-            V8Proxy::SetDOMException(ec);
+            V8Proxy::setDOMException(ec);
             return notHandledByInterceptor();
         }
-        return V8Proxy::ToV8Object(V8ClassIndex::CANVASPATTERN, pattern.get());
+        return V8Proxy::convertToV8Object(V8ClassIndex::CANVASPATTERN, pattern.get());
     }
 
-    V8Proxy::SetDOMException(TYPE_MISMATCH_ERR);
+    V8Proxy::setDOMException(TYPE_MISMATCH_ERR);
     return notHandledByInterceptor();
 }
 
@@ -335,13 +335,13 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DFillText)
 {
     INC_STATS("DOM.CanvasRenderingContext2D.fillText()");
 
-    CanvasRenderingContext2D* context = V8Proxy::ToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
+    CanvasRenderingContext2D* context = V8Proxy::convertToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
 
     // Two forms:
     // * fillText(text, x, y)
     // * fillText(text, x, y, maxWidth)
     if (args.Length() < 3 || args.Length() > 4) {
-        V8Proxy::SetDOMException(SYNTAX_ERR);
+        V8Proxy::setDOMException(SYNTAX_ERR);
         return notHandledByInterceptor();
     }
 
@@ -361,13 +361,13 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DFillText)
 CALLBACK_FUNC_DECL(CanvasRenderingContext2DStrokeText)
 {
     INC_STATS("DOM.CanvasRenderingContext2D.strokeText()");
-    CanvasRenderingContext2D* context = V8Proxy::ToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
+    CanvasRenderingContext2D* context = V8Proxy::convertToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
 
     // Two forms:
     // * strokeText(text, x, y)
     // * strokeText(text, x, y, maxWidth)
     if (args.Length() < 3 || args.Length() > 4) {
-        V8Proxy::SetDOMException(SYNTAX_ERR);
+        V8Proxy::setDOMException(SYNTAX_ERR);
         return notHandledByInterceptor();
     }
 
@@ -392,20 +392,20 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DPutImageData)
     // * putImageData(ImageData, x, y)
     // * putImageData(ImageData, x, y, dirtyX, dirtyY, dirtyWidth, dirtyHeight)
     if (args.Length() != 3 && args.Length() != 7) {
-        V8Proxy::SetDOMException(SYNTAX_ERR);
+        V8Proxy::setDOMException(SYNTAX_ERR);
         return notHandledByInterceptor();
     }
 
-    CanvasRenderingContext2D* context = V8Proxy::ToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
+    CanvasRenderingContext2D* context = V8Proxy::convertToNativeObject<CanvasRenderingContext2D>(V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder());
 
     ImageData* imageData = 0;
 
     // Need to check that the argument is of the correct type, since
-    // ToNativeObject() expects it to be correct. If the argument was incorrect
+    // convertToNativeObject() expects it to be correct. If the argument was incorrect
     // we leave it null, and putImageData() will throw the correct exception
     // (TYPE_MISMATCH_ERR).
-    if (V8Proxy::IsWrapperOfType(args[0], V8ClassIndex::IMAGEDATA))
-        imageData = V8Proxy::ToNativeObject<ImageData>(V8ClassIndex::IMAGEDATA, args[0]);
+    if (V8Proxy::isWrapperOfType(args[0], V8ClassIndex::IMAGEDATA))
+        imageData = V8Proxy::convertToNativeObject<ImageData>(V8ClassIndex::IMAGEDATA, args[0]);
 
     ExceptionCode ec = 0;
 
@@ -415,7 +415,7 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DPutImageData)
         context->putImageData(imageData, toFloat(args[1]), toFloat(args[2]), ec);
 
     if (ec != 0) {
-        V8Proxy::SetDOMException(ec);
+        V8Proxy::setDOMException(ec);
         return notHandledByInterceptor();
     }
 
index e3f89b90b60a904355d2b9d1670a7c035df43916..65ba91ebe1a5c491993057ed1e847e55f940dc3e 100644 (file)
@@ -44,12 +44,12 @@ namespace WebCore {
 INDEXED_PROPERTY_GETTER(ClientRectList)
 {
     INC_STATS("DOM.ClientRectList.IndexedPropertyGetter");
-    ClientRectList* imp = V8Proxy::ToNativeObject<ClientRectList>(V8ClassIndex::CLIENTRECTLIST, info.Holder());
+    ClientRectList* imp = V8Proxy::convertToNativeObject<ClientRectList>(V8ClassIndex::CLIENTRECTLIST, info.Holder());
     RefPtr<ClientRect> result = imp->item(index);
     if (!result)
         return notHandledByInterceptor();
 
-    return V8Proxy::ToV8Object(V8ClassIndex::CLIENTRECT, result.get());
+    return V8Proxy::convertToV8Object(V8ClassIndex::CLIENTRECT, result.get());
 }
 
 } // namespace WebCore
index eff5511b09163d8eb4cf6cd4f40acd3183d2cb37..eea395429ceea116c659b0edf35bfc931c676bbb 100644 (file)
@@ -47,7 +47,7 @@ namespace WebCore {
 ACCESSOR_GETTER(ClipboardTypes)
 {
     INC_STATS("DOM.Clipboard.types()");
-    Clipboard* clipboard = V8Proxy::ToNativeObject<Clipboard>(V8ClassIndex::CLIPBOARD, info.Holder());
+    Clipboard* clipboard = V8Proxy::convertToNativeObject<Clipboard>(V8ClassIndex::CLIPBOARD, info.Holder());
 
     HashSet<String> types = clipboard->types();
     if (types.isEmpty())
@@ -65,7 +65,7 @@ ACCESSOR_GETTER(ClipboardTypes)
 CALLBACK_FUNC_DECL(ClipboardClearData)
 {
     INC_STATS("DOM.Clipboard.clearData()");
-    Clipboard* clipboard = V8Proxy::ToNativeObject<Clipboard>(V8ClassIndex::CLIPBOARD, args.Holder());
+    Clipboard* clipboard = V8Proxy::convertToNativeObject<Clipboard>(V8ClassIndex::CLIPBOARD, args.Holder());
 
     if (!args.Length()) {
         clipboard->clearAllData();
@@ -73,7 +73,7 @@ CALLBACK_FUNC_DECL(ClipboardClearData)
     }
 
     if (args.Length() != 1)
-        return throwError("clearData: Invalid number of arguments", V8Proxy::SYNTAX_ERROR);
+        return throwError("clearData: Invalid number of arguments", V8Proxy::SyntaxError);
 
     String type = toWebCoreString(args[0]);
     clipboard->clearData(type);
@@ -83,10 +83,10 @@ CALLBACK_FUNC_DECL(ClipboardClearData)
 CALLBACK_FUNC_DECL(ClipboardGetData)
 {
     INC_STATS("DOM.Clipboard.getData()");
-    Clipboard* clipboard = V8Proxy::ToNativeObject<Clipboard>(V8ClassIndex::CLIPBOARD, args.Holder());
+    Clipboard* clipboard = V8Proxy::convertToNativeObject<Clipboard>(V8ClassIndex::CLIPBOARD, args.Holder());
 
     if (args.Length() != 1)
-        return throwError("getData: Invalid number of arguments", V8Proxy::SYNTAX_ERROR);
+        return throwError("getData: Invalid number of arguments", V8Proxy::SyntaxError);
 
     bool success;
     String result = clipboard->getData(toWebCoreString(args[0]), success);
@@ -99,10 +99,10 @@ CALLBACK_FUNC_DECL(ClipboardGetData)
 CALLBACK_FUNC_DECL(ClipboardSetData)
 {
     INC_STATS("DOM.Clipboard.setData()");
-    Clipboard* clipboard = V8Proxy::ToNativeObject<Clipboard>(V8ClassIndex::CLIPBOARD, args.Holder());
+    Clipboard* clipboard = V8Proxy::convertToNativeObject<Clipboard>(V8ClassIndex::CLIPBOARD, args.Holder());
 
     if (args.Length() != 2)
-        return throwError("setData: Invalid number of arguments", V8Proxy::SYNTAX_ERROR);
+        return throwError("setData: Invalid number of arguments", V8Proxy::SyntaxError);
 
     String type = toWebCoreString(args[0]);
     String data = toWebCoreString(args[1]);
@@ -112,20 +112,20 @@ CALLBACK_FUNC_DECL(ClipboardSetData)
 CALLBACK_FUNC_DECL(ClipboardSetDragImage)
 {
     INC_STATS("DOM.Clipboard.setDragImage()");
-    Clipboard* clipboard = V8Proxy::ToNativeObject<Clipboard>(V8ClassIndex::CLIPBOARD, args.Holder());
+    Clipboard* clipboard = V8Proxy::convertToNativeObject<Clipboard>(V8ClassIndex::CLIPBOARD, args.Holder());
 
     if (!clipboard->isForDragging())
         return v8::Undefined();
 
     if (args.Length() != 3)
-        return throwError("setDragImage: Invalid number of arguments", V8Proxy::SYNTAX_ERROR);
+        return throwError("setDragImage: Invalid number of arguments", V8Proxy::SyntaxError);
 
     int x = toInt32(args[1]);
     int y = toInt32(args[2]);
 
     Node* node = 0;
     if (V8Node::HasInstance(args[0]))
-        node = V8Proxy::DOMWrapperToNode<Node>(args[0]);
+        node = V8Proxy::convertDOMWrapperToNode<Node>(args[0]);
 
     if (!node || !node->isElementNode())
         return throwError("setDragImageFromElement: Invalid first argument");
index 778979773fdd6af305e3ff6f2e9b3c785f7e65c9..e73a31941d9c5345efee91c0b539374b4ecbdf74 100644 (file)
@@ -51,7 +51,7 @@ bool allowSettingFrameSrcToJavascriptUrl(HTMLFrameElementBase* frame, String val
 {
     if (protocolIs(parseURL(value), "javascript")) {
         Node* contentDoc = frame->contentDocument();
-        if (contentDoc && !V8Proxy::CheckNodeSecurity(contentDoc))
+        if (contentDoc && !V8Proxy::checkNodeSecurity(contentDoc))
             return false;
     }
     return true;
@@ -82,8 +82,8 @@ ACCESSOR_GETTER(DocumentImplementation)
         return implementation;
 
     // Generate a wrapper.
-    Document* document = V8Proxy::DOMWrapperToNative<Document>(info.Holder());
-    v8::Handle<v8::Value> wrapper = V8Proxy::DOMImplementationToV8Object(document->implementation());
+    Document* document = V8Proxy::convertDOMWrapperToNative<Document>(info.Holder());
+    v8::Handle<v8::Value> wrapper = V8Proxy::convertDOMImplementationToV8Object(document->implementation());
 
     // Store the wrapper in the internal field.
     info.Holder()->SetInternalField(kDocumentImplementationIndex, wrapper);
@@ -96,16 +96,16 @@ INDEXED_ACCESS_CHECK(History)
 {
     ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::HISTORY);
     // Only allow same origin access.
-    History* history = V8Proxy::ToNativeObject<History>(V8ClassIndex::HISTORY, host);
-    return V8Proxy::CanAccessFrame(history->frame(), false);
+    History* history = V8Proxy::convertToNativeObject<History>(V8ClassIndex::HISTORY, host);
+    return V8Proxy::canAccessFrame(history->frame(), false);
 }
 
 NAMED_ACCESS_CHECK(History)
 {
     ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::HISTORY);
     // Only allow same origin access.
-    History* history = V8Proxy::ToNativeObject<History>(V8ClassIndex::HISTORY, host);
-    return V8Proxy::CanAccessFrame(history->frame(), false);
+    History* history = V8Proxy::convertToNativeObject<History>(V8ClassIndex::HISTORY, host);
+    return V8Proxy::canAccessFrame(history->frame(), false);
 }
 
 #undef INDEXED_ACCESS_CHECK
@@ -118,21 +118,21 @@ Frame* V8Custom::GetTargetFrame(v8::Local<v8::Object> host, v8::Local<v8::Value>
     Frame* target = 0;
     switch (V8ClassIndex::FromInt(data->Int32Value())) {
     case V8ClassIndex::DOMWINDOW: {
-        v8::Handle<v8::Value> window = V8Proxy::LookupDOMWrapper(V8ClassIndex::DOMWINDOW, host);
+        v8::Handle<v8::Value> window = V8Proxy::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, host);
         if (window.IsEmpty())
             return target;
 
-        DOMWindow* targetWindow = V8Proxy::ToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, window);
+        DOMWindow* targetWindow = V8Proxy::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, window);
         target = targetWindow->frame();
         break;
     }
     case V8ClassIndex::LOCATION: {
-        History* history = V8Proxy::ToNativeObject<History>(V8ClassIndex::HISTORY, host);
+        History* history = V8Proxy::convertToNativeObject<History>(V8ClassIndex::HISTORY, host);
         target = history->frame();
         break;
     }
     case V8ClassIndex::HISTORY: {
-        Location* location = V8Proxy::ToNativeObject<Location>(V8ClassIndex::LOCATION, host);
+        Location* location = V8Proxy::convertToNativeObject<Location>(V8ClassIndex::LOCATION, host);
         target = location->frame();
         break;
     }
index bd9e307f5cd03f139e14f453a8bead069cf50ce4..8f9f3eb63146f2f1d9bf6276d4a13a4d96f44bf5 100644 (file)
@@ -40,7 +40,7 @@ V8EventListener::V8EventListener(Frame* frame, v8::Local<v8::Object> listener, b
 {
     m_listener = v8::Persistent<v8::Object>::New(listener);
 #ifndef NDEBUG
-    V8Proxy::RegisterGlobalHandle(EVENT_LISTENER, this, m_listener);
+    V8Proxy::registerGlobalHandle(EVENT_LISTENER, this, m_listener);
 #endif
 }
 
@@ -49,7 +49,7 @@ V8EventListener::~V8EventListener()
     if (m_frame) {
         V8Proxy* proxy = V8Proxy::retrieve(m_frame);
         if (proxy)
-            proxy->RemoveV8EventListener(this);
+            proxy->removeV8EventListener(this);
     }
 
     disposeListenerObject();
@@ -83,7 +83,7 @@ v8::Local<v8::Value> V8EventListener::callListenerFunction(v8::Handle<v8::Value>
     v8::Handle<v8::Value> parameters[1] = { jsEvent };
 
     V8Proxy* proxy = V8Proxy::retrieve(m_frame);
-    return proxy->CallFunction(handlerFunction, receiver, 1, parameters);
+    return proxy->callFunction(handlerFunction, receiver, 1, parameters);
 }
 
 } // namespace WebCore
index a277027fc717c2c329047a8978e0ae1b29c79524..93ef118abbcfaca5b2a6095d81ecaab1f1e9087b 100644 (file)
@@ -54,15 +54,15 @@ void V8CustomSQLStatementCallback::handleEvent(SQLTransaction* transaction, SQLR
 {
     v8::HandleScope handleScope;
 
-    v8::Handle<v8::Context> context = V8Proxy::GetContext(m_frame.get());
+    v8::Handle<v8::Context> context = V8Proxy::context(m_frame.get());
     if (context.IsEmpty())
         return;
 
     v8::Context::Scope scope(context);
 
     v8::Handle<v8::Value> argv[] = {
-        V8Proxy::ToV8Object(V8ClassIndex::SQLTRANSACTION, transaction),
-        V8Proxy::ToV8Object(V8ClassIndex::SQLRESULTSET, resultSet)
+        V8Proxy::convertToV8Object(V8ClassIndex::SQLTRANSACTION, transaction),
+        V8Proxy::convertToV8Object(V8ClassIndex::SQLRESULTSET, resultSet)
     };
 
     // Protect the frame until the callback returns.
index 2f4401f40b0cb255a1718420682e3474d053da90..7d4e111acdd5926293823f128bc473c3a3ea56e0 100644 (file)
@@ -54,15 +54,15 @@ bool V8CustomSQLStatementErrorCallback::handleEvent(SQLTransaction* transaction,
 {
     v8::HandleScope handleScope;
 
-    v8::Handle<v8::Context> context = V8Proxy::GetContext(m_frame.get());
+    v8::Handle<v8::Context> context = V8Proxy::context(m_frame.get());
     if (context.IsEmpty())
         return true;
 
     v8::Context::Scope scope(context);
 
     v8::Handle<v8::Value> argv[] = {
-        V8Proxy::ToV8Object(V8ClassIndex::SQLTRANSACTION, transaction),
-        V8Proxy::ToV8Object(V8ClassIndex::SQLERROR, error)
+        V8Proxy::convertToV8Object(V8ClassIndex::SQLTRANSACTION, transaction),
+        V8Proxy::convertToV8Object(V8ClassIndex::SQLERROR, error)
     };
 
     // Protect the frame until the callback returns.
index a175df5a1f9cd76ddb856b6c5cd6f8f60aaa5af3..b05ad5c95864573e423a395d44da8502cff2c3d8 100644 (file)
@@ -55,14 +55,14 @@ void V8CustomSQLTransactionCallback::handleEvent(SQLTransaction* transaction, bo
 {
     v8::HandleScope handleScope;
 
-    v8::Handle<v8::Context> context = V8Proxy::GetContext(m_frame.get());
+    v8::Handle<v8::Context> context = V8Proxy::context(m_frame.get());
     if (context.IsEmpty())
         return;
 
     v8::Context::Scope scope(context);
 
     v8::Handle<v8::Value> argv[] = {
-        V8Proxy::ToV8Object(V8ClassIndex::SQLTRANSACTION, transaction)
+        V8Proxy::convertToV8Object(V8ClassIndex::SQLTRANSACTION, transaction)
     };
 
     // Protect the frame until the callback returns.
index 6233a1def5015b18913dec28668c91347bc42f24..4c893b39a6729a0cf446d74e753357580ec7dd95 100644 (file)
@@ -54,14 +54,14 @@ void V8CustomSQLTransactionErrorCallback::handleEvent(SQLError* error)
 {
     v8::HandleScope handleScope;
 
-    v8::Handle<v8::Context> context = V8Proxy::GetContext(m_frame.get());
+    v8::Handle<v8::Context> context = V8Proxy::context(m_frame.get());
     if (context.IsEmpty())
         return;
 
     v8::Context::Scope scope(context);
 
     v8::Handle<v8::Value> argv[] = {
-        V8Proxy::ToV8Object(V8ClassIndex::SQLERROR, error)
+        V8Proxy::convertToV8Object(V8ClassIndex::SQLERROR, error)
     };
 
     // Protect the frame until the callback returns.
index b4daebd8ac649a6881f1de45398065712c4b4921..5df6d09cf426c41a577ffc221b0e253af8eff960 100644 (file)
@@ -50,7 +50,7 @@ void V8CustomVoidCallback::handleEvent()
 {
     v8::HandleScope handleScope;
 
-    v8::Handle<v8::Context> context = V8Proxy::GetContext(m_frame.get());
+    v8::Handle<v8::Context> context = V8Proxy::context(m_frame.get());
     if (context.IsEmpty())
         return;
 
@@ -87,7 +87,7 @@ bool invokeCallback(v8::Persistent<v8::Object> callback, int argc, v8::Handle<v8
     V8Proxy* proxy = V8Proxy::retrieve();
     ASSERT(proxy);
 
-    v8::Handle<v8::Value> result = proxy->CallFunction(callbackFunction, thisObject, argc, argv);
+    v8::Handle<v8::Value> result = proxy->callFunction(callbackFunction, thisObject, argc, argv);
 
     callbackReturnValue = result.IsEmpty() && result->IsBoolean() && result->BooleanValue();
 
index f32ac47968b587c0d66c4bd46ea4105e80201ab7..f25c316cd4b5624fb67865cb1401540b960498e6 100644 (file)
@@ -61,7 +61,7 @@ String V8CustomXPathNSResolver::lookupNamespaceURI(const String& prefix)
 
     if (lookupNamespaceURIFunc.IsEmpty() && !m_resolver->IsFunction()) {
         Frame* frame = V8Proxy::retrieveFrameForEnteredContext();
-        log_info(frame, "XPathNSResolver does not have a lookupNamespaceURI method.", String());
+        logInfo(frame, "XPathNSResolver does not have a lookupNamespaceURI method.", String());
         return String();
     }
 
@@ -74,7 +74,7 @@ String V8CustomXPathNSResolver::lookupNamespaceURI(const String& prefix)
     v8::Handle<v8::Function> function = lookupNamespaceURIFunc.IsEmpty() ? v8::Handle<v8::Function>::Cast(m_resolver) : lookupNamespaceURIFunc;
 
     V8Proxy* proxy = V8Proxy::retrieve();
-    v8::Handle<v8::Value> retval = proxy->CallFunction(function, m_resolver, argc, argv);
+    v8::Handle<v8::Value> retval = proxy->callFunction(function, m_resolver, argc, argv);
 
     // Eat exceptions from namespace resolver and return an empty string. This will most likely cause NAMESPACE_ERR.
     if (try_catch.HasCaught())
index f96b8891ff96ab939c91c82f4aed7cd474edd013..4af5c6eb793d028c810b690462b9244af3508d56 100644 (file)
@@ -39,7 +39,7 @@ namespace WebCore {
 CALLBACK_FUNC_DECL(DOMParserConstructor)
 {
     INC_STATS("DOM.DOMParser.Contructor");
-    return V8Proxy::ConstructDOMObject<V8ClassIndex::DOMPARSER, DOMParser>(args);
+    return V8Proxy::constructDOMObject<V8ClassIndex::DOMPARSER, DOMParser>(args);
 }
 
 } // namespace WebCore
index c13c3b29490c49bc9fb073037cd8f489e225851f..f47700a8f1b98223f877983126983f31c02e8403 100644 (file)
@@ -64,12 +64,12 @@ v8::Handle<v8::Value> V8Custom::WindowSetTimeoutImpl(const v8::Arguments& args,
     if (argumentCount < 1)
         return v8::Undefined();
 
-    DOMWindow* imp = V8Proxy::ToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, args.Holder());
+    DOMWindow* imp = V8Proxy::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, args.Holder());
 
     if (!imp->frame())
         return v8::Undefined();
 
-    if (!V8Proxy::CanAccessFrame(imp->frame(), true))
+    if (!V8Proxy::canAccessFrame(imp->frame(), true))
         return v8::Undefined();
 
     ScriptExecutionContext* scriptContext = static_cast<ScriptExecutionContext*>(imp->frame()->document());
@@ -124,7 +124,7 @@ static bool isAscii(const String& str)
 static v8::Handle<v8::Value> convertBase64(const String& str, bool encode)
 {
     if (!isAscii(str)) {
-        V8Proxy::SetDOMException(INVALID_CHARACTER_ERR);
+        V8Proxy::setDOMException(INVALID_CHARACTER_ERR);
         return notHandledByInterceptor();
     }
 
@@ -137,7 +137,7 @@ static v8::Handle<v8::Value> convertBase64(const String& str, bool encode)
         base64Encode(inputCharacters, outputCharacters);
     else {
         if (!base64Decode(inputCharacters, outputCharacters))
-            return throwError("Cannot decode base64", V8Proxy::GENERAL_ERROR);
+            return throwError("Cannot decode base64", V8Proxy::GeneralError);
     }
 
     return v8String(String(outputCharacters.data(), outputCharacters.size()));
@@ -161,20 +161,20 @@ ACCESSOR_GETTER(DOMWindowCrypto)
 
 ACCESSOR_SETTER(DOMWindowLocation)
 {
-    v8::Handle<v8::Object> holder = V8Proxy::LookupDOMWrapper(V8ClassIndex::DOMWINDOW, info.This());
+    v8::Handle<v8::Object> holder = V8Proxy::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, info.This());
     if (holder.IsEmpty())
         return;
 
-    DOMWindow* imp = V8Proxy::ToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, holder);
+    DOMWindow* imp = V8Proxy::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, holder);
     WindowSetLocation(imp, toWebCoreString(value));
 }
 
 
 ACCESSOR_SETTER(DOMWindowOpener)
 {
-    DOMWindow* imp = V8Proxy::ToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, info.Holder());
+    DOMWindow* imp = V8Proxy::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, info.Holder());
 
-    if (!V8Proxy::CanAccessFrame(imp->frame(), true))
+    if (!V8Proxy::canAccessFrame(imp->frame(), true))
         return;
   
     // Opener can be shadowed if it is in the same domain.
@@ -197,9 +197,9 @@ ACCESSOR_SETTER(DOMWindowOpener)
 CALLBACK_FUNC_DECL(DOMWindowAddEventListener)
 {
     INC_STATS("DOM.DOMWindow.addEventListener()");
-    DOMWindow* imp = V8Proxy::ToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, args.Holder());
+    DOMWindow* imp = V8Proxy::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, args.Holder());
 
-    if (!V8Proxy::CanAccessFrame(imp->frame(), true))
+    if (!V8Proxy::canAccessFrame(imp->frame(), true))
         return v8::Undefined();
 
     if (!imp->frame())
@@ -214,7 +214,7 @@ CALLBACK_FUNC_DECL(DOMWindowAddEventListener)
     if (!proxy)
         return v8::Undefined();
 
-    RefPtr<EventListener> listener = proxy->FindOrCreateV8EventListener(args[1], false);
+    RefPtr<EventListener> listener = proxy->findOrCreateV8EventListener(args[1], false);
 
     if (listener) {
         String eventType = toWebCoreString(args[0]);
@@ -229,9 +229,9 @@ CALLBACK_FUNC_DECL(DOMWindowAddEventListener)
 CALLBACK_FUNC_DECL(DOMWindowRemoveEventListener)
 {
     INC_STATS("DOM.DOMWindow.removeEventListener()");
-    DOMWindow* imp = V8Proxy::ToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, args.Holder());
+    DOMWindow* imp = V8Proxy::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, args.Holder());
 
-    if (!V8Proxy::CanAccessFrame(imp->frame(), true))
+    if (!V8Proxy::canAccessFrame(imp->frame(), true))
         return v8::Undefined();
 
     if (!imp->frame())
@@ -245,7 +245,7 @@ CALLBACK_FUNC_DECL(DOMWindowRemoveEventListener)
     if (!proxy)
         return v8::Undefined();
 
-    RefPtr<EventListener> listener = proxy->FindV8EventListener(args[1], false);
+    RefPtr<EventListener> listener = proxy->findV8EventListener(args[1], false);
 
     if (listener) {
         String eventType = toWebCoreString(args[0]);
@@ -259,7 +259,7 @@ CALLBACK_FUNC_DECL(DOMWindowRemoveEventListener)
 CALLBACK_FUNC_DECL(DOMWindowPostMessage)
 {
     INC_STATS("DOM.DOMWindow.postMessage()");
-    DOMWindow* window = V8Proxy::ToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, args.Holder());
+    DOMWindow* window = V8Proxy::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, args.Holder());
 
     DOMWindow* source = V8Proxy::retrieveFrameForCallingContext()->domWindow();
     ASSERT(source->frame());
@@ -275,8 +275,8 @@ CALLBACK_FUNC_DECL(DOMWindowPostMessage)
     // or
     //   postMessage(message, targetOrigin);
     if (args.Length() > 2) {
-        if (V8Proxy::IsWrapperOfType(args[1], V8ClassIndex::MESSAGEPORT))
-            port = V8Proxy::ToNativeObject<MessagePort>(V8ClassIndex::MESSAGEPORT, args[1]);
+        if (V8Proxy::isWrapperOfType(args[1], V8ClassIndex::MESSAGEPORT))
+            port = V8Proxy::convertToNativeObject<MessagePort>(V8ClassIndex::MESSAGEPORT, args[1]);
         targetOrigin = valueToStringWithNullOrUndefinedCheck(args[2]);
     } else {
         targetOrigin = valueToStringWithNullOrUndefinedCheck(args[1]);
@@ -288,7 +288,7 @@ CALLBACK_FUNC_DECL(DOMWindowPostMessage)
     ExceptionCode ec = 0;
     window->postMessage(message, port, targetOrigin, source, ec);
     if (ec)
-        V8Proxy::SetDOMException(ec);
+        V8Proxy::setDOMException(ec);
 
     return v8::Undefined();
 }
@@ -296,13 +296,13 @@ CALLBACK_FUNC_DECL(DOMWindowPostMessage)
 CALLBACK_FUNC_DECL(DOMWindowAtob)
 {
     INC_STATS("DOM.DOMWindow.atob()");
-    DOMWindow* imp = V8Proxy::ToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, args.Holder());
+    DOMWindow* imp = V8Proxy::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, args.Holder());
 
-    if (!V8Proxy::CanAccessFrame(imp->frame(), true))
+    if (!V8Proxy::canAccessFrame(imp->frame(), true))
         return v8::Undefined();
 
     if (args.Length() < 1)
-        return throwError("Not enough arguments", V8Proxy::SYNTAX_ERROR);
+        return throwError("Not enough arguments", V8Proxy::SyntaxError);
 
     if (args[0]->IsNull())
         return v8String("");
@@ -314,13 +314,13 @@ CALLBACK_FUNC_DECL(DOMWindowAtob)
 CALLBACK_FUNC_DECL(DOMWindowBtoa)
 {
     INC_STATS("DOM.DOMWindow.btoa()");
-    DOMWindow* imp = V8Proxy::ToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, args.Holder());
+    DOMWindow* imp = V8Proxy::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, args.Holder());
 
-    if (!V8Proxy::CanAccessFrame(imp->frame(), true))
+    if (!V8Proxy::canAccessFrame(imp->frame(), true))
         return v8::Undefined();
 
     if (args.Length() < 1)
-        return throwError("Not enough arguments", V8Proxy::SYNTAX_ERROR);
+        return throwError("Not enough arguments", V8Proxy::SyntaxError);
 
     if (args[0]->IsNull())
         return v8String("");
@@ -373,11 +373,11 @@ static String eventNameFromAttributeName(const String& name)
 
 ACCESSOR_SETTER(DOMWindowEventHandler)
 {
-    v8::Handle<v8::Object> holder = V8Proxy::LookupDOMWrapper(V8ClassIndex::DOMWINDOW, info.This());
+    v8::Handle<v8::Object> holder = V8Proxy::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, info.This());
     if (holder.IsEmpty())
         return;
 
-    DOMWindow* imp = V8Proxy::ToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, holder);
+    DOMWindow* imp = V8Proxy::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, holder);
     if (!imp->frame())
         return;
 
@@ -397,7 +397,7 @@ ACCESSOR_SETTER(DOMWindowEventHandler)
             return;
 
         RefPtr<EventListener> listener =
-            proxy->FindOrCreateV8EventListener(value, true);
+            proxy->findOrCreateV8EventListener(value, true);
         if (listener)
             imp->setAttributeEventListener(eventType, listener);
     }
@@ -405,11 +405,11 @@ ACCESSOR_SETTER(DOMWindowEventHandler)
 
 ACCESSOR_GETTER(DOMWindowEventHandler)
 {
-    v8::Handle<v8::Object> holder = V8Proxy::LookupDOMWrapper(V8ClassIndex::DOMWINDOW, info.This());
+    v8::Handle<v8::Object> holder = V8Proxy::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, info.This());
     if (holder.IsEmpty())
         return v8::Undefined();
 
-    DOMWindow* imp = V8Proxy::ToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, holder);
+    DOMWindow* imp = V8Proxy::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, holder);
     if (!imp->frame())
         return v8::Undefined();
 
@@ -421,7 +421,7 @@ ACCESSOR_GETTER(DOMWindowEventHandler)
     String eventType = eventNameFromAttributeName(key);
 
     EventListener* listener = imp->getAttributeEventListener(eventType);
-    return V8Proxy::EventListenerToV8Object(listener);
+    return V8Proxy::convertEventListenerToV8Object(listener);
 }
 
 static bool canShowModalDialogNow(const Frame* frame)
@@ -518,7 +518,7 @@ static Frame* createWindow(Frame* callingFrame,
 
     // Set dialog arguments on the global object of the new frame.
     if (!dialogArgs.IsEmpty()) {
-        v8::Local<v8::Context> context = V8Proxy::GetContext(newFrame);
+        v8::Local<v8::Context> context = V8Proxy::context(newFrame);
         if (!context.IsEmpty()) {
             v8::Context::Scope scope(context);
             context->Global()->Set(v8::String::New("dialogArguments"), dialogArgs);
@@ -544,11 +544,11 @@ static Frame* createWindow(Frame* callingFrame,
 CALLBACK_FUNC_DECL(DOMWindowShowModalDialog)
 {
     INC_STATS("DOM.DOMWindow.showModalDialog()");
-    DOMWindow* window = V8Proxy::ToNativeObject<DOMWindow>(
+    DOMWindow* window = V8Proxy::convertToNativeObject<DOMWindow>(
         V8ClassIndex::DOMWINDOW, args.Holder());
     Frame* frame = window->frame();
 
-    if (!frame || !V8Proxy::CanAccessFrame(frame, true)) 
+    if (!frame || !V8Proxy::canAccessFrame(frame, true)) 
         return v8::Undefined();
 
     Frame* callingFrame = V8Proxy::retrieveFrameForCallingContext();
@@ -611,7 +611,7 @@ CALLBACK_FUNC_DECL(DOMWindowShowModalDialog)
 
     // Hold on to the context of the dialog window long enough to retrieve the
     // value of the return value property.
-    v8::Local<v8::Context> context = V8Proxy::GetContext(dialogFrame);
+    v8::Local<v8::Context> context = V8Proxy::context(dialogFrame);
 
     // Run the dialog.
     dialogFrame->page()->chrome()->runModal();
@@ -633,10 +633,10 @@ CALLBACK_FUNC_DECL(DOMWindowShowModalDialog)
 CALLBACK_FUNC_DECL(DOMWindowOpen)
 {
     INC_STATS("DOM.DOMWindow.open()");
-    DOMWindow* parent = V8Proxy::ToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, args.Holder());
+    DOMWindow* parent = V8Proxy::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, args.Holder());
     Frame* frame = parent->frame();
 
-    if (!frame || !V8Proxy::CanAccessFrame(frame, true))
+    if (!frame || !V8Proxy::canAccessFrame(frame, true))
         return v8::Undefined();
 
     Frame* callingFrame = V8Proxy::retrieveFrameForCallingContext();
@@ -691,7 +691,7 @@ CALLBACK_FUNC_DECL(DOMWindowOpen)
 
             frame->loader()->scheduleLocationChange(completedUrl, referrer, false, userGesture);
         }
-        return V8Proxy::ToV8Object(V8ClassIndex::DOMWINDOW, frame->domWindow());
+        return V8Proxy::convertToV8Object(V8ClassIndex::DOMWINDOW, frame->domWindow());
     }
 
     // In the case of a named frame or a new window, we'll use the
@@ -751,18 +751,18 @@ CALLBACK_FUNC_DECL(DOMWindowOpen)
     if (!frame)
         return v8::Undefined();
 
-    return V8Proxy::ToV8Object(V8ClassIndex::DOMWINDOW, frame->domWindow());
+    return V8Proxy::convertToV8Object(V8ClassIndex::DOMWINDOW, frame->domWindow());
 }
 
 
 INDEXED_PROPERTY_GETTER(DOMWindow)
 {
     INC_STATS("DOM.DOMWindow.IndexedPropertyGetter");
-    v8::Handle<v8::Object> holder = V8Proxy::LookupDOMWrapper(V8ClassIndex::DOMWINDOW, info.This());
+    v8::Handle<v8::Object> holder = V8Proxy::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, info.This());
     if (holder.IsEmpty())
         return notHandledByInterceptor();
 
-    DOMWindow* window = V8Proxy::ToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, holder);
+    DOMWindow* window = V8Proxy::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, holder);
     if (!window)
         return notHandledByInterceptor();
 
@@ -772,7 +772,7 @@ INDEXED_PROPERTY_GETTER(DOMWindow)
 
     Frame* child = frame->tree()->child(index);
     if (child)
-        return V8Proxy::ToV8Object(V8ClassIndex::DOMWINDOW, child->domWindow());
+        return V8Proxy::convertToV8Object(V8ClassIndex::DOMWINDOW, child->domWindow());
 
     return notHandledByInterceptor();
 }
@@ -782,11 +782,11 @@ NAMED_PROPERTY_GETTER(DOMWindow)
 {
     INC_STATS("DOM.DOMWindow.NamedPropertyGetter");
 
-    v8::Handle<v8::Object> holder = V8Proxy::LookupDOMWrapper(V8ClassIndex::DOMWINDOW, info.This());
+    v8::Handle<v8::Object> holder = V8Proxy::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, info.This());
     if (holder.IsEmpty())
         return notHandledByInterceptor();
 
-    DOMWindow* window = V8Proxy::ToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, holder);
+    DOMWindow* window = V8Proxy::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, holder);
     if (!window)
         return notHandledByInterceptor();
 
@@ -799,7 +799,7 @@ NAMED_PROPERTY_GETTER(DOMWindow)
     AtomicString propName = v8StringToAtomicWebCoreString(name);
     Frame* child = frame->tree()->child(propName);
     if (child)
-        return V8Proxy::ToV8Object(V8ClassIndex::DOMWINDOW, child->domWindow());
+        return V8Proxy::convertToV8Object(V8ClassIndex::DOMWINDOW, child->domWindow());
 
     // Search IDL functions defined in the prototype
     v8::Handle<v8::Value> result = holder->GetRealNamedPropertyInPrototypeChain(name);
@@ -812,9 +812,9 @@ NAMED_PROPERTY_GETTER(DOMWindow)
         RefPtr<HTMLCollection> items = doc->windowNamedItems(propName);
         if (items->length() >= 1) {
             if (items->length() == 1)
-                return V8Proxy::NodeToV8Object(items->firstItem());
+                return V8Proxy::convertNodeToV8Object(items->firstItem());
             else
-                return V8Proxy::ToV8Object(V8ClassIndex::HTMLCOLLECTION, items.get());
+                return V8Proxy::convertToV8Object(V8ClassIndex::HTMLCOLLECTION, items.get());
         }
     }
 
@@ -856,8 +856,8 @@ CALLBACK_FUNC_DECL(DOMWindowSetInterval)
 void V8Custom::ClearTimeoutImpl(const v8::Arguments& args)
 {
     v8::Handle<v8::Value> holder = args.Holder();
-    DOMWindow* imp = V8Proxy::ToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, holder);
-    if (!V8Proxy::CanAccessFrame(imp->frame(), true))
+    DOMWindow* imp = V8Proxy::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, holder);
+    if (!V8Proxy::canAccessFrame(imp->frame(), true))
         return;
     ScriptExecutionContext* context = static_cast<ScriptExecutionContext*>(imp->frame()->document());
     int handle = toInt32(args[0]);
@@ -882,11 +882,11 @@ CALLBACK_FUNC_DECL(DOMWindowClearInterval)
 NAMED_ACCESS_CHECK(DOMWindow)
 {
     ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::DOMWINDOW);
-    v8::Handle<v8::Value> window = V8Proxy::LookupDOMWrapper(V8ClassIndex::DOMWINDOW, host);
+    v8::Handle<v8::Value> window = V8Proxy::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, host);
     if (window.IsEmpty())
         return false;  // the frame is gone.
 
-    DOMWindow* targetWindow = V8Proxy::ToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, window);
+    DOMWindow* targetWindow = V8Proxy::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, window);
 
     ASSERT(targetWindow);
 
@@ -902,17 +902,17 @@ NAMED_ACCESS_CHECK(DOMWindow)
             return true;
     }
 
-    return V8Proxy::CanAccessFrame(target, false);
+    return V8Proxy::canAccessFrame(target, false);
 }
 
 INDEXED_ACCESS_CHECK(DOMWindow)
 {
     ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::DOMWINDOW);
-    v8::Handle<v8::Value> window = V8Proxy::LookupDOMWrapper(V8ClassIndex::DOMWINDOW, host);
+    v8::Handle<v8::Value> window = V8Proxy::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, host);
     if (window.IsEmpty())
         return false;
 
-    DOMWindow* targetWindow = V8Proxy::ToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, window);
+    DOMWindow* targetWindow = V8Proxy::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, window);
 
     ASSERT(targetWindow);
 
@@ -924,7 +924,7 @@ INDEXED_ACCESS_CHECK(DOMWindow)
     if ((type == v8::ACCESS_GET || type == v8::ACCESS_HAS) && target->tree()->child(index))
         return true;
 
-    return V8Proxy::CanAccessFrame(target, false);
+    return V8Proxy::canAccessFrame(target, false);
 }
 
 } // namespace WebCore
index 6996d3529c92e5c7c6148050d8cf9e8cbc4a4837..3414417815589c711eee233daaed71187e7daf44 100644 (file)
 
 #if ENABLE(DATABASE)
 
-#include "v8_binding.h"
-#include "v8_proxy.h"
-
 #include "Database.h"
+#include "V8Binding.h"
 #include "V8CustomBinding.h"
 #include "V8CustomSQLTransactionCallback.h"
 #include "V8CustomSQLTransactionErrorCallback.h"
 #include "V8CustomVoidCallback.h"
+#include "V8Proxy.h"
 
 namespace WebCore {
 
@@ -54,16 +53,16 @@ CALLBACK_FUNC_DECL(DatabaseTransaction)
     INC_STATS("DOM.Database.transaction()");
 
     if (args.Length() == 0) {
-        V8Proxy::ThrowError(V8Proxy::SYNTAX_ERROR, "Transaction callback is required.");
+        V8Proxy::throwError(V8Proxy::SyntaxError, "Transaction callback is required.");
         return v8::Undefined();
     }
 
     if (!args[0]->IsObject()) {
-        V8Proxy::ThrowError(V8Proxy::TYPE_ERROR, "Transaction callback must be of valid type.");
+        V8Proxy::throwError(V8Proxy::TypeError, "Transaction callback must be of valid type.");
         return v8::Undefined();
     }
 
-    Database* database = V8Proxy::ToNativeObject<Database>(V8ClassIndex::DATABASE, args.Holder());
+    Database* database = V8Proxy::convertToNativeObject<Database>(V8ClassIndex::DATABASE, args.Holder());
 
     Frame* frame = V8Proxy::retrieveFrame();
 
@@ -72,7 +71,7 @@ CALLBACK_FUNC_DECL(DatabaseTransaction)
     RefPtr<V8CustomSQLTransactionErrorCallback> errorCallback;
     if (args.Length() > 1) {
         if (!args[1]->IsObject()) {
-            V8Proxy::ThrowError(V8Proxy::TYPE_ERROR, "Transaction error callback must be of valid type.");
+            V8Proxy::throwError(V8Proxy::TypeError, "Transaction error callback must be of valid type.");
             return v8::Undefined();
         }
         errorCallback = V8CustomSQLTransactionErrorCallback::create(args[1], frame);
@@ -81,7 +80,7 @@ CALLBACK_FUNC_DECL(DatabaseTransaction)
     RefPtr<V8CustomVoidCallback> successCallback;
     if (args.Length() > 2) {
         if (!args[1]->IsObject()) {
-            V8Proxy::ThrowError(V8Proxy::TYPE_ERROR, "Transaction success callback must be of valid type.");
+            V8Proxy::throwError(V8Proxy::TypeError, "Transaction success callback must be of valid type.");
             return v8::Undefined();
         }
         successCallback = V8CustomVoidCallback::create(args[2], frame);
index a4fc32086a4a9dd40230f7d7454af6b17195ff69..3db57340fd4399df50a5691da9d845dbde60ebe0 100644 (file)
@@ -52,16 +52,16 @@ CALLBACK_FUNC_DECL(DocumentEvaluate)
 {
     INC_STATS("DOM.Document.evaluate()");
 
-    Document* document = V8Proxy::DOMWrapperToNode<Document>(args.Holder());
+    Document* document = V8Proxy::convertDOMWrapperToNode<Document>(args.Holder());
     ExceptionCode ec = 0;
     String expression = toWebCoreString(args[0]);
     Node* contextNode = 0;
     if (V8Node::HasInstance(args[1]))
-        contextNode = V8Proxy::DOMWrapperToNode<Node>(args[1]);
+        contextNode = V8Proxy::convertDOMWrapperToNode<Node>(args[1]);
 
     XPathNSResolver* resolver = 0;
     if (V8XPathNSResolver::HasInstance(args[2]))
-        resolver = V8Proxy::ToNativeObject<XPathNSResolver>(V8ClassIndex::XPATHNSRESOLVER, args[2]);
+        resolver = V8Proxy::convertToNativeObject<XPathNSResolver>(V8ClassIndex::XPATHNSRESOLVER, args[2]);
     else if (args[2]->IsObject())
         resolver = new V8CustomXPathNSResolver(args[2]->ToObject());
     else if (!args[2]->IsNull() && !args[2]->IsUndefined())
@@ -70,7 +70,7 @@ CALLBACK_FUNC_DECL(DocumentEvaluate)
     int type = toInt32(args[3]);
     XPathResult* inResult = 0;
     if (V8XPathResult::HasInstance(args[4]))
-        inResult = V8Proxy::ToNativeObject<XPathResult>(V8ClassIndex::XPATHRESULT, args[4]);
+        inResult = V8Proxy::convertToNativeObject<XPathResult>(V8ClassIndex::XPATHRESULT, args[4]);
 
     v8::TryCatch exceptionCatcher;
     RefPtr<XPathResult> result = document->evaluate(expression, contextNode, resolver, type, inResult, ec);
@@ -80,20 +80,20 @@ CALLBACK_FUNC_DECL(DocumentEvaluate)
     if (ec)
         return throwError(ec);
 
-    return V8Proxy::ToV8Object(V8ClassIndex::XPATHRESULT, result.get());
+    return V8Proxy::convertToV8Object(V8ClassIndex::XPATHRESULT, result.get());
 }
 
 CALLBACK_FUNC_DECL(DocumentGetCSSCanvasContext)
 {
     INC_STATS("DOM.Document.getCSSCanvasContext");
     v8::Handle<v8::Value> holder = args.Holder();
-    Document* imp = V8Proxy::DOMWrapperToNode<Document>(holder);
+    Document* imp = V8Proxy::convertDOMWrapperToNode<Document>(holder);
     String contextId = toWebCoreString(args[0]);
     String name = toWebCoreString(args[1]);
     int width = toInt32(args[2]);
     int height = toInt32(args[3]);
     CanvasRenderingContext2D* result = imp->getCSSCanvasContext(contextId, name, width, height);
-    return V8Proxy::ToV8Object(V8ClassIndex::CANVASRENDERINGCONTEXT2D, result);
+    return V8Proxy::convertToV8Object(V8ClassIndex::CANVASRENDERINGCONTEXT2D, result);
 }
 
 } // namespace WebCore
index dfcacef15836980cf936c4431a950fa8f88c572b..5e9ea9e9aa0397da16452a2cd07bd545d5a4ce80 100644 (file)
@@ -34,17 +34,17 @@ namespace WebCore {
 
 ACCESSOR_GETTER(DocumentLocation)
 {
-    Document* document = V8Proxy::DOMWrapperToNative<Document>(info.Holder());
+    Document* document = V8Proxy::convertDOMWrapperToNative<Document>(info.Holder());
     if (!document->frame())
         return v8::Null();
 
     DOMWindow* window = document->frame()->domWindow();
-    return V8Proxy::ToV8Object(V8ClassIndex::LOCATION, window->location());
+    return V8Proxy::convertToV8Object(V8ClassIndex::LOCATION, window->location());
 }
 
 ACCESSOR_SETTER(DocumentLocation)
 {
-    Document* document = V8Proxy::DOMWrapperToNative<Document>(info.Holder());
+    Document* document = V8Proxy::convertDOMWrapperToNative<Document>(info.Holder());
     if (!document->frame())
         return;
 
index 64a9d3df83fa2ad32598eace692e781193f94f7b..d9e988f144e94ff3c83007c97d3ed096a051cfd3 100644 (file)
@@ -53,7 +53,7 @@ namespace WebCore {
 CALLBACK_FUNC_DECL(ElementSetAttribute)
 {
     INC_STATS("DOM.Element.setAttribute()");
-    Element* element = V8Proxy::DOMWrapperToNode<Element>(args.Holder());
+    Element* element = V8Proxy::convertDOMWrapperToNode<Element>(args.Holder());
     String name = toWebCoreString(args[0]);
     String value = toWebCoreString(args[1]);
 
@@ -74,8 +74,8 @@ CALLBACK_FUNC_DECL(ElementSetAttributeNode)
     if (!V8Attr::HasInstance(args[0]))
         return throwError(TYPE_MISMATCH_ERR);
 
-    Attr* newAttr = V8Proxy::DOMWrapperToNode<Attr>(args[0]);
-    Element* element = V8Proxy::DOMWrapperToNode<Element>(args.Holder());
+    Attr* newAttr = V8Proxy::convertDOMWrapperToNode<Attr>(args[0]);
+    Element* element = V8Proxy::convertDOMWrapperToNode<Element>(args.Holder());
 
     if (!allowSettingSrcToJavascriptURL(element, newAttr->name(), newAttr->value()))
         return v8::Undefined();
@@ -85,13 +85,13 @@ CALLBACK_FUNC_DECL(ElementSetAttributeNode)
     if (ec)
         throwError(ec);
 
-    return V8Proxy::NodeToV8Object(result.get());
+    return V8Proxy::convertNodeToV8Object(result.get());
 }
 
 CALLBACK_FUNC_DECL(ElementSetAttributeNS)
 {
     INC_STATS("DOM.Element.setAttributeNS()");
-    Element* element = V8Proxy::DOMWrapperToNode<Element>(args.Holder());
+    Element* element = V8Proxy::convertDOMWrapperToNode<Element>(args.Holder());
     String namespaceURI = toWebCoreStringWithNullCheck(args[0]);
     String qualifiedName = toWebCoreString(args[1]);
     String value = toWebCoreString(args[2]);
@@ -113,8 +113,8 @@ CALLBACK_FUNC_DECL(ElementSetAttributeNodeNS)
     if (!V8Attr::HasInstance(args[0]))
         return throwError(TYPE_MISMATCH_ERR);
 
-    Attr* newAttr = V8Proxy::DOMWrapperToNode<Attr>(args[0]);
-    Element* element = V8Proxy::DOMWrapperToNode<Element>(args.Holder());
+    Attr* newAttr = V8Proxy::convertDOMWrapperToNode<Attr>(args[0]);
+    Element* element = V8Proxy::convertDOMWrapperToNode<Element>(args.Holder());
 
     if (!allowSettingSrcToJavascriptURL(element, newAttr->name(), newAttr->value()))
         return v8::Undefined();
@@ -124,7 +124,7 @@ CALLBACK_FUNC_DECL(ElementSetAttributeNodeNS)
     if (ec)
         throwError(ec);
 
-    return V8Proxy::NodeToV8Object(result.get());
+    return V8Proxy::convertNodeToV8Object(result.get());
 }
 
 static inline String toEventType(v8::Local<v8::String> value)
@@ -136,7 +136,7 @@ static inline String toEventType(v8::Local<v8::String> value)
 
 ACCESSOR_SETTER(ElementEventHandler)
 {
-    Node* node = V8Proxy::DOMWrapperToNode<Node>(info.Holder());
+    Node* node = V8Proxy::convertDOMWrapperToNode<Node>(info.Holder());
 
     String eventType = toEventType(name);
 
@@ -151,7 +151,7 @@ ACCESSOR_SETTER(ElementEventHandler)
         if (!proxy)
             return;
 
-        if (RefPtr<EventListener> listener = proxy->FindOrCreateV8EventListener(value, true))
+        if (RefPtr<EventListener> listener = proxy->findOrCreateV8EventListener(value, true))
             node->setAttributeEventListener(eventType, listener);
     } else
         node->clearAttributeEventListener(eventType);
@@ -159,10 +159,10 @@ ACCESSOR_SETTER(ElementEventHandler)
 
 ACCESSOR_GETTER(ElementEventHandler)
 {
-    Node* node = V8Proxy::DOMWrapperToNode<Node>(info.Holder());
+    Node* node = V8Proxy::convertDOMWrapperToNode<Node>(info.Holder());
 
     EventListener* listener = node->getAttributeEventListener(toEventType(name));
-    return V8Proxy::EventListenerToV8Object(listener);
+    return V8Proxy::convertEventListenerToV8Object(listener);
 }
 
 } // namespace WebCore
index 1dae8450aac124e6927879f40cae2419d3f1aec9..5767fdebfb90560e9e323eb29569992a76d1bed6 100644 (file)
@@ -43,39 +43,39 @@ namespace WebCore {
 
 ACCESSOR_SETTER(EventReturnValue)
 {
-    Event* event = V8Proxy::DOMWrapperToNative<Event>(info.Holder());
+    Event* event = V8Proxy::convertDOMWrapperToNative<Event>(info.Holder());
     event->setDefaultPrevented(!value->BooleanValue());
 }
 
 ACCESSOR_GETTER(EventDataTransfer)
 {
-    Event* event = V8Proxy::DOMWrapperToNative<Event>(info.Holder());
+    Event* event = V8Proxy::convertDOMWrapperToNative<Event>(info.Holder());
 
     if (event->isDragEvent())
-        return V8Proxy::ToV8Object(V8ClassIndex::CLIPBOARD, static_cast<MouseEvent*>(event)->clipboard());
+        return V8Proxy::convertToV8Object(V8ClassIndex::CLIPBOARD, static_cast<MouseEvent*>(event)->clipboard());
 
     return v8::Undefined();
 }
 
 ACCESSOR_GETTER(EventClipboardData)
 {
-    Event* event = V8Proxy::DOMWrapperToNative<Event>(info.Holder());
+    Event* event = V8Proxy::convertDOMWrapperToNative<Event>(info.Holder());
 
     if (event->isClipboardEvent())
-        return V8Proxy::ToV8Object(V8ClassIndex::CLIPBOARD, static_cast<ClipboardEvent*>(event)->clipboard());
+        return V8Proxy::convertToV8Object(V8ClassIndex::CLIPBOARD, static_cast<ClipboardEvent*>(event)->clipboard());
 
     return v8::Undefined();
 }
 
 ACCESSOR_GETTER(EventSrcElement)
 {
-    Event* event = V8Proxy::DOMWrapperToNative<Event>(info.Holder());
-    return V8Proxy::EventTargetToV8Object(event->target());
+    Event* event = V8Proxy::convertDOMWrapperToNative<Event>(info.Holder());
+    return V8Proxy::convertEventTargetToV8Object(event->target());
 }
 
 ACCESSOR_GETTER(EventReturnValue)
 {
-    Event* event = V8Proxy::DOMWrapperToNative<Event>(info.Holder());
+    Event* event = V8Proxy::convertDOMWrapperToNative<Event>(info.Holder());
     return event->defaultPrevented() ? v8::False() : v8::True();
 }
 
index 7254c4733c26c17a6711e281b47b122c5f32c297..be7abc0a3d4d58db3f4cb8c44811521777472248 100644 (file)
@@ -51,19 +51,19 @@ CALLBACK_FUNC_DECL(HTMLAudioElementConstructor)
 
     Document* document = V8Proxy::retrieveFrame()->document();
     if (!document)
-        return throwError("Audio constructor associated document is unavailable", V8Proxy::REFERENCE_ERROR);
+        return throwError("Audio constructor associated document is unavailable", V8Proxy::ReferenceError);
 
     // Make sure the document is added to the DOM Node map. Otherwise, the HTMLAudioElement instance
     // may end up being the only node in the map and get garbage-ccollected prematurely.
-    V8Proxy::NodeToV8Object(document);
+    V8Proxy::convertNodeToV8Object(document);
 
     RefPtr<HTMLAudioElement> audio = new HTMLAudioElement(HTMLNames::audioTag, V8Proxy::retrieveFrame()->document());
     if (args.Length() > 0)
         audio->setSrc(toWebCoreString(args[0]));
 
-    V8Proxy::SetDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::NODE), audio.get());
+    V8Proxy::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::NODE), audio.get());
     audio->ref();
-    V8Proxy::SetJSWrapperForDOMNode(audio.get(), v8::Persistent<v8::Object>::New(args.Holder()));
+    V8Proxy::setJSWrapperForDOMNode(audio.get(), v8::Persistent<v8::Object>::New(args.Holder()));
     return args.Holder();
 }
 
index cf66e39d4d8c477bd2460b9df032d39700bfdc67..81ecb44b79635e75764f10cfe52e674961f8f652 100644 (file)
@@ -40,12 +40,12 @@ namespace WebCore {
 
 CALLBACK_FUNC_DECL(HTMLCanvasElementGetContext)
 {
-    INC_STATS("DOM.HTMLCanvasElement.getContext");
+    INC_STATS("DOM.HTMLCanvasElement.context");
     v8::Handle<v8::Value> holder = args.Holder();
-    HTMLCanvasElement* imp = V8Proxy::DOMWrapperToNode<HTMLCanvasElement>(holder);
+    HTMLCanvasElement* imp = V8Proxy::convertDOMWrapperToNode<HTMLCanvasElement>(holder);
     String contextId = ToWebCoreString(args[0]);
     CanvasRenderingContext2D* result = imp->getContext(contextId);
-    return V8Proxy::ToV8Object(V8ClassIndex::CANVASRENDERINGCONTEXT2D, result);
+    return V8Proxy::convertToV8Object(V8ClassIndex::CANVASRENDERINGCONTEXT2D, result);
 }
 
 } // namespace WebCore
index 1436a480bdd202e22145204ccb130b5af7d6d286..7ad07cb12b53d82960df4c5abb38709189aab5c3 100644 (file)
@@ -47,10 +47,10 @@ static v8::Handle<v8::Value> getNamedItems(HTMLCollection* collection, AtomicStr
         return v8::Handle<v8::Value>();
 
     if (namedItems.size() == 1)
-        return V8Proxy::NodeToV8Object(namedItems.at(0).get());
+        return V8Proxy::convertNodeToV8Object(namedItems.at(0).get());
 
     NodeList* list = new V8NamedNodesCollection(namedItems);
-    return V8Proxy::ToV8Object(V8ClassIndex::NODELIST, list);
+    return V8Proxy::convertToV8Object(V8ClassIndex::NODELIST, list);
 }
 
 static v8::Handle<v8::Value> getItem(HTMLCollection* collection, v8::Handle<v8::Value> argument)
@@ -66,7 +66,7 @@ static v8::Handle<v8::Value> getItem(HTMLCollection* collection, v8::Handle<v8::
     }
 
     RefPtr<Node> result = collection->item(index->Uint32Value());
-    return V8Proxy::NodeToV8Object(result.get());
+    return V8Proxy::convertNodeToV8Object(result.get());
 }
 
 NAMED_PROPERTY_GETTER(HTMLCollection)
@@ -84,21 +84,21 @@ NAMED_PROPERTY_GETTER(HTMLCollection)
         return v8::Handle<v8::Value>();
 
     // Finally, search the DOM structure.
-    HTMLCollection* imp = V8Proxy::ToNativeObject<HTMLCollection>(V8ClassIndex::HTMLCOLLECTION, info.Holder());
+    HTMLCollection* imp = V8Proxy::convertToNativeObject<HTMLCollection>(V8ClassIndex::HTMLCOLLECTION, info.Holder());
     return getNamedItems(imp, v8StringToAtomicWebCoreString(name));
 }
 
 CALLBACK_FUNC_DECL(HTMLCollectionItem)
 {
     INC_STATS("DOM.HTMLCollection.item()");
-    HTMLCollection* imp = V8Proxy::ToNativeObject<HTMLCollection>(V8ClassIndex::HTMLCOLLECTION, args.Holder());
+    HTMLCollection* imp = V8Proxy::convertToNativeObject<HTMLCollection>(V8ClassIndex::HTMLCOLLECTION, args.Holder());
     return getItem(imp, args[0]);
 }
 
 CALLBACK_FUNC_DECL(HTMLCollectionNamedItem)
 {
     INC_STATS("DOM.HTMLCollection.namedItem()");
-    HTMLCollection* imp = V8Proxy::ToNativeObject<HTMLCollection>(V8ClassIndex::HTMLCOLLECTION, args.Holder());
+    HTMLCollection* imp = V8Proxy::convertToNativeObject<HTMLCollection>(V8ClassIndex::HTMLCOLLECTION, args.Holder());
     v8::Handle<v8::Value> result = getNamedItems(imp, toWebCoreString(args[0]));
 
     if (result.IsEmpty())
@@ -113,7 +113,7 @@ CALLBACK_FUNC_DECL(HTMLCollectionCallAsFunction)
     if (args.Length() < 1)
         return v8::Undefined();
 
-    HTMLCollection* imp = V8Proxy::ToNativeObject<HTMLCollection>(V8ClassIndex::HTMLCOLLECTION, args.Holder());
+    HTMLCollection* imp = V8Proxy::convertToNativeObject<HTMLCollection>(V8ClassIndex::HTMLCOLLECTION, args.Holder());
 
     if (args.Length() == 1)
         return getItem(imp, args[0]);
@@ -128,7 +128,7 @@ CALLBACK_FUNC_DECL(HTMLCollectionCallAsFunction)
     Node* node = imp->namedItem(name);
     while (node) {
         if (!current)
-            return V8Proxy::NodeToV8Object(node);
+            return V8Proxy::convertNodeToV8Object(node);
 
         node = imp->nextNamedItem(name);
         current--;
index 34bf89cc93549549b19e59abac4e0bf4ac56f513..7871ed59a2d5a701554f3d33884ae77ccc1de729 100644 (file)
@@ -78,7 +78,7 @@ NAMED_PROPERTY_GETTER(HTMLDocument)
             return value;
     }
 
-    HTMLDocument* htmlDocument = V8Proxy::DOMWrapperToNode<HTMLDocument>(info.Holder());
+    HTMLDocument* htmlDocument = V8Proxy::convertDOMWrapperToNode<HTMLDocument>(info.Holder());
 
     // Fast case for named elements that are not there.
     if (!htmlDocument->hasNamedItem(key.impl()) && !htmlDocument->hasExtraNamedItem(key.impl()))
@@ -92,12 +92,12 @@ NAMED_PROPERTY_GETTER(HTMLDocument)
         Node* node = items->firstItem();
         Frame* frame = 0;
         if (node->hasTagName(HTMLNames::iframeTag) && (frame = static_cast<HTMLIFrameElement*>(node)->contentFrame()))
-            return V8Proxy::ToV8Object(V8ClassIndex::DOMWINDOW, frame->domWindow());
+            return V8Proxy::convertToV8Object(V8ClassIndex::DOMWINDOW, frame->domWindow());
 
-        return V8Proxy::NodeToV8Object(node);
+        return V8Proxy::convertNodeToV8Object(node);
     }
 
-    return V8Proxy::ToV8Object(V8ClassIndex::HTMLCOLLECTION, items.get());
+    return V8Proxy::convertToV8Object(V8ClassIndex::HTMLCOLLECTION, items.get());
 }
 
 // HTMLDocument ----------------------------------------------------------------
@@ -117,7 +117,7 @@ static String writeHelperGetString(const v8::Arguments& args)
 CALLBACK_FUNC_DECL(HTMLDocumentWrite)
 {
     INC_STATS("DOM.HTMLDocument.write()");
-    HTMLDocument* htmlDocument = V8Proxy::DOMWrapperToNode<HTMLDocument>(args.Holder());
+    HTMLDocument* htmlDocument = V8Proxy::convertDOMWrapperToNode<HTMLDocument>(args.Holder());
     Frame* frame = V8Proxy::retrieveFrameForCallingContext();
     ASSERT(frame);
     htmlDocument->write(writeHelperGetString(args), frame->document());
@@ -127,7 +127,7 @@ CALLBACK_FUNC_DECL(HTMLDocumentWrite)
 CALLBACK_FUNC_DECL(HTMLDocumentWriteln)
 {
     INC_STATS("DOM.HTMLDocument.writeln()");
-    HTMLDocument* htmlDocument = V8Proxy::DOMWrapperToNode<HTMLDocument>(args.Holder());
+    HTMLDocument* htmlDocument = V8Proxy::convertDOMWrapperToNode<HTMLDocument>(args.Holder());
     Frame* frame = V8Proxy::retrieveFrameForCallingContext();
     ASSERT(frame);
     htmlDocument->writeln(writeHelperGetString(args), frame->document());
@@ -137,12 +137,12 @@ CALLBACK_FUNC_DECL(HTMLDocumentWriteln)
 CALLBACK_FUNC_DECL(HTMLDocumentOpen)
 {
     INC_STATS("DOM.HTMLDocument.open()");
-    HTMLDocument* htmlDocument = V8Proxy::DOMWrapperToNode<HTMLDocument>(args.Holder());
+    HTMLDocument* htmlDocument = V8Proxy::convertDOMWrapperToNode<HTMLDocument>(args.Holder());
 
     if (args.Length() > 2) {
         if (Frame* frame = htmlDocument->frame()) {
             // Fetch the global object for the frame.
-            v8::Local<v8::Context> context = V8Proxy::GetContext(frame);
+            v8::Local<v8::Context> context = V8Proxy::context(frame);
             // Bail out if we cannot get the context.
             if (context.IsEmpty())
                 return v8::Undefined();
@@ -162,7 +162,7 @@ CALLBACK_FUNC_DECL(HTMLDocumentOpen)
             V8Proxy* proxy = V8Proxy::retrieve(frame);
             ASSERT(proxy);
 
-            v8::Local<v8::Value> result = proxy->CallFunction(v8::Local<v8::Function>::Cast(function), global, args.Length(), params);
+            v8::Local<v8::Value> result = proxy->callFunction(v8::Local<v8::Function>::Cast(function), global, args.Length(), params);
             delete[] params;
             return result;
         }
@@ -179,9 +179,9 @@ ACCESSOR_GETTER(HTMLDocumentAll)
     INC_STATS("DOM.HTMLDocument.all._get");
     v8::HandleScope scope;
     v8::Handle<v8::Object> holder = info.Holder();
-    HTMLDocument* htmlDocument = V8Proxy::DOMWrapperToNode<HTMLDocument>(holder);
+    HTMLDocument* htmlDocument = V8Proxy::convertDOMWrapperToNode<HTMLDocument>(holder);
     RefPtr<HTMLCollection> collection = WTF::getPtr(htmlDocument->all());
-    return V8Proxy::ToV8Object(V8ClassIndex::HTMLCOLLECTION, WTF::getPtr(collection));
+    return V8Proxy::convertToV8Object(V8ClassIndex::HTMLCOLLECTION, WTF::getPtr(collection));
 }
 
 ACCESSOR_SETTER(HTMLDocumentAll)
index 27ab7e3eb10b189d1c1b3558a988685993aa286b..1c5774d2ec5931fd1d03a2938a41fcf96913a47e 100644 (file)
@@ -42,19 +42,19 @@ namespace WebCore {
 INDEXED_PROPERTY_GETTER(HTMLFormElement)
 {
     INC_STATS("DOM.HTMLFormElement.IndexedPropertyGetter");
-    HTMLFormElement* form = V8Proxy::DOMWrapperToNode<HTMLFormElement>(info.Holder());
+    HTMLFormElement* form = V8Proxy::convertDOMWrapperToNode<HTMLFormElement>(info.Holder());
     
     RefPtr<Node> formElement = form->elements()->item(index);
     if (!formElement)
         return notHandledByInterceptor();
-    return V8Proxy::NodeToV8Object(formElement.get());
+    return V8Proxy::convertNodeToV8Object(formElement.get());
 }
 
 
 NAMED_PROPERTY_GETTER(HTMLFormElement)
 {
     INC_STATS("DOM.HTMLFormElement.NamedPropertyGetter");
-    HTMLFormElement* imp = V8Proxy::DOMWrapperToNode<HTMLFormElement>(info.Holder());
+    HTMLFormElement* imp = V8Proxy::convertDOMWrapperToNode<HTMLFormElement>(info.Holder());
     AtomicString v = v8StringToAtomicWebCoreString(name);
 
     // Call getNamedElements twice, first time check if it has a value
@@ -74,15 +74,15 @@ NAMED_PROPERTY_GETTER(HTMLFormElement)
     ASSERT(!elements.isEmpty());
 
     if (elements.size() == 1)
-        return V8Proxy::NodeToV8Object(elements.at(0).get());
+        return V8Proxy::convertNodeToV8Object(elements.at(0).get());
 
     NodeList* collection = new V8NamedNodesCollection(elements);
-    return V8Proxy::ToV8Object(V8ClassIndex::NODELIST, collection);
+    return V8Proxy::convertToV8Object(V8ClassIndex::NODELIST, collection);
 }
     
 CALLBACK_FUNC_DECL(HTMLFormElementSubmit) {
     INC_STATS("DOM.HTMLFormElement.submit()");
-    HTMLFormElement* form = V8Proxy::DOMWrapperToNative<HTMLFormElement>(args.Holder());
+    HTMLFormElement* form = V8Proxy::convertDOMWrapperToNative<HTMLFormElement>(args.Holder());
     form->submit(0, false, false);
     return v8::Undefined();
 }
index bfc4c281e379f31294fabcaa6bce21d3839b4271..06cd66d99ab14c506702804dbf64af5af7080fca 100644 (file)
@@ -39,7 +39,7 @@ namespace WebCore {
 
 ACCESSOR_SETTER(HTMLFrameElementSrc)
 {
-    HTMLFrameElement* frame = V8Proxy::DOMWrapperToNode<HTMLFrameElement>(info.Holder());
+    HTMLFrameElement* frame = V8Proxy::convertDOMWrapperToNode<HTMLFrameElement>(info.Holder());
     String srcValue = toWebCoreStringWithNullCheck(value);
 
     if (!allowSettingFrameSrcToJavascriptUrl(frame, srcValue))
@@ -50,7 +50,7 @@ ACCESSOR_SETTER(HTMLFrameElementSrc)
 
 ACCESSOR_SETTER(HTMLFrameElementLocation)
 {
-    HTMLFrameElement* frame = V8Proxy::DOMWrapperToNode<HTMLFrameElement>(info.Holder());
+    HTMLFrameElement* frame = V8Proxy::convertDOMWrapperToNode<HTMLFrameElement>(info.Holder());
     String locationValue = toWebCoreStringWithNullCheck(value);
 
     if (!allowSettingFrameSrcToJavascriptUrl(frame, locationValue))
index 220af02def53503d31728468f7bf8b454538d57a..0d2b24a3fbc3853cb08c79072d28f432a50f2295 100644 (file)
@@ -47,14 +47,14 @@ namespace WebCore {
 NAMED_PROPERTY_GETTER(HTMLFrameSetElement)
 {
     INC_STATS("DOM.HTMLFrameSetElement.NamedPropertyGetter");
-    HTMLFrameSetElement* imp = V8Proxy::DOMWrapperToNode<HTMLFrameSetElement>(info.Holder());
+    HTMLFrameSetElement* imp = V8Proxy::convertDOMWrapperToNode<HTMLFrameSetElement>(info.Holder());
     Node* frameNode = imp->children()->namedItem(v8StringToAtomicWebCoreString(name));
     if (frameNode && frameNode->hasTagName(HTMLNames::frameTag)) {
         Document* doc = static_cast<HTMLFrameElement*>(frameNode)->contentDocument();
         if (!doc)
             return v8::Undefined();
         if (Frame* frame = doc->frame())
-            return V8Proxy::ToV8Object(V8ClassIndex::DOMWINDOW, frame->domWindow());
+            return V8Proxy::convertToV8Object(V8ClassIndex::DOMWINDOW, frame->domWindow());
     }
     return notHandledByInterceptor();
 }
index 3739a4eb3ef36bb75077b634b396ea87505af679..4e446b6dc2358b43d7c2fc99bb25e3301d2e5edb 100644 (file)
@@ -39,7 +39,7 @@ namespace WebCore {
 
 ACCESSOR_SETTER(HTMLIFrameElementSrc)
 {
-    HTMLIFrameElement* iframe = V8Proxy::DOMWrapperToNode<HTMLIFrameElement>(info.Holder());
+    HTMLIFrameElement* iframe = V8Proxy::convertDOMWrapperToNode<HTMLIFrameElement>(info.Holder());
     String v = valueToStringWithNullCheck(value);
 
     if (!allowSettingFrameSrcToJavascriptUrl(iframe, v))
index afcc29d89ad2ca376af19d69ecc310fd7013939e..5844d3f9ad3bba8d28aab911b8ca07cf6ee74e2a 100644 (file)
@@ -51,11 +51,11 @@ CALLBACK_FUNC_DECL(HTMLImageElementConstructor)
 
     Document* document = V8Proxy::retrieveFrame()->document();
     if (!document)
-        return throwError("Image constructor associated document is unavailable", V8Proxy::REFERENCE_ERROR);
+        return throwError("Image constructor associated document is unavailable", V8Proxy::ReferenceError);
 
     // Make sure the document is added to the DOM Node map. Otherwise, the HTMLImageElement instance
     // may end up being the only node in the map and get garbage-ccollected prematurely.
-    V8Proxy::NodeToV8Object(document);
+    V8Proxy::convertNodeToV8Object(document);
 
     RefPtr<HTMLImageElement> image = new HTMLImageElement(HTMLNames::imgTag, V8Proxy::retrieveFrame()->document());
     if (args.Length() > 0) {
@@ -64,9 +64,9 @@ CALLBACK_FUNC_DECL(HTMLImageElementConstructor)
             image->setHeight(toInt32(args[1]));
     }
 
-    V8Proxy::SetDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::NODE), image.get());
+    V8Proxy::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::NODE), image.get());
     image->ref();
-    V8Proxy::SetJSWrapperForDOMNode(image.get(), v8::Persistent<v8::Object>::New(args.Holder()));
+    V8Proxy::setJSWrapperForDOMNode(image.get(), v8::Persistent<v8::Object>::New(args.Holder()));
     return args.Holder();
 }
 
index 628634d2af3711221bcb44b8a6302e88cccb6bf8..aeaacaa7bc0cc94c5755d2a527f46936362df754 100644 (file)
@@ -41,7 +41,7 @@ ACCESSOR_GETTER(HTMLInputElementSelectionStart)
 {
     INC_STATS("DOM.HTMLInputElement.selectionStart._get");
     v8::Handle<v8::Object> holder = info.Holder();
-    HTMLInputElement* imp = V8Proxy::DOMWrapperToNode<HTMLInputElement>(holder);
+    HTMLInputElement* imp = V8Proxy::convertDOMWrapperToNode<HTMLInputElement>(holder);
 
     if (!imp->canHaveSelection())
         return throwError("Accessing selectionStart on an input element that cannot have a selection.");
@@ -54,7 +54,7 @@ ACCESSOR_SETTER(HTMLInputElementSelectionStart)
 {
     INC_STATS("DOM.HTMLInputElement.selectionStart._set");
     v8::Handle<v8::Object> holder = info.Holder();
-    HTMLInputElement* imp = V8Proxy::DOMWrapperToNode<HTMLInputElement>(holder);
+    HTMLInputElement* imp = V8Proxy::convertDOMWrapperToNode<HTMLInputElement>(holder);
 
     if (!imp->canHaveSelection()) {
         throwError("Accessing selectionStart on an input element that cannot have a selection.");
@@ -67,7 +67,7 @@ ACCESSOR_GETTER(HTMLInputElementSelectionEnd)
 {
     INC_STATS("DOM.HTMLInputElement.selectionEnd._get");
     v8::Handle<v8::Object> holder = info.Holder();
-    HTMLInputElement* imp = V8Proxy::DOMWrapperToNode<HTMLInputElement>(holder);
+    HTMLInputElement* imp = V8Proxy::convertDOMWrapperToNode<HTMLInputElement>(holder);
 
     if (!imp->canHaveSelection())
         return throwError("Accessing selectionEnd on an input element that cannot have a selection.");
@@ -80,7 +80,7 @@ ACCESSOR_SETTER(HTMLInputElementSelectionEnd)
 {
     INC_STATS("DOM.HTMLInputElement.selectionEnd._set");
     v8::Handle<v8::Object> holder = info.Holder();
-    HTMLInputElement* imp = V8Proxy::DOMWrapperToNode<HTMLInputElement>(holder);
+    HTMLInputElement* imp = V8Proxy::convertDOMWrapperToNode<HTMLInputElement>(holder);
 
     if (!imp->canHaveSelection()) {
         throwError("Accessing selectionEnd on an input element that cannot have a selection.");
@@ -94,7 +94,7 @@ CALLBACK_FUNC_DECL(HTMLInputElementSetSelectionRange)
 {
     INC_STATS("DOM.HTMLInputElement.setSelectionRange");
     v8::Handle<v8::Object> holder = args.Holder();
-    HTMLInputElement* imp = V8Proxy::DOMWrapperToNode<HTMLInputElement>(holder);
+    HTMLInputElement* imp = V8Proxy::convertDOMWrapperToNode<HTMLInputElement>(holder);
 
     if (!imp->canHaveSelection())
         return throwError("Calling setSelectionRange on an input element that cannot have a selection.");
index 93a9b68ba0916ee8ee31b507ca3825c7163c491c..76ca278c0a1b33da9fdb8e90eff323e24a2e80ae 100644 (file)
@@ -52,7 +52,7 @@ CALLBACK_FUNC_DECL(HTMLOptionElementConstructor)
 
     Document* document = V8Proxy::retrieveFrame()->document();
     if (!document)
-        return throwError("Option constructor associated document is unavailable", V8Proxy::REFERENCE_ERROR);
+        return throwError("Option constructor associated document is unavailable", V8Proxy::ReferenceError);
 
     RefPtr<HTMLOptionElement> option = new HTMLOptionElement(HTMLNames::optionTag, V8Proxy::retrieveFrame()->document());
 
@@ -81,9 +81,9 @@ CALLBACK_FUNC_DECL(HTMLOptionElementConstructor)
         }
     }
 
-    V8Proxy::SetDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::NODE), option.get());
+    V8Proxy::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::NODE), option.get());
     option->ref();
-    V8Proxy::SetJSWrapperForDOMNode(option.get(), v8::Persistent<v8::Object>::New(args.Holder()));
+    V8Proxy::setJSWrapperForDOMNode(option.get(), v8::Persistent<v8::Object>::New(args.Holder()));
     return args.Holder();
 }
 
index 9f0d25e4e6ab345ea479c8c5fca26c8d65a4343c..aff06202270b49b3746040e9834feca31922b9ea 100644 (file)
@@ -46,7 +46,7 @@ namespace WebCore {
 CALLBACK_FUNC_DECL(HTMLOptionsCollectionRemove)
 {
     INC_STATS("DOM.HTMLOptionsCollection.remove()");
-    HTMLOptionsCollection* imp = V8Proxy::ToNativeObject<HTMLOptionsCollection>(V8ClassIndex::HTMLOPTIONSCOLLECTION, args.Holder());
+    HTMLOptionsCollection* imp = V8Proxy::convertToNativeObject<HTMLOptionsCollection>(V8ClassIndex::HTMLOPTIONSCOLLECTION, args.Holder());
     HTMLSelectElement* base = static_cast<HTMLSelectElement*>(imp->base());
     return removeElement(base, args);
 }
@@ -55,11 +55,11 @@ CALLBACK_FUNC_DECL(HTMLOptionsCollectionAdd)
 {
     INC_STATS("DOM.HTMLOptionsCollection.add()");
     if (!V8HTMLOptionElement::HasInstance(args[0])) {
-        V8Proxy::SetDOMException(TYPE_MISMATCH_ERR);
+        V8Proxy::setDOMException(TYPE_MISMATCH_ERR);
         return v8::Undefined();
     }
-    HTMLOptionsCollection* imp = V8Proxy::ToNativeObject<HTMLOptionsCollection>(V8ClassIndex::HTMLOPTIONSCOLLECTION, args.Holder());
-    HTMLOptionElement* option = V8Proxy::DOMWrapperToNode<HTMLOptionElement>(args[0]);
+    HTMLOptionsCollection* imp = V8Proxy::convertToNativeObject<HTMLOptionsCollection>(V8ClassIndex::HTMLOPTIONSCOLLECTION, args.Holder());
+    HTMLOptionElement* option = V8Proxy::convertDOMWrapperToNode<HTMLOptionElement>(args[0]);
 
     ExceptionCode ec = 0;
     if (args.Length() < 2)
@@ -79,7 +79,7 @@ CALLBACK_FUNC_DECL(HTMLOptionsCollectionAdd)
     }
 
     if (ec != 0)
-        V8Proxy::SetDOMException(ec);
+        V8Proxy::setDOMException(ec);
 
     return v8::Undefined();
 }
@@ -87,7 +87,7 @@ CALLBACK_FUNC_DECL(HTMLOptionsCollectionAdd)
 ACCESSOR_GETTER(HTMLOptionsCollectionLength)
 {
     INC_STATS("DOM.HTMLOptionsCollection.length._get");
-    HTMLOptionsCollection* imp = V8Proxy::ToNativeObject<HTMLOptionsCollection>(V8ClassIndex::HTMLOPTIONSCOLLECTION, info.Holder());
+    HTMLOptionsCollection* imp = V8Proxy::convertToNativeObject<HTMLOptionsCollection>(V8ClassIndex::HTMLOPTIONSCOLLECTION, info.Holder());
     int v = imp->length();
     return v8::Integer::New(v);
 }
@@ -95,7 +95,7 @@ ACCESSOR_GETTER(HTMLOptionsCollectionLength)
 ACCESSOR_SETTER(HTMLOptionsCollectionLength)
 {
     INC_STATS("DOM.HTMLOptionsCollection.length._set");
-    HTMLOptionsCollection* imp = V8Proxy::ToNativeObject<HTMLOptionsCollection>(V8ClassIndex::HTMLOPTIONSCOLLECTION, info.Holder());
+    HTMLOptionsCollection* imp = V8Proxy::convertToNativeObject<HTMLOptionsCollection>(V8ClassIndex::HTMLOPTIONSCOLLECTION, info.Holder());
     double v = value->NumberValue();
     unsigned newLength = 0;
     ExceptionCode ec = 0;
@@ -110,25 +110,25 @@ ACCESSOR_SETTER(HTMLOptionsCollectionLength)
     if (!ec)
         imp->setLength(value->Uint32Value(), ec);
 
-    V8Proxy::SetDOMException(ec);
+    V8Proxy::setDOMException(ec);
 }
 
 INDEXED_PROPERTY_GETTER(HTMLOptionsCollection)
 {
     INC_STATS("DOM.HTMLOptionsCollection.IndexedPropertyGetter");
-    HTMLOptionsCollection* collection = V8Proxy::ToNativeObject<HTMLOptionsCollection>(V8ClassIndex::HTMLOPTIONSCOLLECTION, info.Holder());
+    HTMLOptionsCollection* collection = V8Proxy::convertToNativeObject<HTMLOptionsCollection>(V8ClassIndex::HTMLOPTIONSCOLLECTION, info.Holder());
 
     RefPtr<Node> result = collection->item(index);
     if (!result)
         return notHandledByInterceptor();
 
-    return V8Proxy::NodeToV8Object(result.get());
+    return V8Proxy::convertNodeToV8Object(result.get());
 }
 
 INDEXED_PROPERTY_SETTER(HTMLOptionsCollection)
 {
     INC_STATS("DOM.HTMLOptionsCollection.IndexedPropertySetter");
-    HTMLOptionsCollection* collection = V8Proxy::ToNativeObject<HTMLOptionsCollection>(V8ClassIndex::HTMLOPTIONSCOLLECTION, info.Holder());
+    HTMLOptionsCollection* collection = V8Proxy::convertToNativeObject<HTMLOptionsCollection>(V8ClassIndex::HTMLOPTIONSCOLLECTION, info.Holder());
     HTMLSelectElement* base = static_cast<HTMLSelectElement*>(collection->base());
     return toOptionsCollectionSetter(index, value, base);
 }
index a6e41a1830cf3542574d2666ab382c879c4cd319..ed879e3c6e50f7f8df98f452a200af4175bbf818 100644 (file)
@@ -45,7 +45,7 @@ namespace WebCore {
 NAMED_PROPERTY_GETTER(HTMLPlugInElement)
 {
     INC_STATS("DOM.HTMLPlugInElement.NamedPropertyGetter");
-    HTMLPlugInElement* imp = V8Proxy::DOMWrapperToNode<HTMLPlugInElement>(info.Holder());
+    HTMLPlugInElement* imp = V8Proxy::convertDOMWrapperToNode<HTMLPlugInElement>(info.Holder());
     ScriptInstance scriptInstance = imp->getInstance();
     if (!scriptInstance)
         return notHandledByInterceptor();
@@ -60,7 +60,7 @@ NAMED_PROPERTY_GETTER(HTMLPlugInElement)
 NAMED_PROPERTY_SETTER(HTMLPlugInElement)
 {
     INC_STATS("DOM.HTMLPlugInElement.NamedPropertySetter");
-    HTMLPlugInElement* imp = V8Proxy::DOMWrapperToNode<HTMLPlugInElement>(info.Holder());
+    HTMLPlugInElement* imp = V8Proxy::convertDOMWrapperToNode<HTMLPlugInElement>(info.Holder());
     ScriptInstance scriptInstance = imp->getInstance();
     if (!scriptInstance)
         return notHandledByInterceptor();
@@ -81,7 +81,7 @@ CALLBACK_FUNC_DECL(HTMLPlugInElement)
 INDEXED_PROPERTY_GETTER(HTMLPlugInElement)
 {
     INC_STATS("DOM.HTMLPlugInElement.IndexedPropertyGetter");
-    HTMLPlugInElement* imp = V8Proxy::DOMWrapperToNode<HTMLPlugInElement>(info.Holder());
+    HTMLPlugInElement* imp = V8Proxy::convertDOMWrapperToNode<HTMLPlugInElement>(info.Holder());
     ScriptInstance scriptInstance = imp->getInstance();
     if (!scriptInstance)
         return notHandledByInterceptor();
@@ -96,7 +96,7 @@ INDEXED_PROPERTY_GETTER(HTMLPlugInElement)
 INDEXED_PROPERTY_SETTER(HTMLPlugInElement)
 {
     INC_STATS("DOM.HTMLPlugInElement.IndexedPropertySetter");
-    HTMLPlugInElement* imp = V8Proxy::DOMWrapperToNode<HTMLPlugInElement>(info.Holder());
+    HTMLPlugInElement* imp = V8Proxy::convertDOMWrapperToNode<HTMLPlugInElement>(info.Holder());
     ScriptInstance scriptInstance = imp->getInstance();
     if (!scriptInstance)
         return notHandledByInterceptor();
index 8b3b72ac21a03c09145d64868ee5d6e6a395f9e5..f3eb95b7f2ba1e5dcf01fa63ed96d51b215db02a 100644 (file)
@@ -43,7 +43,7 @@ namespace WebCore {
 NAMED_PROPERTY_GETTER(HTMLSelectElementCollection)
 {
     INC_STATS("DOM.HTMLSelectElementCollection.NamedPropertySetter");
-    HTMLSelectElement* select = V8Proxy::DOMWrapperToNode<HTMLSelectElement>(info.Holder());
+    HTMLSelectElement* select = V8Proxy::convertDOMWrapperToNode<HTMLSelectElement>(info.Holder());
     v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototypeChain(name);
 
     if (!value.IsEmpty())
@@ -62,16 +62,16 @@ NAMED_PROPERTY_GETTER(HTMLSelectElementCollection)
         return notHandledByInterceptor();
 
     if (items.size() == 1)
-        return V8Proxy::NodeToV8Object(items.at(0).get());
+        return V8Proxy::convertNodeToV8Object(items.at(0).get());
 
     NodeList* list = new V8NamedNodesCollection(items);
-    return V8Proxy::ToV8Object(V8ClassIndex::NODELIST, list);
+    return V8Proxy::convertToV8Object(V8ClassIndex::NODELIST, list);
 }
 
 INDEXED_PROPERTY_SETTER(HTMLSelectElementCollection)
 {
     INC_STATS("DOM.HTMLSelectElementCollection.IndexedPropertySetter");
-    HTMLSelectElement* select = V8Proxy::DOMWrapperToNode<HTMLSelectElement>(info.Holder());
+    HTMLSelectElement* select = V8Proxy::convertDOMWrapperToNode<HTMLSelectElement>(info.Holder());
     return toOptionsCollectionSetter(index, value, select);
 }
 
index 97f772604778ce17c5fee9f2840e523f8b21ad63..7afdd004d967fb849b8ccfe3a16dd412ac77ced2 100644 (file)
@@ -44,14 +44,14 @@ namespace WebCore {
 CALLBACK_FUNC_DECL(HTMLSelectElementRemove)
 {
     INC_STATS("DOM.HTMLSelectElement.remove");
-    HTMLSelectElement* imp = V8Proxy::DOMWrapperToNode<HTMLSelectElement>(args.Holder());
+    HTMLSelectElement* imp = V8Proxy::convertDOMWrapperToNode<HTMLSelectElement>(args.Holder());
     return removeElement(imp, args);
 }
 
 v8::Handle<v8::Value> removeElement(HTMLSelectElement* imp, const v8::Arguments& args) 
 {
     if (V8HTMLOptionElement::HasInstance(args[0])) {
-        HTMLOptionElement* element = V8Proxy::DOMWrapperToNode<HTMLOptionElement>(args[0]);
+        HTMLOptionElement* element = V8Proxy::convertDOMWrapperToNode<HTMLOptionElement>(args[0]);
         imp->remove(element->index());
         return v8::Undefined();
     }
index a85c0d6cc4cfbeba82485f36557a65a0e01307e3..eea4690a3a32bb05b4f0c773a8efd060c33d513d 100644 (file)
@@ -56,11 +56,11 @@ CALLBACK_FUNC_DECL(InspectorControllerHighlightDOMNode)
     if (args.Length() < 1)
         return v8::Undefined();
 
-    Node* node = V8Proxy::DOMWrapperToNode<Node>(args[0]);
+    Node* node = V8Proxy::convertDOMWrapperToNode<Node>(args[0]);
     if (!node)
         return v8::Undefined();
 
-    InspectorController* inspectorController = V8Proxy::ToNativeObject<InspectorController>(V8ClassIndex::INSPECTORCONTROLLER, args.Holder());
+    InspectorController* inspectorController = V8Proxy::convertToNativeObject<InspectorController>(V8ClassIndex::INSPECTORCONTROLLER, args.Holder());
     inspectorController->highlight(node);
 
     return v8::Undefined();
@@ -78,7 +78,7 @@ CALLBACK_FUNC_DECL(InspectorControllerGetResourceDocumentNode)
 
     unsigned identifier = args[1]->Int32Value();
 
-    InspectorController* inspectorController = V8Proxy::ToNativeObject<InspectorController>(V8ClassIndex::INSPECTORCONTROLLER, args.Holder());
+    InspectorController* inspectorController = V8Proxy::convertToNativeObject<InspectorController>(V8ClassIndex::INSPECTORCONTROLLER, args.Holder());
     RefPtr<InspectorResource> resource = inspectorController->resources().get(identifier);
     ASSERT(resource);
     if (!resource)
@@ -90,7 +90,7 @@ CALLBACK_FUNC_DECL(InspectorControllerGetResourceDocumentNode)
     if (document->isPluginDocument() || document->isImageDocument() || document->isMediaDocument())
         return v8::Undefined();
 
-    return V8Proxy::ToV8Object(V8ClassIndex::DOCUMENT, document);
+    return V8Proxy::convertToV8Object(V8ClassIndex::DOCUMENT, document);
 }
 
 CALLBACK_FUNC_DECL(InspectorControllerSearch)
@@ -100,7 +100,7 @@ CALLBACK_FUNC_DECL(InspectorControllerSearch)
     if (args.Length() < 2)
         return v8::Undefined();
 
-    Node* node = V8Proxy::DOMWrapperToNode<Node>(args[0]);
+    Node* node = V8Proxy::convertDOMWrapperToNode<Node>(args[0]);
     if (!node)
         return v8::Undefined();
 
@@ -124,7 +124,7 @@ CALLBACK_FUNC_DECL(InspectorControllerSearch)
         if (newStart == startVisiblePosition(searchRange.get(), DOWNSTREAM))
             break;
 
-        result->Set(v8::Number::New(index++), V8Proxy::ToV8Object<Range>(V8ClassIndex::RANGE, resultRange.get()));
+        result->Set(v8::Number::New(index++), V8Proxy::convertToV8Object<Range>(V8ClassIndex::RANGE, resultRange.get()));
 
         setStart(searchRange.get(), newStart);
     } while (true);
@@ -145,8 +145,8 @@ CALLBACK_FUNC_DECL(InspectorControllerInspectedWindow)
 {
     INC_STATS("InspectorController.inspectedWindow()");
 
-    InspectorController* inspectorController = V8Proxy::ToNativeObject<InspectorController>(V8ClassIndex::INSPECTORCONTROLLER, args.Holder());
-    return V8Proxy::ToV8Object<DOMWindow>(V8ClassIndex::DOMWINDOW, inspectorController->inspectedPage()->mainFrame()->domWindow());
+    InspectorController* inspectorController = V8Proxy::convertToNativeObject<InspectorController>(V8ClassIndex::INSPECTORCONTROLLER, args.Holder());
+    return V8Proxy::convertToV8Object<DOMWindow>(V8ClassIndex::DOMWINDOW, inspectorController->inspectedPage()->mainFrame()->domWindow());
 }
 
 CALLBACK_FUNC_DECL(InspectorControllerSetting)
@@ -160,7 +160,7 @@ CALLBACK_FUNC_DECL(InspectorControllerSetting)
     if (key.isEmpty())
         return v8::Undefined();
 
-    InspectorController* inspectorController = V8Proxy::ToNativeObject<InspectorController>(V8ClassIndex::INSPECTORCONTROLLER, args.Holder());
+    InspectorController* inspectorController = V8Proxy::convertToNativeObject<InspectorController>(V8ClassIndex::INSPECTORCONTROLLER, args.Holder());
     const InspectorController::Setting& setting = inspectorController ->setting(key);
 
     switch (setting.type()) {
@@ -221,7 +221,7 @@ CALLBACK_FUNC_DECL(InspectorControllerSetSetting)
     } else
         return v8::Undefined();
 
-    InspectorController* inspectorController = V8Proxy::ToNativeObject<InspectorController>(V8ClassIndex::INSPECTORCONTROLLER, args.Holder());
+    InspectorController* inspectorController = V8Proxy::convertToNativeObject<InspectorController>(V8ClassIndex::INSPECTORCONTROLLER, args.Holder());
     inspectorController->setSetting(key, setting);
 
     return v8::Undefined();
index c5f3b1dfe9eaa2f0e5b281f226064a7f9e3fb8b0..b4d2a44033aa7b60e412b673552bfd32696b8d0c 100644 (file)
@@ -62,7 +62,7 @@ ACCESSOR_SETTER(LocationHash)
 {
     INC_STATS("DOM.Location.hash._set");
     v8::Handle<v8::Object> holder = info.Holder();
-    Location* imp = V8Proxy::ToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+    Location* imp = V8Proxy::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
     String hash = toWebCoreString(value);
 
     Frame* frame = imp->frame();
@@ -85,7 +85,7 @@ ACCESSOR_SETTER(LocationHost)
 {
     INC_STATS("DOM.Location.host._set");
     v8::Handle<v8::Object> holder = info.Holder();
-    Location* imp = V8Proxy::ToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+    Location* imp = V8Proxy::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
     String host = toWebCoreString(value);
 
     Frame* frame = imp->frame();
@@ -105,7 +105,7 @@ ACCESSOR_SETTER(LocationHostname)
 {
     INC_STATS("DOM.Location.hostname._set");
     v8::Handle<v8::Object> holder = info.Holder();
-    Location* imp = V8Proxy::ToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+    Location* imp = V8Proxy::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
     String hostname = toWebCoreString(value);
 
     Frame* frame = imp->frame();
@@ -122,7 +122,7 @@ ACCESSOR_SETTER(LocationHref)
 {
     INC_STATS("DOM.Location.href._set");
     v8::Handle<v8::Object> holder = info.Holder();
-    Location* imp = V8Proxy::ToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+    Location* imp = V8Proxy::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
 
     Frame* frame = imp->frame();
     if (!frame)
@@ -142,7 +142,7 @@ ACCESSOR_SETTER(LocationPathname)
 {
     INC_STATS("DOM.Location.pathname._set");
     v8::Handle<v8::Object> holder = info.Holder();
-    Location* imp = V8Proxy::ToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+    Location* imp = V8Proxy::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
     String pathname = toWebCoreString(value);
 
     Frame* frame = imp->frame();
@@ -159,7 +159,7 @@ ACCESSOR_SETTER(LocationPort)
 {
     INC_STATS("DOM.Location.port._set");
     v8::Handle<v8::Object> holder = info.Holder();
-    Location* imp = V8Proxy::ToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+    Location* imp = V8Proxy::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
     String port = toWebCoreString(value);
 
     Frame* frame = imp->frame();
@@ -176,7 +176,7 @@ ACCESSOR_SETTER(LocationProtocol)
 {
     INC_STATS("DOM.Location.protocol._set");
     v8::Handle<v8::Object> holder = info.Holder();
-    Location* imp = V8Proxy::ToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+    Location* imp = V8Proxy::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
     String protocol = toWebCoreString(value);
 
     Frame* frame = imp->frame();
@@ -193,7 +193,7 @@ ACCESSOR_SETTER(LocationSearch)
 {
     INC_STATS("DOM.Location.search._set");
     v8::Handle<v8::Object> holder = info.Holder();
-    Location* imp = V8Proxy::ToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+    Location* imp = V8Proxy::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
     String query = toWebCoreString(value);
 
     Frame* frame = imp->frame();
@@ -210,14 +210,14 @@ ACCESSOR_GETTER(LocationReload)
 {
     INC_STATS("DOM.Location.reload._get");
     static v8::Persistent<v8::FunctionTemplate> privateTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(v8LocationReloadCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
-    v8::Handle<v8::Object> holder = V8Proxy::LookupDOMWrapper(V8ClassIndex::LOCATION, info.This());
+    v8::Handle<v8::Object> holder = V8Proxy::lookupDOMWrapper(V8ClassIndex::LOCATION, info.This());
     if (holder.IsEmpty()) {
         // can only reach here by 'object.__proto__.func', and it should passed
         // domain security check already
         return privateTemplate->GetFunction();
     }
-    Location* imp = V8Proxy::ToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
-    if (!V8Proxy::CanAccessFrame(imp->frame(), false)) {
+    Location* imp = V8Proxy::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+    if (!V8Proxy::canAccessFrame(imp->frame(), false)) {
         static v8::Persistent<v8::FunctionTemplate> sharedTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(v8LocationReloadCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
         return sharedTemplate->GetFunction();
     } else
@@ -228,14 +228,14 @@ ACCESSOR_GETTER(LocationReplace)
 {
     INC_STATS("DOM.Location.replace._get");
     static v8::Persistent<v8::FunctionTemplate> privateTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(v8LocationReplaceCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
-    v8::Handle<v8::Object> holder = V8Proxy::LookupDOMWrapper(V8ClassIndex::LOCATION, info.This());
+    v8::Handle<v8::Object> holder = V8Proxy::lookupDOMWrapper(V8ClassIndex::LOCATION, info.This());
     if (holder.IsEmpty()) {
         // can only reach here by 'object.__proto__.func', and it should passed
         // domain security check already
         return privateTemplate->GetFunction();
     }
-    Location* imp = V8Proxy::ToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
-    if (!V8Proxy::CanAccessFrame(imp->frame(), false)) {
+    Location* imp = V8Proxy::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+    if (!V8Proxy::canAccessFrame(imp->frame(), false)) {
         static v8::Persistent<v8::FunctionTemplate> sharedTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(v8LocationReplaceCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
         return sharedTemplate->GetFunction();
     } else
@@ -247,14 +247,14 @@ ACCESSOR_GETTER(LocationAssign)
     INC_STATS("DOM.Location.assign._get");
     static v8::Persistent<v8::FunctionTemplate> privateTemplate =
     v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(v8LocationAssignCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
-    v8::Handle<v8::Object> holder = V8Proxy::LookupDOMWrapper(V8ClassIndex::LOCATION, info.This());
+    v8::Handle<v8::Object> holder = V8Proxy::lookupDOMWrapper(V8ClassIndex::LOCATION, info.This());
     if (holder.IsEmpty()) {
         // can only reach here by 'object.__proto__.func', and it should passed
         // domain security check already
         return privateTemplate->GetFunction();
     }
-    Location* imp = V8Proxy::ToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
-    if (!V8Proxy::CanAccessFrame(imp->frame(), false)) {
+    Location* imp = V8Proxy::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+    if (!V8Proxy::canAccessFrame(imp->frame(), false)) {
         static v8::Persistent<v8::FunctionTemplate> sharedTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(v8LocationAssignCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
         return sharedTemplate->GetFunction();
     } else
@@ -267,7 +267,7 @@ CALLBACK_FUNC_DECL(LocationReload)
 
     INC_STATS("DOM.Location.reload");
     v8::Handle<v8::Value> holder = args.Holder();
-    Location* imp = V8Proxy::ToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+    Location* imp = V8Proxy::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
 
     Frame* frame = imp->frame();
     if (!frame || !ScriptController::isSafeScript(frame))
@@ -282,7 +282,7 @@ CALLBACK_FUNC_DECL(LocationReplace)
 {
     INC_STATS("DOM.Location.replace");
     v8::Handle<v8::Value> holder = args.Holder();
-    Location* imp = V8Proxy::ToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+    Location* imp = V8Proxy::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
 
     Frame* frame = imp->frame();
     if (!frame)
@@ -303,7 +303,7 @@ CALLBACK_FUNC_DECL(LocationAssign)
 {
     INC_STATS("DOM.Location.assign");
     v8::Handle<v8::Value> holder = args.Holder();
-    Location* imp = V8Proxy::ToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+    Location* imp = V8Proxy::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
 
     Frame* frame = imp->frame();
     if (!frame)
@@ -334,8 +334,8 @@ CALLBACK_FUNC_DECL(LocationToString)
 {
     INC_STATS("DOM.Location.toString");
     v8::Handle<v8::Value> holder = args.Holder();
-    Location* imp = V8Proxy::ToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
-    if (!V8Proxy::CanAccessFrame(imp->frame(), true))
+    Location* imp = V8Proxy::convertToNativeObject<Location>(V8ClassIndex::LOCATION, holder);
+    if (!V8Proxy::canAccessFrame(imp->frame(), true))
         return v8::Undefined();
     String result = imp->href();
     return v8String(result);
@@ -345,16 +345,16 @@ INDEXED_ACCESS_CHECK(Location)
 {
     ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::LOCATION);
     // Only allow same origin access
-    Location* imp =  V8Proxy::ToNativeObject<Location>(V8ClassIndex::LOCATION, host);
-    return V8Proxy::CanAccessFrame(imp->frame(), false);
+    Location* imp =  V8Proxy::convertToNativeObject<Location>(V8ClassIndex::LOCATION, host);
+    return V8Proxy::canAccessFrame(imp->frame(), false);
 }
 
 NAMED_ACCESS_CHECK(Location)
 {
     ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::LOCATION);
     // Only allow same origin access
-    Location* imp = V8Proxy::ToNativeObject<Location>(V8ClassIndex::LOCATION, host);
-    return V8Proxy::CanAccessFrame(imp->frame(), false);
+    Location* imp = V8Proxy::convertToNativeObject<Location>(V8ClassIndex::LOCATION, host);
+    return V8Proxy::canAccessFrame(imp->frame(), false);
 }
 
 }  // namespace WebCore
index 3a414678dca2e5e23219bd6feeb681a44bbcb63b..4ca9b9debfcdfc84c7c64a34e7ad19ee811b93c3 100644 (file)
@@ -44,7 +44,7 @@ namespace WebCore {
 CALLBACK_FUNC_DECL(MessageChannelConstructor)
 {
     INC_STATS("DOM.MessageChannel.Constructor");
-    // FIXME: The logic here is almost exact duplicate of V8::ConstructDOMObject.
+    // FIXME: The logic here is almost exact duplicate of V8::constructDOMObject.
     // Consider refactoring to reduce duplication.
     if (!args.IsConstructCall())
         return throwError("DOM object constructor cannot be called as a function.");
@@ -57,7 +57,7 @@ CALLBACK_FUNC_DECL(MessageChannelConstructor)
     Document* document = frame->document();
 
     // Note: it's OK to let this RefPtr go out of scope because we also call
-    // SetDOMWrapper(), which effectively holds a reference to obj.
+    // setDOMWrapper(), which effectively holds a reference to obj.
     RefPtr<MessageChannel> obj = MessageChannel::create(document);
 
     v8::Local<v8::Object> messageChannel = args.Holder();
@@ -65,11 +65,11 @@ CALLBACK_FUNC_DECL(MessageChannelConstructor)
     // Create references from the MessageChannel wrapper to the two
     // MessagePort wrappers to make sure that the MessagePort wrappers
     // stay alive as long as the MessageChannel wrapper is around.
-    messageChannel->SetInternalField(kMessageChannelPort1Index, V8Proxy::ToV8Object(V8ClassIndex::MESSAGEPORT, obj->port1()));
-    messageChannel->SetInternalField(kMessageChannelPort2Index, V8Proxy::ToV8Object(V8ClassIndex::MESSAGEPORT, obj->port2()));
+    messageChannel->SetInternalField(kMessageChannelPort1Index, V8Proxy::convertToV8Object(V8ClassIndex::MESSAGEPORT, obj->port1()));
+    messageChannel->SetInternalField(kMessageChannelPort2Index, V8Proxy::convertToV8Object(V8ClassIndex::MESSAGEPORT, obj->port2()));
 
     // Setup the standard wrapper object internal fields.
-    V8Proxy::SetDOMWrapper(messageChannel, V8ClassIndex::MESSAGECHANNEL, obj.get());
+    V8Proxy::setDOMWrapper(messageChannel, V8ClassIndex::MESSAGECHANNEL, obj.get());
     return toV8(obj.release(), messageChannel);
 }
 
index 24e80b8fdabddef64fb09f3312d58a51eccd6c68..fd02630fd8bba7e1d95c183d5c2f9568650b70b2 100644 (file)
@@ -43,14 +43,14 @@ namespace WebCore {
 ACCESSOR_GETTER(MessagePortOnmessage)
 {
     INC_STATS("DOM.MessagePort.onmessage._get");
-    MessagePort* messagePort = V8Proxy::ToNativeObject<MessagePort>(V8ClassIndex::MESSAGEPORT, info.Holder());
-    return V8Proxy::EventListenerToV8Object(messagePort->onmessage());
+    MessagePort* messagePort = V8Proxy::convertToNativeObject<MessagePort>(V8ClassIndex::MESSAGEPORT, info.Holder());
+    return V8Proxy::convertEventListenerToV8Object(messagePort->onmessage());
 }
 
 ACCESSOR_SETTER(MessagePortOnmessage)
 {
     INC_STATS("DOM.MessagePort.onmessage._set");
-    MessagePort* messagePort = V8Proxy::ToNativeObject<MessagePort>(V8ClassIndex::MESSAGEPORT, info.Holder());
+    MessagePort* messagePort = V8Proxy::convertToNativeObject<MessagePort>(V8ClassIndex::MESSAGEPORT, info.Holder());
     if (value->IsNull()) {
         if (messagePort->onmessage()) {
             V8ObjectEventListener* listener = static_cast<V8ObjectEventListener*>(messagePort->onmessage());
@@ -65,7 +65,7 @@ ACCESSOR_SETTER(MessagePortOnmessage)
         if (!proxy)
             return;
 
-        RefPtr<EventListener> listener = proxy->FindOrCreateObjectEventListener(value, false);
+        RefPtr<EventListener> listener = proxy->findOrCreateObjectEventListener(value, false);
         if (listener) {
             messagePort->setOnmessage(listener);
             createHiddenDependency(info.Holder(), value, V8Custom::kMessagePortRequestCacheIndex);
@@ -76,13 +76,13 @@ ACCESSOR_SETTER(MessagePortOnmessage)
 CALLBACK_FUNC_DECL(MessagePortAddEventListener)
 {
     INC_STATS("DOM.MessagePort.AddEventListener()");
-    MessagePort* messagePort = V8Proxy::ToNativeObject<MessagePort>(V8ClassIndex::MESSAGEPORT, args.Holder());
+    MessagePort* messagePort = V8Proxy::convertToNativeObject<MessagePort>(V8ClassIndex::MESSAGEPORT, args.Holder());
 
     V8Proxy* proxy = V8Proxy::retrieve(messagePort->scriptExecutionContext());
     if (!proxy)
         return v8::Undefined();
 
-    RefPtr<EventListener> listener = proxy->FindOrCreateObjectEventListener(args[1], false);
+    RefPtr<EventListener> listener = proxy->findOrCreateObjectEventListener(args[1], false);
     if (listener) {
         String type = toWebCoreString(args[0]);
         bool useCapture = args[2]->BooleanValue();
@@ -96,13 +96,13 @@ CALLBACK_FUNC_DECL(MessagePortAddEventListener)
 CALLBACK_FUNC_DECL(MessagePortRemoveEventListener)
 {
     INC_STATS("DOM.MessagePort.RemoveEventListener()");
-    MessagePort* messagePort = V8Proxy::ToNativeObject<MessagePort>(V8ClassIndex::MESSAGEPORT, args.Holder());
+    MessagePort* messagePort = V8Proxy::convertToNativeObject<MessagePort>(V8ClassIndex::MESSAGEPORT, args.Holder());
 
     V8Proxy* proxy = V8Proxy::retrieve(messagePort->scriptExecutionContext());
     if (!proxy)
         return v8::Undefined(); // probably leaked
 
-    RefPtr<EventListener> listener = proxy->FindObjectEventListener(args[1], false);
+    RefPtr<EventListener> listener = proxy->findObjectEventListener(args[1], false);
 
     if (listener) {
         String type = toWebCoreString(args[0]);
index 8e529cc6fdd0b20193d490f87f3adb3653aebba6..ae8691a4226a2cb94874f9e7dec56db3fec2d870 100644 (file)
@@ -42,12 +42,12 @@ namespace WebCore {
 INDEXED_PROPERTY_GETTER(NamedNodeMap)
 {
     INC_STATS("DOM.NamedNodeMap.IndexedPropertyGetter");
-    NamedNodeMap* imp = V8Proxy::ToNativeObject<NamedNodeMap>(V8ClassIndex::NAMEDNODEMAP, info.Holder());
+    NamedNodeMap* imp = V8Proxy::convertToNativeObject<NamedNodeMap>(V8ClassIndex::NAMEDNODEMAP, info.Holder());
     RefPtr<Node> result = imp->item(index);
     if (!result)