JavaScriptCore should build with newer clang
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Sep 2014 19:33:29 +0000 (19:33 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Sep 2014 19:33:29 +0000 (19:33 +0000)
commit8f2251b4978efa297795240fe29dfba086b76e9d
tree14798cfc8119d31589d0e0c4877644aabbbfd047
parent1d5a2f5d5e7c6a9e77ee77cae05bfcbabb792476
JavaScriptCore should build with newer clang
<http://webkit.org/b/136002>
<rdar://problem/18020616>

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Other than the JSC::SourceProvider::asID() change (which simply
removes code that the optimizing compiler would have discarded
in Release builds), we move the |this| checks in OpaqueJSString
to NULL checks in to JSBase, JSObjectRef, JSScriptRef,
JSStringRef{CF} and JSValueRef.

Note that the following function arguments are _not_ NULL-checked
since doing so would just cover up bugs (and were not needed to
prevent any tests from failing):
- |script| in JSEvaluateScript(), JSCheckScriptSyntax();
- |body| in JSObjectMakeFunction();
- |source| in JSScriptCreateReferencingImmortalASCIIText()
  (which is a const char* anyway);
- |source| in JSScriptCreateFromString().

* API/JSBase.cpp:
(JSEvaluateScript): Add NULL check for |sourceURL|.
(JSCheckScriptSyntax): Ditto.
* API/JSObjectRef.cpp:
(JSObjectMakeFunction): Ditto.
* API/JSScriptRef.cpp:
(JSScriptCreateReferencingImmortalASCIIText): Ditto.
(JSScriptCreateFromString): Add NULL check for |url|.
* API/JSStringRef.cpp:
(JSStringGetLength): Return early if NULL pointer is passed in.
(JSStringGetCharactersPtr): Ditto.
(JSStringGetUTF8CString): Ditto.  Also check |buffer| parameter.
* API/JSStringRefCF.cpp:
(JSStringCopyCFString): Ditto.
* API/JSValueRef.cpp:
(JSValueMakeString): Add NULL check for |string|.

* API/OpaqueJSString.cpp:
(OpaqueJSString::string): Remove code that checks |this|.
(OpaqueJSString::identifier): Ditto.
(OpaqueJSString::characters): Ditto.
* API/OpaqueJSString.h:
(OpaqueJSString::is8Bit): Remove code that checks |this|.
(OpaqueJSString::characters8): Ditto.
(OpaqueJSString::characters16): Ditto.
(OpaqueJSString::length): Ditto.

* parser/SourceProvider.h:
(JSC::SourceProvider::asID): Remove code that checks |this|.

Source/WebKit2:

* Shared/API/c/WKString.cpp:
(WKStringCreateWithJSString): Add NULL check to prevent
WebKitTestRunner crashes that relied on the previous |this|
behavior where NULL values were allowed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173326 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
Source/JavaScriptCore/API/JSBase.cpp
Source/JavaScriptCore/API/JSObjectRef.cpp
Source/JavaScriptCore/API/JSScriptRef.cpp
Source/JavaScriptCore/API/JSStringRef.cpp
Source/JavaScriptCore/API/JSStringRefCF.cpp
Source/JavaScriptCore/API/JSValueRef.cpp
Source/JavaScriptCore/API/OpaqueJSString.cpp
Source/JavaScriptCore/API/OpaqueJSString.h
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/parser/SourceProvider.h
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/API/c/WKString.cpp