Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Unified Diff: Source/bindings/core/v8/V8PerContextData.cpp

Issue 1067763002: bindings: Use Maybe version of Get in bindings/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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());
+ 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()) {
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)

Powered by Google App Engine
This is Rietveld 408576698