JavaScriptCore should build with newer clang
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Sep 2014 00:53:16 +0000 (00:53 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Sep 2014 00:53:16 +0000 (00:53 +0000)
commit40e81e47b30f5f99b577c5ce508f2f27581c9a51
tree67481b7443f13a269c3d2545b445884bc5146569
parenta5b828e51baac2e08272e41ea4fcdd8ca999e722
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, JSScriptRef, JSStringRef{CF} and
JSValueRef.

* API/JSBase.cpp:
(JSEvaluateScript): Use String() in case |script| or |sourceURL|
are NULL.
* API/JSScriptRef.cpp:
(JSScriptCreateReferencingImmortalASCIIText): Use String() in
case |url| is NULL.
* 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): Use String() in case |string| is NULL.

* 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@173245 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/API/JSBase.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