2018-10-03 Kocsen Chung Cherry-pick r236806. rdar://problem/44855484 CRASH in CVPixelBufferGetBytePointerCallback() https://bugs.webkit.org/show_bug.cgi?id=190092 Reviewed by Eric Carlson. Speculative fix for crash that occurs when callers of CVPixelBufferGetBytePointerCallback() attempt to read the last byte of a CVPixelBuffer (as a pre-flight check) and crash due to a memory access error. It's speculated that mismatching CVPixelBufferLockBytePointer / CVPixelBufferUnlockBytePointer calls could result in an incorrect state inside the CVPixelBuffer. Add log count checks, locking, and release logging to try to pinpoint if mismatch lock counts are occurring in this code path. * platform/graphics/cv/PixelBufferConformerCV.cpp: (WebCore::CVPixelBufferGetBytePointerCallback): (WebCore::CVPixelBufferReleaseBytePointerCallback): (WebCore::CVPixelBufferReleaseInfoCallback): (WebCore::PixelBufferConformerCV::createImageFromPixelBuffer): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236806 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-10-03 Jer Noble CRASH in CVPixelBufferGetBytePointerCallback() https://bugs.webkit.org/show_bug.cgi?id=190092 Reviewed by Eric Carlson. Speculative fix for crash that occurs when callers of CVPixelBufferGetBytePointerCallback() attempt to read the last byte of a CVPixelBuffer (as a pre-flight check) and crash due to a memory access error. It's speculated that mismatching CVPixelBufferLockBytePointer / CVPixelBufferUnlockBytePointer calls could result in an incorrect state inside the CVPixelBuffer. Add log count checks, locking, and release logging to try to pinpoint if mismatch lock counts are occurring in this code path. * platform/graphics/cv/PixelBufferConformerCV.cpp: (WebCore::CVPixelBufferGetBytePointerCallback): (WebCore::CVPixelBufferReleaseBytePointerCallback): (WebCore::CVPixelBufferReleaseInfoCallback): (WebCore::PixelBufferConformerCV::createImageFromPixelBuffer): 2018-09-28 Babak Shafiei Cherry-pick r236615. rdar://problem/44883290 [Apple Pay] Remove the "in-store" button type https://bugs.webkit.org/show_bug.cgi?id=190079 Reviewed by Tim Horton. Source/WebCore: According to , this button is meant only for certain kinds of native apps. It shouldn't be available on the web. Updated http/tests/ssl/applepay/ApplePayButton.html. * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator ApplePayButtonType const): * css/CSSValueKeywords.in: * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): * rendering/RenderThemeCocoa.mm: (WebCore::toPKPaymentButtonType): * rendering/style/RenderStyleConstants.h: Source/WebInspectorUI: * UserInterface/Models/CSSKeywordCompletions.js: LayoutTests: * http/tests/ssl/applepay/ApplePayButton.html: * platform/mac/http/tests/ssl/applepay/ApplePayButton-expected.png: * platform/mac/http/tests/ssl/applepay/ApplePayButton-expected.txt: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236615 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-09-28 Andy Estes [Apple Pay] Remove the "in-store" button type https://bugs.webkit.org/show_bug.cgi?id=190079 Reviewed by Tim Horton. According to , this button is meant only for certain kinds of native apps. It shouldn't be available on the web. Updated http/tests/ssl/applepay/ApplePayButton.html. * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator ApplePayButtonType const): * css/CSSValueKeywords.in: * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): * rendering/RenderThemeCocoa.mm: (WebCore::toPKPaymentButtonType): * rendering/style/RenderStyleConstants.h: 2018-09-21 Kocsen Chung Cherry-pick r236306. rdar://problem/44682841 Restrict the total combined size of backdrop filters https://bugs.webkit.org/show_bug.cgi?id=189812 Reviewed by Simon Fraser. Source/WebCore: If the total area of all backdrop filters on the page gets too large, the universe collapses in on itself and we enter the Quantum Realm (i.e. crash horribly). Put a hard limit on the total coverage, and ignore any backdrop filters after the limit. This might break some content, but such content is likely not doing things in the most optimal manner. There isn't any reason to have a backdrop larger than the size of the screen, because you'd be better off applying a foreground filter to the main content and showing something above it. Tests: css3/filters/backdrop/resource-use-add-more-layers.html css3/filters/backdrop/resource-use-excessive.html css3/filters/backdrop/resource-use-ok.html css3/filters/backdrop/resource-use-remove-some-layers.html * platform/graphics/ca/GraphicsLayerCA.cpp: Pick a fairly small maximum size. We can consider increasing this if necessary, and as devices with less RAM are upgraded. (WebCore::GraphicsLayerCA::recursiveCommitChanges): Gather the accumulated size of backdrop filters into the commit state as we are recursing through the tree. (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers): Force any layer with backdrop filters, or any that is removing backdrop filters, into an update. (WebCore::GraphicsLayerCA::updateBackdropFilters): Update the logic to first check if this backdrop layer causes us to exceed the total allowed size, and if it does, forbid it from getting the GraphicsLayer that composits the backdrop. * platform/graphics/ca/GraphicsLayerCA.h: Remove const from some parameters so that we can use the CommitState to hold the accumulated size. LayoutTests: Tests that have an acceptable number of backdrops, an excessive number of backdrops, and then some that add and remove backdrops at various points in the tree to confirm we do recursive checks correctly. * css3/filters/backdrop/layer-tree-as-text.js: Added. * css3/filters/backdrop/resource-use-add-more-layers-expected.txt: Added. * css3/filters/backdrop/resource-use-add-more-layers.html: Added. * css3/filters/backdrop/resource-use-excessive-expected.txt: Added. * css3/filters/backdrop/resource-use-excessive.html: Added. * css3/filters/backdrop/resource-use-ok-expected.txt: Added. * css3/filters/backdrop/resource-use-ok.html: Added. * css3/filters/backdrop/resource-use-remove-some-layers-expected.txt: Added. * css3/filters/backdrop/resource-use-remove-some-layers.html: Added. * css3/filters/backdrop/resource-use.css: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236306 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-09-20 Dean Jackson Restrict the total combined size of backdrop filters https://bugs.webkit.org/show_bug.cgi?id=189812 Reviewed by Simon Fraser. If the total area of all backdrop filters on the page gets too large, the universe collapses in on itself and we enter the Quantum Realm (i.e. crash horribly). Put a hard limit on the total coverage, and ignore any backdrop filters after the limit. This might break some content, but such content is likely not doing things in the most optimal manner. There isn't any reason to have a backdrop larger than the size of the screen, because you'd be better off applying a foreground filter to the main content and showing something above it. Tests: css3/filters/backdrop/resource-use-add-more-layers.html css3/filters/backdrop/resource-use-excessive.html css3/filters/backdrop/resource-use-ok.html css3/filters/backdrop/resource-use-remove-some-layers.html * platform/graphics/ca/GraphicsLayerCA.cpp: Pick a fairly small maximum size. We can consider increasing this if necessary, and as devices with less RAM are upgraded. (WebCore::GraphicsLayerCA::recursiveCommitChanges): Gather the accumulated size of backdrop filters into the commit state as we are recursing through the tree. (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers): Force any layer with backdrop filters, or any that is removing backdrop filters, into an update. (WebCore::GraphicsLayerCA::updateBackdropFilters): Update the logic to first check if this backdrop layer causes us to exceed the total allowed size, and if it does, forbid it from getting the GraphicsLayer that composits the backdrop. * platform/graphics/ca/GraphicsLayerCA.h: Remove const from some parameters so that we can use the CommitState to hold the accumulated size. 2018-09-19 Kocsen Chung Cherry-pick r235752. rdar://problem/44576797 Don't pause playback when locking screen if video is being displayed on second screen. https://bugs.webkit.org/show_bug.cgi?id=189321 Reviewed by Eric Carlson. Source/WebCore: Expand the existing behavior when AirPlaying to an external device to playing to a local external screen. Don't pause when the screen locks, and don't stop buffering in that mode either. Add a KVO-observer to the WebAVPlayerController's playingOnSecondScreen property, and pass that observed value on to the media element. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::setShouldPlayToPlaybackTarget): (WebCore::HTMLMediaElement::setPlayingOnSecondScreen): (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const): (WebCore::HTMLMediaElement::processingUserGestureForMedia const): (WebCore::HTMLMediaElement::mediaState const): (WebCore::HTMLMediaElement::purgeBufferedDataIfPossible): (WebCore::HTMLMediaElement::shouldOverrideBackgroundLoadingRestriction const): (WebCore::HTMLMediaElement::webkitCurrentPlaybackTargetIsWireless const): Deleted. (WebCore::HTMLMediaElement::canPlayToWirelessPlaybackTarget const): Deleted. (WebCore::HTMLMediaElement::isPlayingToWirelessPlaybackTarget const): Deleted. * html/HTMLMediaElement.h: (WebCore::HTMLMediaElement::webkitCurrentPlaybackTargetIsWireless const): (WebCore::HTMLMediaElement::isPlayingToExternalTarget const): * html/MediaElementSession.cpp: (WebCore::MediaElementSession::canPlayToWirelessPlaybackTarget const): Deleted. * html/MediaElementSession.h: * platform/audio/PlatformMediaSession.h: (WebCore::PlatformMediaSessionClient::setWirelessPlaybackTarget): (WebCore::PlatformMediaSessionClient::isPlayingOnSecondScreen const): (WebCore::PlatformMediaSession::canPlayToWirelessPlaybackTarget const): Deleted. (WebCore::PlatformMediaSessionClient::canPlayToWirelessPlaybackTarget const): Deleted. * platform/cocoa/PlaybackSessionModel.h: * platform/cocoa/PlaybackSessionModelMediaElement.h: * platform/cocoa/PlaybackSessionModelMediaElement.mm: (WebCore::PlaybackSessionModelMediaElement::setPlayingOnSecondScreen): * platform/ios/WebAVPlayerController.mm: (-[WebAVPlayerController init]): (-[WebAVPlayerController dealloc]): (-[WebAVPlayerController observeValueForKeyPath:ofObject:change:context:]): * platform/ios/WebVideoFullscreenControllerAVKit.mm: (VideoFullscreenControllerContext::setPlayingOnSecondScreen): Source/WebKit: Pass the "isPlayingOnSecondScreen" value across the process boundary. * UIProcess/Cocoa/PlaybackSessionManagerProxy.h: * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm: (WebKit::PlaybackSessionModelContext::setPlayingOnSecondScreen): (WebKit::PlaybackSessionManagerProxy::setPlayingOnSecondScreen): * WebProcess/cocoa/PlaybackSessionManager.h: * WebProcess/cocoa/PlaybackSessionManager.messages.in: * WebProcess/cocoa/PlaybackSessionManager.mm: (WebKit::PlaybackSessionManager::setPlayingOnSecondScreen): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235752 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-09-06 Jer Noble Don't pause playback when locking screen if video is being displayed on second screen. https://bugs.webkit.org/show_bug.cgi?id=189321 Reviewed by Eric Carlson. Expand the existing behavior when AirPlaying to an external device to playing to a local external screen. Don't pause when the screen locks, and don't stop buffering in that mode either. Add a KVO-observer to the WebAVPlayerController's playingOnSecondScreen property, and pass that observed value on to the media element. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::setShouldPlayToPlaybackTarget): (WebCore::HTMLMediaElement::setPlayingOnSecondScreen): (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const): (WebCore::HTMLMediaElement::processingUserGestureForMedia const): (WebCore::HTMLMediaElement::mediaState const): (WebCore::HTMLMediaElement::purgeBufferedDataIfPossible): (WebCore::HTMLMediaElement::shouldOverrideBackgroundLoadingRestriction const): (WebCore::HTMLMediaElement::webkitCurrentPlaybackTargetIsWireless const): Deleted. (WebCore::HTMLMediaElement::canPlayToWirelessPlaybackTarget const): Deleted. (WebCore::HTMLMediaElement::isPlayingToWirelessPlaybackTarget const): Deleted. * html/HTMLMediaElement.h: (WebCore::HTMLMediaElement::webkitCurrentPlaybackTargetIsWireless const): (WebCore::HTMLMediaElement::isPlayingToExternalTarget const): * html/MediaElementSession.cpp: (WebCore::MediaElementSession::canPlayToWirelessPlaybackTarget const): Deleted. * html/MediaElementSession.h: * platform/audio/PlatformMediaSession.h: (WebCore::PlatformMediaSessionClient::setWirelessPlaybackTarget): (WebCore::PlatformMediaSessionClient::isPlayingOnSecondScreen const): (WebCore::PlatformMediaSession::canPlayToWirelessPlaybackTarget const): Deleted. (WebCore::PlatformMediaSessionClient::canPlayToWirelessPlaybackTarget const): Deleted. * platform/cocoa/PlaybackSessionModel.h: * platform/cocoa/PlaybackSessionModelMediaElement.h: * platform/cocoa/PlaybackSessionModelMediaElement.mm: (WebCore::PlaybackSessionModelMediaElement::setPlayingOnSecondScreen): * platform/ios/WebAVPlayerController.mm: (-[WebAVPlayerController init]): (-[WebAVPlayerController dealloc]): (-[WebAVPlayerController observeValueForKeyPath:ofObject:change:context:]): * platform/ios/WebVideoFullscreenControllerAVKit.mm: (VideoFullscreenControllerContext::setPlayingOnSecondScreen): 2018-09-19 Kocsen Chung Cherry-pick r235956. rdar://problem/44576825 imported/w3c/web-platform-tests/shadow-dom/form-control-form-attribute.html hits assertion https://bugs.webkit.org/show_bug.cgi?id=189493 Reviewed by Alex Christensen. Source/WebCore: The debug assertion was caused by RefPtr in FormAssociatedElement::formOwnerRemovedFromTree introduced by r224390 and r223644 ref'ing ShadowRoot while calling removeDetachedChildren inside ~ShadowRoot. When a form (or any other) element has more than one ref inside removeDetachedChildren, addChildNodesToDeletionQueue calls notifyChildNodeRemoved in the tree oreder. However, when a form associated element of this form element appears later in the tree order, FormAssociatedElement::formOwnerRemovedFromTree can traverse up ancestors including the ShadowRoot. Fixed the bug by using raw pointers instead. Luckily, there is no DOM mutations or other non-trivial operations happening in this function so this should be safe. Test: imported/w3c/web-platform-tests/shadow-dom/form-control-form-attribute.html * html/FormAssociatedElement.cpp: (WebCore::FormAssociatedElement::formOwnerRemovedFromTree): Fixed the bug. LayoutTests: Unskip the test now that it doesn't hit a debug assertion. * TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235956 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-09-11 Ryosuke Niwa imported/w3c/web-platform-tests/shadow-dom/form-control-form-attribute.html hits assertion https://bugs.webkit.org/show_bug.cgi?id=189493 Reviewed by Alex Christensen. The debug assertion was caused by RefPtr in FormAssociatedElement::formOwnerRemovedFromTree introduced by r224390 and r223644 ref'ing ShadowRoot while calling removeDetachedChildren inside ~ShadowRoot. When a form (or any other) element has more than one ref inside removeDetachedChildren, addChildNodesToDeletionQueue calls notifyChildNodeRemoved in the tree oreder. However, when a form associated element of this form element appears later in the tree order, FormAssociatedElement::formOwnerRemovedFromTree can traverse up ancestors including the ShadowRoot. Fixed the bug by using raw pointers instead. Luckily, there is no DOM mutations or other non-trivial operations happening in this function so this should be safe. Test: imported/w3c/web-platform-tests/shadow-dom/form-control-form-attribute.html * html/FormAssociatedElement.cpp: (WebCore::FormAssociatedElement::formOwnerRemovedFromTree): Fixed the bug. 2018-09-06 Babak Shafiei Cherry-pick r235754. rdar://problem/44210305 [Apple Pay] Rename the -apple-pay-button-type value "checkout" to "check-out" https://bugs.webkit.org/show_bug.cgi?id=189366 Reviewed by Sam Weinig. Source/WebCore: The button title is "Check out with Apple Pay", so we should use the verb phrase "check out" rather than the noun "checkout" for naming this value. Updated http/tests/ssl/applepay/ApplePayButtonV4.html. * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator ApplePayButtonType const): * css/CSSValueKeywords.in: * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): * rendering/RenderThemeCocoa.mm: (WebCore::toPKPaymentButtonType): * rendering/style/RenderStyleConstants.h: Source/WebInspectorUI: * UserInterface/Models/CSSKeywordCompletions.js: LayoutTests: * http/tests/ssl/applepay/ApplePayButtonV4.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235754 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-09-06 Andy Estes [Apple Pay] Rename the -apple-pay-button-type value "checkout" to "check-out" https://bugs.webkit.org/show_bug.cgi?id=189366 Reviewed by Sam Weinig. The button title is "Check out with Apple Pay", so we should use the verb phrase "check out" rather than the noun "checkout" for naming this value. Updated http/tests/ssl/applepay/ApplePayButtonV4.html. * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator ApplePayButtonType const): * css/CSSValueKeywords.in: * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): * rendering/RenderThemeCocoa.mm: (WebCore::toPKPaymentButtonType): * rendering/style/RenderStyleConstants.h: 2018-09-06 Babak Shafiei Cherry-pick r235349. rdar://problem/44209834 [Apple Pay] Introduce new values for -apple-pay-button-type https://bugs.webkit.org/show_bug.cgi?id=188949 Reviewed by Anders Carlsson. Source/WebCore: Added "in-store", "checkout", "book", and "subscribe" keywords for -apple-pay-button-type, and mapped those values to their equivalent PKPaymentButtonTypes. Tests: http/tests/ssl/applepay/ApplePayButton.html http/tests/ssl/applepay/ApplePayButtonV4.html * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator ApplePayButtonType const): * css/CSSValueKeywords.in: * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): * rendering/RenderThemeCocoa.mm: (WebCore::toPKPaymentButtonType): * rendering/style/RenderStyleConstants.h: Source/WebCore/PAL: * pal/spi/cocoa/PassKitSPI.h: LayoutTests: * http/tests/ssl/applepay/ApplePayButton.html: Added. * http/tests/ssl/applepay/ApplePayButtonV4.html: Added. * platform/mac-highsierra/http/tests/ssl/applepay/ApplePayButton-expected.png: * platform/mac-highsierra/http/tests/ssl/applepay/ApplePayButton-expected.txt: * platform/mac/http/tests/ssl/applepay/ApplePayButton-expected.png: Added. * platform/mac/http/tests/ssl/applepay/ApplePayButton-expected.txt: Added. * platform/mac/http/tests/ssl/applepay/ApplePayButtonV4-expected.png: Added. * platform/mac/http/tests/ssl/applepay/ApplePayButtonV4-expected.txt: Added. * platform/mac-wk2/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235349 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-08-26 Andy Estes [Apple Pay] Introduce new values for -apple-pay-button-type https://bugs.webkit.org/show_bug.cgi?id=188949 Reviewed by Anders Carlsson. Added "in-store", "checkout", "book", and "subscribe" keywords for -apple-pay-button-type, and mapped those values to their equivalent PKPaymentButtonTypes. Tests: http/tests/ssl/applepay/ApplePayButton.html http/tests/ssl/applepay/ApplePayButtonV4.html * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator ApplePayButtonType const): * css/CSSValueKeywords.in: * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): * rendering/RenderThemeCocoa.mm: (WebCore::toPKPaymentButtonType): * rendering/style/RenderStyleConstants.h: 2018-09-06 Babak Shafiei Cherry-pick r235569. rdar://problem/44169479 Storage Access API: Maintain access through same-site navigations https://bugs.webkit.org/show_bug.cgi?id=188564 Reviewed by Alex Christensen. Source/WebCore: Tests: http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access.html http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access.html * dom/Document.h: Removed unused member variable m_hasFrameSpecificStorageAccess. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): * loader/FrameLoaderClient.h: Source/WebKit: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchWillChangeDocument): Now takes the current URL and the new URL as parameters and only clears out storage access if the navigation is cross-site, i.e. with differing eTLD+1s. * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: LayoutTests: * http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame-expected.txt: * http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame.html: Added both a same-site and a cross-site navigation to the sub frame to test maintained and cleared access. * http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access-expected.txt: Copied from LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access-expected.txt. * http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access.html: Copied from LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html. * http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access-expected.txt: Renamed from LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access-expected.txt. * http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access.html: Renamed from LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html. * http/tests/storageAccess/resources/get-cookies.php: Support for the new test scenarios. * http/tests/storageAccess/resources/self-navigating-frame-after-granted-access.html: Support for the new test scenarios. * platform/mac-wk2/TestExpectations: Marked the new and the renamed tests as [ Pass ]. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235569 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-08-31 John Wilander Storage Access API: Maintain access through same-site navigations https://bugs.webkit.org/show_bug.cgi?id=188564 Reviewed by Alex Christensen. Tests: http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access.html http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access.html * dom/Document.h: Removed unused member variable m_hasFrameSpecificStorageAccess. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): * loader/FrameLoaderClient.h: 2018-09-06 Babak Shafiei Cherry-pick r235318. rdar://problem/44209848 [Apple Pay] Allow $0 totals https://bugs.webkit.org/show_bug.cgi?id=185150 Reviewed by Dan Bernstein. Source/WebCore: Relaxed payment request validation to allow $0 totals. This matches PassKit behavior. Updated test cases in http/tests/ssl/applepay/. * Modules/applepay/PaymentRequestValidator.mm: (WebCore::PaymentRequestValidator::validateTotal): LayoutTests: * http/tests/ssl/applepay/ApplePaySession-expected.txt: * http/tests/ssl/applepay/ApplePaySession.html: * http/tests/ssl/applepay/ApplePaySessionV3-expected.txt: * http/tests/ssl/applepay/ApplePaySessionV3.html: * http/tests/ssl/applepay/ApplePaySessionV4-expected.txt: * http/tests/ssl/applepay/ApplePaySessionV4.html: * http/tests/ssl/applepay/PaymentRequest.https-expected.txt: * http/tests/ssl/applepay/PaymentRequest.https.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235318 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-08-24 Andy Estes [Apple Pay] Allow $0 totals https://bugs.webkit.org/show_bug.cgi?id=185150 Reviewed by Dan Bernstein. Relaxed payment request validation to allow $0 totals. This matches PassKit behavior. Updated test cases in http/tests/ssl/applepay/. * Modules/applepay/PaymentRequestValidator.mm: (WebCore::PaymentRequestValidator::validateTotal): 2018-09-06 Babak Shafiei Cherry-pick r235251. rdar://problem/44209840 [Apple Pay] Introduce Apple Pay JS v4 on iOS 12 and macOS Mojave https://bugs.webkit.org/show_bug.cgi?id=188829 Reviewed by Tim Horton. Source/JavaScriptCore: * Configurations/FeatureDefines.xcconfig: Source/WebCore: Test: http/tests/ssl/applepay/ApplePaySessionV4.html * Configurations/FeatureDefines.xcconfig: * testing/MockPaymentCoordinator.cpp: (WebCore::MockPaymentCoordinator::supportsVersion): Source/WebCore/PAL: * Configurations/FeatureDefines.xcconfig: Source/WebKit: * Configurations/FeatureDefines.xcconfig: * WebProcess/ApplePay/WebPaymentCoordinator.cpp: (WebKit::WebPaymentCoordinator::supportsVersion): Source/WebKitLegacy/mac: * Configurations/FeatureDefines.xcconfig: Tools: * TestWebKitAPI/Configurations/FeatureDefines.xcconfig: LayoutTests: * http/tests/ssl/applepay/ApplePaySession-expected.txt: * http/tests/ssl/applepay/ApplePaySession.html: * http/tests/ssl/applepay/ApplePaySessionV3-expected.txt: * http/tests/ssl/applepay/ApplePaySessionV3.html: * http/tests/ssl/applepay/ApplePaySessionV4-expected.txt: Added. * http/tests/ssl/applepay/ApplePaySessionV4.html: Added. * platform/mac-wk2/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235251 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-08-23 Andy Estes [Apple Pay] Introduce Apple Pay JS v4 on iOS 12 and macOS Mojave https://bugs.webkit.org/show_bug.cgi?id=188829 Reviewed by Tim Horton. Test: http/tests/ssl/applepay/ApplePaySessionV4.html * Configurations/FeatureDefines.xcconfig: * testing/MockPaymentCoordinator.cpp: (WebCore::MockPaymentCoordinator::supportsVersion): 2018-09-06 Babak Shafiei Cherry-pick r235721. rdar://problem/44212406 Source/WebCore: The width of an empty or nullptr TextRun should be zero https://bugs.webkit.org/show_bug.cgi?id=189154 Reviewed by Zalan Bujtas. If a page has an empty TextRun and attempts to paint it we can crash with a nullptr. This patch recognizes that an empty TextRun should always produce a zero width, rather than attempt to compute this value from font data. It also prevents ListBox from attempting to paint a null string. Test: fast/text/null-string-textrun.html * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::widthOfTextRange const): An empty TextRun has zero width. (WebCore::FontCascade::width const): Ditto. * platform/graphics/TextRun.h: (WebCore::TextRun::TextRun): ASSERT that the supplied String is non-null. (WebCore::TextRun::setText): Ditto. * rendering/RenderListBox.cpp: (WebCore::RenderListBox::paintItemForeground): Don't attempt to paint a null string. Source/WTF: The width of an empty or nullptr TextRun should be zero https://bugs.webkit.org/show_bug.cgi?id=189154 Reviewed by Zalan Bujtas. Most accessors in WTFString.cpp, such as isAllASCII(), hash(), etc., perform a nullptr check before using m_impl, but is8Bit() does not. This patch adds a check in the is8Bit() implementation to be consistent with other methods, and to address a small number of crashes observed in testing. * wtf/text/WTFString.h: (WTF::String::is8Bit const): LayoutTests: The width of a nullptr TextRun should be zero https://bugs.webkit.org/show_bug.cgi?id=189154 Reviewed by Zalan Bujtas. * fast/text/null-string-textrun-expected.txt: Added. * fast/text/null-string-textrun.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235721 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-09-05 Brent Fulgham The width of an empty or nullptr TextRun should be zero https://bugs.webkit.org/show_bug.cgi?id=189154 Reviewed by Zalan Bujtas. If a page has an empty TextRun and attempts to paint it we can crash with a nullptr. This patch recognizes that an empty TextRun should always produce a zero width, rather than attempt to compute this value from font data. It also prevents ListBox from attempting to paint a null string. Test: fast/text/null-string-textrun.html * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::widthOfTextRange const): An empty TextRun has zero width. (WebCore::FontCascade::width const): Ditto. * platform/graphics/TextRun.h: (WebCore::TextRun::TextRun): ASSERT that the supplied String is non-null. (WebCore::TextRun::setText): Ditto. * rendering/RenderListBox.cpp: (WebCore::RenderListBox::paintItemForeground): Don't attempt to paint a null string. 2018-09-06 Mark Lam Cherry-pick r235254, r235419, r235666. rdar://problem/44169332 2018-08-23 Mark Lam Move vmEntryGlobalObject() to VM from CallFrame. https://bugs.webkit.org/show_bug.cgi?id=188900 Reviewed by Michael Saboff. No new tests needed because this patch does not introduce new functionality. * bindings/js/JSCustomXPathNSResolver.cpp: (WebCore::JSCustomXPathNSResolver::create): * bindings/js/JSDOMGlobalObject.cpp: (WebCore::callerGlobalObject): (WebCore::toJSDOMGlobalObject): Deleted. * bindings/js/JSDOMWindowBase.cpp: (WebCore::firstDOMWindow): * bridge/c/c_utility.cpp: (JSC::Bindings::convertValueToNPVariant): * bridge/objc/WebScriptObject.mm: (WebCore::addExceptionToConsole): * bridge/objc/objc_instance.mm: (ObjcInstance::moveGlobalExceptionToExecState): * bridge/objc/objc_runtime.mm: (JSC::Bindings::convertValueToObjcObject): * bridge/objc/objc_utility.mm: (JSC::Bindings::convertValueToObjcValue): * testing/Internals.cpp: (WebCore::Internals::cloneArrayBuffer): 2018-09-06 Babak Shafiei Cherry-pick r235537. rdar://problem/44169516 CounterMaps should hold a unique_ptr of CounterMap. https://bugs.webkit.org/show_bug.cgi?id=189174 Reviewed by Ryosuke Niwa. Source/WebCore: In certain cases calls to CounterMaps might lead to unexpected deletion of the CounterMap object. Test: fast/css/counters/crash-when-cloning-body.html * rendering/RenderCounter.cpp: (WebCore::makeCounterNode): (WebCore::destroyCounterNodeWithoutMapRemoval): (WebCore::RenderCounter::destroyCounterNodes): (WebCore::RenderCounter::destroyCounterNode): (WebCore::updateCounters): (showCounterRendererTree): LayoutTests: * fast/css/counters/crash-when-cloning-body-expected.txt: Added. * fast/css/counters/crash-when-cloning-body.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235537 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-08-30 Zalan Bujtas CounterMaps should hold a unique_ptr of CounterMap. https://bugs.webkit.org/show_bug.cgi?id=189174 Reviewed by Ryosuke Niwa. In certain cases calls to CounterMaps might lead to unexpected deletion of the CounterMap object. Test: fast/css/counters/crash-when-cloning-body.html * rendering/RenderCounter.cpp: (WebCore::makeCounterNode): (WebCore::destroyCounterNodeWithoutMapRemoval): (WebCore::RenderCounter::destroyCounterNodes): (WebCore::RenderCounter::destroyCounterNode): (WebCore::updateCounters): (showCounterRendererTree): 2018-09-06 Babak Shafiei Cherry-pick r233898. rdar://problem/44168991 [WebCrypto] Crypto operations should copy their parameters before hoping to another thread https://bugs.webkit.org/show_bug.cgi?id=187501 Reviewed by Youenn Fablet. Source/WebCore: This patch aims at making all captured variables in all crypto lambdas that need to be passed to a worker thread thread safe, which includes: 1) changing ref counted objects to thread safe ref counted object. 2) adding isolatedCopy methods to non ref counted classes, so they can be called by CrossThreadCopy(). In addition to above changes, this patch also does the following things: 1) change the name CryptoAlgorithm::dispatchOperation => CryptoAlgorithm::dispatchOperationInWorkQueue to make it clear that lambdas will be passed to a secondary thread. 2) make CryptoAlgorithmParameters as const parameters for all methods. 3) add null checks on BufferSource.length() and .data(). Tests: crypto/subtle/aes-gcm-import-key-unwrap-ec-raw-key.html http/wpt/crypto/aes-cbc-crash.any.html http/wpt/crypto/aes-cbc-crash.any.worker.html http/wpt/crypto/aes-ctr-crash.any.html http/wpt/crypto/aes-ctr-crash.any.worker.html http/wpt/crypto/aes-gcm-crash.any.html http/wpt/crypto/aes-gcm-crash.any.worker.html http/wpt/crypto/derive-hmac-key-crash.any.html http/wpt/crypto/derive-hmac-key-crash.any.worker.html http/wpt/crypto/ecdsa-crash.any.html http/wpt/crypto/ecdsa-crash.any.worker.html http/wpt/crypto/hkdf-crash.any.html http/wpt/crypto/hkdf-crash.any.worker.html http/wpt/crypto/pbkdf2-crash.any.html http/wpt/crypto/pbkdf2-crash.any.worker.html http/wpt/crypto/rsa-oaep-crash.any.html http/wpt/crypto/rsa-oaep-crash.any.worker.html http/wpt/crypto/rsa-pss-crash.any.html http/wpt/crypto/rsa-pss-crash.any.worker.html http/wpt/crypto/unwrap-ec-key-crash.any.html http/wpt/crypto/unwrap-ec-key-crash.any.worker.html http/wpt/crypto/unwrap-rsa-key-crash.any.html http/wpt/crypto/unwrap-rsa-key-crash.any.worker.html * bindings/js/BufferSource.h: (WebCore::BufferSource::data const): (WebCore::BufferSource::length const): * crypto/CryptoAlgorithm.cpp: (WebCore::CryptoAlgorithm::encrypt): (WebCore::CryptoAlgorithm::decrypt): (WebCore::CryptoAlgorithm::sign): (WebCore::CryptoAlgorithm::verify): (WebCore::CryptoAlgorithm::deriveBits): (WebCore::CryptoAlgorithm::importKey): (WebCore::dispatchAlgorithmOperation): (WebCore::CryptoAlgorithm::dispatchOperationInWorkQueue): (WebCore::CryptoAlgorithm::dispatchOperation): Deleted. * crypto/CryptoAlgorithm.h: * crypto/SubtleCrypto.cpp: (WebCore::crossThreadCopyImportParams): (WebCore::SubtleCrypto::encrypt): (WebCore::SubtleCrypto::decrypt): (WebCore::SubtleCrypto::sign): (WebCore::SubtleCrypto::verify): (WebCore::SubtleCrypto::deriveKey): (WebCore::SubtleCrypto::deriveBits): (WebCore::SubtleCrypto::importKey): (WebCore::SubtleCrypto::wrapKey): (WebCore::SubtleCrypto::unwrapKey): * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::encrypt): (WebCore::CryptoAlgorithmAES_CBC::decrypt): (WebCore::CryptoAlgorithmAES_CBC::importKey): * crypto/algorithms/CryptoAlgorithmAES_CBC.h: * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp: (WebCore::CryptoAlgorithmAES_CFB::encrypt): (WebCore::CryptoAlgorithmAES_CFB::decrypt): (WebCore::CryptoAlgorithmAES_CFB::importKey): * crypto/algorithms/CryptoAlgorithmAES_CFB.h: * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp: (WebCore::parametersAreValid): (WebCore::CryptoAlgorithmAES_CTR::encrypt): (WebCore::CryptoAlgorithmAES_CTR::decrypt): (WebCore::CryptoAlgorithmAES_CTR::importKey): * crypto/algorithms/CryptoAlgorithmAES_CTR.h: * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp: (WebCore::CryptoAlgorithmAES_GCM::encrypt): (WebCore::CryptoAlgorithmAES_GCM::decrypt): (WebCore::CryptoAlgorithmAES_GCM::importKey): * crypto/algorithms/CryptoAlgorithmAES_GCM.h: * crypto/algorithms/CryptoAlgorithmAES_KW.cpp: (WebCore::CryptoAlgorithmAES_KW::importKey): * crypto/algorithms/CryptoAlgorithmAES_KW.h: * crypto/algorithms/CryptoAlgorithmECDH.cpp: (WebCore::CryptoAlgorithmECDH::deriveBits): (WebCore::CryptoAlgorithmECDH::importKey): * crypto/algorithms/CryptoAlgorithmECDH.h: * crypto/algorithms/CryptoAlgorithmECDSA.cpp: (WebCore::CryptoAlgorithmECDSA::sign): (WebCore::CryptoAlgorithmECDSA::verify): (WebCore::CryptoAlgorithmECDSA::importKey): * crypto/algorithms/CryptoAlgorithmECDSA.h: * crypto/algorithms/CryptoAlgorithmHKDF.cpp: (WebCore::CryptoAlgorithmHKDF::deriveBits): (WebCore::CryptoAlgorithmHKDF::importKey): * crypto/algorithms/CryptoAlgorithmHKDF.h: * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::sign): (WebCore::CryptoAlgorithmHMAC::verify): (WebCore::CryptoAlgorithmHMAC::importKey): * crypto/algorithms/CryptoAlgorithmHMAC.h: * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp: (WebCore::CryptoAlgorithmPBKDF2::deriveBits): (WebCore::CryptoAlgorithmPBKDF2::importKey): * crypto/algorithms/CryptoAlgorithmPBKDF2.h: * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey): * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign): (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify): (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey): * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::encrypt): (WebCore::CryptoAlgorithmRSA_OAEP::decrypt): (WebCore::CryptoAlgorithmRSA_OAEP::importKey): * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h: * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp: (WebCore::CryptoAlgorithmRSA_PSS::sign): (WebCore::CryptoAlgorithmRSA_PSS::verify): (WebCore::CryptoAlgorithmRSA_PSS::importKey): * crypto/algorithms/CryptoAlgorithmRSA_PSS.h: * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp: (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt): (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt): * crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp: (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt): (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt): * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp: (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt): (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt): * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp: (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt): (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt): * crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp: (WebCore::CryptoAlgorithmHKDF::platformDeriveBits): * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp: (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits): * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt): (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt): * crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp: (WebCore::CryptoAlgorithmRSA_PSS::platformSign): (WebCore::CryptoAlgorithmRSA_PSS::platformVerify): * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp: (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt): (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt): * crypto/mac/CryptoAlgorithmAES_CFBMac.cpp: (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt): (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt): * crypto/mac/CryptoAlgorithmAES_CTRMac.cpp: (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt): (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt): * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp: (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt): (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt): * crypto/mac/CryptoAlgorithmHKDFMac.cpp: (WebCore::CryptoAlgorithmHKDF::platformDeriveBits): * crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp: (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits): * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt): (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt): * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp: (WebCore::CryptoAlgorithmRSA_PSS::platformSign): (WebCore::CryptoAlgorithmRSA_PSS::platformVerify): * crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h: * crypto/parameters/CryptoAlgorithmAesCtrParams.h: * crypto/parameters/CryptoAlgorithmAesGcmParams.h: * crypto/parameters/CryptoAlgorithmEcKeyParams.h: * crypto/parameters/CryptoAlgorithmEcdsaParams.h: * crypto/parameters/CryptoAlgorithmHkdfParams.h: * crypto/parameters/CryptoAlgorithmHmacKeyParams.h: * crypto/parameters/CryptoAlgorithmPbkdf2Params.h: * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h: * crypto/parameters/CryptoAlgorithmRsaOaepParams.h: * crypto/parameters/CryptoAlgorithmRsaPssParams.h: LayoutTests: crypto/subtle/aes-gcm-import-key-unwrap-ec-raw-key.html is an exception of this series of tests as it only aims to test the correct behavoir of suggested algorithms. This patch aslo does some test gardening. * TestExpectations: * crypto/subtle/aes-gcm-import-key-unwrap-ec-raw-key-expected.txt: Added. * crypto/subtle/aes-gcm-import-key-unwrap-ec-raw-key.html: Added. * http/wpt/crypto/aes-cbc-crash.any-expected.txt: Added. * http/wpt/crypto/aes-cbc-crash.any.html: Added. * http/wpt/crypto/aes-cbc-crash.any.js: Added. * http/wpt/crypto/aes-cbc-crash.any.worker-expected.txt: Added. * http/wpt/crypto/aes-cbc-crash.any.worker.html: Added. * http/wpt/crypto/aes-ctr-crash.any-expected.txt: Added. * http/wpt/crypto/aes-ctr-crash.any.html: Added. * http/wpt/crypto/aes-ctr-crash.any.js: Added. * http/wpt/crypto/aes-ctr-crash.any.worker-expected.txt: Added. * http/wpt/crypto/aes-ctr-crash.any.worker.html: Added. * http/wpt/crypto/aes-gcm-crash.any-expected.txt: Added. * http/wpt/crypto/aes-gcm-crash.any.html: Added. * http/wpt/crypto/aes-gcm-crash.any.js: Added. * http/wpt/crypto/aes-gcm-crash.any.worker-expected.txt: Added. * http/wpt/crypto/aes-gcm-crash.any.worker.html: Added. * http/wpt/crypto/derive-hmac-key-crash.any-expected.txt: Added. * http/wpt/crypto/derive-hmac-key-crash.any.html: Added. * http/wpt/crypto/derive-hmac-key-crash.any.js: Added. * http/wpt/crypto/derive-hmac-key-crash.any.worker-expected.txt: Added. * http/wpt/crypto/derive-hmac-key-crash.any.worker.html: Added. * http/wpt/crypto/ecdsa-crash.any-expected.txt: Added. * http/wpt/crypto/ecdsa-crash.any.html: Added. * http/wpt/crypto/ecdsa-crash.any.js: Added. * http/wpt/crypto/ecdsa-crash.any.worker-expected.txt: Added. * http/wpt/crypto/ecdsa-crash.any.worker.html: Added. * http/wpt/crypto/hkdf-crash.any-expected.txt: Added. * http/wpt/crypto/hkdf-crash.any.html: Added. * http/wpt/crypto/hkdf-crash.any.js: Added. * http/wpt/crypto/hkdf-crash.any.worker-expected.txt: Added. * http/wpt/crypto/hkdf-crash.any.worker.html: Added. * http/wpt/crypto/pbkdf2-crash.any-expected.txt: Added. * http/wpt/crypto/pbkdf2-crash.any.html: Added. * http/wpt/crypto/pbkdf2-crash.any.js: Added. * http/wpt/crypto/pbkdf2-crash.any.worker-expected.txt: Added. * http/wpt/crypto/pbkdf2-crash.any.worker.html: Added. * http/wpt/crypto/resources/common.js: Added. * http/wpt/crypto/rsa-oaep-crash.any-expected.txt: Added. * http/wpt/crypto/rsa-oaep-crash.any.html: Added. * http/wpt/crypto/rsa-oaep-crash.any.js: Added. * http/wpt/crypto/rsa-oaep-crash.any.worker-expected.txt: Added. * http/wpt/crypto/rsa-oaep-crash.any.worker.html: Added. * http/wpt/crypto/rsa-pss-crash.any-expected.txt: Added. * http/wpt/crypto/rsa-pss-crash.any.html: Added. * http/wpt/crypto/rsa-pss-crash.any.js: Added. * http/wpt/crypto/rsa-pss-crash.any.worker-expected.txt: Added. * http/wpt/crypto/rsa-pss-crash.any.worker.html: Added. * http/wpt/crypto/unwrap-ec-key-crash.any-expected.txt: Added. * http/wpt/crypto/unwrap-ec-key-crash.any.html: Added. * http/wpt/crypto/unwrap-ec-key-crash.any.js: Added. * http/wpt/crypto/unwrap-ec-key-crash.any.worker-expected.txt: Added. * http/wpt/crypto/unwrap-ec-key-crash.any.worker.html: Added. * http/wpt/crypto/unwrap-rsa-key-crash.any-expected.txt: Added. * http/wpt/crypto/unwrap-rsa-key-crash.any.html: Added. * http/wpt/crypto/unwrap-rsa-key-crash.any.js: Added. * http/wpt/crypto/unwrap-rsa-key-crash.any.worker.html: Added. * http/wpt/crypto/unwrap-rsa-key-crash.any.worker-expected.txt: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233898 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-15 Jiewen Tan [WebCrypto] Crypto operations should copy their parameters before hoping to another thread https://bugs.webkit.org/show_bug.cgi?id=187501 Reviewed by Youenn Fablet. This patch aims at making all captured variables in all crypto lambdas that need to be passed to a worker thread thread safe, which includes: 1) changing ref counted objects to thread safe ref counted object. 2) adding isolatedCopy methods to non ref counted classes, so they can be called by CrossThreadCopy(). In addition to above changes, this patch also does the following things: 1) change the name CryptoAlgorithm::dispatchOperation => CryptoAlgorithm::dispatchOperationInWorkQueue to make it clear that lambdas will be passed to a secondary thread. 2) make CryptoAlgorithmParameters as const parameters for all methods. 3) add null checks on BufferSource.length() and .data(). Tests: crypto/subtle/aes-gcm-import-key-unwrap-ec-raw-key.html http/wpt/crypto/aes-cbc-crash.any.html http/wpt/crypto/aes-cbc-crash.any.worker.html http/wpt/crypto/aes-ctr-crash.any.html http/wpt/crypto/aes-ctr-crash.any.worker.html http/wpt/crypto/aes-gcm-crash.any.html http/wpt/crypto/aes-gcm-crash.any.worker.html http/wpt/crypto/derive-hmac-key-crash.any.html http/wpt/crypto/derive-hmac-key-crash.any.worker.html http/wpt/crypto/ecdsa-crash.any.html http/wpt/crypto/ecdsa-crash.any.worker.html http/wpt/crypto/hkdf-crash.any.html http/wpt/crypto/hkdf-crash.any.worker.html http/wpt/crypto/pbkdf2-crash.any.html http/wpt/crypto/pbkdf2-crash.any.worker.html http/wpt/crypto/rsa-oaep-crash.any.html http/wpt/crypto/rsa-oaep-crash.any.worker.html http/wpt/crypto/rsa-pss-crash.any.html http/wpt/crypto/rsa-pss-crash.any.worker.html http/wpt/crypto/unwrap-ec-key-crash.any.html http/wpt/crypto/unwrap-ec-key-crash.any.worker.html http/wpt/crypto/unwrap-rsa-key-crash.any.html http/wpt/crypto/unwrap-rsa-key-crash.any.worker.html * bindings/js/BufferSource.h: (WebCore::BufferSource::data const): (WebCore::BufferSource::length const): * crypto/CryptoAlgorithm.cpp: (WebCore::CryptoAlgorithm::encrypt): (WebCore::CryptoAlgorithm::decrypt): (WebCore::CryptoAlgorithm::sign): (WebCore::CryptoAlgorithm::verify): (WebCore::CryptoAlgorithm::deriveBits): (WebCore::CryptoAlgorithm::importKey): (WebCore::dispatchAlgorithmOperation): (WebCore::CryptoAlgorithm::dispatchOperationInWorkQueue): (WebCore::CryptoAlgorithm::dispatchOperation): Deleted. * crypto/CryptoAlgorithm.h: * crypto/SubtleCrypto.cpp: (WebCore::crossThreadCopyImportParams): (WebCore::SubtleCrypto::encrypt): (WebCore::SubtleCrypto::decrypt): (WebCore::SubtleCrypto::sign): (WebCore::SubtleCrypto::verify): (WebCore::SubtleCrypto::deriveKey): (WebCore::SubtleCrypto::deriveBits): (WebCore::SubtleCrypto::importKey): (WebCore::SubtleCrypto::wrapKey): (WebCore::SubtleCrypto::unwrapKey): * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::encrypt): (WebCore::CryptoAlgorithmAES_CBC::decrypt): (WebCore::CryptoAlgorithmAES_CBC::importKey): * crypto/algorithms/CryptoAlgorithmAES_CBC.h: * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp: (WebCore::CryptoAlgorithmAES_CFB::encrypt): (WebCore::CryptoAlgorithmAES_CFB::decrypt): (WebCore::CryptoAlgorithmAES_CFB::importKey): * crypto/algorithms/CryptoAlgorithmAES_CFB.h: * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp: (WebCore::parametersAreValid): (WebCore::CryptoAlgorithmAES_CTR::encrypt): (WebCore::CryptoAlgorithmAES_CTR::decrypt): (WebCore::CryptoAlgorithmAES_CTR::importKey): * crypto/algorithms/CryptoAlgorithmAES_CTR.h: * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp: (WebCore::CryptoAlgorithmAES_GCM::encrypt): (WebCore::CryptoAlgorithmAES_GCM::decrypt): (WebCore::CryptoAlgorithmAES_GCM::importKey): * crypto/algorithms/CryptoAlgorithmAES_GCM.h: * crypto/algorithms/CryptoAlgorithmAES_KW.cpp: (WebCore::CryptoAlgorithmAES_KW::importKey): * crypto/algorithms/CryptoAlgorithmAES_KW.h: * crypto/algorithms/CryptoAlgorithmECDH.cpp: (WebCore::CryptoAlgorithmECDH::deriveBits): (WebCore::CryptoAlgorithmECDH::importKey): * crypto/algorithms/CryptoAlgorithmECDH.h: * crypto/algorithms/CryptoAlgorithmECDSA.cpp: (WebCore::CryptoAlgorithmECDSA::sign): (WebCore::CryptoAlgorithmECDSA::verify): (WebCore::CryptoAlgorithmECDSA::importKey): * crypto/algorithms/CryptoAlgorithmECDSA.h: * crypto/algorithms/CryptoAlgorithmHKDF.cpp: (WebCore::CryptoAlgorithmHKDF::deriveBits): (WebCore::CryptoAlgorithmHKDF::importKey): * crypto/algorithms/CryptoAlgorithmHKDF.h: * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::sign): (WebCore::CryptoAlgorithmHMAC::verify): (WebCore::CryptoAlgorithmHMAC::importKey): * crypto/algorithms/CryptoAlgorithmHMAC.h: * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp: (WebCore::CryptoAlgorithmPBKDF2::deriveBits): (WebCore::CryptoAlgorithmPBKDF2::importKey): * crypto/algorithms/CryptoAlgorithmPBKDF2.h: * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey): * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign): (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify): (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey): * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::encrypt): (WebCore::CryptoAlgorithmRSA_OAEP::decrypt): (WebCore::CryptoAlgorithmRSA_OAEP::importKey): * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h: * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp: (WebCore::CryptoAlgorithmRSA_PSS::sign): (WebCore::CryptoAlgorithmRSA_PSS::verify): (WebCore::CryptoAlgorithmRSA_PSS::importKey): * crypto/algorithms/CryptoAlgorithmRSA_PSS.h: * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp: (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt): (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt): * crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp: (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt): (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt): * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp: (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt): (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt): * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp: (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt): (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt): * crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp: (WebCore::CryptoAlgorithmHKDF::platformDeriveBits): * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp: (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits): * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt): (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt): * crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp: (WebCore::CryptoAlgorithmRSA_PSS::platformSign): (WebCore::CryptoAlgorithmRSA_PSS::platformVerify): * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp: (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt): (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt): * crypto/mac/CryptoAlgorithmAES_CFBMac.cpp: (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt): (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt): * crypto/mac/CryptoAlgorithmAES_CTRMac.cpp: (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt): (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt): * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp: (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt): (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt): * crypto/mac/CryptoAlgorithmHKDFMac.cpp: (WebCore::CryptoAlgorithmHKDF::platformDeriveBits): * crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp: (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits): * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt): (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt): * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp: (WebCore::CryptoAlgorithmRSA_PSS::platformSign): (WebCore::CryptoAlgorithmRSA_PSS::platformVerify): * crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h: * crypto/parameters/CryptoAlgorithmAesCtrParams.h: * crypto/parameters/CryptoAlgorithmAesGcmParams.h: * crypto/parameters/CryptoAlgorithmEcKeyParams.h: * crypto/parameters/CryptoAlgorithmEcdsaParams.h: * crypto/parameters/CryptoAlgorithmHkdfParams.h: * crypto/parameters/CryptoAlgorithmHmacKeyParams.h: * crypto/parameters/CryptoAlgorithmPbkdf2Params.h: * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h: * crypto/parameters/CryptoAlgorithmRsaOaepParams.h: * crypto/parameters/CryptoAlgorithmRsaPssParams.h: 2018-09-05 Babak Shafiei Cherry-pick r234905. rdar://problem/44144059 Can't share an app on AppStore to WeChat due to a release assert https://bugs.webkit.org/show_bug.cgi?id=188621 Reviewed by Geoffrey Garen. Disable the thread safety check when the app is not linked on or after iOS 12 since this release assert is getting hit by third party applications on iOS in UI process. Source/WebCore: * platform/Timer.cpp: (WebCore::shouldSuppressThreadSafetyCheck): Added a SDK check. Source/WebKit: * UIProcess/Cocoa/VersionChecks.h: (WebKit::SDKVersion::FirstWithMainThreadReleaseAssertionInWebPageProxy): Added. It's iOS 12 or macOS 10.14 Mojave. * UIProcess/WebProcessProxy.cpp: (WebKit::isMainThreadOrCheckDisabled): Added. Returns true whether when we're in the main thread or if the app is not linked on or after iOS 12 or macOS 10.14 Mojave. (WebKit::globalPageMap): (WebKit::m_isInPrewarmedPool): (WebKit::WebProcessProxy::~WebProcessProxy): (WebKit::WebProcessProxy::shutDown): (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores): (WebKit::WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData): (WebKit::WebProcessProxy::didFinishLaunching): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234905 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-08-15 Ryosuke Niwa Can't share an app on AppStore to WeChat due to a release assert https://bugs.webkit.org/show_bug.cgi?id=188621 Reviewed by Geoffrey Garen. Disable the thread safety check when the app is not linked on or after iOS 12 since this release assert is getting hit by third party applications on iOS in UI process. * platform/Timer.cpp: (WebCore::shouldSuppressThreadSafetyCheck): Added a SDK check. 2018-09-05 Babak Shafiei Cherry-pick r234890. rdar://problem/44144063 Remove failing assertion introduced in r234873 https://bugs.webkit.org/show_bug.cgi?id=188581 * contentextensions/ContentExtensionCompiler.cpp: (WebCore::ContentExtensions::compileRuleList): The assertion is correct but failing because VectorTraits is incorrect. I'll re-add it and fix VectorTraits in a separate patch. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234890 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-08-15 Alex Christensen Remove failing assertion introduced in r234873 https://bugs.webkit.org/show_bug.cgi?id=188581 * contentextensions/ContentExtensionCompiler.cpp: (WebCore::ContentExtensions::compileRuleList): The assertion is correct but failing because VectorTraits is incorrect. I'll re-add it and fix VectorTraits in a separate patch. 2018-09-05 Babak Shafiei Cherry-pick r234873. rdar://problem/44144063 isValidCSSSelector is unsafe to be called from a non-main thread https://bugs.webkit.org/show_bug.cgi?id=188581 Reviewed by Sam Weinig. Source/WebCore: Parsing and determining whether the css selectors are valid is fast enough to do before hopping to the background thread for the slow NFA/DFA operations and writing to disk. Doing it on the main thread avoids the thread safety issues in the CSSParser's use of strings. * contentextensions/ContentExtensionCompiler.cpp: (WebCore::ContentExtensions::compileRuleList): * contentextensions/ContentExtensionCompiler.h: * contentextensions/ContentExtensionParser.cpp: (WebCore::ContentExtensions::isValidCSSSelector): (WebCore::ContentExtensions::loadEncodedRules): (WebCore::ContentExtensions::parseRuleList): * contentextensions/ContentExtensionParser.h: * contentextensions/ContentExtensionRule.cpp: (WebCore::ContentExtensions::Trigger::isolatedCopy const): (WebCore::ContentExtensions::Action::isolatedCopy const): * contentextensions/ContentExtensionRule.h: (WebCore::ContentExtensions::Trigger::isEmpty const): (WebCore::ContentExtensions::Trigger::operator== const): (WebCore::ContentExtensions::Action::Action): (WebCore::ContentExtensions::ContentExtensionRule::isolatedCopy const): (WebCore::ContentExtensions::ContentExtensionRule::operator== const): (WebCore::ContentExtensions::vectorIsolatedCopy): Source/WebKit: * UIProcess/API/APIContentRuleListStore.cpp: (API::compiledToFile): (API::ContentRuleListStore::lookupContentRuleList): (API::ContentRuleListStore::getAvailableContentRuleListIdentifiers): (API::ContentRuleListStore::compileContentRuleList): (API::ContentRuleListStore::removeContentRuleList): (API::ContentRuleListStore::getContentRuleListSource): * UIProcess/API/APIContentRuleListStore.h: * UIProcess/API/Cocoa/WKContentRuleListStore.mm: Source/WTF: * wtf/Vector.h: (WTF::minCapacity>::isolatedCopy): Tools: * TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp: (TestWebKitAPI::InMemoryCompiledContentExtension::create): (TestWebKitAPI::checkCompilerError): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234873 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-08-14 Alex Christensen isValidCSSSelector is unsafe to be called from a non-main thread https://bugs.webkit.org/show_bug.cgi?id=188581 Reviewed by Sam Weinig. Parsing and determining whether the css selectors are valid is fast enough to do before hopping to the background thread for the slow NFA/DFA operations and writing to disk. Doing it on the main thread avoids the thread safety issues in the CSSParser's use of strings. * contentextensions/ContentExtensionCompiler.cpp: (WebCore::ContentExtensions::compileRuleList): * contentextensions/ContentExtensionCompiler.h: * contentextensions/ContentExtensionParser.cpp: (WebCore::ContentExtensions::isValidCSSSelector): (WebCore::ContentExtensions::loadEncodedRules): (WebCore::ContentExtensions::parseRuleList): * contentextensions/ContentExtensionParser.h: * contentextensions/ContentExtensionRule.cpp: (WebCore::ContentExtensions::Trigger::isolatedCopy const): (WebCore::ContentExtensions::Action::isolatedCopy const): * contentextensions/ContentExtensionRule.h: (WebCore::ContentExtensions::Trigger::isEmpty const): (WebCore::ContentExtensions::Trigger::operator== const): (WebCore::ContentExtensions::Action::Action): (WebCore::ContentExtensions::ContentExtensionRule::isolatedCopy const): (WebCore::ContentExtensions::ContentExtensionRule::operator== const): (WebCore::ContentExtensions::vectorIsolatedCopy): 2018-09-05 Babak Shafiei Cherry-pick r234778. rdar://problem/44144053 [macOS] Multiple third party apps crash due to the thread safety check in TimerBase::setNextFireTime https://bugs.webkit.org/show_bug.cgi?id=188480 Reviewed by Simon Fraser. Source/WebCore: Suppress the release assert in WebKit1 on macOS (isInWebProcess is always true in non-Cocoa platforms). In the future, we should consider throwing Objective-C exceptions when third party apps call WebKit1 or WebKit2 APIs in non-main threads. * platform/Timer.cpp: (WebCore::shouldSuppressThreadSafetyCheck): Extracted out of ~TimerBase and setNextFireTime. (WebCore::TimerBase::~TimerBase): (WebCore::TimerBase::setNextFireTime): Source/WTF: Added the SDK version for macOS Mojave. * wtf/spi/darwin/dyldSPI.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234778 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-08-10 Ryosuke Niwa [macOS] Multiple third party apps crash due to the thread safety check in TimerBase::setNextFireTime https://bugs.webkit.org/show_bug.cgi?id=188480 Reviewed by Simon Fraser. Suppress the release assert in WebKit1 on macOS (isInWebProcess is always true in non-Cocoa platforms). In the future, we should consider throwing Objective-C exceptions when third party apps call WebKit1 or WebKit2 APIs in non-main threads. * platform/Timer.cpp: (WebCore::shouldSuppressThreadSafetyCheck): Extracted out of ~TimerBase and setNextFireTime. (WebCore::TimerBase::~TimerBase): (WebCore::TimerBase::setNextFireTime): 2018-09-05 Babak Shafiei Cherry-pick r234766. rdar://problem/44144088 CrashTracer: com.apple.WebKit.Storage at WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose https://bugs.webkit.org/show_bug.cgi?id=188461 Reviewed by Chris Dumez. When we try to schedule shutdown for database, we should cancel the timer so no scheduleShutdownForClose will be running after this. * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234766 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-08-10 Sihui Liu CrashTracer: com.apple.WebKit.Storage at WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose https://bugs.webkit.org/show_bug.cgi?id=188461 Reviewed by Chris Dumez. When we try to schedule shutdown for database, we should cancel the timer so no scheduleShutdownForClose will be running after this. * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose): 2018-09-05 Babak Shafiei Cherry-pick r234718. rdar://problem/44144071 REGRESSION (r228260): Events handled by input method invoke default event handler https://bugs.webkit.org/show_bug.cgi?id=188370 Reviewed by Wenson Hsieh. Source/WebCore: The bug was caused by the default event handler being invoked for the "virtual" keydown events generated for input methods. Namely, when Japanese or Chinese input methods swallows TAB key, WebKit should not invoke the default event handler and move the focus during input composition. Fixed the bug by adding a new boolean on Event indicating whether the default event handler should be invoked, and restoring the behavior prior to r228260 for these virtual keydown events. Test: editing/input/press-tab-during-ime-composition.html * dom/Event.h: (WebCore::Event::isDefaultEventHandlerIgnored const): Added. (WebCore::Event::setIsDefaultEventHandlerIgnored): Added. * dom/EventDispatcher.cpp: (WebCore::EventDispatcher::dispatchEvent): Don't invoke the default event handler if isDefaultEventHandlerIgnored is set. * page/EventHandler.cpp: (WebCore::EventHandler::internalKeyEvent): Set isDefaultEventHandlerIgnored. This restores WebKit's behavior prior to r228260. LayoutTests: Added a regression test. Due to the lack of adequate support of textInputController in WebKitTestRunner, the test is only enabled in WebKit1. The WTR fix is tracked by https://webkit.org/b/188428. * editing/input/press-tab-during-ime-composition-expected.txt: Added. * editing/input/press-tab-during-ime-composition.html: Added. * platform/ios/TestExpectations: * platform/wk2/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234718 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-08-08 Ryosuke Niwa REGRESSION (r228260): Events handled by input method invoke default event handler https://bugs.webkit.org/show_bug.cgi?id=188370 Reviewed by Wenson Hsieh. The bug was caused by the default event handler being invoked for the "virtual" keydown events generated for input methods. Namely, when Japanese or Chinese input methods swallows TAB key, WebKit should not invoke the default event handler and move the focus during input composition. Fixed the bug by adding a new boolean on Event indicating whether the default event handler should be invoked, and restoring the behavior prior to r228260 for these virtual keydown events. Test: editing/input/press-tab-during-ime-composition.html * dom/Event.h: (WebCore::Event::isDefaultEventHandlerIgnored const): Added. (WebCore::Event::setIsDefaultEventHandlerIgnored): Added. * dom/EventDispatcher.cpp: (WebCore::EventDispatcher::dispatchEvent): Don't invoke the default event handler if isDefaultEventHandlerIgnored is set. * page/EventHandler.cpp: (WebCore::EventHandler::internalKeyEvent): Set isDefaultEventHandlerIgnored. This restores WebKit's behavior prior to r228260. 2018-08-03 Babak Shafiei Cherry-pick r234534. rdar://problem/42902608 Control center controls disappear when pausing, locking device. https://bugs.webkit.org/show_bug.cgi?id=188282 Reviewed by Eric Carlson. Source/WebCore: Test: platform/mac/media/audio-session-category-video-paused.html MediaRemote will set any app whose audio session category changes from MediaPlayback to Ambient as not eligable for being the "now playing" app. Previously, due to the ordering of events, we never moved from MediaPlayback to Ambient when pausing