Changeset 173326 in webkit
- Timestamp:
- Sep 5, 2014 12:33:29 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/JSBase.cpp
r173263 r173326 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->string(), sourceURL ? sourceURL->string() : String(), TextPosition(OrdinalNumber::fromOneBasedInt(startingLineNumber), OrdinalNumber::first())); 64 64 65 65 JSValue evaluationException; … … 98 98 startingLineNumber = std::max(1, startingLineNumber); 99 99 100 SourceCode source = makeSource(script->string(), sourceURL ->string(), TextPosition(OrdinalNumber::fromOneBasedInt(startingLineNumber), OrdinalNumber::first()));100 SourceCode source = makeSource(script->string(), sourceURL ? sourceURL->string() : String(), TextPosition(OrdinalNumber::fromOneBasedInt(startingLineNumber), OrdinalNumber::first())); 101 101 102 102 JSValue syntaxException; -
trunk/Source/JavaScriptCore/API/JSObjectRef.cpp
r171691 r173326 148 148 args.append(jsString(exec, body->string())); 149 149 150 JSObject* result = constructFunction(exec, exec->lexicalGlobalObject(), args, nameID, sourceURL ->string(), TextPosition(OrdinalNumber::fromOneBasedInt(startingLineNumber), OrdinalNumber::first()));150 JSObject* result = constructFunction(exec, exec->lexicalGlobalObject(), args, nameID, sourceURL ? sourceURL->string() : String(), TextPosition(OrdinalNumber::fromOneBasedInt(startingLineNumber), OrdinalNumber::first())); 151 151 if (exec->hadException()) { 152 152 JSValue exceptionValue = exec->exception(); -
trunk/Source/JavaScriptCore/API/JSScriptRef.cpp
r173263 r173326 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; … … 106 106 startingLineNumber = std::max(1, startingLineNumber); 107 107 108 RefPtr<OpaqueJSScript> result = OpaqueJSScript::create(vm, url ->string(), startingLineNumber, source->string());108 RefPtr<OpaqueJSScript> result = OpaqueJSScript::create(vm, url ? url->string() : String(), startingLineNumber, source->string()); 109 109 110 110 ParserError error; -
trunk/Source/JavaScriptCore/API/JSStringRef.cpp
r173263 r173326 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
r173263 r173326 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
r173263 r173326 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
r173263 r173326 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
r173263 r173326 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
r173318 r173326 1 2014-09-05 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, JSObjectRef, JSScriptRef, 13 JSStringRef{CF} and JSValueRef. 14 15 Note that the following function arguments are _not_ NULL-checked 16 since doing so would just cover up bugs (and were not needed to 17 prevent any tests from failing): 18 - |script| in JSEvaluateScript(), JSCheckScriptSyntax(); 19 - |body| in JSObjectMakeFunction(); 20 - |source| in JSScriptCreateReferencingImmortalASCIIText() 21 (which is a const char* anyway); 22 - |source| in JSScriptCreateFromString(). 23 24 * API/JSBase.cpp: 25 (JSEvaluateScript): Add NULL check for |sourceURL|. 26 (JSCheckScriptSyntax): Ditto. 27 * API/JSObjectRef.cpp: 28 (JSObjectMakeFunction): Ditto. 29 * API/JSScriptRef.cpp: 30 (JSScriptCreateReferencingImmortalASCIIText): Ditto. 31 (JSScriptCreateFromString): Add NULL check for |url|. 32 * API/JSStringRef.cpp: 33 (JSStringGetLength): Return early if NULL pointer is passed in. 34 (JSStringGetCharactersPtr): Ditto. 35 (JSStringGetUTF8CString): Ditto. Also check |buffer| parameter. 36 * API/JSStringRefCF.cpp: 37 (JSStringCopyCFString): Ditto. 38 * API/JSValueRef.cpp: 39 (JSValueMakeString): Add NULL check for |string|. 40 41 * API/OpaqueJSString.cpp: 42 (OpaqueJSString::string): Remove code that checks |this|. 43 (OpaqueJSString::identifier): Ditto. 44 (OpaqueJSString::characters): Ditto. 45 * API/OpaqueJSString.h: 46 (OpaqueJSString::is8Bit): Remove code that checks |this|. 47 (OpaqueJSString::characters8): Ditto. 48 (OpaqueJSString::characters16): Ditto. 49 (OpaqueJSString::length): Ditto. 50 51 * parser/SourceProvider.h: 52 (JSC::SourceProvider::asID): Remove code that checks |this|. 53 1 54 2014-06-06 Jer Noble <jer.noble@apple.com> 2 55 -
trunk/Source/JavaScriptCore/parser/SourceProvider.h
r173263 r173326 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
r173320 r173326 1 2014-09-05 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-05 Beth Dakin <bdakin@apple.com> 2 15 -
trunk/Source/WebKit2/Shared/API/c/WKString.cpp
r173263 r173326 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.