Chromium Code Reviews| Index: Source/bindings/core/v8/V8PerContextData.cpp |
| diff --git a/Source/bindings/core/v8/V8PerContextData.cpp b/Source/bindings/core/v8/V8PerContextData.cpp |
| index 2c2bdcc59c470684f014387238f38ede14051a60..fc0dc5df2aef8630bece77608f9a6af5bba84435 100644 |
| --- a/Source/bindings/core/v8/V8PerContextData.cpp |
| +++ b/Source/bindings/core/v8/V8PerContextData.cpp |
| @@ -40,7 +40,7 @@ |
| namespace blink { |
| -V8PerContextData::V8PerContextData(v8::Handle<v8::Context> context) |
| +V8PerContextData::V8PerContextData(v8::Local<v8::Context> context) |
| : m_isolate(context->GetIsolate()) |
| , m_wrapperBoilerplates(m_isolate) |
| , m_constructorMap(m_isolate) |
| @@ -53,10 +53,9 @@ V8PerContextData::V8PerContextData(v8::Handle<v8::Context> context) |
| v8::Context::Scope contextScope(context); |
| ASSERT(m_errorPrototype.isEmpty()); |
| - v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(context->Global()->Get(v8AtomicString(m_isolate, "Error"))); |
| - ASSERT(!object.IsEmpty()); |
| - v8::Handle<v8::Value> prototypeValue = object->Get(v8AtomicString(m_isolate, "prototype")); |
| - ASSERT(!prototypeValue.IsEmpty()); |
| + v8::Local<v8::Value> objectValue = context->Global()->Get(context, v8AtomicString(m_isolate, "Error")).ToLocalChecked(); |
| + ASSERT(objectValue->IsObject()); |
|
haraken
2015/04/07 08:56:43
This ASSERT won't be needed, since the following A
bashi
2015/04/07 09:37:31
Removed.
|
| + v8::Local<v8::Value> prototypeValue = objectValue.As<v8::Object>()->Get(context, v8AtomicString(m_isolate, "prototype")).ToLocalChecked(); |
| m_errorPrototype.set(m_isolate, prototypeValue); |
| } |
| @@ -64,12 +63,12 @@ V8PerContextData::~V8PerContextData() |
| { |
| } |
| -PassOwnPtr<V8PerContextData> V8PerContextData::create(v8::Handle<v8::Context> context) |
| +PassOwnPtr<V8PerContextData> V8PerContextData::create(v8::Local<v8::Context> context) |
| { |
| return adoptPtr(new V8PerContextData(context)); |
| } |
| -V8PerContextData* V8PerContextData::from(v8::Handle<v8::Context> context) |
| +V8PerContextData* V8PerContextData::from(v8::Local<v8::Context> context) |
| { |
| return ScriptState::from(context)->perContextData(); |
| } |
| @@ -111,8 +110,8 @@ v8::Local<v8::Function> V8PerContextData::constructorForTypeSlowCase(const Wrapp |
| return v8::Local<v8::Function>(); |
| } |
| - v8::Local<v8::Value> prototypeValue = function->Get(v8AtomicString(m_isolate, "prototype")); |
| - if (!prototypeValue.IsEmpty() && prototypeValue->IsObject()) { |
| + v8::Local<v8::Value> prototypeValue; |
| + if (function->Get(currentContext, v8AtomicString(m_isolate, "prototype")).ToLocal(&prototypeValue) && prototypeValue->IsObject()) { |
|
bashi
2015/04/07 09:37:31
Chatted offline and we think it would be better to
|
| v8::Local<v8::Object> prototypeObject = v8::Local<v8::Object>::Cast(prototypeValue); |
| if (prototypeObject->InternalFieldCount() == v8PrototypeInternalFieldcount |
| && type->wrapperTypePrototype == WrapperTypeInfo::WrapperTypeObjectPrototype) |
| @@ -134,7 +133,10 @@ v8::Local<v8::Object> V8PerContextData::prototypeForType(const WrapperTypeInfo* |
| v8::Local<v8::Object> constructor = constructorForType(type); |
| if (constructor.IsEmpty()) |
| return v8::Local<v8::Object>(); |
| - return constructor->Get(v8String(m_isolate, "prototype")).As<v8::Object>(); |
| + v8::Local<v8::Value> prototypeValue; |
| + if (!constructor->Get(context(), v8String(m_isolate, "prototype")).ToLocal(&prototypeValue) || !prototypeValue->IsObject()) |
| + return v8::Local<v8::Object>(); |
| + return prototypeValue.As<v8::Object>(); |
| } |
| void V8PerContextData::addCustomElementBinding(CustomElementDefinition* definition, PassOwnPtr<CustomElementBinding> binding) |