Fix invalid V8 empty handle access after r198475
BUG=508080
R=pdr@chromium.org
Review URL: https://codereview.chromium.org/1231603002 .
git-svn-id: svn://svn.chromium.org/blink/trunk@198533 bbb929c8-8fbe-4397-9dbb-9b2b20218538
diff --git a/Source/bindings/core/v8/custom/V8WindowCustom.cpp b/Source/bindings/core/v8/custom/V8WindowCustom.cpp
index fcc86e3..18fa0f9 100644
--- a/Source/bindings/core/v8/custom/V8WindowCustom.cpp
+++ b/Source/bindings/core/v8/custom/V8WindowCustom.cpp
@@ -275,13 +275,14 @@
v8::Local<v8::Context> context = isolate->GetCurrentContext();
AtomicString propName = toCoreAtomicString(name);
- v8::Local<v8::Map> interfaces = V8HiddenValue::getHiddenValue(isolate, info.Holder(), V8HiddenValue::testInterfaces(isolate)).As<v8::Map>();
+ v8::Local<v8::Value> interfaces = V8HiddenValue::getHiddenValue(isolate, info.Holder(), V8HiddenValue::testInterfaces(isolate));
if (interfaces.IsEmpty()) {
interfaces = v8::Map::New(isolate);
V8HiddenValue::setHiddenValue(isolate, info.Holder(), V8HiddenValue::testInterfaces(isolate), interfaces);
}
- v8::Local<v8::Value> result = v8CallOrCrash(interfaces->Get(context, name));
+ v8::Local<v8::Map> interfacesMap = interfaces.As<v8::Map>();
+ v8::Local<v8::Value> result = v8CallOrCrash(interfacesMap->Get(context, name));
if (!result->IsUndefined()) {
v8SetReturnValue(info, result);
return true;
@@ -289,7 +290,7 @@
v8::Local<v8::Value> interface = frame.loader().client()->createTestInterface(propName);
if (!interface.IsEmpty()) {
- v8CallOrCrash(interfaces->Set(context, name, interface));
+ v8CallOrCrash(interfacesMap->Set(context, name, interface));
v8SetReturnValue(info, interface);
return true;
}