Implement Dictionary.h on mac (83472)
authorjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Apr 2012 17:23:45 +0000 (17:23 +0000)
committerjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Apr 2012 17:23:45 +0000 (17:23 +0000)
commit18c38150668f183404b8336ba65e3b5d7966ab23
tree5f90244600f97399e1fdc0dea54703f7410b2666
parentcd9e1e83839130dc3692ae720c1642eae2947771
Implement Dictionary.h on mac (83472)
https://bugs.webkit.org/show_bug.cgi?id=83472
<rdar://problem/11209766>

Reviewed by Kentaro Hara.

A difference between Dictionary and JSDictionary makes it difficult to merge the two together and avoid
creating a confusing API. The boolean returned by Dictionary::get() represents whether the
property was found. The boolean returned by JSDictionary::tryGetProperty() represents whether an
exception was thrown.

* WebCore.xcodeproj/project.pbxproj: Add Dictionary.h and Dictionary.cpp.

* bindings/js/Dictionary.cpp: Added.
(WebCore::Dictionary::Dictionary):
(WebCore::Dictionary::get):
* bindings/js/Dictionary.h: Leverage JSDictionary's functionality to obtain the data.
(WebCore::Dictionary::isObject): Mark an unimplemented.
(WebCore::Dictionary::isUndefinedOrNull): Mark an unimplemented.
(WebCore::Dictionary::getWithUndefinedOrNullCheck): Mark an unimplemented.

* bindings/js/JSDictionary.cpp:
(WebCore::JSDictionary::tryGetProperty): Convert to a const function.
* bindings/js/JSDictionary.h:
(WebCore::JSDictionary::isValid):
(WebCore::JSDictionary::tryGetProperty): Convert to a const function.
(WebCore::JSDictionary::get): Similar to tryGetProperty(), but returns true if the
property was found, converting the value succeeded and the out parameter "result" was set.
(WebCore::JSDictionary::tryGetPropertyAndResult): Refactor tryGetProperty() to return the enum directly.

Change bindings scripts to use Dictionary constructor.
* bindings/js/IDBBindingUtilities.cpp: Remove createDictionaryFromValue().
* bindings/js/IDBBindingUtilities.h: Remove createDictionaryFromValue().
* bindings/scripts/CodeGeneratorJS.pm:
(JSValueToNative): Update to remove IDBBindingUtilities.h dependency, and use Dictionary constructor.
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionOptionsObject): Update expected generated output.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114001 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/Dictionary.cpp [new file with mode: 0644]
Source/WebCore/bindings/js/Dictionary.h
Source/WebCore/bindings/js/IDBBindingUtilities.cpp
Source/WebCore/bindings/js/IDBBindingUtilities.h
Source/WebCore/bindings/js/JSDictionary.cpp
Source/WebCore/bindings/js/JSDictionary.h
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp