Changeset 116763 in webkit
- Timestamp:
- May 11, 2012 6:49:17 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r116758 r116763 1 2012-05-11 Christophe Dumez <christophe.dumez@intel.com> 2 3 Web Intents code only supports V8 4 https://bugs.webkit.org/show_bug.cgi?id=85954 5 6 Reviewed by Adam Barth. 7 8 Add ENABLE_WEB_INTENTS flag to CMake. 9 10 * Source/cmake/WebKitFeatures.cmake: 11 * Source/cmakeconfig.h.cmake: 12 1 13 2012-05-11 Xiaobo Wang <xbwang@torchmobile.com.cn> 2 14 -
trunk/Source/JavaScriptCore/API/JSValueRef.h
r56189 r116763 64 64 @result A value of type JSType that identifies value's type. 65 65 */ 66 JS_EXPORT JSType JSValueGetType(JSContextRef ctx, JSValueRef value);66 JS_EXPORT JSType JSValueGetType(JSContextRef ctx, JSValueRef); 67 67 68 68 /*! -
trunk/Source/WebCore/CMakeLists.txt
r116690 r116763 4 4 "${WEBCORE_DIR}/Modules/geolocation" 5 5 "${WEBCORE_DIR}/Modules/indexeddb" 6 "${WEBCORE_DIR}/Modules/intents" 6 7 "${WEBCORE_DIR}/Modules/webaudio" 7 8 "${WEBCORE_DIR}/Modules/webdatabase" … … 2508 2509 ENDIF () 2509 2510 2511 IF (ENABLE_WEB_INTENTS) 2512 LIST(APPEND WebCore_IDL_FILES 2513 Modules/intents/DOMWindowIntents.idl 2514 Modules/intents/Intent.idl 2515 Modules/intents/IntentResultCallback.idl 2516 Modules/intents/NavigatorIntents.idl 2517 ) 2518 LIST(APPEND WebCore_SOURCES 2519 Modules/intents/Intent.cpp 2520 Modules/intents/IntentRequest.cpp 2521 Modules/intents/NavigatorIntents.cpp 2522 ) 2523 ENDIF () 2524 2510 2525 # Modules that the bindings generator scripts may use 2511 2526 SET(SCRIPTS_RESOLVE_SUPPLEMENTAL -
trunk/Source/WebCore/ChangeLog
r116762 r116763 1 2012-05-11 Christophe Dumez <christophe.dumez@intel.com> 2 3 Web Intents code only supports V8 4 https://bugs.webkit.org/show_bug.cgi?id=85954 5 6 Reviewed by Adam Barth. 7 8 Add necessary abstraction for js Dictionary and ScriptValue so that 9 the Web Intents code in WebCore compiles with JSC, not just V8. 10 11 This required changes in the JSC bindings generator to pass 12 callback arguments of type SerializedScriptValue as raw pointers 13 instead of RefPtr. This matches the change made to the V8 bindings 14 generator in r104531. 15 16 * CMakeLists.txt: 17 * Modules/intents/Intent.cpp: 18 * Modules/intents/Intent.h: 19 * bindings/js/Dictionary.cpp: 20 (WebCore::Dictionary::Dictionary): 21 (WebCore): 22 (WebCore::Dictionary::getOwnPropertiesAsStringHashMap): 23 * bindings/js/Dictionary.h: 24 (Dictionary): 25 * bindings/js/JSBindingsAllInOne.cpp: 26 * bindings/js/JSDictionary.cpp: 27 (WebCore::JSDictionary::convertValue): 28 (WebCore): 29 * bindings/js/JSDictionary.h: 30 (WebCore): 31 (WebCore::JSDictionary::initializerObject): 32 * bindings/js/ScriptValue.cpp: 33 (WebCore::ScriptValue::serialize): 34 (WebCore): 35 * bindings/js/ScriptValue.h: 36 (ScriptValue): 37 * bindings/scripts/CodeGeneratorJS.pm: 38 (AddIncludesForType): 39 (GenerateCallbackHeader): 40 (GenerateCallbackImplementation): 41 (GetNativeTypeForCallbacks): 42 1 43 2012-05-11 Alexander Pavlov <apavlov@chromium.org> 2 44 -
trunk/Source/WebCore/Modules/intents/Intent.cpp
r115264 r116763 34 34 #include "ExceptionCode.h" 35 35 #include "MessagePort.h" 36 #include "ScriptState.h"37 36 #include "SerializedScriptValue.h" 38 37 -
trunk/Source/WebCore/Modules/intents/Intent.h
r115264 r116763 36 36 #include "MessagePort.h" 37 37 #include "MessagePortChannel.h" 38 #include "ScriptState.h" 38 39 #include <wtf/Forward.h> 39 40 #include <wtf/PassRefPtr.h> … … 44 45 namespace WebCore { 45 46 46 class ScriptState;47 47 class SerializedScriptValue; 48 48 -
trunk/Source/WebCore/bindings/js/Dictionary.cpp
r114855 r116763 36 36 namespace WebCore { 37 37 38 Dictionary::Dictionary() 39 : m_dictionary(0, 0) 40 { 41 } 42 38 43 Dictionary::Dictionary(JSC::ExecState* exec, JSC::JSValue value) 39 44 : m_dictionary(exec, value.isObject() ? value.getObject() : 0) … … 50 55 #endif 51 56 57 bool Dictionary::getOwnPropertiesAsStringHashMap(WTF::HashMap<String, String>& map) const 58 { 59 if (!m_dictionary.isValid()) 60 return false; 61 62 JSObject* object = m_dictionary.initializerObject(); 63 ExecState* exec = m_dictionary.execState(); 64 65 PropertyNameArray propertyNames(exec); 66 JSObject::getOwnPropertyNames(object, exec, propertyNames, ExcludeDontEnumProperties); 67 for (PropertyNameArray::const_iterator it = propertyNames.begin(); it != propertyNames.end(); it++) { 68 String stringKey = ustringToString(it->ustring()); 69 if (stringKey.isEmpty()) 70 continue; 71 JSValue value = object->get(exec, *it); 72 if (exec->hadException()) 73 continue; 74 String stringValue = ustringToString(value.toString(exec)->value(exec)); 75 if (!exec->hadException()) 76 map.set(stringKey, stringValue); 77 } 78 79 return true; 80 } 81 52 82 }; 53 83 -
trunk/Source/WebCore/bindings/js/Dictionary.h
r114855 r116763 32 32 #include "NotImplemented.h" 33 33 #include "ScriptValue.h" 34 #include <wtf/HashMap.h> 34 35 #include <wtf/text/CString.h> 35 36 #include <wtf/text/WTFString.h> … … 44 45 class Dictionary { 45 46 public: 47 Dictionary(); 46 48 Dictionary(JSC::ExecState*, JSC::JSValue); 47 49 … … 59 61 bool isObject() const { return m_dictionary.isValid(); } 60 62 bool isUndefinedOrNull() const { return !m_dictionary.isValid(); } 63 bool getOwnPropertiesAsStringHashMap(WTF::HashMap<String, String>&) const; 61 64 bool getWithUndefinedOrNullCheck(const String&, String&) const { notImplemented(); return false; } 62 65 -
trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
r107454 r116763 29 29 #include "DOMObjectHashTableMap.cpp" 30 30 #include "DOMWrapperWorld.cpp" 31 #include "Dictionary.cpp" 31 32 #include "GCController.cpp" 32 33 #include "JSArrayBufferCustom.cpp" -
trunk/Source/WebCore/bindings/js/JSDictionary.cpp
r114001 r116763 27 27 #include "JSDictionary.h" 28 28 29 #include "Dictionary.h" 29 30 #include "JSDOMWindow.h" 30 31 #include "JSEventTarget.h" … … 90 91 { 91 92 result = value.toNumber(exec); 93 } 94 95 void JSDictionary::convertValue(JSC::ExecState* exec, JSC::JSValue value, Dictionary& result) 96 { 97 result = Dictionary(exec, value); 92 98 } 93 99 -
trunk/Source/WebCore/bindings/js/JSDictionary.h
r114855 r116763 33 33 namespace WebCore { 34 34 35 class Dictionary; 35 36 class DOMWindow; 36 37 class EventTarget; … … 60 61 61 62 JSC::ExecState* execState() const { return m_exec; } 63 JSC::JSObject* initializerObject() const { return m_initializerObject; } 62 64 bool isValid() const { return m_exec && m_initializerObject; } 63 65 … … 87 89 static void convertValue(JSC::ExecState*, JSC::JSValue, unsigned long long& result); 88 90 static void convertValue(JSC::ExecState*, JSC::JSValue, double& result); 91 static void convertValue(JSC::ExecState*, JSC::JSValue, Dictionary& result); 89 92 static void convertValue(JSC::ExecState*, JSC::JSValue, String& result); 90 93 static void convertValue(JSC::ExecState*, JSC::JSValue, ScriptValue& result); -
trunk/Source/WebCore/bindings/js/ScriptValue.cpp
r115061 r116763 107 107 } 108 108 109 PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptState, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, bool& didThrow) 110 { 111 JSValueRef exception = 0; 112 RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(toRef(scriptState), toRef(scriptState, jsValue()), messagePorts, arrayBuffers, &exception); 113 didThrow = exception ? true : false; 114 return serializedValue.release(); 115 } 116 109 117 ScriptValue ScriptValue::deserialize(ScriptState* scriptState, SerializedScriptValue* value, SerializationErrorMode throwExceptions) 110 118 { -
trunk/Source/WebCore/bindings/js/ScriptValue.h
r115158 r116763 64 64 65 65 PassRefPtr<SerializedScriptValue> serialize(ScriptState*, SerializationErrorMode = Throwing); 66 PassRefPtr<SerializedScriptValue> serialize(ScriptState*, MessagePortArray*, ArrayBufferArray*, bool&); 66 67 static ScriptValue deserialize(ScriptState*, SerializedScriptValue*, SerializationErrorMode = Throwing); 67 68 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r116487 r116763 263 263 } elsif ($type eq "unsigned long[]") { 264 264 $includesRef->{"<wtf/Vector.h>"} = 1; 265 } elsif ($type eq "SerializedScriptValue") { 266 $includesRef->{"SerializedScriptValue.h"} = 1; 265 267 } elsif ($isCallback) { 266 268 $includesRef->{"JS${type}.h"} = 1; … … 2605 2607 } 2606 2608 2607 push(@headerContent, " virtual " . GetNativeType ($function->signature->type) . " " . $function->signature->name . "(");2609 push(@headerContent, " virtual " . GetNativeTypeForCallbacks($function->signature->type) . " " . $function->signature->name . "("); 2608 2610 2609 2611 my @args = (); 2610 2612 foreach my $param (@params) { 2611 push(@args, GetNativeType ($param->type) . " " . $param->name);2613 push(@args, GetNativeTypeForCallbacks($param->type) . " " . $param->name); 2612 2614 } 2613 2615 push(@headerContent, join(", ", @args)); … … 2684 2686 2685 2687 AddIncludesForTypeInImpl($function->signature->type); 2686 push(@implContent, "\n" . GetNativeType ($function->signature->type) . " ${className}::" . $function->signature->name . "(");2688 push(@implContent, "\n" . GetNativeTypeForCallbacks($function->signature->type) . " ${className}::" . $function->signature->name . "("); 2687 2689 2688 2690 my @args = (); … … 2692 2694 my $paramName = $param->name; 2693 2695 AddIncludesForTypeInImpl($param->type, 1); 2694 push(@args, GetNativeType ($param->type) . " " . $paramName);2696 push(@args, GetNativeTypeForCallbacks($param->type) . " " . $paramName); 2695 2697 if ($thisType and $thisType eq $param->type) { 2696 2698 push(@argsCheck, <<END); … … 2718 2720 } elsif ($param->type eq "boolean") { 2719 2721 push(@implContent, " args.append(jsBoolean(${paramName}));\n"); 2722 } elsif ($param->type eq "SerializedScriptValue") { 2723 push(@implContent, " args.append($paramName ? $paramName->deserialize(exec, m_data->globalObject(), 0) : jsNull());\n"); 2720 2724 } else { 2721 2725 push(@implContent, " args.append(toJS(exec, m_data->globalObject(), ${paramName}));\n"); … … 2833 2837 } 2834 2838 2839 sub GetNativeTypeForCallbacks 2840 { 2841 my $type = shift; 2842 return "SerializedScriptValue*" if $type eq "SerializedScriptValue"; 2843 2844 return GetNativeType($type); 2845 } 2846 2835 2847 sub GetSVGPropertyTypes 2836 2848 { -
trunk/Source/cmake/WebKitFeatures.cmake
r116571 r116763 90 90 WEBKIT_OPTION_DEFINE(ENABLE_WEBGL "Toggle 3D canvas (WebGL) support" OFF) 91 91 WEBKIT_OPTION_DEFINE(ENABLE_WEB_AUDIO "Toggle Web Audio support" OFF) 92 WEBKIT_OPTION_DEFINE(ENABLE_WEB_INTENTS "Toggle Web Intents support" OFF) 92 93 WEBKIT_OPTION_DEFINE(ENABLE_WEB_SOCKETS "Toggle Web Sockets support" ON) 93 94 WEBKIT_OPTION_DEFINE(ENABLE_WEB_TIMING "Toggle Web Timing support" OFF) -
trunk/Source/cmakeconfig.h.cmake
r116536 r116763 71 71 #cmakedefine01 ENABLE_WEBGL 72 72 #cmakedefine01 ENABLE_WEB_AUDIO 73 #cmakedefine01 ENABLE_WEB_INTENTS 73 74 #cmakedefine01 ENABLE_WEB_SOCKETS 74 75 #cmakedefine01 ENABLE_WEB_TIMING
Note: See TracChangeset
for help on using the changeset viewer.