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

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: rebase Created 5 years, 7 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 { 93 {
94 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(expected , provided)); 94 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(expected , provided));
95 } 95 }
96 96
97 PassRefPtrWillBeRawPtr<NodeFilter> toNodeFilter(v8::Local<v8::Value> callback, v 8::Local<v8::Object> creationContext, ScriptState* scriptState) 97 PassRefPtrWillBeRawPtr<NodeFilter> toNodeFilter(v8::Local<v8::Value> callback, v 8::Local<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::Local<v8::Object> filterWrapper = toV8(filter.get(), creationContext, sc riptState->isolate()).As<v8::Object>(); 103 v8::Local<v8::Value> filterWrapper = toV8(filter.get(), creationContext, scr iptState->isolate());
104 if (filterWrapper.IsEmpty())
105 return nullptr;
104 106
105 RefPtrWillBeRawPtr<NodeFilterCondition> condition = V8NodeFilterCondition::c reate(callback, filterWrapper, scriptState); 107 RefPtrWillBeRawPtr<NodeFilterCondition> condition = V8NodeFilterCondition::c reate(callback, filterWrapper.As<v8::Object>(), 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());
114 v8::TryCatch block; 116 v8::TryCatch block;
115 bool result = false; 117 bool result = false;
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 v8::Local<v8::Value> data = info.Data(); 990 v8::Local<v8::Value> data = info.Data();
989 ASSERT(data->IsExternal()); 991 ASSERT(data->IsExternal());
990 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre ationContext()); 992 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre ationContext());
991 if (!perContextData) 993 if (!perContextData)
992 return; 994 return;
993 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u nwrap(data))); 995 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u nwrap(data)));
994 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 996 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
995 } 997 }
996 998
997 } // namespace blink 999 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/ScriptValueSerializer.cpp ('k') | Source/bindings/core/v8/V8CustomElementLifecycleCallbacks.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698