Title: [119484] trunk/Source/WebCore
Revision
119484
Author
[email protected]
Date
2012-06-05 05:27:44 -0700 (Tue, 05 Jun 2012)

Log Message

JSC:need to implement Dictionary::getWithUndefinedOrNullCheck for IDB
https://bugs.webkit.org/show_bug.cgi?id=88283

Reviewed by Kentaro Hara.

No new tests, idb not working for JSC yet.

* bindings/js/Dictionary.cpp:
(WebCore::Dictionary::getWithUndefinedOrNullCheck):
* bindings/js/Dictionary.h:
(Dictionary):
* bindings/js/JSDictionary.cpp:
(WebCore::JSDictionary::getWithUndefinedOrNullCheck):
(WebCore):
* bindings/js/JSDictionary.h:
(JSDictionary):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (119483 => 119484)


--- trunk/Source/WebCore/ChangeLog	2012-06-05 11:35:30 UTC (rev 119483)
+++ trunk/Source/WebCore/ChangeLog	2012-06-05 12:27:44 UTC (rev 119484)
@@ -1,3 +1,22 @@
+2012-06-05  Charles Wei  <[email protected]>
+
+        JSC:need to implement Dictionary::getWithUndefinedOrNullCheck for IDB
+        https://bugs.webkit.org/show_bug.cgi?id=88283
+
+        Reviewed by Kentaro Hara.
+
+        No new tests, idb not working for JSC yet.
+
+        * bindings/js/Dictionary.cpp:
+        (WebCore::Dictionary::getWithUndefinedOrNullCheck):
+        * bindings/js/Dictionary.h:
+        (Dictionary):
+        * bindings/js/JSDictionary.cpp:
+        (WebCore::JSDictionary::getWithUndefinedOrNullCheck):
+        (WebCore):
+        * bindings/js/JSDictionary.h:
+        (JSDictionary):
+
 2012-06-05  Dongwoo Im  <[email protected]>
 
         Add 'isProtocolHandlerRegistered' and 'unregisterProtocolHandler'.

Modified: trunk/Source/WebCore/bindings/js/Dictionary.cpp (119483 => 119484)


--- trunk/Source/WebCore/bindings/js/Dictionary.cpp	2012-06-05 11:35:30 UTC (rev 119483)
+++ trunk/Source/WebCore/bindings/js/Dictionary.cpp	2012-06-05 12:27:44 UTC (rev 119484)
@@ -79,5 +79,9 @@
     return true;
 }
 
+bool Dictionary::getWithUndefinedOrNullCheck(const String& propertyName, String& value) const
+{
+    return m_dictionary.getWithUndefinedOrNullCheck(propertyName, value);
+}
+
 };
-

Modified: trunk/Source/WebCore/bindings/js/Dictionary.h (119483 => 119484)


--- trunk/Source/WebCore/bindings/js/Dictionary.h	2012-06-05 11:35:30 UTC (rev 119483)
+++ trunk/Source/WebCore/bindings/js/Dictionary.h	2012-06-05 12:27:44 UTC (rev 119484)
@@ -61,7 +61,7 @@
     bool isObject() const { return m_dictionary.isValid(); }
     bool isUndefinedOrNull() const { return !m_dictionary.isValid(); }
     bool getOwnPropertiesAsStringHashMap(WTF::HashMap<String, String>&) const;
-    bool getWithUndefinedOrNullCheck(const String&, String&) const { notImplemented(); return false; }
+    bool getWithUndefinedOrNullCheck(const String& propertyName, String& value) const;
 
 private:
     template <typename T>

Modified: trunk/Source/WebCore/bindings/js/JSDictionary.cpp (119483 => 119484)


--- trunk/Source/WebCore/bindings/js/JSDictionary.cpp	2012-06-05 11:35:30 UTC (rev 119483)
+++ trunk/Source/WebCore/bindings/js/JSDictionary.cpp	2012-06-05 12:27:44 UTC (rev 119484)
@@ -167,4 +167,14 @@
 }
 #endif
 
+bool JSDictionary::getWithUndefinedOrNullCheck(const String& propertyName, String& result) const
+{
+    JSValue value;
+    if (tryGetProperty(propertyName.utf8().data(), value) != PropertyFound || value.isUndefinedOrNull())
+        return false;
+
+    result = ustringToString(value.toString(m_exec)->value(m_exec));
+    return true;
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/js/JSDictionary.h (119483 => 119484)


--- trunk/Source/WebCore/bindings/js/JSDictionary.h	2012-06-05 11:35:30 UTC (rev 119483)
+++ trunk/Source/WebCore/bindings/js/JSDictionary.h	2012-06-05 12:27:44 UTC (rev 119484)
@@ -58,6 +58,7 @@
     // Returns true if the property was found in the dictionary, and the value could be converted to the desired type.
     template <typename Result>
     bool get(const char* propertyName, Result&) const;
+    bool getWithUndefinedOrNullCheck(const String& propertyName, String& value) const;
 
     JSC::ExecState* execState() const { return m_exec; }
     JSC::JSObject* initializerObject() const { return m_initializerObject; }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to