Changeset 127955 in webkit
- Timestamp:
- Sep 7, 2012 6:39:13 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r127954 r127955 1 2012-09-07 Adam Barth <abarth@chromium.org> 2 3 [V8] DOM wrapper creation involves a bunch of sketchy code related to finding the Frame 4 https://bugs.webkit.org/show_bug.cgi?id=96147 5 6 Reviewed by Eric Seidel. 7 8 The V8 results for this test now match the JSC results. We can remove 9 the chromium-specific baseline. 10 11 * platform/chromium/fast/workers/storage/test-authorizer-sync-expected.txt: Removed. 12 1 13 2012-09-07 James Robinson <jamesr@chromium.org> 2 14 -
trunk/Source/WebCore/ChangeLog
r127952 r127955 1 2012-09-07 Adam Barth <abarth@chromium.org> 2 3 [V8] DOM wrapper creation involves a bunch of sketchy code related to finding the Frame 4 https://bugs.webkit.org/show_bug.cgi?id=96147 5 6 Reviewed by Eric Seidel. 7 8 Previously, we used the Frame when instantiating DOM wrappers. That's 9 sketchy because not all DOM wrappers know how to find their Frame, and 10 the Frame might be displaying a different document now anyway. This 11 patch now gets all the information directly from the creation context. 12 13 In addition, this patch gets the proper creation context in a few more 14 cases, including Location. 15 16 * bindings/scripts/CodeGeneratorV8.pm: 17 (GetInternalFields): 18 (GenerateNormalAttrGetter): 19 (GenerateToV8Converters): 20 (GenerateFunctionCallString): 21 (NativeToJSValue): 22 * bindings/scripts/test/V8/V8Float64Array.cpp: 23 (WebCore::Float64ArrayV8Internal::fooCallback): 24 (WebCore::V8Float64Array::wrapSlow): 25 * bindings/scripts/test/V8/V8TestActiveDOMObject.cpp: 26 (WebCore::V8TestActiveDOMObject::wrapSlow): 27 * bindings/scripts/test/V8/V8TestCallback.cpp: 28 (WebCore::V8TestCallback::callbackWithClass1Param): 29 (WebCore::V8TestCallback::callbackWithClass2Param): 30 (WebCore::V8TestCallback::callbackWithStringList): 31 (WebCore::V8TestCallback::callbackRequiresThisToPass): 32 * bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp: 33 (WebCore::V8TestCustomNamedGetter::wrapSlow): 34 * bindings/scripts/test/V8/V8TestEventConstructor.cpp: 35 (WebCore::V8TestEventConstructor::wrapSlow): 36 * bindings/scripts/test/V8/V8TestEventTarget.cpp: 37 (WebCore::TestEventTargetV8Internal::itemCallback): 38 (WebCore::V8TestEventTarget::wrapSlow): 39 * bindings/scripts/test/V8/V8TestException.cpp: 40 (WebCore::V8TestException::wrapSlow): 41 * bindings/scripts/test/V8/V8TestInterface.cpp: 42 (WebCore::TestInterfaceV8Internal::supplementalNodeAttrGetter): 43 (WebCore::TestInterfaceV8Internal::supplementalMethod2Callback): 44 (WebCore::V8TestInterface::wrapSlow): 45 * bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp: 46 (WebCore::V8TestMediaQueryListListener::wrapSlow): 47 * bindings/scripts/test/V8/V8TestNamedConstructor.cpp: 48 (WebCore::V8TestNamedConstructor::wrapSlow): 49 * bindings/scripts/test/V8/V8TestNode.cpp: 50 (WebCore::V8TestNode::wrapSlow): 51 * bindings/scripts/test/V8/V8TestObj.cpp: 52 (WebCore::TestObjV8Internal::testObjAttrAttrGetter): 53 (WebCore::TestObjV8Internal::XMLObjAttrAttrGetter): 54 (WebCore::TestObjV8Internal::typedArrayAttrAttrGetter): 55 (WebCore::TestObjV8Internal::withScriptExecutionContextAttributeAttrGetter): 56 (WebCore::TestObjV8Internal::withScriptStateAttributeRaisesAttrGetter): 57 (WebCore::TestObjV8Internal::withScriptExecutionContextAttributeRaisesAttrGetter): 58 (WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeAttrGetter): 59 (WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeRaisesAttrGetter): 60 (WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateWithSpacesAttributeAttrGetter): 61 (WebCore::TestObjV8Internal::withScriptArgumentsAndCallStackAttributeAttrGetter): 62 (WebCore::TestObjV8Internal::contentDocumentAttrGetter): 63 (WebCore::TestObjV8Internal::objMethodCallback): 64 (WebCore::TestObjV8Internal::objMethodWithArgsCallback): 65 (WebCore::TestObjV8Internal::methodThatRequiresAllArgsAndThrowsCallback): 66 (WebCore::TestObjV8Internal::withScriptStateObjCallback): 67 (WebCore::TestObjV8Internal::withScriptStateObjExceptionCallback): 68 (WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateObjExceptionCallback): 69 (WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateWithSpacesCallback): 70 (WebCore::TestObjV8Internal::getSVGDocumentCallback): 71 (WebCore::TestObjV8Internal::strictFunctionCallback): 72 (WebCore::V8TestObj::wrapSlow): 73 * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp: 74 (WebCore::V8TestSerializedScriptValueInterface::wrapSlow): 75 * bindings/v8/V8DOMWindowShell.cpp: 76 (WebCore::V8DOMWindowShell::disposeContext): 77 * bindings/v8/V8DOMWrapper.cpp: 78 (WebCore::V8DOMWrapper::instantiateV8Object): 79 * bindings/v8/V8DOMWrapper.h: 80 (V8DOMWrapper): 81 * bindings/v8/V8PerContextData.cpp: 82 (WebCore): 83 (WebCore::V8PerContextData::current): 84 (WebCore::V8PerContextData::dispose): 85 (WebCore::V8PerContextData::init): 86 * bindings/v8/V8PerContextData.h: 87 (V8PerContextData): 88 1 89 2012-09-07 James Robinson <jamesr@chromium.org> 2 90 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
r127946 r127955 561 561 562 562 my @customInternalFields = (); 563 564 if ($name eq "DOMWindow" || $dataNode->extendedAttributes->{"IsWorkerContext"}) { 565 push(@customInternalFields, "perContextDataIndex"); 566 } 567 563 568 # We can't ask whether a parent type has a given extendedAttribute, 564 569 # so special-case AbstractWorker and WorkerContext to include all sub-types. … … 1088 1093 END 1089 1094 } else { 1090 push(@implContentDecls, " " . ReturnNativeToJSValue($attribute->signature, $result, "info. GetIsolate()").";\n");1095 push(@implContentDecls, " " . ReturnNativeToJSValue($attribute->signature, $result, "info.Holder()", "info.GetIsolate()").";\n"); 1091 1096 } 1092 1097 } … … 3360 3365 3361 3366 AddToImplIncludes("Frame.h"); 3362 my $frame = "0";3363 if (IsNodeSubType($dataNode)) {3364 # DocumentType nodes are the only nodes that may have a NULL document.3365 if ($interfaceName eq "DocumentType") {3366 $frame = "impl->document() ? impl->document()->frame() : 0";3367 } else {3368 $frame = "impl->document()->frame()";3369 }3370 }3371 push(@implContent, <<END);3372 Frame* frame = $frame;3373 END3374 3367 3375 3368 if (IsSubType($dataNode, "Document")) { 3376 3369 push(@implContent, <<END); 3377 if (frame && frame->script()->windowShell()->context().IsEmpty() && frame->script()->windowShell()->initializeIfNeeded()) { 3378 // initializeIfNeeded may have created a wrapper for the object, retry from the start. 3379 return ${className}::wrap(impl.get(), creationContext, isolate); 3380 } 3381 END 3382 } 3383 3384 # FIXME: We need a better way of recovering the correct prototype chain 3385 # for every sort of object. For now, we special-case cross-origin visible 3386 # objects (i.e., those with CheckSecurity). 3387 if (IsVisibleAcrossOrigins($dataNode)) { 3388 AddToImplIncludes("Frame.h"); 3389 push(@implContent, <<END); 3390 if (impl->frame()) { 3391 frame = impl->frame(); 3392 frame->script()->windowShell()->initializeIfNeeded(); 3370 if (Frame* frame = impl->frame()) { 3371 if (frame->script()->windowShell()->context().IsEmpty() && frame->script()->windowShell()->initializeIfNeeded()) { 3372 // initializeIfNeeded may have created a wrapper for the object, retry from the start. 3373 return ${className}::wrap(impl.get(), creationContext, isolate); 3374 } 3393 3375 } 3394 3376 END … … 3405 3387 context->Enter(); 3406 3388 } 3407 END 3408 3409 push(@implContent, <<END); 3410 wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); 3411 END 3412 3413 push(@implContent, <<END); 3389 3390 wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get()); 3391 3414 3392 if (!context.IsEmpty()) 3415 3393 context->Exit(); 3416 END 3417 3418 push(@implContent, <<END); 3394 3419 3395 if (UNLIKELY(wrapper.IsEmpty())) 3420 3396 return wrapper; … … 3592 3568 3593 3569 $return .= ".release()" if ($returnIsRef); 3594 $result .= $indent . ReturnNativeToJSValue($function->signature, $return, "args. GetIsolate()") . ";\n";3570 $result .= $indent . ReturnNativeToJSValue($function->signature, $return, "args.Holder()", "args.GetIsolate()") . ";\n"; 3595 3571 3596 3572 return $result; … … 4023 3999 my $signature = shift; 4024 4000 my $value = shift; 4001 my $getCreationContext = shift; 4002 my $getCreationContextArg = $getCreationContext ? ", $getCreationContext" : ""; 4025 4003 my $getIsolate = shift; 4026 4004 my $getIsolateArg = $getIsolate ? ", $getIsolate" : ""; … … 4079 4057 AddToImplIncludes("$sequenceType.h"); 4080 4058 } 4081 return "v8Array($value , $getIsolate)";4059 return "v8Array($value$getIsolateArg)"; 4082 4060 } 4083 4061 … … 4086 4064 # special case for non-DOM node interfaces 4087 4065 if (IsDOMNodeType($type)) { 4088 return "toV8(${value} , v8::Handle<v8::Object>()" . ($signature->extendedAttributes->{"ReturnNewObject"} ? "$getIsolateArg, true)" : "$getIsolateArg)");4066 return "toV8(${value}$getCreationContextArg$getIsolateArg" . ($signature->extendedAttributes->{"ReturnNewObject"} ? ", true)" : ")"); 4089 4067 } 4090 4068 4091 4069 if ($type eq "EventTarget") { 4092 return "V8DOMWrapper::convertEventTargetToV8Object($value , v8::Handle<v8::Object>()$getIsolateArg)";4070 return "V8DOMWrapper::convertEventTargetToV8Object($value$getCreationContextArg$getIsolateArg)"; 4093 4071 } 4094 4072 … … 4107 4085 AddToImplIncludes("wtf/GetPtr.h"); 4108 4086 4109 return "toV8($value , v8::Handle<v8::Object>()$getIsolateArg)";4087 return "toV8($value$getCreationContextArg$getIsolateArg)"; 4110 4088 } 4111 4089 -
trunk/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp
r127946 r127955 57 57 Float64Array* imp = V8Float64Array::toNative(args.Holder()); 58 58 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); 59 return toV8(imp->foo(array), v8::Handle<v8::Object>(), args.GetIsolate());59 return toV8(imp->foo(array), args.Holder(), args.GetIsolate()); 60 60 } 61 61 … … 152 152 v8::Handle<v8::Object> wrapper; 153 153 ASSERT(static_cast<void*>(static_cast<ArrayBufferView*>(impl.get())) == static_cast<void*>(impl.get())); 154 Frame* frame = 0;155 154 156 155 v8::Handle<v8::Context> context; … … 162 161 context->Enter(); 163 162 } 164 wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); 163 164 wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get()); 165 165 166 if (!context.IsEmpty()) 166 167 context->Exit(); 168 167 169 if (UNLIKELY(wrapper.IsEmpty())) 168 170 return wrapper; -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp
r127946 r127955 180 180 { 181 181 v8::Handle<v8::Object> wrapper; 182 Frame* frame = 0;183 if (impl->frame()) {184 frame = impl->frame();185 frame->script()->windowShell()->initializeIfNeeded();186 }187 182 188 183 v8::Handle<v8::Context> context; … … 194 189 context->Enter(); 195 190 } 196 wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); 191 192 wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get()); 193 197 194 if (!context.IsEmpty()) 198 195 context->Exit(); 196 199 197 if (UNLIKELY(wrapper.IsEmpty())) 200 198 return wrapper; -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp
r127946 r127955 87 87 v8::Context::Scope scope(v8Context); 88 88 89 v8::Handle<v8::Value> class1ParamHandle = toV8(class1Param , v8::Handle<v8::Object>());89 v8::Handle<v8::Value> class1ParamHandle = toV8(class1Param); 90 90 if (class1ParamHandle.IsEmpty()) { 91 91 if (!isScriptControllerTerminating()) … … 115 115 v8::Context::Scope scope(v8Context); 116 116 117 v8::Handle<v8::Value> class2ParamHandle = toV8(class2Param , v8::Handle<v8::Object>());117 v8::Handle<v8::Value> class2ParamHandle = toV8(class2Param); 118 118 if (class2ParamHandle.IsEmpty()) { 119 119 if (!isScriptControllerTerminating()) … … 150 150 v8::Context::Scope scope(v8Context); 151 151 152 v8::Handle<v8::Value> listParamHandle = toV8(listParam , v8::Handle<v8::Object>());152 v8::Handle<v8::Value> listParamHandle = toV8(listParam); 153 153 if (listParamHandle.IsEmpty()) { 154 154 if (!isScriptControllerTerminating()) … … 208 208 v8::Context::Scope scope(v8Context); 209 209 210 v8::Handle<v8::Value> class8ParamHandle = toV8(class8Param , v8::Handle<v8::Object>());210 v8::Handle<v8::Value> class8ParamHandle = toV8(class8Param); 211 211 if (class8ParamHandle.IsEmpty()) { 212 212 if (!isScriptControllerTerminating()) … … 214 214 return true; 215 215 } 216 v8::Handle<v8::Value> thisClassParamHandle = toV8(thisClassParam , v8::Handle<v8::Object>());216 v8::Handle<v8::Value> thisClassParamHandle = toV8(thisClassParam); 217 217 if (thisClassParamHandle.IsEmpty()) { 218 218 if (!isScriptControllerTerminating()) -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp
r127946 r127955 114 114 { 115 115 v8::Handle<v8::Object> wrapper; 116 Frame* frame = 0;117 116 118 117 v8::Handle<v8::Context> context; … … 124 123 context->Enter(); 125 124 } 126 wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); 125 126 wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get()); 127 127 128 if (!context.IsEmpty()) 128 129 context->Exit(); 130 129 131 if (UNLIKELY(wrapper.IsEmpty())) 130 132 return wrapper; -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp
r127946 r127955 151 151 { 152 152 v8::Handle<v8::Object> wrapper; 153 Frame* frame = 0;154 153 155 154 v8::Handle<v8::Context> context; … … 161 160 context->Enter(); 162 161 } 163 wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); 162 163 wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get()); 164 164 165 if (!context.IsEmpty()) 165 166 context->Exit(); 167 166 168 if (UNLIKELY(wrapper.IsEmpty())) 167 169 return wrapper; -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp
r127946 r127955 56 56 goto fail; 57 57 } 58 return toV8(imp->item(index), v8::Handle<v8::Object>(), args.GetIsolate());58 return toV8(imp->item(index), args.Holder(), args.GetIsolate()); 59 59 } 60 60 fail: … … 175 175 { 176 176 v8::Handle<v8::Object> wrapper; 177 Frame* frame = 0;178 177 179 178 v8::Handle<v8::Context> context; … … 185 184 context->Enter(); 186 185 } 187 wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); 186 187 wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get()); 188 188 189 if (!context.IsEmpty()) 189 190 context->Exit(); 191 190 192 if (UNLIKELY(wrapper.IsEmpty())) 191 193 return wrapper; -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp
r127946 r127955 105 105 { 106 106 v8::Handle<v8::Object> wrapper; 107 Frame* frame = 0;108 107 109 108 v8::Handle<v8::Context> context; … … 115 114 context->Enter(); 116 115 } 117 wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); 116 117 wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get()); 118 118 119 if (!context.IsEmpty()) 119 120 context->Exit(); 121 120 122 if (UNLIKELY(wrapper.IsEmpty())) 121 123 return wrapper; -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp
r127946 r127955 121 121 INC_STATS("DOM.TestInterface.supplementalNode._get"); 122 122 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 123 return toV8(TestSupplemental::supplementalNode(imp), v8::Handle<v8::Object>(), info.GetIsolate());123 return toV8(TestSupplemental::supplementalNode(imp), info.Holder(), info.GetIsolate()); 124 124 } 125 125 … … 169 169 if (UNLIKELY(ec)) 170 170 goto fail; 171 return toV8(result.release(), v8::Handle<v8::Object>(), args.GetIsolate());171 return toV8(result.release(), args.Holder(), args.GetIsolate()); 172 172 } 173 173 fail: … … 348 348 { 349 349 v8::Handle<v8::Object> wrapper; 350 Frame* frame = 0;351 350 352 351 v8::Handle<v8::Context> context; … … 358 357 context->Enter(); 359 358 } 360 wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); 359 360 wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get()); 361 361 362 if (!context.IsEmpty()) 362 363 context->Exit(); 364 363 365 if (UNLIKELY(wrapper.IsEmpty())) 364 366 return wrapper; -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp
r127946 r127955 114 114 { 115 115 v8::Handle<v8::Object> wrapper; 116 Frame* frame = 0;117 116 118 117 v8::Handle<v8::Context> context; … … 124 123 context->Enter(); 125 124 } 126 wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); 125 126 wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get()); 127 127 128 if (!context.IsEmpty()) 128 129 context->Exit(); 130 129 131 if (UNLIKELY(wrapper.IsEmpty())) 130 132 return wrapper; -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp
r127946 r127955 158 158 { 159 159 v8::Handle<v8::Object> wrapper; 160 Frame* frame = 0;161 160 162 161 v8::Handle<v8::Context> context; … … 168 167 context->Enter(); 169 168 } 170 wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); 169 170 wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get()); 171 171 172 if (!context.IsEmpty()) 172 173 context->Exit(); 174 173 175 if (UNLIKELY(wrapper.IsEmpty())) 174 176 return wrapper; -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp
r127946 r127955 114 114 v8::Handle<v8::Object> wrapper; 115 115 ASSERT(static_cast<void*>(static_cast<Node*>(impl.get())) == static_cast<void*>(impl.get())); 116 Frame* frame = impl->document()->frame();117 116 118 117 v8::Handle<v8::Context> context; … … 124 123 context->Enter(); 125 124 } 126 wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); 125 126 wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get()); 127 127 128 if (!context.IsEmpty()) 128 129 context->Exit(); 130 129 131 if (UNLIKELY(wrapper.IsEmpty())) 130 132 return wrapper; -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
r127946 r127955 230 230 INC_STATS("DOM.TestObj.testObjAttr._get"); 231 231 TestObj* imp = V8TestObj::toNative(info.Holder()); 232 return toV8(imp->testObjAttr(), v8::Handle<v8::Object>(), info.GetIsolate());232 return toV8(imp->testObjAttr(), info.Holder(), info.GetIsolate()); 233 233 } 234 234 … … 246 246 INC_STATS("DOM.TestObj.XMLObjAttr._get"); 247 247 TestObj* imp = V8TestObj::toNative(info.Holder()); 248 return toV8(imp->xmlObjAttr(), v8::Handle<v8::Object>(), info.GetIsolate());248 return toV8(imp->xmlObjAttr(), info.Holder(), info.GetIsolate()); 249 249 } 250 250 … … 422 422 INC_STATS("DOM.TestObj.typedArrayAttr._get"); 423 423 TestObj* imp = V8TestObj::toNative(info.Holder()); 424 return toV8(imp->typedArrayAttr(), v8::Handle<v8::Object>(), info.GetIsolate());424 return toV8(imp->typedArrayAttr(), info.Holder(), info.GetIsolate()); 425 425 } 426 426 … … 549 549 if (!scriptContext) 550 550 return v8Undefined(); 551 return toV8(imp->withScriptExecutionContextAttribute(scriptContext), v8::Handle<v8::Object>(), info.GetIsolate());551 return toV8(imp->withScriptExecutionContextAttribute(scriptContext), info.Holder(), info.GetIsolate()); 552 552 } 553 553 … … 577 577 if (state.hadException()) 578 578 return throwError(state.exception(), info.GetIsolate()); 579 return toV8(v.release(), v8::Handle<v8::Object>(), info.GetIsolate());579 return toV8(v.release(), info.Holder(), info.GetIsolate()); 580 580 } 581 581 … … 608 608 if (UNLIKELY(ec)) 609 609 return setDOMException(ec, info.GetIsolate()); 610 return toV8(v.release(), v8::Handle<v8::Object>(), info.GetIsolate());610 return toV8(v.release(), info.Holder(), info.GetIsolate()); 611 611 } 612 612 … … 636 636 if (!scriptContext) 637 637 return v8Undefined(); 638 return toV8(imp->withScriptExecutionContextAndScriptStateAttribute(state, scriptContext), v8::Handle<v8::Object>(), info.GetIsolate());638 return toV8(imp->withScriptExecutionContextAndScriptStateAttribute(state, scriptContext), info.Holder(), info.GetIsolate()); 639 639 } 640 640 … … 672 672 if (state.hadException()) 673 673 return throwError(state.exception(), info.GetIsolate()); 674 return toV8(v.release(), v8::Handle<v8::Object>(), info.GetIsolate());674 return toV8(v.release(), info.Holder(), info.GetIsolate()); 675 675 } 676 676 … … 705 705 if (!scriptContext) 706 706 return v8Undefined(); 707 return toV8(imp->withScriptExecutionContextAndScriptStateWithSpacesAttribute(state, scriptContext), v8::Handle<v8::Object>(), info.GetIsolate());707 return toV8(imp->withScriptExecutionContextAndScriptStateWithSpacesAttribute(state, scriptContext), info.Holder(), info.GetIsolate()); 708 708 } 709 709 … … 732 732 if (!callStack) 733 733 return v8Undefined(); 734 return toV8(imp->withScriptArgumentsAndCallStackAttribute(callStack), v8::Handle<v8::Object>(), info.GetIsolate());734 return toV8(imp->withScriptArgumentsAndCallStackAttribute(callStack), info.Holder(), info.GetIsolate()); 735 735 } 736 736 … … 950 950 return v8::Handle<v8::Value>(v8::Null(info.GetIsolate())); 951 951 952 return toV8(imp->contentDocument(), v8::Handle<v8::Object>(), info.GetIsolate());952 return toV8(imp->contentDocument(), info.Holder(), info.GetIsolate()); 953 953 } 954 954 … … 1112 1112 INC_STATS("DOM.TestObj.objMethod"); 1113 1113 TestObj* imp = V8TestObj::toNative(args.Holder()); 1114 return toV8(imp->objMethod(), v8::Handle<v8::Object>(), args.GetIsolate());1114 return toV8(imp->objMethod(), args.Holder(), args.GetIsolate()); 1115 1115 } 1116 1116 … … 1124 1124 STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)); 1125 1125 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); 1126 return toV8(imp->objMethodWithArgs(Arg, strArg, objArg), v8::Handle<v8::Object>(), args.GetIsolate());1126 return toV8(imp->objMethodWithArgs(Arg, strArg, objArg), args.Holder(), args.GetIsolate()); 1127 1127 } 1128 1128 … … 1161 1161 if (UNLIKELY(ec)) 1162 1162 goto fail; 1163 return toV8(result.release(), v8::Handle<v8::Object>(), args.GetIsolate());1163 return toV8(result.release(), args.Holder(), args.GetIsolate()); 1164 1164 } 1165 1165 fail: … … 1268 1268 if (state.hadException()) 1269 1269 return throwError(state.exception(), args.GetIsolate()); 1270 return toV8(result.release(), v8::Handle<v8::Object>(), args.GetIsolate());1270 return toV8(result.release(), args.Holder(), args.GetIsolate()); 1271 1271 } 1272 1272 … … 1301 1301 if (state.hadException()) 1302 1302 return throwError(state.exception(), args.GetIsolate()); 1303 return toV8(result.release(), v8::Handle<v8::Object>(), args.GetIsolate());1303 return toV8(result.release(), args.Holder(), args.GetIsolate()); 1304 1304 } 1305 1305 fail: … … 1347 1347 if (state.hadException()) 1348 1348 return throwError(state.exception(), args.GetIsolate()); 1349 return toV8(result.release(), v8::Handle<v8::Object>(), args.GetIsolate());1349 return toV8(result.release(), args.Holder(), args.GetIsolate()); 1350 1350 } 1351 1351 fail: … … 1364 1364 if (state.hadException()) 1365 1365 return throwError(state.exception(), args.GetIsolate()); 1366 return toV8(result.release(), v8::Handle<v8::Object>(), args.GetIsolate());1366 return toV8(result.release(), args.Holder(), args.GetIsolate()); 1367 1367 } 1368 1368 … … 1834 1834 if (UNLIKELY(ec)) 1835 1835 goto fail; 1836 return toV8(result.release(), v8::Handle<v8::Object>(), args.GetIsolate());1836 return toV8(result.release(), args.Holder(), args.GetIsolate()); 1837 1837 } 1838 1838 fail: … … 1920 1920 if (UNLIKELY(ec)) 1921 1921 goto fail; 1922 return toV8(result.release(), v8::Handle<v8::Object>(), args.GetIsolate());1922 return toV8(result.release(), args.Holder(), args.GetIsolate()); 1923 1923 } 1924 1924 fail: … … 2325 2325 { 2326 2326 v8::Handle<v8::Object> wrapper; 2327 Frame* frame = 0;2328 2327 2329 2328 v8::Handle<v8::Context> context; … … 2335 2334 context->Enter(); 2336 2335 } 2337 wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); 2336 2337 wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get()); 2338 2338 2339 if (!context.IsEmpty()) 2339 2340 context->Exit(); 2341 2340 2342 if (UNLIKELY(wrapper.IsEmpty())) 2341 2343 return wrapper; -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp
r127946 r127955 297 297 { 298 298 v8::Handle<v8::Object> wrapper; 299 Frame* frame = 0;300 299 301 300 v8::Handle<v8::Context> context; … … 307 306 context->Enter(); 308 307 } 309 wrapper = V8DOMWrapper::instantiateV8Object(frame, &info, impl.get()); 308 309 wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get()); 310 310 311 if (!context.IsEmpty()) 311 312 context->Exit(); 313 312 314 if (UNLIKELY(wrapper.IsEmpty())) 313 315 return wrapper; -
trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp
r127946 r127955 194 194 void V8DOMWindowShell::disposeContext() 195 195 { 196 m_perContextData.clear(); 197 196 198 if (!m_context.isEmpty()) { 197 199 m_frame->loader()->client()->willReleaseScriptContext(m_context.get(), 0); … … 204 206 V8GCForContextDispose::instance().notifyContextDisposed(isMainFrame); 205 207 } 206 207 m_perContextData.clear();208 208 } 209 209 -
trunk/Source/WebCore/bindings/v8/V8DOMWrapper.cpp
r127946 r127955 158 158 } 159 159 160 v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(Frame* frame, WrapperTypeInfo* type, void* impl) 161 { 162 #if ENABLE(WORKERS) 163 WorkerContext* workerContext = 0; 164 #endif 165 if (!frame) { 166 v8::Handle<v8::Context> context = v8::Context::GetCurrent(); 167 if (!context.IsEmpty()) { 168 v8::Handle<v8::Object> globalPrototype = v8::Handle<v8::Object>::Cast(context->Global()->GetPrototype()); 169 if (isWrapperOfType(globalPrototype, &V8DOMWindow::info)) { 170 Frame* globalFrame = V8DOMWindow::toNative(globalPrototype)->frame(); 171 if (globalFrame && globalFrame->script()->canExecuteScripts(NotAboutToExecuteScript)) 172 frame = globalFrame; 173 } 174 #if ENABLE(WORKERS) 175 else if (isWrapperOfType(globalPrototype, &V8WorkerContext::info)) 176 workerContext = V8WorkerContext::toNative(lookupDOMWrapper(V8WorkerContext::GetTemplate(), context->Global())); 177 #endif 178 } 179 } 180 181 V8PerContextData* contextData = 0; 182 if (frame) 183 contextData = perContextDataForCurrentWorld(frame); 184 #if ENABLE(WORKERS) 185 else if (workerContext) 186 contextData = perContextData(workerContext); 187 #endif 188 189 v8::Local<v8::Object> instance; 190 if (contextData) 191 instance = contextData->createWrapperFromCache(type); 192 else { 193 v8::Local<v8::Function> function = type->getTemplate()->GetFunction(); 194 instance = V8ObjectConstructor::newInstance(function); 195 } 196 if (!instance.IsEmpty()) { 197 // Avoid setting the DOM wrapper for failed allocations. 198 setDOMWrapper(instance, type, impl); 199 if (type == &V8HTMLDocument::info) 200 instance = V8HTMLDocument::wrapInShadowObject(instance, static_cast<Node*>(impl)); 201 } 160 v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(WrapperTypeInfo* type, void* impl) 161 { 162 V8PerContextData* perContextData = V8PerContextData::current(); 163 164 v8::Local<v8::Object> instance = perContextData ? perContextData->createWrapperFromCache(type) : V8ObjectConstructor::newInstance(type->getTemplate()->GetFunction()); 165 166 // Avoid setting the DOM wrapper for failed allocations. 167 if (instance.IsEmpty()) 168 return instance; 169 170 setDOMWrapper(instance, type, impl); 171 if (type == &V8HTMLDocument::info) 172 instance = V8HTMLDocument::wrapInShadowObject(instance, static_cast<Node*>(impl)); 173 202 174 return instance; 203 175 } -
trunk/Source/WebCore/bindings/v8/V8DOMWrapper.h
r127946 r127955 120 120 static void setNamedHiddenWindowReference(Frame*, const char*, v8::Handle<v8::Value>); 121 121 122 static v8::Local<v8::Object> instantiateV8Object( Frame*,WrapperTypeInfo*, void*);122 static v8::Local<v8::Object> instantiateV8Object(WrapperTypeInfo*, void*); 123 123 124 124 static v8::Handle<v8::Object> getCachedWrapper(Node* node) -
trunk/Source/WebCore/bindings/v8/V8PerContextData.cpp
r126926 r127955 32 32 #include "V8PerContextData.h" 33 33 34 #include "V8DOMWindow.h" 34 35 #include "V8ObjectConstructor.h" 36 #include "V8WorkerContext.h" 35 37 36 38 namespace WebCore { 37 39 40 static const int perContextDataIndex = V8DOMWindow::perContextDataIndex; 41 COMPILE_ASSERT(V8DOMWindow::perContextDataIndex == V8WorkerContext::perContextDataIndex, DOMWindowAndWorkerContextMustHaveTheSamePerContextDataIndex); 42 43 V8PerContextData* V8PerContextData::current() 44 { 45 return static_cast<V8PerContextData*>(v8::Handle<v8::Object>::Cast(v8::Context::GetCurrent()->Global()->GetPrototype())->GetPointerFromInternalField(perContextDataIndex)); 46 } 47 38 48 void V8PerContextData::dispose() 39 49 { 50 v8::HandleScope handleScope; 51 v8::Handle<v8::Object>::Cast(m_context->Global()->GetPrototype())->SetPointerInInternalField(perContextDataIndex, 0); 52 40 53 { 41 54 WrapperBoilerplateMap::iterator it = m_wrapperBoilerplates.begin(); … … 74 87 bool V8PerContextData::init() 75 88 { 89 v8::Handle<v8::Object>::Cast(m_context->Global()->GetPrototype())->SetPointerInInternalField(perContextDataIndex, this); 90 76 91 v8::Handle<v8::String> prototypeString = v8::String::NewSymbol("prototype"); 77 92 if (prototypeString.IsEmpty()) -
trunk/Source/WebCore/bindings/v8/V8PerContextData.h
r126484 r127955 54 54 bool init(); 55 55 56 static V8PerContextData* current(); 57 56 58 // To create JS Wrapper objects, we create a cache of a 'boiler plate' 57 59 // object, and then simply Clone that object each time we need a new one.
Note: See TracChangeset
for help on using the changeset viewer.