Changeset 173245 in webkit
- Timestamp:
- Sep 3, 2014 5:53:16 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/JSBase.cpp
r167326 r173245 61 61 // evaluate sets "this" to the global object if it is NULL 62 62 JSGlobalObject* globalObject = exec->vmEntryGlobalObject(); 63 SourceCode source = makeSource(script ->string(), sourceURL->string(), TextPosition(OrdinalNumber::fromOneBasedInt(startingLineNumber), OrdinalNumber::first()));63 SourceCode source = makeSource(script ? script->string() : String(), sourceURL ? sourceURL->string() : String(), TextPosition(OrdinalNumber::fromOneBasedInt(startingLineNumber), OrdinalNumber::first())); 64 64 65 65 JSValue evaluationException; -
trunk/Source/JavaScriptCore/API/JSScriptRef.cpp
r167313 r173245 85 85 startingLineNumber = std::max(1, startingLineNumber); 86 86 87 RefPtr<OpaqueJSScript> result = OpaqueJSScript::create(vm, url ->string(), startingLineNumber, String(StringImpl::createFromLiteral(source, length)));87 RefPtr<OpaqueJSScript> result = OpaqueJSScript::create(vm, url ? url->string() : String(), startingLineNumber, String(StringImpl::createFromLiteral(source, length))); 88 88 89 89 ParserError error; -
trunk/Source/JavaScriptCore/API/JSStringRef.cpp
r165676 r173245 79 79 size_t JSStringGetLength(JSStringRef string) 80 80 { 81 if (!string) 82 return 0; 81 83 return string->length(); 82 84 } … … 84 86 const JSChar* JSStringGetCharactersPtr(JSStringRef string) 85 87 { 88 if (!string) 89 return nullptr; 86 90 return string->characters(); 87 91 } … … 95 99 size_t JSStringGetUTF8CString(JSStringRef string, char* buffer, size_t bufferSize) 96 100 { 97 if (! bufferSize)101 if (!string || !buffer || !bufferSize) 98 102 return 0; 99 103 -
trunk/Source/JavaScriptCore/API/JSStringRefCF.cpp
r165676 r173245 58 58 CFStringRef JSStringCopyCFString(CFAllocatorRef allocator, JSStringRef string) 59 59 { 60 if (!string ->length())60 if (!string || !string->length()) 61 61 return CFSTR(""); 62 62 -
trunk/Source/JavaScriptCore/API/JSValueRef.cpp
r171543 r173245 319 319 JSLockHolder locker(exec); 320 320 321 return toRef(exec, jsString(exec, string ->string()));321 return toRef(exec, jsString(exec, string ? string->string() : String())); 322 322 } 323 323 -
trunk/Source/JavaScriptCore/API/OpaqueJSString.cpp
r165719 r173245 57 57 String OpaqueJSString::string() const 58 58 { 59 if (!this)60 return String();61 62 59 // Return a copy of the wrapped string, because the caller may make it an Identifier. 63 60 return m_string.isolatedCopy(); … … 66 63 Identifier OpaqueJSString::identifier(VM* vm) const 67 64 { 68 if ( !this ||m_string.isNull())65 if (m_string.isNull()) 69 66 return Identifier(); 70 67 … … 80 77 const UChar* OpaqueJSString::characters() 81 78 { 82 if (!this)83 return nullptr;84 85 79 // m_characters is put in a local here to avoid an extra atomic load. 86 80 UChar* characters = m_characters; -
trunk/Source/JavaScriptCore/API/OpaqueJSString.h
r165676 r173245 56 56 JS_EXPORT_PRIVATE ~OpaqueJSString(); 57 57 58 bool is8Bit() { return this ? m_string.is8Bit() : false; }59 const LChar* characters8() { return this ? m_string.characters8() : nullptr; }60 const UChar* characters16() { return this ? m_string.characters16() : nullptr; }61 unsigned length() { return this ? m_string.length() : 0; }58 bool is8Bit() { return m_string.is8Bit(); } 59 const LChar* characters8() { return m_string.characters8(); } 60 const UChar* characters16() { return m_string.characters16(); } 61 unsigned length() { return m_string.length(); } 62 62 63 63 const UChar* characters(); -
trunk/Source/JavaScriptCore/ChangeLog
r173244 r173245 1 2014-09-03 David Kilzer <ddkilzer@apple.com> 2 3 JavaScriptCore should build with newer clang 4 <http://webkit.org/b/136002> 5 <rdar://problem/18020616> 6 7 Reviewed by Geoffrey Garen. 8 9 Other than the JSC::SourceProvider::asID() change (which simply 10 removes code that the optimizing compiler would have discarded 11 in Release builds), we move the |this| checks in OpaqueJSString 12 to NULL checks in to JSBase, JSScriptRef, JSStringRef{CF} and 13 JSValueRef. 14 15 * API/JSBase.cpp: 16 (JSEvaluateScript): Use String() in case |script| or |sourceURL| 17 are NULL. 18 * API/JSScriptRef.cpp: 19 (JSScriptCreateReferencingImmortalASCIIText): Use String() in 20 case |url| is NULL. 21 * API/JSStringRef.cpp: 22 (JSStringGetLength): Return early if NULL pointer is passed in. 23 (JSStringGetCharactersPtr): Ditto. 24 (JSStringGetUTF8CString): Ditto. Also check |buffer| parameter. 25 * API/JSStringRefCF.cpp: 26 (JSStringCopyCFString): Ditto. 27 * API/JSValueRef.cpp: 28 (JSValueMakeString): Use String() in case |string| is NULL. 29 30 * API/OpaqueJSString.cpp: 31 (OpaqueJSString::string): Remove code that checks |this|. 32 (OpaqueJSString::identifier): Ditto. 33 (OpaqueJSString::characters): Ditto. 34 * API/OpaqueJSString.h: 35 (OpaqueJSString::is8Bit): Remove code that checks |this|. 36 (OpaqueJSString::characters8): Ditto. 37 (OpaqueJSString::characters16): Ditto. 38 (OpaqueJSString::length): Ditto. 39 40 * parser/SourceProvider.h: 41 (JSC::SourceProvider::asID): Remove code that checks |this|. 42 1 43 2014-09-03 Filip Pizlo <fpizlo@apple.com> 2 44 -
trunk/Source/JavaScriptCore/parser/SourceProvider.h
r165676 r173245 55 55 intptr_t asID() 56 56 { 57 ASSERT(this);58 if (!this) // Be defensive in release mode.59 return nullID;60 57 if (!m_id) 61 58 getID(); -
trunk/Source/WebKit2/ChangeLog
r173235 r173245 1 2014-09-03 David Kilzer <ddkilzer@apple.com> 2 3 JavaScriptCore should build with newer clang 4 <http://webkit.org/b/136002> 5 <rdar://problem/18020616> 6 7 Reviewed by Geoffrey Garen. 8 9 * Shared/API/c/WKString.cpp: 10 (WKStringCreateWithJSString): Add NULL check to prevent 11 WebKitTestRunner crashes that relied on the previous |this| 12 behavior where NULL values were allowed. 13 1 14 2014-09-03 Enrica Casucci <enrica@apple.com> 2 15 -
trunk/Source/WebKit2/Shared/API/c/WKString.cpp
r160608 r173245 86 86 WKStringRef WKStringCreateWithJSString(JSStringRef jsStringRef) 87 87 { 88 RefPtr<API::String> apiString = API::String::create(jsStringRef);88 RefPtr<API::String> apiString = jsStringRef ? API::String::create(jsStringRef) : API::String::createNull(); 89 89 return toAPI(apiString.release().leakRef()); 90 90 }
Note: See TracChangeset
for help on using the changeset viewer.