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().
(JSEvaluateScript): Add NULL check for |sourceURL|.
(JSCheckScriptSyntax): Ditto.
(JSObjectMakeFunction): Ditto.
(JSScriptCreateReferencingImmortalASCIIText): Ditto.
(JSScriptCreateFromString): Add NULL check for |url|.
(JSStringGetLength): Return early if NULL pointer is passed in.
(JSStringGetCharactersPtr): Ditto.
(JSStringGetUTF8CString): Ditto. Also check |buffer| parameter.
(JSStringCopyCFString): Ditto.
(JSValueMakeString): Add NULL check for |string|.
(OpaqueJSString::string): Remove code that checks |this|.
(OpaqueJSString::identifier): Ditto.
(OpaqueJSString::characters): Ditto.
(OpaqueJSString::is8Bit): Remove code that checks |this|.
(OpaqueJSString::characters8): Ditto.
(OpaqueJSString::characters16): Ditto.
(OpaqueJSString::length): Ditto.
(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.