[JSC API] We should support the symbol type in our C/Obj-C API
https://bugs.webkit.org/show_bug.cgi?id=175836
Reviewed by Filip Pizlo.
This patch makes the following API additions:
1) Test if a JSValue/JSValueRef is a symbol via any of the methods API are able to test for the types of other JSValues.
2) Create a symbol on both APIs.
3) Get/Set/Delete/Define property now take ids in the Obj-C API.
4) Add Get/Set/Delete in the C API.
We can do 3 because it is both binary and source compatable with
the existing API. I added (4) because the current property access
APIs only have the ability to get Strings. It was possible to
merge symbols into JSStringRef but that felt confusing and exposes
implementation details of our engine. The new functions match the
same meaning that they have in JS, thus should be forward
compatible with any future language extensions.
Lastly, this patch adds the same availability preproccessing phase
in WebCore to JavaScriptCore, which enables TBA features for
testing on previous releases.
- API/APICast.h:
- API/JSBasePrivate.h:
- API/JSContext.h:
- API/JSContextPrivate.h:
- API/JSContextRef.h:
- API/JSContextRefInternal.h:
- API/JSContextRefPrivate.h:
- API/JSManagedValue.h:
- API/JSObjectRef.cpp:
(JSObjectHasPropertyKey):
(JSObjectGetPropertyKey):
(JSObjectSetPropertyKey):
(JSObjectDeletePropertyKey):
- API/JSObjectRef.h:
- API/JSRemoteInspector.h:
- API/JSTypedArray.h:
- API/JSValue.h:
- API/JSValue.mm:
(+[JSValue valueWithNewSymbolFromDescription:inContext:]):
(performPropertyOperation):
(-[JSValue valueForProperty:valueForProperty:]):
(-[JSValue setValue:forProperty:setValue:forProperty:]):
(-[JSValue deleteProperty:deleteProperty:]):
(-[JSValue hasProperty:hasProperty:]):
(-[JSValue defineProperty:descriptor:defineProperty:descriptor:]):
(-[JSValue isSymbol]):
(-[JSValue objectForKeyedSubscript:]):
(-[JSValue setObject:forKeyedSubscript:]):
(-[JSValue valueForProperty:]): Deleted.
(-[JSValue setValue:forProperty:]): Deleted.
(-[JSValue deleteProperty:]): Deleted.
(-[JSValue hasProperty:]): Deleted.
(-[JSValue defineProperty:descriptor:]): Deleted.
(JSValueGetType):
(JSValueIsSymbol):
(JSValueMakeSymbol):
- API/JSValueRef.h:
- API/WebKitAvailability.h:
- API/tests/CurrentThisInsideBlockGetterTest.mm:
- API/tests/CustomGlobalObjectClassTest.c:
- API/tests/DateTests.mm:
- API/tests/JSExportTests.mm:
- API/tests/JSNode.c:
- API/tests/JSNodeList.c:
- API/tests/Node.c:
- API/tests/NodeList.c:
- API/tests/minidom.c:
- API/tests/testapi.c:
(main):
- API/tests/testapi.cpp: Added.
(APIString::APIString):
(APIString::~APIString):
(APIString::operator JSStringRef):
(APIContext::APIContext):
(APIContext::~APIContext):
(APIContext::operator JSGlobalContextRef):
(APIVector::APIVector):
(APIVector::~APIVector):
(APIVector::append):
(testCAPIViaCpp):
(TestAPI::evaluateScript):
(TestAPI::callFunction):
(TestAPI::functionReturnsTrue):
(TestAPI::check):
(TestAPI::checkJSAndAPIMatch):
(TestAPI::interestingObjects):
(TestAPI::interestingKeys):
(TestAPI::run):
(testObjectiveCAPIMain):
- JavaScriptCore.xcodeproj/project.pbxproj:
- config.h:
- postprocess-headers.sh:
- shell/CMakeLists.txt:
- testmem/testmem.mm: