[V8] DOM wrapper creation involves a bunch of sketchy code related to finding the...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 8 Sep 2012 18:17:39 +0000 (18:17 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 8 Sep 2012 18:17:39 +0000 (18:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=96147

Patch by Adam Barth <abarth@chromium.org> on 2012-09-08
Reviewed by Eric Seidel.

Source/WebCore:

Previously, we used the Frame when instantiating DOM wrappers. That's
sketchy because not all DOM wrappers know how to find their Frame, and
the Frame might be displaying a different document now anyway. This
patch now gets all the information directly from the creation context.

In addition, this patch gets the proper creation context in a few more
cases, including Location.

* bindings/scripts/CodeGeneratorV8.pm:
(GetInternalFields):
(GenerateNormalAttrGetter):
(GenerateToV8Converters):
(GenerateFunctionCallString):
(NativeToJSValue):
* bindings/scripts/test/V8/V8Float64Array.cpp:
(WebCore::Float64ArrayV8Internal::fooCallback):
(WebCore::V8Float64Array::wrapSlow):
* bindings/scripts/test/V8/V8TestActiveDOMObject.cpp:
(WebCore::V8TestActiveDOMObject::wrapSlow):
* bindings/scripts/test/V8/V8TestCallback.cpp:
(WebCore::V8TestCallback::callbackWithClass1Param):
(WebCore::V8TestCallback::callbackWithClass2Param):
(WebCore::V8TestCallback::callbackWithStringList):
(WebCore::V8TestCallback::callbackRequiresThisToPass):
* bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp:
(WebCore::V8TestCustomNamedGetter::wrapSlow):
* bindings/scripts/test/V8/V8TestEventConstructor.cpp:
(WebCore::V8TestEventConstructor::wrapSlow):
* bindings/scripts/test/V8/V8TestEventTarget.cpp:
(WebCore::TestEventTargetV8Internal::itemCallback):
(WebCore::V8TestEventTarget::wrapSlow):
* bindings/scripts/test/V8/V8TestException.cpp:
(WebCore::V8TestException::wrapSlow):
* bindings/scripts/test/V8/V8TestInterface.cpp:
(WebCore::TestInterfaceV8Internal::supplementalNodeAttrGetter):
(WebCore::TestInterfaceV8Internal::supplementalMethod2Callback):
(WebCore::V8TestInterface::wrapSlow):
* bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp:
(WebCore::V8TestMediaQueryListListener::wrapSlow):
* bindings/scripts/test/V8/V8TestNamedConstructor.cpp:
(WebCore::V8TestNamedConstructor::wrapSlow):
* bindings/scripts/test/V8/V8TestNode.cpp:
(WebCore::V8TestNode::wrapSlow):
* bindings/scripts/test/V8/V8TestObj.cpp:
(WebCore::TestObjV8Internal::testObjAttrAttrGetter):
(WebCore::TestObjV8Internal::XMLObjAttrAttrGetter):
(WebCore::TestObjV8Internal::typedArrayAttrAttrGetter):
(WebCore::TestObjV8Internal::withScriptExecutionContextAttributeAttrGetter):
(WebCore::TestObjV8Internal::withScriptStateAttributeRaisesAttrGetter):
(WebCore::TestObjV8Internal::withScriptExecutionContextAttributeRaisesAttrGetter):
(WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeAttrGetter):
(WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeRaisesAttrGetter):
(WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateWithSpacesAttributeAttrGetter):
(WebCore::TestObjV8Internal::withScriptArgumentsAndCallStackAttributeAttrGetter):
(WebCore::TestObjV8Internal::contentDocumentAttrGetter):
(WebCore::TestObjV8Internal::objMethodCallback):
(WebCore::TestObjV8Internal::objMethodWithArgsCallback):
(WebCore::TestObjV8Internal::methodThatRequiresAllArgsAndThrowsCallback):
(WebCore::TestObjV8Internal::withScriptStateObjCallback):
(WebCore::TestObjV8Internal::withScriptStateObjExceptionCallback):
(WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateObjExceptionCallback):
(WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateWithSpacesCallback):
(WebCore::TestObjV8Internal::getSVGDocumentCallback):
(WebCore::TestObjV8Internal::strictFunctionCallback):
(WebCore::V8TestObj::wrapSlow):
* bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp:
(WebCore::V8TestSerializedScriptValueInterface::wrapSlow):
* bindings/v8/V8DOMWindowShell.cpp:
(WebCore::V8DOMWindowShell::disposeContext):
* bindings/v8/V8DOMWrapper.cpp:
(WebCore::V8DOMWrapper::instantiateV8Object):
* bindings/v8/V8DOMWrapper.h:
(V8DOMWrapper):
* bindings/v8/V8PerContextData.cpp:
(WebCore):
(WebCore::V8PerContextData::current):
(WebCore::V8PerContextData::dispose):
(WebCore::V8PerContextData::init):
* bindings/v8/V8PerContextData.h:
(V8PerContextData):

LayoutTests:

The V8 results for this test now match the JSC results. We can remove
the chromium-specific baseline.

* platform/chromium/fast/workers/storage/test-authorizer-sync-expected.txt: Removed.

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

25 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/chromium/fast/workers/storage/test-authorizer-sync-expected.txt [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp
Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp
Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp
Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp
Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp
Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp
Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp
Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp
Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp
Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp
Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp
Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp
Source/WebCore/bindings/v8/V8Binding.cpp
Source/WebCore/bindings/v8/V8Binding.h
Source/WebCore/bindings/v8/V8DOMWindowShell.cpp
Source/WebCore/bindings/v8/V8DOMWrapper.cpp
Source/WebCore/bindings/v8/V8DOMWrapper.h
Source/WebCore/bindings/v8/V8HiddenPropertyName.h
Source/WebCore/bindings/v8/V8PerContextData.cpp
Source/WebCore/bindings/v8/V8PerContextData.h

index a6ff15b..1dd440c 100644 (file)
@@ -1,3 +1,15 @@
+2012-09-08  Adam Barth  <abarth@chromium.org>
+
+        [V8] DOM wrapper creation involves a bunch of sketchy code related to finding the Frame
+        https://bugs.webkit.org/show_bug.cgi?id=96147
+
+        Reviewed by Eric Seidel.
+
+        The V8 results for this test now match the JSC results. We can remove
+        the chromium-specific baseline.
+
+        * platform/chromium/fast/workers/storage/test-authorizer-sync-expected.txt: Removed.
+
 2012-09-08  Julien Chaffraix  <jchaffraix@webkit.org>
 
         [Chromium] Layout Tests tables/mozilla/bugs/bug27038*.html are failing
diff --git a/LayoutTests/platform/chromium/fast/workers/storage/test-authorizer-sync-expected.txt b/LayoutTests/platform/chromium/fast/workers/storage/test-authorizer-sync-expected.txt
deleted file mode 100644 (file)
index 7ad9bab..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-Test the database authorizer.
-Beginning write transaction:
-SQLITE_CREATE_TABLE allowed.
-SQLITE_CREATE_INDEX allowed.
-SQLITE_CREATE_TEMP_TABLE allowed.
-SQLITE_CREATE_TEMP_TRIGGER allowed.
-SQLITE_CREATE_TEMP_VIEW allowed.
-SQLITE_CREATE_TRIGGER allowed.
-SQLITE_CREATE_VIEW allowed.
-SQLITE_CREATE_VTABLE not allowed: [object SQLException] (5)
-SQLITE_READ allowed.
-SQLITE_SELECT allowed.
-SQLITE_DELETE allowed.
-SQLITE_INSERT allowed.
-SQLITE_UPDATE allowed.
-SQLITE_PRAGMA not allowed: [object SQLException] (5)
-SQLITE_ALTER_TABLE allowed.
-SQLITE_ALTER_TABLE allowed.
-SQLITE_TRANSACTION not allowed: [object SQLException] (5)
-SQLITE_ATTACH not allowed: [object SQLException] (5)
-SQLITE_DETACH not allowed: [object SQLException] (5)
-SQLITE_REINDEX allowed.
-SQLITE_ANALYZE not allowed: [object SQLException] (5)
-SQLITE_DROP_INDEX allowed.
-SQLITE_DROP_TEMP_TABLE allowed.
-SQLITE_DROP_TEMP_TRIGGER allowed.
-SQLITE_DROP_TEMP_VIEW allowed.
-SQLITE_DROP_TRIGGER allowed.
-SQLITE_DROP_VIEW allowed.
-SQLITE_DROP_TABLE allowed.
-Write transaction succeeded.
-
-Beginning read transactions:
-SQLITE_CREATE_TABLE not allowed: [object SQLException] (5)
-SQLITE_CREATE_TABLE allowed.
-SQLITE_CREATE_INDEX not allowed: [object SQLException] (5)
-SQLITE_CREATE_TEMP_TABLE not allowed: [object SQLException] (5)
-SQLITE_CREATE_TEMP_TRIGGER not allowed: [object SQLException] (5)
-SQLITE_CREATE_TEMP_VIEW not allowed: [object SQLException] (5)
-SQLITE_CREATE_TRIGGER not allowed: [object SQLException] (5)
-SQLITE_CREATE_VIEW not allowed: [object SQLException] (5)
-SQLITE_CREATE_VTABLE not allowed: [object SQLException] (5)
-SQLITE_CREATE_INDEX allowed.
-SQLITE_CREATE_TEMP_TABLE allowed.
-SQLITE_CREATE_TEMP_TRIGGER allowed.
-SQLITE_CREATE_TEMP_VIEW allowed.
-SQLITE_CREATE_TRIGGER allowed.
-SQLITE_CREATE_VIEW allowed.
-SQLITE_CREATE_VTABLE not allowed: [object SQLException] (5)
-SQLITE_READ allowed.
-SQLITE_SELECT allowed.
-SQLITE_DELETE not allowed: [object SQLException] (5)
-SQLITE_INSERT not allowed: [object SQLException] (5)
-SQLITE_UPDATE not allowed: [object SQLException] (5)
-SQLITE_PRAGMA not allowed: [object SQLException] (5)
-SQLITE_ALTER_TABLE not allowed: [object SQLException] (5)
-SQLITE_ALTER_TABLE not allowed: [object SQLException] (5)
-SQLITE_TRANSACTION not allowed: [object SQLException] (5)
-SQLITE_ATTACH not allowed: [object SQLException] (5)
-SQLITE_DETACH not allowed: [object SQLException] (5)
-SQLITE_REINDEX not allowed: [object SQLException] (5)
-SQLITE_ANALYZE not allowed: [object SQLException] (5)
-SQLITE_DROP_INDEX not allowed: [object SQLException] (5)
-SQLITE_DROP_TEMP_TABLE not allowed: [object SQLException] (5)
-SQLITE_DROP_TEMP_TRIGGER not allowed: [object SQLException] (5)
-SQLITE_DROP_TEMP_VIEW not allowed: [object SQLException] (5)
-SQLITE_DROP_TRIGGER not allowed: [object SQLException] (5)
-SQLITE_DROP_VIEW not allowed: [object SQLException] (5)
-SQLITE_DROP_TABLE not allowed: [object SQLException] (5)
-Read transactions succeeded.
-
index b95770f..b0ec582 100644 (file)
@@ -1,3 +1,91 @@
+2012-09-08  Adam Barth  <abarth@chromium.org>
+
+        [V8] DOM wrapper creation involves a bunch of sketchy code related to finding the Frame
+        https://bugs.webkit.org/show_bug.cgi?id=96147
+
+        Reviewed by Eric Seidel.
+
+        Previously, we used the Frame when instantiating DOM wrappers. That's
+        sketchy because not all DOM wrappers know how to find their Frame, and
+        the Frame might be displaying a different document now anyway. This
+        patch now gets all the information directly from the creation context.
+
+        In addition, this patch gets the proper creation context in a few more
+        cases, including Location.
+
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (GetInternalFields):
+        (GenerateNormalAttrGetter):
+        (GenerateToV8Converters):
+        (GenerateFunctionCallString):
+        (NativeToJSValue):
+        * bindings/scripts/test/V8/V8Float64Array.cpp:
+        (WebCore::Float64ArrayV8Internal::fooCallback):
+        (WebCore::V8Float64Array::wrapSlow):
+        * bindings/scripts/test/V8/V8TestActiveDOMObject.cpp:
+        (WebCore::V8TestActiveDOMObject::wrapSlow):
+        * bindings/scripts/test/V8/V8TestCallback.cpp:
+        (WebCore::V8TestCallback::callbackWithClass1Param):
+        (WebCore::V8TestCallback::callbackWithClass2Param):
+        (WebCore::V8TestCallback::callbackWithStringList):
+        (WebCore::V8TestCallback::callbackRequiresThisToPass):
+        * bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp:
+        (WebCore::V8TestCustomNamedGetter::wrapSlow):
+        * bindings/scripts/test/V8/V8TestEventConstructor.cpp:
+        (WebCore::V8TestEventConstructor::wrapSlow):
+        * bindings/scripts/test/V8/V8TestEventTarget.cpp:
+        (WebCore::TestEventTargetV8Internal::itemCallback):
+        (WebCore::V8TestEventTarget::wrapSlow):
+        * bindings/scripts/test/V8/V8TestException.cpp:
+        (WebCore::V8TestException::wrapSlow):
+        * bindings/scripts/test/V8/V8TestInterface.cpp:
+        (WebCore::TestInterfaceV8Internal::supplementalNodeAttrGetter):
+        (WebCore::TestInterfaceV8Internal::supplementalMethod2Callback):
+        (WebCore::V8TestInterface::wrapSlow):
+        * bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp:
+        (WebCore::V8TestMediaQueryListListener::wrapSlow):
+        * bindings/scripts/test/V8/V8TestNamedConstructor.cpp:
+        (WebCore::V8TestNamedConstructor::wrapSlow):
+        * bindings/scripts/test/V8/V8TestNode.cpp:
+        (WebCore::V8TestNode::wrapSlow):
+        * bindings/scripts/test/V8/V8TestObj.cpp:
+        (WebCore::TestObjV8Internal::testObjAttrAttrGetter):
+        (WebCore::TestObjV8Internal::XMLObjAttrAttrGetter):
+        (WebCore::TestObjV8Internal::typedArrayAttrAttrGetter):
+        (WebCore::TestObjV8Internal::withScriptExecutionContextAttributeAttrGetter):
+        (WebCore::TestObjV8Internal::withScriptStateAttributeRaisesAttrGetter):
+        (WebCore::TestObjV8Internal::withScriptExecutionContextAttributeRaisesAttrGetter):
+        (WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeAttrGetter):
+        (WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeRaisesAttrGetter):
+        (WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateWithSpacesAttributeAttrGetter):
+        (WebCore::TestObjV8Internal::withScriptArgumentsAndCallStackAttributeAttrGetter):
+        (WebCore::TestObjV8Internal::contentDocumentAttrGetter):
+        (WebCore::TestObjV8Internal::objMethodCallback):
+        (WebCore::TestObjV8Internal::objMethodWithArgsCallback):
+        (WebCore::TestObjV8Internal::methodThatRequiresAllArgsAndThrowsCallback):
+        (WebCore::TestObjV8Internal::withScriptStateObjCallback):
+        (WebCore::TestObjV8Internal::withScriptStateObjExceptionCallback):
+        (WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateObjExceptionCallback):
+        (WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateWithSpacesCallback):
+        (WebCore::TestObjV8Internal::getSVGDocumentCallback):
+        (WebCore::TestObjV8Internal::strictFunctionCallback):
+        (WebCore::V8TestObj::wrapSlow):
+        * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp:
+        (WebCore::V8TestSerializedScriptValueInterface::wrapSlow):
+        * bindings/v8/V8DOMWindowShell.cpp:
+        (WebCore::V8DOMWindowShell::disposeContext):
+        * bindings/v8/V8DOMWrapper.cpp:
+        (WebCore::V8DOMWrapper::instantiateV8Object):
+        * bindings/v8/V8DOMWrapper.h:
+        (V8DOMWrapper):
+        * bindings/v8/V8PerContextData.cpp:
+        (WebCore):
+        (WebCore::V8PerContextData::current):
+        (WebCore::V8PerContextData::dispose):
+        (WebCore::V8PerContextData::init):
+        * bindings/v8/V8PerContextData.h:
+        (V8PerContextData):
+
 2012-09-08  Arvid Nilsson  <anilsson@rim.com>
 
         [CSS Shaders] [BlackBerry] Refactor CustomFilterMesh and CustomFilter*Program
index d5c3437..94f1a1b 100644 (file)
@@ -1087,7 +1087,7 @@ END
     return value;
 END
         } else {
-            push(@implContentDecls, "    " . ReturnNativeToJSValue($attribute->signature, $result, "info.GetIsolate()").";\n");
+            push(@implContentDecls, "    " . ReturnNativeToJSValue($attribute->signature, $result, "info.Holder()", "info.GetIsolate()").";\n");
         }
     }
 
@@ -3359,37 +3359,14 @@ END
     }
 
     AddToImplIncludes("Frame.h");
-    my $frame = "0";
-    if (IsNodeSubType($dataNode)) {
-        # DocumentType nodes are the only nodes that may have a NULL document.
-        if ($interfaceName eq "DocumentType") {
-            $frame = "impl->document() ? impl->document()->frame() : 0";
-        } else {
-            $frame = "impl->document()->frame()";
-        }
-    }
-    push(@implContent, <<END);
-    Frame* frame = $frame;
-END
 
     if (IsSubType($dataNode, "Document")) {
         push(@implContent, <<END);
-    if (frame && frame->script()->windowShell()->context().IsEmpty() && frame->script()->windowShell()->initializeIfNeeded()) {
-        // initializeIfNeeded may have created a wrapper for the object, retry from the start.
-        return ${className}::wrap(impl.get(), creationContext, isolate);
-    }
-END
-    }
-
-    # FIXME: We need a better way of recovering the correct prototype chain
-    # for every sort of object. For now, we special-case cross-origin visible
-    # objects (i.e., those with CheckSecurity).
-    if (IsVisibleAcrossOrigins($dataNode)) {
-        AddToImplIncludes("Frame.h");
-        push(@implContent, <<END);
-    if (impl->frame()) {
-        frame = impl->frame();
-        frame->script()->windowShell()->initializeIfNeeded();
+    if (Frame* frame = impl->frame()) {
+        if (frame->script()->windowShell()->context().IsEmpty() && frame->script()->windowShell()->initializeIfNeeded()) {
+            // initializeIfNeeded may have created a wrapper for the object, retry from the start.
+            return ${className}::wrap(impl.get(), creationContext, isolate);
+        }
     }
 END
     }
@@ -3404,18 +3381,12 @@ END
         ASSERT(!context.IsEmpty());
         context->Enter();
     }
