Changeset 128135 in webkit
- Timestamp:
- Sep 10, 2012 5:41:13 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r128134 r128135 1 2012-09-10 Adam Barth <abarth@chromium.org> 2 3 [V8] createFunctionOnlyCallback should be in V8Callback.h with the other callback functions 4 https://bugs.webkit.org/show_bug.cgi?id=96336 5 6 Reviewed by Kentaro Hara. 7 8 Moving this function to V8Callback.h also lets us delete 9 setTypeMismatchException because we no longer have a header inclusion 10 cycle. 11 12 * bindings/v8/V8Callback.h: 13 (WebCore::createFunctionOnlyCallback): 14 (WebCore): 15 * bindings/v8/V8Utilities.cpp: 16 * bindings/v8/V8Utilities.h: 17 (WebCore): 18 * bindings/v8/custom/V8GeolocationCustom.cpp: 19 * bindings/v8/custom/V8NotificationCustom.cpp: 20 1 21 2012-09-10 Beth Dakin <bdakin@apple.com> 2 22 -
trunk/Source/WebCore/bindings/v8/V8Callback.h
r125745 r128135 32 32 #define V8Callback_h 33 33 34 #include "ExceptionCode.h" 35 #include "V8Binding.h" 34 36 #include <v8.h> 35 37 … … 41 43 bool invokeCallback(v8::Persistent<v8::Object> callback, v8::Handle<v8::Object> thisObject, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue, ScriptExecutionContext*); 42 44 45 enum CallbackAllowedValueFlag { 46 CallbackAllowUndefined = 1, 47 CallbackAllowNull = 1 << 1 48 }; 49 50 typedef unsigned CallbackAllowedValueFlags; 51 52 // 'FunctionOnly' is assumed for the created callback. 53 template <typename V8CallbackType> 54 PassRefPtr<V8CallbackType> createFunctionOnlyCallback(v8::Local<v8::Value> value, bool& succeeded, v8::Isolate* isolate, CallbackAllowedValueFlags acceptedValues = 0) 55 { 56 succeeded = true; 57 58 if (value->IsUndefined() && (acceptedValues & CallbackAllowUndefined)) 59 return 0; 60 61 if (value->IsNull() && (acceptedValues & CallbackAllowNull)) 62 return 0; 63 64 if (!value->IsFunction()) { 65 succeeded = false; 66 setDOMException(TYPE_MISMATCH_ERR, isolate); 67 return 0; 68 } 69 70 return V8CallbackType::create(value, getScriptExecutionContext()); 71 } 72 43 73 } // namespace WebCore 44 74 -
trunk/Source/WebCore/bindings/v8/V8Utilities.cpp
r128125 r128135 164 164 } 165 165 166 void setTypeMismatchException(v8::Isolate* isolate)167 {168 setDOMException(TYPE_MISMATCH_ERR, isolate);169 }170 171 166 } // namespace WebCore -
trunk/Source/WebCore/bindings/v8/V8Utilities.h
r128125 r128135 54 54 ScriptExecutionContext* getScriptExecutionContext(); 55 55 56 void setTypeMismatchException(v8::Isolate*);57 58 enum CallbackAllowedValueFlag {59 CallbackAllowUndefined = 1,60 CallbackAllowNull = 1 << 161 };62 63 typedef unsigned CallbackAllowedValueFlags;64 65 56 typedef WTF::Vector<RefPtr<MessagePort>, 1> MessagePortArray; 66 57 typedef WTF::Vector<RefPtr<ArrayBuffer>, 1> ArrayBufferArray; … … 73 64 bool getMessagePortArray(v8::Local<v8::Value>, MessagePortArray&, v8::Isolate*); 74 65 75 // 'FunctionOnly' is assumed for the created callback.76 template <typename V8CallbackType>77 PassRefPtr<V8CallbackType> createFunctionOnlyCallback(v8::Local<v8::Value> value, bool& succeeded, v8::Isolate* isolate, CallbackAllowedValueFlags acceptedValues = 0)78 {79 succeeded = true;80 81 if (value->IsUndefined() && (acceptedValues & CallbackAllowUndefined))82 return 0;83 84 if (value->IsNull() && (acceptedValues & CallbackAllowNull))85 return 0;86 87 if (!value->IsFunction()) {88 succeeded = false;89 setTypeMismatchException(isolate);90 return 0;91 }92 93 return V8CallbackType::create(value, getScriptExecutionContext());94 }95 96 66 } // namespace WebCore 97 67 -
trunk/Source/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp
r117730 r128135 32 32 #include "Geolocation.h" 33 33 #include "V8Binding.h" 34 #include "V8Callback.h" 34 35 #include "V8PositionCallback.h" 35 36 #include "V8PositionErrorCallback.h" -
trunk/Source/WebCore/bindings/v8/custom/V8NotificationCustom.cpp
r126399 r128135 30 30 31 31 #include "ExceptionCode.h" 32 #include "V8Callback.h" 32 33 #include "V8NotificationPermissionCallback.h" 33 34
Note: See TracChangeset
for help on using the changeset viewer.