Changeset 264751 in webkit
- Timestamp:
- Jul 23, 2020, 1:49:40 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/webrtc/missing-exception-checks-RTCPeerConnection-generateCertificate-expected.txt (added)
-
LayoutTests/webrtc/missing-exception-checks-RTCPeerConnection-generateCertificate.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp (modified) (4 diffs)
-
Source/WebCore/bindings/js/JSDOMConvertUnion.h (modified) (13 diffs)
-
Source/WebCore/bindings/js/JSDOMOperationReturningPromise.h (modified) (5 diffs)
-
Source/WebCore/bindings/js/JSDOMPromiseDeferred.cpp (modified) (3 diffs)
-
Source/WebCore/bindings/js/JSDOMPromiseDeferred.h (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r264749 r264751 1 2020-07-23 Mark Lam <mark.lam@apple.com> 2 3 Fix missing exception checks below RTCPeerConnection.generateCertificate(). 4 https://bugs.webkit.org/show_bug.cgi?id=214668 5 <rdar://problem/65929975> 6 7 Reviewed by Yusuke Suzuki. 8 9 * webrtc/missing-exception-checks-RTCPeerConnection-generateCertificate-expected.txt: Added. 10 * webrtc/missing-exception-checks-RTCPeerConnection-generateCertificate.html: Added. 11 1 12 2020-07-23 Diego Pino Garcia <dpino@igalia.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r264746 r264751 1 2020-07-23 Mark Lam <mark.lam@apple.com> 2 3 Fix missing exception checks below RTCPeerConnection.generateCertificate(). 4 https://bugs.webkit.org/show_bug.cgi?id=214668 5 <rdar://problem/65929975> 6 7 Reviewed by Yusuke Suzuki. 8 9 Test: webrtc/missing-exception-checks-RTCPeerConnection-generateCertificate.html 10 11 * bindings/js/JSCustomElementRegistryCustom.cpp: 12 (WebCore::JSCustomElementRegistry::whenDefined): 13 * bindings/js/JSDOMConvertUnion.h: 14 * bindings/js/JSDOMOperationReturningPromise.h: 15 (WebCore::IDLOperationReturningPromise::call): 16 (WebCore::IDLOperationReturningPromise::callReturningOwnPromise): 17 (WebCore::IDLOperationReturningPromise::callStatic): 18 (WebCore::IDLOperationReturningPromise::callStaticReturningOwnPromise): 19 * bindings/js/JSDOMPromiseDeferred.cpp: 20 (WebCore::DeferredPromise::reject): 21 (WebCore::rejectPromiseWithExceptionIfAny): 22 * bindings/js/JSDOMPromiseDeferred.h: 23 (WebCore::callPromiseFunction): 24 1 25 2020-07-22 Conrad Shultz <conrad_shultz@apple.com> 2 26 -
trunk/Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp
r260848 r264751 1 1 /* 2 * Copyright (C) 2015-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2015-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 205 205 JSValue JSCustomElementRegistry::whenDefined(JSGlobalObject& lexicalGlobalObject, CallFrame& callFrame) 206 206 { 207 auto scope = DECLARE_CATCH_SCOPE(lexicalGlobalObject.vm());207 auto catchScope = DECLARE_CATCH_SCOPE(lexicalGlobalObject.vm()); 208 208 209 209 ASSERT(globalObject()); … … 211 211 JSValue promise = whenDefinedPromise(lexicalGlobalObject, callFrame, *globalObject(), wrapped(), *result); 212 212 213 if (UNLIKELY(scope.exception())) { 214 rejectPromiseWithExceptionIfAny(lexicalGlobalObject, *globalObject(), *result); 215 scope.assertNoException(); 213 if (UNLIKELY(catchScope.exception())) { 214 rejectPromiseWithExceptionIfAny(lexicalGlobalObject, *globalObject(), *result, catchScope); 215 // FIXME: We could have error since any JS call can throw stack-overflow errors. 216 // https://bugs.webkit.org/show_bug.cgi?id=203402 217 RETURN_IF_EXCEPTION(catchScope, JSC::jsUndefined()); 216 218 return result; 217 219 } … … 220 222 } 221 223 222 } 224 } // namespace WebCore -
trunk/Source/WebCore/bindings/js/JSDOMConvertUnion.h
r251425 r264751 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 173 173 if (hasNullType) { 174 174 if (value.isUndefinedOrNull()) 175 return ConditionalConverter<ReturnType, IDLNull, hasNullType>::convert(lexicalGlobalObject, value).value();175 RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, IDLNull, hasNullType>::convert(lexicalGlobalObject, value).value())); 176 176 } 177 177 … … 183 183 if (value.isUndefinedOrNull()) { 184 184 // 1. If types includes a dictionary type, then return the result of converting V to that dictionary type. 185 return ConditionalConverter<ReturnType, DictionaryType, hasDictionaryType>::convert(lexicalGlobalObject, value).value();185 RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, DictionaryType, hasDictionaryType>::convert(lexicalGlobalObject, value).value())); 186 186 } 187 187 } … … 232 232 if (hasArrayBufferType) 233 233 return ConditionalReturner<ReturnType, hasArrayBufferType>::get(WTFMove(arrayBuffer)).value(); 234 return ConditionalConverter<ReturnType, ObjectType, hasObjectType>::convert(lexicalGlobalObject, value).value();234 RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, ObjectType, hasObjectType>::convert(lexicalGlobalObject, value).value())); 235 235 } 236 236 } … … 242 242 if (hasArrayBufferViewType) 243 243 return ConditionalReturner<ReturnType, hasArrayBufferViewType>::get(WTFMove(arrayBufferView)).value(); 244 return ConditionalConverter<ReturnType, ObjectType, hasObjectType>::convert(lexicalGlobalObject, value).value();244 RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, ObjectType, hasObjectType>::convert(lexicalGlobalObject, value).value())); 245 245 } 246 246 } … … 255 255 if (hasDataViewType) 256 256 return ConditionalReturner<ReturnType, hasDataViewType>::get(WTFMove(dataView)).value(); 257 return ConditionalConverter<ReturnType, ObjectType, hasObjectType>::convert(lexicalGlobalObject, value).value();257 RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, ObjectType, hasObjectType>::convert(lexicalGlobalObject, value).value())); 258 258 } 259 259 } … … 308 308 RETURN_IF_EXCEPTION(scope, ReturnType()); 309 309 if (!method.isUndefined()) 310 return ConditionalSequenceConverter<ReturnType, SequenceType, hasSequenceType>::convert(lexicalGlobalObject, object, method).value();310 RELEASE_AND_RETURN(scope, (ConditionalSequenceConverter<ReturnType, SequenceType, hasSequenceType>::convert(lexicalGlobalObject, object, method).value())); 311 311 } 312 312 … … 321 321 RETURN_IF_EXCEPTION(scope, ReturnType()); 322 322 if (!method.isUndefined()) 323 return ConditionalSequenceConverter<ReturnType, FrozenArrayType, hasFrozenArrayType>::convert(lexicalGlobalObject, object, method).value();323 RELEASE_AND_RETURN(scope, (ConditionalSequenceConverter<ReturnType, FrozenArrayType, hasFrozenArrayType>::convert(lexicalGlobalObject, object, method).value())); 324 324 } 325 325 … … 327 327 // converting V to that dictionary type. 328 328 if (hasDictionaryType) 329 return ConditionalConverter<ReturnType, DictionaryType, hasDictionaryType>::convert(lexicalGlobalObject, value).value();329 RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, DictionaryType, hasDictionaryType>::convert(lexicalGlobalObject, value).value())); 330 330 331 331 // 4. If types includes a record type, then return the result of converting V to that record type. 332 332 if (hasRecordType) 333 return ConditionalConverter<ReturnType, RecordType, hasRecordType>::convert(lexicalGlobalObject, value).value();333 RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, RecordType, hasRecordType>::convert(lexicalGlobalObject, value).value())); 334 334 335 335 // 5. If types includes a callback interface type, then return the result of converting V to that interface type. … … 338 338 // 6. If types includes object, then return the IDL value that is a reference to the object V. 339 339 if (hasObjectType) 340 return ConditionalConverter<ReturnType, ObjectType, hasObjectType>::convert(lexicalGlobalObject, value).value();340 RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, ObjectType, hasObjectType>::convert(lexicalGlobalObject, value).value())); 341 341 } 342 342 } … … 348 348 if (hasBooleanType) { 349 349 if (value.isBoolean()) 350 return ConditionalConverter<ReturnType, IDLBoolean, hasBooleanType>::convert(lexicalGlobalObject, value).value();350 RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, IDLBoolean, hasBooleanType>::convert(lexicalGlobalObject, value).value())); 351 351 } 352 352 … … 356 356 if (hasNumericType) { 357 357 if (value.isNumber()) 358 return ConditionalConverter<ReturnType, NumericType, hasNumericType>::convert(lexicalGlobalObject, value).value();358 RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, NumericType, hasNumericType>::convert(lexicalGlobalObject, value).value())); 359 359 } 360 360 … … 362 362 constexpr bool hasStringType = brigand::size<StringTypeList>::value != 0; 363 363 if (hasStringType) 364 return ConditionalConverter<ReturnType, StringType, hasStringType>::convert(lexicalGlobalObject, value).value();364 RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, StringType, hasStringType>::convert(lexicalGlobalObject, value).value())); 365 365 366 366 // 15. If types includes a numeric type, then return the result of converting V to that numeric type. 367 367 if (hasNumericType) 368 return ConditionalConverter<ReturnType, NumericType, hasNumericType>::convert(lexicalGlobalObject, value).value();368 RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, NumericType, hasNumericType>::convert(lexicalGlobalObject, value).value())); 369 369 370 370 // 16. If types includes a boolean, then return the result of converting V to boolean. 371 371 if (hasBooleanType) 372 return ConditionalConverter<ReturnType, IDLBoolean, hasBooleanType>::convert(lexicalGlobalObject, value).value();372 RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, IDLBoolean, hasBooleanType>::convert(lexicalGlobalObject, value).value())); 373 373 374 374 // 17. Throw a TypeError. -
trunk/Source/WebCore/bindings/js/JSDOMOperationReturningPromise.h
r251691 r264751 1 1 /* 2 2 * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) 3 * Copyright (C) 2003-20 06, 2008-2009, 2013, 2016Apple Inc. All rights reserved.3 * Copyright (C) 2003-2020 Apple Inc. All rights reserved. 4 4 * Copyright (C) 2007 Samuel Weinig <sam@webkit.org> 5 5 * Copyright (C) 2009 Google, Inc. All rights reserved. … … 50 50 51 51 // FIXME: We should refactor the binding generated code to use references for lexicalGlobalObject and thisObject. 52 return operation(&lexicalGlobalObject, &callFrame, thisObject, WTFMove(promise), throwScope);52 RELEASE_AND_RETURN(throwScope, operation(&lexicalGlobalObject, &callFrame, thisObject, WTFMove(promise), throwScope)); 53 53 })); 54 54 } … … 69 69 70 70 // FIXME: We should refactor the binding generated code to use references for lexicalGlobalObject and thisObject. 71 return operation(&lexicalGlobalObject, &callFrame, thisObject, throwScope);71 RELEASE_AND_RETURN(throwScope, operation(&lexicalGlobalObject, &callFrame, thisObject, throwScope)); 72 72 } 73 73 … … 79 79 80 80 // FIXME: We should refactor the binding generated code to use references for lexicalGlobalObject. 81 return operation(&lexicalGlobalObject, &callFrame, WTFMove(promise), throwScope);81 RELEASE_AND_RETURN(throwScope, operation(&lexicalGlobalObject, &callFrame, WTFMove(promise), throwScope)); 82 82 })); 83 83 } … … 91 91 92 92 // FIXME: We should refactor the binding generated code to use references for lexicalGlobalObject. 93 return operation(&lexicalGlobalObject, &callFrame, throwScope);93 RELEASE_AND_RETURN(throwScope, operation(&lexicalGlobalObject, &callFrame, throwScope)); 94 94 } 95 95 }; -
trunk/Source/WebCore/bindings/js/JSDOMPromiseDeferred.cpp
r260744 r264751 1 1 /* 2 * Copyright (C) 2013-20 17Apple Inc. All rights reserved.2 * Copyright (C) 2013-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 151 151 152 152 reject(lexicalGlobalObject, error, rejectAsHandled); 153 EXCEPTION_ASSERT(!scope.exception() || isTerminatedExecutionException(lexicalGlobalObject.vm(), scope.exception())); 153 154 } 154 155 … … 198 199 } 199 200 200 void rejectPromiseWithExceptionIfAny(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, JSPromise& promise) 201 { 202 VM& vm = lexicalGlobalObject.vm(); 203 auto scope = DECLARE_CATCH_SCOPE(vm); 204 205 if (LIKELY(!scope.exception())) 206 return; 207 208 JSValue error = scope.exception()->value(); 209 scope.clearException(); 201 void rejectPromiseWithExceptionIfAny(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, JSPromise& promise, JSC::CatchScope& catchScope) 202 { 203 UNUSED_PARAM(lexicalGlobalObject); 204 if (LIKELY(!catchScope.exception())) 205 return; 206 207 JSValue error = catchScope.exception()->value(); 208 catchScope.clearException(); 210 209 211 210 DeferredPromise::create(globalObject, promise)->reject<IDLAny>(error); -
trunk/Source/WebCore/bindings/js/JSDOMPromiseDeferred.h
r264021 r264751 1 1 /* 2 * Copyright (C) 2013 Apple Inc. All rights reserved.2 * Copyright (C) 2013-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 290 290 void fulfillPromiseWithArrayBuffer(Ref<DeferredPromise>&&, ArrayBuffer*); 291 291 void fulfillPromiseWithArrayBuffer(Ref<DeferredPromise>&&, const void*, size_t); 292 WEBCORE_EXPORT void rejectPromiseWithExceptionIfAny(JSC::JSGlobalObject&, JSDOMGlobalObject&, JSC::JSPromise& );292 WEBCORE_EXPORT void rejectPromiseWithExceptionIfAny(JSC::JSGlobalObject&, JSDOMGlobalObject&, JSC::JSPromise&, JSC::CatchScope&); 293 293 294 294 enum class RejectedPromiseWithTypeErrorCause { NativeGetter, InvalidThis }; … … 301 301 { 302 302 JSC::VM& vm = JSC::getVM(&lexicalGlobalObject); 303 auto scope = DECLARE_CATCH_SCOPE(vm);303 auto catchScope = DECLARE_CATCH_SCOPE(vm); 304 304 305 305 auto& globalObject = callerGlobalObject(lexicalGlobalObject, callFrame); … … 309 309 promiseFunction(lexicalGlobalObject, callFrame, DeferredPromise::create(globalObject, *promise)); 310 310 311 rejectPromiseWithExceptionIfAny(lexicalGlobalObject, globalObject, *promise );311 rejectPromiseWithExceptionIfAny(lexicalGlobalObject, globalObject, *promise, catchScope); 312 312 // FIXME: We could have error since any JS call can throw stack-overflow errors. 313 313 // https://bugs.webkit.org/show_bug.cgi?id=203402 314 RETURN_IF_EXCEPTION( scope, JSC::jsUndefined());314 RETURN_IF_EXCEPTION(catchScope, JSC::jsUndefined()); 315 315 return promise; 316 316 } … … 320 320 { 321 321 JSC::VM& vm = JSC::getVM(&lexicalGlobalObject); 322 auto scope = DECLARE_CATCH_SCOPE(vm);322 auto catchScope = DECLARE_CATCH_SCOPE(vm); 323 323 324 324 auto& globalObject = callerGlobalObject(lexicalGlobalObject, callFrame); … … 328 328 functor(lexicalGlobalObject, callFrame, DeferredPromise::create(globalObject, *promise)); 329 329 330 rejectPromiseWithExceptionIfAny(lexicalGlobalObject, globalObject, *promise );330 rejectPromiseWithExceptionIfAny(lexicalGlobalObject, globalObject, *promise, catchScope); 331 331 // FIXME: We could have error since any JS call can throw stack-overflow errors. 332 332 // https://bugs.webkit.org/show_bug.cgi?id=203402 333 RETURN_IF_EXCEPTION( scope, JSC::jsUndefined());333 RETURN_IF_EXCEPTION(catchScope, JSC::jsUndefined()); 334 334 return promise; 335 335 }
Note:
See TracChangeset
for help on using the changeset viewer.