-END
 
-    push(@implContent, <<END);
-    wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get());
-END
+    wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get());
 
-    push(@implContent, <<END);
     if (!context.IsEmpty())
         context->Exit();
-END
 
-    push(@implContent, <<END);
     if (UNLIKELY(wrapper.IsEmpty()))
         return wrapper;
 END
@@ -3591,7 +3562,7 @@ sub GenerateFunctionCallString()
     }
 
     $return .= ".release()" if ($returnIsRef);
-    $result .= $indent . ReturnNativeToJSValue($function->signature, $return, "args.GetIsolate()") . ";\n";
+    $result .= $indent . ReturnNativeToJSValue($function->signature, $return, "args.Holder()", "args.GetIsolate()") . ";\n";
 
     return $result;
 }
@@ -4022,6 +3993,8 @@ sub NativeToJSValue
 {
     my $signature = shift;
     my $value = shift;
+    my $getCreationContext = shift;
+    my $getCreationContextArg = $getCreationContext ? ", $getCreationContext" : "";
     my $getIsolate = shift;
     my $getIsolateArg = $getIsolate ? ", $getIsolate" : "";
     my $type = GetTypeFromSignature($signature);
@@ -4078,18 +4051,18 @@ sub NativeToJSValue
             AddToImplIncludes("V8$sequenceType.h");
             AddToImplIncludes("$sequenceType.h");
         }
-        return "v8Array($value, $getIsolate)";
+        return "v8Array($value$getIsolateArg)";
     }
 
     AddIncludesForType($type);
 
     # special case for non-DOM node interfaces
     if (IsDOMNodeType($type)) {
-        return "toV8(${value}, v8::Handle<v8::Object>()" . ($signature->extendedAttributes->{"ReturnNewObject"} ? "$getIsolateArg, true)" : "$getIsolateArg)");
+        return "toV8(${value}$getCreationContextArg$getIsolateArg" . ($signature->extendedAttributes->{"ReturnNewObject"} ? ", true)" : ")");
     }
 
     if ($type eq "EventTarget") {
-        return "V8DOMWrapper::convertEventTargetToV8Object($value, v8::Handle<v8::Object>()$getIsolateArg)";
+        return "V8DOMWrapper::convertEventTargetToV8Object($value$getCreationContextArg$getIsolateArg)";
     }
 
     if ($type eq "EventListener") {
@@ -4106,7 +4079,7 @@ sub NativeToJSValue
     AddToImplIncludes("wtf/RefPtr.h");
     AddToImplIncludes("wtf/GetPtr.h");
 
-    return "toV8($value, v8::Handle<v8::Object>()$getIsolateArg)";
+    return "toV8($value$getCreationContextArg$getIsolateArg)";
 }
 
 sub ReturnNativeToJSValue
index 579891a..e4703bc 100644 (file)
@@ -56,7 +56,7 @@ static v8::Handle<v8::Value> fooCallback(const v8::Arguments& args)
         return throwNotEnoughArgumentsError(args.GetIsolate());
     Float64Array* imp = V8Float64Array::toNative(args.Holder());
     EXCEPTION_BLOCK(Float32Array*, array, V8Float32Array::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8Float32Array::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
-    return toV8(imp->foo(array), v8::Handle<v8::Object>(), args.GetIsolate());
+    return toV8(imp->foo(array), args.Holder(), args.GetIsolate());
 }
 
 static v8::Handle<v8::Value> setCallback(const v8::Arguments& args)
