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

Side by Side Diff: Source/bindings/core/v8/V8Binding.cpp

Issue 1100223003: bindings: Add empty checks for toV8() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(expected , provided)); 94 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(expected , provided));
95 } 95 }
96 96
97 PassRefPtrWillBeRawPtr<NodeFilter> toNodeFilter(v8::Handle<v8::Value> callback, v8::Handle<v8::Object> creationContext, ScriptState* scriptState) 97 PassRefPtrWillBeRawPtr<NodeFilter> toNodeFilter(v8::Handle<v8::Value> callback, v8::Handle<v8::Object> creationContext, ScriptState* scriptState)
98 { 98 {
99 if (callback->IsNull()) 99 if (callback->IsNull())
100 return nullptr; 100 return nullptr;
101 RefPtrWillBeRawPtr<NodeFilter> filter = NodeFilter::create(); 101 RefPtrWillBeRawPtr<NodeFilter> filter = NodeFilter::create();
102 102
103 v8::Handle<v8::Object> filterWrapper = toV8(filter.get(), creationContext, s criptState->isolate()).As<v8::Object>(); 103 v8::Handle<v8::Object> filterWrapper = toV8(filter.get(), creationContext, s criptState->isolate()).As<v8::Object>();
104 if (filterWrapper.IsEmpty())
haraken 2015/04/28 04:24:59 This is a bit too late to check the emptiness. We
bashi 2015/04/28 05:41:53 Done.
105 return nullptr;
104 106
105 RefPtrWillBeRawPtr<NodeFilterCondition> condition = V8NodeFilterCondition::c reate(callback, filterWrapper, scriptState); 107 RefPtrWillBeRawPtr<NodeFilterCondition> condition = V8NodeFilterCondition::c reate(callback, filterWrapper, scriptState);
106 filter->setCondition(condition.release()); 108 filter->setCondition(condition.release());
107 109
108 return filter.release(); 110 return filter.release();
109 } 111 }
110 112
111 bool toBooleanSlow(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionSt ate& exceptionState) 113 bool toBooleanSlow(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionSt ate& exceptionState)
112 { 114 {
113 ASSERT(!value->IsBoolean()); 115 ASSERT(!value->IsBoolean());
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 v8::Local<v8::Value> data = info.Data(); 989 v8::Local<v8::Value> data = info.Data();
988 ASSERT(data->IsExternal()); 990 ASSERT(data->IsExternal());
989 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre ationContext()); 991 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre ationContext());
990 if (!perContextData) 992 if (!perContextData)
991 return; 993 return;
992 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u nwrap(data))); 994 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u nwrap(data)));
993 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 995 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
994 } 996 }
995 997
996 } // namespace blink 998 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698