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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/custom/V8CustomEventCustom.cpp

Issue 2272613003: binding: Retires ExceptionState::throwIfNeeded(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Synced. Created 4 years, 3 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // when the getter of |detail| is called in the main world later. 54 // when the getter of |detail| is called in the main world later.
55 if (scriptState->world().isIsolatedWorld()) 55 if (scriptState->world().isIsolatedWorld())
56 impl->setSerializedDetail(SerializedScriptValue::serializeAndSwallowExce ptions(scriptState->isolate(), detail)); 56 impl->setSerializedDetail(SerializedScriptValue::serializeAndSwallowExce ptions(scriptState->isolate(), detail));
57 } 57 }
58 58
59 void V8CustomEvent::constructorCustom(const v8::FunctionCallbackInfo<v8::Value>& info) 59 void V8CustomEvent::constructorCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
60 { 60 {
61 ExceptionState exceptionState(ExceptionState::ConstructionContext, "CustomEv ent", info.Holder(), info.GetIsolate()); 61 ExceptionState exceptionState(ExceptionState::ConstructionContext, "CustomEv ent", info.Holder(), info.GetIsolate());
62 if (UNLIKELY(info.Length() < 1)) { 62 if (UNLIKELY(info.Length() < 1)) {
63 setMinimumArityTypeError(exceptionState, 1, info.Length()); 63 setMinimumArityTypeError(exceptionState, 1, info.Length());
64 exceptionState.throwIfNeeded();
65 return; 64 return;
66 } 65 }
67 66
68 V8StringResource<> type = info[0]; 67 V8StringResource<> type = info[0];
69 if (!type.prepare()) 68 if (!type.prepare())
70 return; 69 return;
71 70
72 CustomEventInit eventInitDict; 71 CustomEventInit eventInitDict;
73 if (!isUndefinedOrNull(info[1])) { 72 if (!isUndefinedOrNull(info[1])) {
74 if (!info[1]->IsObject()) { 73 if (!info[1]->IsObject()) {
75 exceptionState.throwTypeError("parameter 2 ('eventInitDict') is not an object."); 74 exceptionState.throwTypeError("parameter 2 ('eventInitDict') is not an object.");
76 exceptionState.throwIfNeeded();
77 return; 75 return;
78 } 76 }
79 V8CustomEventInit::toImpl(info.GetIsolate(), info[1], eventInitDict, exc eptionState); 77 V8CustomEventInit::toImpl(info.GetIsolate(), info[1], eventInitDict, exc eptionState);
80 if (exceptionState.throwIfNeeded()) 78 if (exceptionState.hadException())
81 return; 79 return;
82 } 80 }
83 81
84 CustomEvent* impl = CustomEvent::create(type, eventInitDict); 82 CustomEvent* impl = CustomEvent::create(type, eventInitDict);
85 v8::Local<v8::Object> wrapper = info.Holder(); 83 v8::Local<v8::Object> wrapper = info.Holder();
86 wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8CustomEvent::wrap perTypeInfo, wrapper); 84 wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8CustomEvent::wrap perTypeInfo, wrapper);
87 85
88 // TODO(bashi): Workaround for http://crbug.com/529941. We need to store 86 // TODO(bashi): Workaround for http://crbug.com/529941. We need to store
89 // |detail| as a private property to avoid cycle references. 87 // |detail| as a private property to avoid cycle references.
90 if (eventInitDict.hasDetail()) { 88 if (eventInitDict.hasDetail()) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 } 124 }
127 125
128 // |detail| should be null when it is an empty handle because its default va lue is null. 126 // |detail| should be null when it is an empty handle because its default va lue is null.
129 if (detail.IsEmpty()) 127 if (detail.IsEmpty())
130 detail = v8::Null(info.GetIsolate()); 128 detail = v8::Null(info.GetIsolate());
131 privateDetail.set(scriptState->context(), info.Holder(), detail); 129 privateDetail.set(scriptState->context(), info.Holder(), detail);
132 v8SetReturnValue(info, detail); 130 v8SetReturnValue(info, detail);
133 } 131 }
134 132
135 } // namespace blink 133 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698