@@ -151,7 +151,6 @@ v8::Handle<v8::Object> V8Float64Array::wrapSlow(PassRefPtr<Float64Array> impl, v
 {
     v8::Handle<v8::Object> wrapper;
     ASSERT(static_cast<void*>(static_cast<ArrayBufferView*>(impl.get())) == static_cast<void*>(impl.get()));
-    Frame* frame = 0;
 
     v8::Handle<v8::Context> context;
     if (!creationContext.IsEmpty() && creationContext->CreationContext() != v8::Context::GetCurrent()) {
@@ -161,9 +160,12 @@ v8::Handle<v8::Object> V8Float64Array::wrapSlow(PassRefPtr<Float64Array> impl, v
         ASSERT(!context.IsEmpty());
         context->Enter();
     }
-    wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get());
+
+    wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get());
+
     if (!context.IsEmpty())
         context->Exit();
+
     if (UNLIKELY(wrapper.IsEmpty()))
         return wrapper;
     v8::Persistent<v8::Object> wrapperHandle = V8DOMWrapper::setJSWrapperForDOMObject(impl, wrapper, isolate);
index c271120..b996c81 100644 (file)
@@ -179,11 +179,6 @@ bool V8TestActiveDOMObject::HasInstance(v8::Handle<v8::Value> value)
 v8::Handle<v8::Object> V8TestActiveDOMObject::wrapSlow(PassRefPtr<TestActiveDOMObject> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
 {
     v8::Handle<v8::Object> wrapper;
-    Frame* frame = 0;
-    if (impl->frame()) {
-        frame = impl->frame();
-        frame->script()->windowShell()->initializeIfNeeded();
-    }
 
     v8::Handle<v8::Context> context;
     if (!creationContext.IsEmpty() && creationContext->CreationContext() != v8::Context::GetCurrent()) {
@@ -193,9 +188,12 @@ v8::Handle<v8::Object> V8TestActiveDOMObject::wrapSlow(PassRefPtr<TestActiveDOMO
         ASSERT(!context.IsEmpty());
         context->Enter();
     }
-    wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get());
+
+    wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get());
+
     if (!context.IsEmpty())
         context->Exit();
+
     if (UNLIKELY(wrapper.IsEmpty()))
         return wrapper;
     v8::Persistent<v8::Object> wrapperHandle = V8DOMWrapper::setJSWrapperForDOMObject(impl, wrapper, isolate);
index b8b5107..ed2de6e 100644 (file)
@@ -86,7 +86,7 @@ bool V8TestCallback::callbackWithClass1Param(Class1* class1Param)
 
     v8::Context::Scope scope(v8Context);
 
-    v8::Handle<v8::Value> class1ParamHandle = toV8(class1Param, v8::Handle<v8::Object>());
+    v8::Handle<v8::Value> class1ParamHandle = toV8(class1Param);
     if (class1ParamHandle.IsEmpty()) {
         if (!isScriptControllerTerminating())
             CRASH();
@@ -114,7 +114,7 @@ bool V8TestCallback::callbackWithClass2Param(Class2* class2Param, const String&
 
     v8::Context::Scope scope(v8Context);
 
-    v8::Handle<v8::Value> class2ParamHandle = toV8(class2Param, v8::Handle<v8::Object>());
+    v8::Handle<v8::Value> class2ParamHandle = toV8(class2Param);
     if (class2ParamHandle.IsEmpty()) {
         if (!isScriptControllerTerminating())
             CRASH();
@@ -149,7 +149,7 @@ bool V8TestCallback::callbackWithStringList(RefPtr<DOMStringList> listParam)
 
     v8::Context::Scope scope(v8Context);
 
-    v8::Handle<v8::Value> listParamHandle = toV8(listParam, v8::Handle<v8::Object>());
+    v8::Handle<v8::Value> listParamHandle = toV8(listParam);
     if (listParamHandle.IsEmpty()) {
         if (!isScriptControllerTerminating())
             CRASH();
@@ -207,13 +207,13 @@ bool V8TestCallback::callbackRequiresThisToPass(Class8* class8Param, ThisClass*
 
     v8::Context::Scope scope(v8Context);
 
-    v8::Handle<v8::Value> class8ParamHandle = toV8(class8Param, v8::Handle<v8::Object>());
+    v8::Handle<v8::Value> class8ParamHandle = toV8(class8Param);
     if (class8ParamHandle.IsEmpty()) {
         if (!isScriptControllerTerminating())
             CRASH();
         return true;
     }
-    v8::Handle<v8::Value> thisClassParamHandle = toV8(thisClassParam, v8::Handle<v8::Object>());
+    v8::Handle<v8::Value> thisClassParamHandle = toV8(thisClassParam);
     if (thisClassParamHandle.IsEmpty()) {
         if (!isScriptControllerTerminating())
             CRASH();
index 1fd6e27..7c32be6 100644 (file)
@@ -113,7 +113,6 @@ bool V8TestCustomNamedGetter::HasInstance(v8::Handle<v8::Value> value)
 v8::Handle<v8::Object> V8TestCustomNamedGetter::wrapSlow(PassRefPtr<TestCustomNamedGetter> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
 {
     v8::Handle<v8::Object> wrapper;
-    Frame* frame = 0;
 
     v8::Handle<v8::Context> context;
     if (!creationContext.IsEmpty() && creationContext->CreationContext() != v8::Context::GetCurrent()) {
@@ -123,9 +122,12 @@ v8::Handle<v8::Object> V8TestCustomNamedGetter::wrapSlow(PassRefPtr<TestCustomNa
         ASSERT(!context.IsEmpty());
         context->Enter();
     }
-    wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get());
+
+    wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get());
+
     if (!context.IsEmpty())
         context->Exit();
+
     if (UNLIKELY(wrapper.IsEmpty()))
         return wrapper;
     v8::Persistent<v8::Object> wrapperHandle = V8DOMWrapper::setJSWrapperForDOMObject(impl, wrapper, isolate);
index b20f15a..b3a3534 100644 (file)
@@ -150,7 +150,6 @@ bool V8TestEventConstructor::HasInstance(v8::Handle<v8::Value> value)
 v8::Handle<v8::Object> V8TestEventConstructor::wrapSlow(PassRefPtr<TestEventConstructor> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
 {
     v8::Handle<v8::Object> wrapper;
-    Frame* frame = 0;
 
     v8::Handle<v8::Context> context;
     if (!creationContext.IsEmpty() && creationContext->CreationContext() != v8::Context::GetCurrent()) {
@@ -160,9 +159,12 @@ v8::Handle<v8::Object> V8TestEventConstructor::wrapSlow(PassRefPtr<TestEventCons
         ASSERT(!context.IsEmpty());
         context->Enter();
     }
-    wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get());
+
+    wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get());
+
     if (!context.IsEmpty())
         context->Exit();
+
     if (UNLIKELY(wrapper.IsEmpty()))
         return wrapper;
     v8::Persistent<v8::Object> wrapperHandle = V8DOMWrapper::setJSWrapperForDOMObject(impl, wrapper, isolate);
index 8de08ba..b78369e 100644 (file)
@@ -55,7 +55,7 @@ static v8::Handle<v8::Value> itemCallback(const v8::Arguments& args)
         ec = INDEX_SIZE_ERR;
         goto fail;
     }
-    return toV8(imp->item(index), v8::Handle<v8::Object>(), args.GetIsolate());
+    return toV8(imp->item(index), args.Holder(), args.GetIsolate());
     }
     fail:
     return setDOMException(ec, args.GetIsolate());
@@ -174,7 +174,6 @@ bool V8TestEventTarget::HasInstance(v8::Handle<v8::Value> value)
 v8::Handle<v8::Object> V8TestEventTarget::wrapSlow(PassRefPtr<TestEventTarget> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
 {
     v8::Handle<v8::Object> wrapper;
-    Frame* frame = 0;
 
     v8::Handle<v8::Context> context;
     if (!creationContext.IsEmpty() && creationContext->CreationContext() != v8::Context::GetCurrent()) {
@@ -184,9 +183,12 @@ v8::Handle<v8::Object> V8TestEventTarget::wrapSlow(PassRefPtr<TestEventTarget> i
         ASSERT(!context.IsEmpty());
         context->Enter();
     }
-    wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get());
+
+    wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get());
+
     if (!context.IsEmpty())
         context->Exit();
+
     if (UNLIKELY(wrapper.IsEmpty()))
         return wrapper;
     v8::Persistent<v8::Object> wrapperHandle = V8DOMWrapper::setJSWrapperForDOMObject(impl, wrapper, isolate);
index 354bcea..d80199d 100644 (file)
@@ -104,7 +104,6 @@ bool V8TestException::HasInstance(v8::Handle<v8::Value> value)
 v8::Handle<v8::Object> V8TestException::wrapSlow(PassRefPtr<TestException> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
 {
     v8::Handle<v8::Object> wrapper;
-    Frame* frame = 0;
 
     v8::Handle<v8::Context> context;
     if (!creationContext.IsEmpty() && creationContext->CreationContext() != v8::Context::GetCurrent()) {
@@ -114,9 +113,12 @@ v8::Handle<v8::Object> V8TestException::wrapSlow(PassRefPtr<TestException> impl,
         ASSERT(!context.IsEmpty());
         context->Enter();
     }
-    wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get());
+
+    wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get());
+
     if (!context.IsEmpty())
         context->Exit();
+
     if (UNLIKELY(wrapper.IsEmpty()))
         return wrapper;
     v8::Persistent<v8::Object> wrapperHandle = V8DOMWrapper::setJSWrapperForDOMObject(impl, wrapper, isolate);
index 0506b93..c535076 100644 (file)
@@ -120,7 +120,7 @@ static v8::Handle<v8::Value> supplementalNodeAttrGetter(v8::Local<v8::String> na
 {
     INC_STATS("DOM.TestInterface.supplementalNode._get");
     TestInterface* imp = V8TestInterface::toNative(info.Holder());
-    return toV8(TestSupplemental::supplementalNode(imp), v8::Handle<v8::Object>(), info.GetIsolate());
+    return toV8(TestSupplemental::supplementalNode(imp), info.Holder(), info.GetIsolate());
 }
 
 #endif // ENABLE(Condition11) || ENABLE(Condition12)
@@ -168,7 +168,7 @@ static v8::Handle<v8::Value> supplementalMethod2Callback(const v8::Arguments& ar
     RefPtr<TestObj> result = TestSupplemental::supplementalMethod2(scriptContext, imp, strArg, objArg, ec);
     if (UNLIKELY(ec))
         goto fail;
-    return toV8(result.release(), v8::Handle<v8::Object>(), args.GetIsolate());
+    return toV8(result.release(), args.Holder(), args.GetIsolate());
     }
     fail:
     return setDOMException(ec, args.GetIsolate());
@@ -347,7 +347,6 @@ ActiveDOMObject* V8TestInterface::toActiveDOMObject(v8::Handle<v8::Object> objec
 v8::Handle<v8::Object> V8TestInterface::wrapSlow(PassRefPtr<TestInterface> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
 {
     v8::Handle<v8::Object> wrapper;
-    Frame* frame = 0;
 
     v8::Handle<v8::Context> context;
     if (!creationContext.IsEmpty() && creationContext->CreationContext() != v8::Context::GetCurrent()) {
@@ -357,9 +356,12 @@ v8::Handle<v8::Object> V8TestInterface::wrapSlow(PassRefPtr<TestInterface> impl,
         ASSERT(!context.IsEmpty());
         context->Enter();
     }
-    wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get());
+
+    wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get());
+
     if (!context.IsEmpty())
         context->Exit();
+
     if (UNLIKELY(wrapper.IsEmpty()))
         return wrapper;
     v8::Persistent<v8::Object> wrapperHandle = V8DOMWrapper::setJSWrapperForActiveDOMObject(impl, wrapper, isolate);
index 60b9684..24c4df6 100644 (file)
@@ -113,7 +113,6 @@ bool V8TestMediaQueryListListener::HasInstance(v8::Handle<v8::Value> value)
 v8::Handle<v8::Object> V8TestMediaQueryListListener::wrapSlow(PassRefPtr<TestMediaQueryListListener> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
 {
     v8::Handle<v8::Object> wrapper;
-    Frame* frame = 0;
 
     v8::Handle<v8::Context> context;
     if (!creationContext.IsEmpty() && creationContext->CreationContext() != v8::Context::GetCurrent()) {
@@ -123,9 +122,12 @@ v8::Handle<v8::Object> V8TestMediaQueryListListener::wrapSlow(PassRefPtr<TestMed
         ASSERT(!context.IsEmpty());
         context->Enter();
     }
-    wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get());
+
+    wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get());
+
     if (!context.IsEmpty())
         context->Exit();
+
     if (UNLIKELY(wrapper.IsEmpty()))
         return wrapper;
     v8::Persistent<v8::Object> wrapperHandle = V8DOMWrapper::setJSWrapperForDOMObject(impl, wrapper, isolate);
index 6e44d89..6e262d4 100644 (file)
@@ -157,7 +157,6 @@ ActiveDOMObject* V8TestNamedConstructor::toActiveDOMObject(v8::Handle<v8::Object
 v8::Handle<v8::Object> V8TestNamedConstructor::wrapSlow(PassRefPtr<TestNamedConstructor> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
 {
     v8::Handle<v8::Object> wrapper;
-    Frame* frame = 0;
 
     v8::Handle<v8::Context> context;
     if (!creationContext.IsEmpty() && creationContext->CreationContext() != v8::Context::GetCurrent()) {
@@ -167,9 +166,12 @@ v8::Handle<v8::Object> V8TestNamedConstructor::wrapSlow(PassRefPtr<TestNamedCons
         ASSERT(!context.IsEmpty());
         context->Enter();
     }
-    wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get());
+
+    wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get());
+
     if (!context.IsEmpty())
         context->Exit();
+
     if (UNLIKELY(wrapper.IsEmpty()))
         return wrapper;
     v8::Persistent<v8::Object> wrapperHandle = V8DOMWrapper::setJSWrapperForActiveDOMObject(impl, wrapper, isolate);
index 0bfe133..5655a8c 100644 (file)
@@ -113,7 +113,6 @@ v8::Handle<v8::Object> V8TestNode::wrapSlow(PassRefPtr<TestNode> impl, v8::Handl
 {
     v8::Handle<v8::Object> wrapper;
     ASSERT(static_cast<void*>(static_cast<Node*>(impl.get())) == static_cast<void*>(impl.get()));
-    Frame* frame = impl->document()->frame();
 
     v8::Handle<v8::Context> context;
     if (!creationContext.IsEmpty() && creationContext->CreationContext() != v8::Context::GetCurrent()) {
@@ -123,9 +122,12 @@ v8::Handle<v8::Object> V8TestNode::wrapSlow(PassRefPtr<TestNode> impl, v8::Handl
         ASSERT(!context.IsEmpty());
         context->Enter();
     }
-    wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get());
+
+    wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get());
+
     if (!context.IsEmpty())
         context->Exit();
+
     if (UNLIKELY(wrapper.IsEmpty()))
         return wrapper;
     v8::Persistent<v8::Object> wrapperHandle = V8DOMWrapper::setJSWrapperForDOMNode(impl, wrapper, isolate);
index 7efed5c..46b415d 100644 (file)
@@ -229,7 +229,7 @@ static v8::Handle<v8::Value> testObjAttrAttrGetter(v8::Local<v8::String> name, c
 {
     INC_STATS("DOM.TestObj.testObjAttr._get");
     TestObj* imp = V8TestObj::toNative(info.Holder());
-    return toV8(imp->testObjAttr(), v8::Handle<v8::Object>(), info.GetIsolate());
+    return toV8(imp->testObjAttr(), info.Holder(), info.GetIsolate());
 }
 
 static void testObjAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
@@ -245,7 +245,7 @@ static v8::Handle<v8::Value> XMLObjAttrAttrGetter(v8::Local<v8::String> name, co
 {
     INC_STATS("DOM.TestObj.XMLObjAttr._get");
     TestObj* imp = V8TestObj::toNative(info.Holder());
-    return toV8(imp->xmlObjAttr(), v8::Handle<v8::Object>(), info.GetIsolate());
+    return toV8(imp->xmlObjAttr(), info.Holder(), info.GetIsolate());
 }
 
 static void XMLObjAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
@@ -421,7 +421,7 @@ static v8::Handle<v8::Value> typedArrayAttrAttrGetter(v8::Local<v8::String> name
 {
     INC_STATS("DOM.TestObj.typedArrayAttr._get");
     TestObj* imp = V8TestObj::toNative(info.Holder());
-    return toV8(imp->typedArrayAttr(), v8::Handle<v8::Object>(), info.GetIsolate());
+    return toV8(imp->typedArrayAttr(), info.Holder(), info.GetIsolate());
 }
 
 static void typedArrayAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
@@ -548,7 +548,7 @@ static v8::Handle<v8::Value> withScriptExecutionContextAttributeAttrGetter(v8::L
     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
     if (!scriptContext)
         return v8Undefined();
-    return toV8(imp->withScriptExecutionContextAttribute(scriptContext), v8::Handle<v8::Object>(), info.GetIsolate());
+    return toV8(imp->withScriptExecutionContextAttribute(scriptContext), info.Holder(), info.GetIsolate());
 }
 
 static void withScriptExecutionContextAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
@@ -576,7 +576,7 @@ static v8::Handle<v8::Value> withScriptStateAttributeRaisesAttrGetter(v8::Local<
         return setDOMException(ec, info.GetIsolate());
     if (state.hadException())
         return throwError(state.exception(), info.GetIsolate());
-    return toV8(v.release(), v8::Handle<v8::Object>(), info.GetIsolate());
+    return toV8(v.release(), info.Holder(), info.GetIsolate());
 }
 
 static void withScriptStateAttributeRaisesAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
@@ -607,7 +607,7 @@ static v8::Handle<v8::Value> withScriptExecutionContextAttributeRaisesAttrGetter
     RefPtr<TestObj> v = imp->withScriptExecutionContextAttributeRaises(scriptContext, ec);
     if (UNLIKELY(ec))
         return setDOMException(ec, info.GetIsolate());
-    return toV8(v.release(), v8::Handle<v8::Object>(), info.GetIsolate());
+    return toV8(v.release(), info.Holder(), info.GetIsolate());
 }
 
 static void withScriptExecutionContextAttributeRaisesAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
@@ -635,7 +635,7 @@ static v8::Handle<v8::Value> withScriptExecutionContextAndScriptStateAttributeAt
     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
     if (!scriptContext)
         return v8Undefined();
-    return toV8(imp->withScriptExecutionContextAndScriptStateAttribute(state, scriptContext), v8::Handle<v8::Object>(), info.GetIsolate());
+    return toV8(imp->withScriptExecutionContextAndScriptStateAttribute(state, scriptContext), info.Holder(), info.GetIsolate());
 }
 
 static void withScriptExecutionContextAndScriptStateAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
@@ -671,7 +671,7 @@ static v8::Handle<v8::Value> withScriptExecutionContextAndScriptStateAttributeRa
         return setDOMException(ec, info.GetIsolate());
     if (state.hadException())
         return throwError(state.exception(), info.GetIsolate());
-    return toV8(v.release(), v8::Handle<v8::Object>(), info.GetIsolate());
+    return toV8(v.release(), info.Holder(), info.GetIsolate());
 }
 
 static void withScriptExecutionContextAndScriptStateAttributeRaisesAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
@@ -704,7 +704,7 @@ static v8::Handle<v8::Value> withScriptExecutionContextAndScriptStateWithSpacesA
     ScriptExecutionContext* scriptContext = getScriptExecutionContext();
     if (!scriptContext)
         return v8Undefined();
-    return toV8(imp->withScriptExecutionContextAndScriptStateWithSpacesAttribute(state, scriptContext), v8::Handle<v8::Object>(), info.GetIsolate());
+    return toV8(imp->withScriptExecutionContextAndScriptStateWithSpacesAttribute(state, scriptContext), info.Holder(), info.GetIsolate());
 }
 
 static void withScriptExecutionContextAndScriptStateWithSpacesAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
@@ -731,7 +731,7 @@ static v8::Handle<v8::Value> withScriptArgumentsAndCallStackAttributeAttrGetter(
     RefPtr<ScriptCallStack> callStack(createScriptCallStackForInspector());
     if (!callStack)
         return v8Undefined();
-    return toV8(imp->withScriptArgumentsAndCallStackAttribute(callStack), v8::Handle<v8::Object>(), info.GetIsolate());
+    return toV8(imp->withScriptArgumentsAndCallStackAttribute(callStack), info.Holder(), info.GetIsolate());
 }
 
 static void withScriptArgumentsAndCallStackAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
@@ -949,7 +949,7 @@ static v8::Handle<v8::Value> contentDocumentAttrGetter(v8::Local<v8::String> nam
     if (!BindingSecurity::shouldAllowAccessToNode(BindingState::instance(), imp->contentDocument()))
         return v8::Handle<v8::Value>(v8::Null(info.GetIsolate()));
 
-    return toV8(imp->contentDocument(), v8::Handle<v8::Object>(), info.GetIsolate());
+    return toV8(imp->contentDocument(), info.Holder(), info.GetIsolate());
 }
 
 static v8::Handle<v8::Value> mutablePointAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
@@ -1111,7 +1111,7 @@ static v8::Handle<v8::Value> objMethodCallback(const v8::Arguments& args)
 {
     INC_STATS("DOM.TestObj.objMethod");
     TestObj* imp = V8TestObj::toNative(args.Holder());
-    return toV8(imp->objMethod(), v8::Handle<v8::Object>(), args.GetIsolate());
+    return toV8(imp->objMethod(), args.Holder(), args.GetIsolate());
 }
 
 static v8::Handle<v8::Value> objMethodWithArgsCallback(const v8::Arguments& args)
@@ -1123,7 +1123,7 @@ static v8::Handle<v8::Value> objMethodWithArgsCallback(const v8::Arguments& args
     EXCEPTION_BLOCK(long long, Arg, toInt64(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined)) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined))) : 0);
-    return toV8(imp->objMethodWithArgs(Arg, strArg, objArg), v8::Handle<v8::Object>(), args.GetIsolate());
+    return toV8(imp->objMethodWithArgs(Arg, strArg, objArg), args.Holder(), args.GetIsolate());
 }
 
 static v8::Handle<v8::Value> methodWithSequenceArgCallback(const v8::Arguments& args)
@@ -1160,7 +1160,7 @@ static v8::Handle<v8::Value> methodThatRequiresAllArgsAndThrowsCallback(const v8
     RefPtr<TestObj> result = imp->methodThatRequiresAllArgsAndThrows(strArg, objArg, ec);
     if (UNLIKELY(ec))
         goto fail;
-    return toV8(result.release(), v8::Handle<v8::Object>(), args.GetIsolate());
+    return toV8(result.release(), args.Holder(), args.GetIsolate());
     }
     fail:
     return setDOMException(ec, args.GetIsolate());
@@ -1267,7 +1267,7 @@ static v8::Handle<v8::Value> withScriptStateObjCallback(const v8::Arguments& arg
     RefPtr<TestObj> result = imp->withScriptStateObj(&state);
     if (state.hadException())
         return throwError(state.exception(), args.GetIsolate());
-    return toV8(result.release(), v8::Handle<v8::Object>(), args.GetIsolate());
+    return toV8(result.release(), args.Holder(), args.GetIsolate());
 }
 
 static v8::Handle<v8::Value> withScriptStateVoidExceptionCallback(const v8::Arguments& args)
@@ -1300,7 +1300,7 @@ static v8::Handle<v8::Value> withScriptStateObjExceptionCallback(const v8::Argum
         goto fail;
     if (state.hadException())
         return throwError(state.exception(), args.GetIsolate());
-    return toV8(result.release(), v8::Handle<v8::Object>(), args.GetIsolate());
+    return toV8(result.release(), args.Holder(), args.GetIsolate());
     }
     fail:
     return setDOMException(ec, args.GetIsolate());
@@ -1346,7 +1346,7 @@ static v8::Handle<v8::Value> withScriptExecutionContextAndScriptStateObjExceptio
         goto fail;
     if (state.hadException())
         return throwError(state.exception(), args.GetIsolate());
-    return toV8(result.release(), v8::Handle<v8::Object>(), args.GetIsolate());
+    return toV8(result.release(), args.Holder(), args.GetIsolate());
     }
     fail:
     return setDOMException(ec, args.GetIsolate());
@@ -1363,7 +1363,7 @@ static v8::Handle<v8::Value> withScriptExecutionContextAndScriptStateWithSpacesC
     RefPtr<TestObj> result = imp->withScriptExecutionContextAndScriptStateWithSpaces(&state, scriptContext);
     if (state.hadException())
         return throwError(state.exception(), args.GetIsolate());
-    return toV8(result.release(), v8::Handle<v8::Object>(), args.GetIsolate());
+    return toV8(result.release(), args.Holder(), args.GetIsolate());
 }
 
 static v8::Handle<v8::Value> withScriptArgumentsAndCallStackCallback(const v8::Arguments& args)
@@ -1833,7 +1833,7 @@ static v8::Handle<v8::Value> getSVGDocumentCallback(const v8::Arguments& args)
     RefPtr<SVGDocument> result = imp->getSVGDocument(ec);
     if (UNLIKELY(ec))
         goto fail;
-    return toV8(result.release(), v8::Handle<v8::Object>(), args.GetIsolate());
+    return toV8(result.release(), args.Holder(), args.GetIsolate());
     }
     fail:
     return setDOMException(ec, args.GetIsolate());
@@ -1919,7 +1919,7 @@ static v8::Handle<v8::Value> strictFunctionCallback(const v8::Arguments& args)
     RefPtr<bool> result = imp->strictFunction(str, a, b, ec);
     if (UNLIKELY(ec))
         goto fail;
-    return toV8(result.release(), v8::Handle<v8::Object>(), args.GetIsolate());
+    return toV8(result.release(), args.Holder(), args.GetIsolate());
     }
     fail:
     return setDOMException(ec, args.GetIsolate());
@@ -2324,7 +2324,6 @@ void V8TestObj::installPerContextProperties(v8::Handle<v8::Object> instance, Tes
 v8::Handle<v8::Object> V8TestObj::wrapSlow(PassRefPtr<TestObj> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
 {
     v8::Handle<v8::Object> wrapper;
-    Frame* frame = 0;
 
     v8::Handle<v8::Context> context;
     if (!creationContext.IsEmpty() && creationContext->CreationContext() != v8::Context::GetCurrent()) {
@@ -2334,9 +2333,12 @@ v8::Handle<v8::Object> V8TestObj::wrapSlow(PassRefPtr<TestObj> impl, v8::Handle<
         ASSERT(!context.IsEmpty());
         context->Enter();
     }
-    wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get());
+
+    wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get());
+
     if (!context.IsEmpty())
         context->Exit();
+
     if (UNLIKELY(wrapper.IsEmpty()))
         return wrapper;
     installPerContextProperties(wrapper, impl.get());
index e424f65..ba4c40d 100644 (file)
@@ -296,7 +296,6 @@ bool V8TestSerializedScriptValueInterface::HasInstance(v8::Handle<v8::Value> val
 v8::Handle<v8::Object> V8TestSerializedScriptValueInterface::wrapSlow(PassRefPtr<TestSerializedScriptValueInterface> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
 {
     v8::Handle<v8::Object> wrapper;
-    Frame* frame = 0;
 
     v8::Handle<v8::Context> context;
     if (!creationContext.IsEmpty() && creationContext->CreationContext() != v8::Context::GetCurrent()) {
@@ -306,9 +305,12 @@ v8::Handle<v8::Object> V8TestSerializedScriptValueInterface::wrapSlow(PassRefPtr
         ASSERT(!context.IsEmpty());
         context->Enter();
     }
-    wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get());
+
+    wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get());
+
     if (!context.IsEmpty())
         context->Exit();
+
     if (UNLIKELY(wrapper.IsEmpty()))
         return wrapper;
     v8::Persistent<v8::Object> wrapperHandle = V8DOMWrapper::setJSWrapperForDOMObject(impl, wrapper, isolate);
index c13e49f..f921486 100644 (file)
@@ -254,6 +254,11 @@ PassRefPtr<XPathNSResolver> toXPathNSResolver(v8::Handle<v8::Value> value)
     return resolver;
 }
 
+v8::Handle<v8::Object> toInnerGlobalObject(v8::Handle<v8::Context> context)
+{
+    return v8::Handle<v8::Object>::Cast(context->Global()->GetPrototype());
+}
+
 DOMWindow* toDOMWindow(v8::Handle<v8::Context> context)
 {
     v8::Handle<v8::Object> global = context->Global();
index f61cfbe..0c9ee4f 100644 (file)
@@ -353,6 +353,7 @@ namespace WebCore {
     PassRefPtr<DOMStringList> toDOMStringList(v8::Handle<v8::Value>);
     PassRefPtr<XPathNSResolver> toXPathNSResolver(v8::Handle<v8::Value>);
 
+    v8::Handle<v8::Object> toInnerGlobalObject(v8::Handle<v8::Context>);
     DOMWindow* toDOMWindow(v8::Handle<v8::Context>);
     ScriptExecutionContext* toScriptExecutionContext(v8::Handle<v8::Context>);
 
index 7e6e4ca..44d7301 100644 (file)
@@ -170,11 +170,6 @@ static void checkDocumentWrapper(v8::Handle<v8::Object> wrapper, Document* docum
     ASSERT(!document->isHTMLDocument() || (V8Document::toNative(v8::Handle<v8::Object>::Cast(wrapper->GetPrototype())) == document));
 }
 
-static v8::Handle<v8::Object> toInnerGlobalObject(v8::Handle<v8::Context> context)
-{
-    return v8::Handle<v8::Object>::Cast(context->Global()->GetPrototype());
-}
-
 PassRefPtr<V8DOMWindowShell> V8DOMWindowShell::create(Frame* frame)
 {
     return adoptRef(new V8DOMWindowShell(frame));
@@ -193,6 +188,8 @@ bool V8DOMWindowShell::isContextInitialized()
 
 void V8DOMWindowShell::disposeContext()
 {
+    m_perContextData.clear();
+
     if (!m_context.isEmpty()) {
         m_frame->loader()->client()->willReleaseScriptContext(m_context.get(), 0);
         m_context.clear();
@@ -203,8 +200,6 @@ void V8DOMWindowShell::disposeContext()
         bool isMainFrame = m_frame->page() && (m_frame->page()->mainFrame() == m_frame); 
         V8GCForContextDispose::instance().notifyContextDisposed(isMainFrame);
     }
-
-    m_perContextData.clear();
 }
 
 void V8DOMWindowShell::destroyGlobal()
index eb25c5b..c94c579 100644 (file)
@@ -157,48 +157,20 @@ PassRefPtr<NodeFilter> V8DOMWrapper::wrapNativeNodeFilter(v8::Handle<v8::Value>
     return NodeFilter::create(V8NodeFilterCondition::create(filter));
 }
 
-v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(Frame* frame, WrapperTypeInfo* type, void* impl)
+v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(WrapperTypeInfo* type, void* impl)
 {
-#if ENABLE(WORKERS)
-    WorkerContext* workerContext = 0;
-#endif
-    if (!frame) {
-        v8::Handle<v8::Context> context = v8::Context::GetCurrent();
-        if (!context.IsEmpty()) {
-            v8::Handle<v8::Object> globalPrototype = v8::Handle<v8::Object>::Cast(context->Global()->GetPrototype());
-            if (isWrapperOfType(globalPrototype, &V8DOMWindow::info)) {
-                Frame* globalFrame = V8DOMWindow::toNative(globalPrototype)->frame();
-                if (globalFrame && globalFrame->script()->canExecuteScripts(NotAboutToExecuteScript))
-                    frame = globalFrame;
-            }
-#if ENABLE(WORKERS)
-            else if (isWrapperOfType(globalPrototype, &V8WorkerContext::info))
-                workerContext = V8WorkerContext::toNative(lookupDOMWrapper(V8WorkerContext::GetTemplate(), context->Global()));
-#endif
-        }
-    }
+    V8PerContextData* perContextData = V8PerContextData::current();
 
-    V8PerContextData* contextData = 0;
-    if (frame)
-        contextData = perContextDataForCurrentWorld(frame);
-#if ENABLE(WORKERS)
-    else if (workerContext)
-        contextData = perContextData(workerContext);
-#endif
+    v8::Local<v8::Object> instance = perContextData ? perContextData->createWrapperFromCache(type) : V8ObjectConstructor::newInstance(type->getTemplate()->GetFunction());
+
+    // Avoid setting the DOM wrapper for failed allocations.
+    if (instance.IsEmpty())
+        return instance;
+
+    setDOMWrapper(instance, type, impl);
+    if (type == &V8HTMLDocument::info)
+        instance = V8HTMLDocument::wrapInShadowObject(instance, static_cast<Node*>(impl));
 
-    v8::Local<v8::Object> instance;
-    if (contextData)
-        instance = contextData->createWrapperFromCache(type);
-    else {
-        v8::Local<v8::Function> function = type->getTemplate()->GetFunction();
-        instance = V8ObjectConstructor::newInstance(function);
-    }
-    if (!instance.IsEmpty()) {
-        // Avoid setting the DOM wrapper for failed allocations.
-        setDOMWrapper(instance, type, impl);
-        if (type == &V8HTMLDocument::info)
-            instance = V8HTMLDocument::wrapInShadowObject(instance, static_cast<Node*>(impl));
-    }
     return instance;
 }
 
index 362a341..a609e32 100644 (file)
@@ -119,7 +119,7 @@ namespace WebCore {
         static void setNamedHiddenReference(v8::Handle<v8::Object> parent, const char* name, v8::Handle<v8::Value> child);
         static void setNamedHiddenWindowReference(Frame*, const char*, v8::Handle<v8::Value>);
 
-        static v8::Local<v8::Object> instantiateV8Object(Frame*, WrapperTypeInfo*, void*);
+        static v8::Local<v8::Object> instantiateV8Object(WrapperTypeInfo*, void*);
 
         static v8::Handle<v8::Object> getCachedWrapper(Node* node)
         {
index 40c700f..f859195 100644 (file)
@@ -44,6 +44,7 @@ namespace WebCore {
     V(event) \
     V(listener) \
     V(ownerNode) \
+    V(perContextData) \
     V(scriptState) \
     V(sleepFunction) \
     V(state) \
index e57029b..945b7bf 100644 (file)
 #include "config.h"
 #include "V8PerContextData.h"
 
+#include "V8Binding.h"
+#include "V8HiddenPropertyName.h"
 #include "V8ObjectConstructor.h"
 
 namespace WebCore {
 
+V8PerContextData* V8PerContextData::current()
+{
+    v8::Handle<v8::Value> wrappedPerContextData = toInnerGlobalObject(v8::Context::GetCurrent())->GetHiddenValue(V8HiddenPropertyName::perContextData());
+    if (wrappedPerContextData.IsEmpty())
+        return 0;
+    return static_cast<V8PerContextData*>(v8::External::Unwrap(wrappedPerContextData));
+}
+
 void V8PerContextData::dispose()
 {
+    v8::HandleScope handleScope;
+    toInnerGlobalObject(m_context)->DeleteHiddenValue(V8HiddenPropertyName::perContextData());
+
     {
         WrapperBoilerplateMap::iterator it = m_wrapperBoilerplates.begin();
         for (; it != m_wrapperBoilerplates.end(); ++it) {
@@ -73,6 +86,8 @@ void V8PerContextData::dispose()
 
 bool V8PerContextData::init()
 {
+    toInnerGlobalObject(m_context)->SetHiddenValue(V8HiddenPropertyName::perContextData(), v8::External::Wrap(this));
+
     v8::Handle<v8::String> prototypeString = v8::String::NewSymbol("prototype");
     if (prototypeString.IsEmpty())
         return false;
index 20e910c..9f651e6 100644 (file)
@@ -53,6 +53,8 @@ public:
 
     bool init();
 
+    static V8PerContextData* current();
+
     // 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.