Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "bindings/modules/v8/V8IDBObserver.h" | |
| 6 | |
| 7 #include "bindings/core/v8/ExceptionMessages.h" | |
| 8 #include "bindings/core/v8/ExceptionState.h" | |
| 9 #include "bindings/core/v8/V8Binding.h" | |
| 10 #include "bindings/core/v8/V8DOMWrapper.h" | |
| 11 #include "bindings/core/v8/V8GCController.h" | |
| 12 #include "bindings/modules/v8/V8IDBObserverCallback.h" | |
| 13 #include "bindings/modules/v8/V8IDBObserverInit.h" | |
| 14 | |
| 15 namespace blink { | |
| 16 | |
| 17 void V8IDBObserver::constructorCustom(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 18 { | |
| 19 if (UNLIKELY(info.Length() < 1)) { | |
| 20 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod(in fo.GetIsolate(), "createIDBObserver", "IDB", 1, info.Length()), info.GetIsolate( )); | |
|
dmurph
2016/06/02 23:48:37
s/"IDB"/"IDBObserver"/ here an below.
Marijn Kruisselbrink
2016/06/02 23:51:24
I think this should be createMinimumArityTypeError
palakj1
2016/06/03 01:21:52
Done
| |
| 21 return; | |
| 22 } | |
| 23 | |
| 24 v8::Local<v8::Object> wrapper = info.Holder(); | |
| 25 | |
| 26 if (!info[0]->IsFunction()) { | |
| 27 V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::f ailedToExecute("createIDBObserver", "IDB", "The callback provided as parameter 1 is not a function.")); | |
|
Marijn Kruisselbrink
2016/06/02 23:51:24
All these other failedToExecute methods also seem
palakj1
2016/06/03 01:21:52
Changes made.
| |
| 28 return; | |
| 29 } | |
| 30 | |
| 31 if (info.Length() > 1 && !isUndefinedOrNull(info[1]) && !info[1]->IsObject() ) { | |
| 32 V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::f ailedToExecute("createIDBObserver", "IDB", "IDBObserverInit (parameter 2) is not an object.")); | |
| 33 return; | |
| 34 } | |
| 35 | |
| 36 IDBObserverInit idbObserverInit; | |
| 37 ExceptionState exceptionState(ExceptionState::ConstructionContext, "IDB", in fo.Holder(), info.GetIsolate()); | |
|
Marijn Kruisselbrink
2016/06/02 23:51:24
Here also "IDB" should be "IDBObserver" to get cor
palakj1
2016/06/03 01:21:52
Done
| |
| 38 V8IDBObserverInit::toImpl(info.GetIsolate(), info[1], idbObserverInit, excep tionState); | |
| 39 if (exceptionState.throwIfNeeded()) | |
| 40 return; | |
| 41 | |
| 42 IDBObserverCallback* callback = new V8IDBObserverCallback(v8::Local<v8::Func tion>::Cast(info[0]), wrapper, ScriptState::current(info.GetIsolate())); | |
| 43 IDBObserver* observer = IDBObserver::create(*callback, idbObserverInit); | |
| 44 if (exceptionState.throwIfNeeded()) | |
| 45 return; | |
| 46 ASSERT(observer); | |
| 47 v8SetReturnValue(info, V8DOMWrapper::associateObjectWithWrapper(info.GetIsol ate(), observer, &wrapperTypeInfo, wrapper)); | |
| 48 } | |
| 49 | |
| 50 } // namespace blink | |
| OLD | NEW |