Repository navigation
[pull] main from oven-sh:main - #1
Merged
Merged
Conversation
https://bugs.webkit.org/show_bug.cgi?id=317835 rdar://180609461 Reviewed by Eric Carlson. VP9 codec isn't available on iOS simulator, we make the preference SWVPDecodersAlwaysEnabled true by default on simulator. Covered by existing tests. * LayoutTests/media/media-video-fullrange-offscreen.html: * LayoutTests/media/media-video-fullrange.html: * LayoutTests/media/media-video-videorange-offscreen.html: * LayoutTests/media/media-video-videorange.html: * LayoutTests/media/media-webm-av1.html: * LayoutTests/media/video-webm-canvas-drawing.html: * LayoutTests/media/video-webm-seek-multi-audio-tracks.html: * LayoutTests/media/vp9.html: * LayoutTests/platform/mac/media/mediacapabilities/vp9-decodingInfo-sw.html: * Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: Canonical link: https://commits.webkit.org/315881@main
https://bugs.webkit.org/show_bug.cgi?id=317748 rdar://180505090 Reviewed by Dan Glastonbury. Access context attributes through WebGLDefaultFramebuffer instead of GraphicsContextGL. This is work to reduce bugs due to state management in GraphicsContextGL, preparing to move the context default framebuffer implementation (MSAA management, etc.) from GraphicsContextGL into the WebGL layer. Fixes following theoretical bugs: - Theoretically adjusted contextAttributes were not communicated back from GPUP. - The theoretically adjusted stencil attribute wasn't adjusted in WCP side due to copy-paste error: `if (m_attributes.stencil) m_attributes.depth = glAttributes.depth;` * Source/WebCore/html/canvas/WebGLDefaultFramebuffer.cpp: (WebCore::WebGLDefaultFramebuffer::WebGLDefaultFramebuffer): (WebCore::WebGLDefaultFramebuffer::size const): (WebCore::WebGLDefaultFramebuffer::reshape): * Source/WebCore/html/canvas/WebGLDefaultFramebuffer.h: * Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::initializeContextState): * Source/WebCore/html/canvas/WebGLRenderingContextBase.h: (WebCore::WebGLRenderingContextBase::attributes const): * Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp: (WebKit::RemoteGraphicsContextGL::workQueueInitialize): * Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLInitializationState.h: * Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLInitializationState.serialization.in: * Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp: (WebKit::RemoteGraphicsContextGLProxy::initialize): Canonical link: https://commits.webkit.org/315882@main
…s used for glyph cache https://bugs.webkit.org/show_bug.cgi?id=317914 Reviewed by Nikolas Zimmermann. Now that deferred display list is enabled with the skia compositor, we are using more internal skia resources, so it's important to set the limits for skia internal caches depending the device. * Source/WebCore/platform/graphics/PlatformDisplay.h: * Source/WebCore/platform/graphics/skia/PlatformDisplaySkia.cpp: (WebCore::glyphCacheTextureMaximumBytes): (WebCore::initializeMaxResourceCacheBytes): (WebCore::SkiaGLContext::maxResourceCacheBytes const): (WebCore::SkiaGLContext::SkiaGLContext): (WebCore::PlatformDisplay::maxSkiaResourceCacheBytes const): * Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedTileBuffer.cpp: (WebCore::CoordinatedAcceleratedTileBuffer::create): Canonical link: https://commits.webkit.org/315883@main
…system service without UI-process re-derivation at 4 sites https://bugs.webkit.org/show_bug.cgi?id=315534 rdar://176895464 Reviewed by Sihui Liu. Four UI-process IPC handlers accepted an origin/domain field from a DispatchedFrom=WebContent message and forwarded it verbatim to a system service as a per-site authorization key, without comparing it against UI-process-authoritative state. A compromised WebContent process could spoof the origin and have CoreLocation / AppSSO / MarketplaceKit / the geolocation policy decider apply another site's permission decision. This change re-derives each value from UI-process-authoritative state (WebFrameProxy::url() / WebFrameProxy::securityOrigin() / the page's committed main-frame URL) instead of trusting the IPC-supplied field: - SOAuthorizationSession: derive InitiatorOrigin from m_page->mainFrame()->url() for all initiating actions, matching the existing SubFrame override and dropping the read of NavigationActionData::originatingFrameInfoData.securityOrigin. - interceptMarketplaceKitNavigation: derive the referrer/top-origin URL from page.mainFrame()->url() instead of NavigationRequester::topOrigin. - WebPageProxy::requestGeolocationPermissionForFrame: overwrite FrameInfoData::securityOrigin with WebFrameProxy::securityOrigin() (computed UI-side at commit time) before passing it to the embedder, and MESSAGE_CHECK that the frame resolves. The override is only applied when the frame's load URL carries a meaningful host, since some loads (e.g. webarchives loaded from a local file URL) commit a document whose origin is determined by content the UIProcess cannot inspect; in that case the WebContent-supplied origin is left in place. - WebGeolocationManagerProxy::startUpdatingWithProxy: bind the RegistrableDomain (derived UI-side from the page's committed main-frame URL at permission-request time) to the authorization token, and MESSAGE_CHECK that the WebContent-supplied domain in StartUpdating matches the token's bound domain. When the UI-derived domain is empty (same webarchive / opaque-document case as above), the equality check is skipped and the WebContent-supplied domain is accepted, matching the pre-existing behavior for those edge cases. Tests: ipc/forged-geolocation-permission-frame-origin.html Tools/TestWebKitAPI/Tests/WebKitCocoa/SOAuthorizationTests.mm * LayoutTests/ipc/forged-geolocation-permission-frame-origin-expected.txt: Added. * LayoutTests/ipc/forged-geolocation-permission-frame-origin.html: Added. * Source/WebKit/UIProcess/Cocoa/NavigationState.mm: (WebKit::interceptMarketplaceKitNavigation): * Source/WebKit/UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm: (WebKit::SOAuthorizationSession::continueStartAfterDecidePolicy): * Source/WebKit/UIProcess/GeolocationPermissionRequestManagerProxy.cpp: (WebKit::GeolocationPermissionRequestManagerProxy::createRequest): (WebKit::GeolocationPermissionRequestManagerProxy::didReceiveGeolocationPermissionDecision): (WebKit::GeolocationPermissionRequestManagerProxy::registrableDomainForAuthorizationToken const): * Source/WebKit/UIProcess/GeolocationPermissionRequestManagerProxy.h: * Source/WebKit/UIProcess/GeolocationPermissionRequestProxy.cpp: (WebKit::GeolocationPermissionRequestProxy::GeolocationPermissionRequestProxy): * Source/WebKit/UIProcess/GeolocationPermissionRequestProxy.h: (WebKit::GeolocationPermissionRequestProxy::create): * Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp: (WebKit::WebGeolocationManagerProxy::startUpdatingWithProxy): * Source/WebKit/UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestGeolocationPermissionForFrame): * Tools/TestWebKitAPI/Tests/WebKitCocoa/SOAuthorizationTests.mm: (TestWebKitAPI::overrideBeginAuthorizationWithURLAndRecordInitiatorOrigin): (TestWebKitAPI::TEST(SOAuthorizationRedirect, InitiatorOriginIgnoresWebProcessSuppliedSourceFrameOrigin)): Canonical link: https://commits.webkit.org/315884@main
…start method for python 3.14 compatibility https://bugs.webkit.org/show_bug.cgi?id=317863 Reviewed by Carlos Alberto Lopez Perez. Python 3.14 changed multiprocessing default start method from fork to forkserver, where a server process is in charge of forking the new processes out of it. This method breaks the current WebDriver W3C executor, which assumes that the spawned code will inherit the state of the parent, like envvars, etc. This commit reverts back to use the original 'fork' method locally for these workers. Note that we still need the changes from bug317850 with the required bumps for full 3.14 compatibility. * Tools/Scripts/webkitpy/webdriver_tests/webdriver_w3c_executor.py: (WebDriverW3CExecutor.__init__): (WebDriverW3CExecutor.setup): Canonical link: https://commits.webkit.org/315885@main
… IOSurface rdar://164306288 https://bugs.webkit.org/show_bug.cgi?id=317842 Reviewed by Jean-Yves Avenard. Some IOSurfaces that are not readable by CPU will have their base address equal to nullptr. But their base address of plane would not be nullptr since an offset would be added. This breaks SharedVideoFrameInfo::writePixelBuffer which was only testing for the plan address to not be nullptr. We add a check that the base address is nullptr to prevent crashing the GPU process. The web process will then create a black pixel buffer instead in RemoteVideoFrameProxy::pixelBuffer. Covered by added test. * LayoutTests/http/tests/media/fairplay/fps-video-frame-expected.txt: Added. * LayoutTests/http/tests/media/fairplay/fps-video-frame.html: Added. * Source/WebCore/platform/cocoa/SharedVideoFrameInfo.mm: (WebCore::SharedVideoFrameInfo::writePixelBuffer): Canonical link: https://commits.webkit.org/315886@main
…io session active while capturing rdar://174786023 https://bugs.webkit.org/show_bug.cgi?id=317741 Reviewed by Eric Carlson. Microphone capture requires the AudioSession unit to stay active. While for getUserMedia, the WebProcess is ensuring that the AudioSession is active, this is not the case for speech recognition. This can cause issues in case other WebProcess deactivate the AudioSession. To prevent this, we make sure that SpeechRecognitionRealtimeMediaSourceManager sources are tied to the MediaSessionManager, by making each source an AudioCaptureSource. It ensures that the audio session is properly set up whenever capture for speech recgonition starts. We also make sure to deactivate the AudioSession as needed when capture stops. We have to fix a race condition in how RemoteAudioSession is returning whether active or not. When AudioSession is enabled/disabled very quickly, there might be configuration changed messages being received in between. They might change the active state creating flakiness in tests. To prevent this, we only set RemoteAudioSession::m_active in tryToSetActiveInternal and no longer synchronize it when configuration changes. We add a protected setActive in AudioSession, so that RemoteAudioSession can set it back to false when GPU process crashes. We no longer need AudioSession::isActive to be virtual as a small bonus. This test can be flaky in case of rerunning it since navigating away stops the recognition right away but was stopping the capture asynchronously in WebProcess since it needs to go through UIProcess. We add a way for the source created in the WebProcess to register itself to the SpeechRecognition object. This allows to synchronously stop capture when the SpeechRecognition gets stopped. Test: fast/mediastream/audio-session-stays-active-when-removing-session-during-speech-recognition.html * LayoutTests/fast/mediastream/audio-session-stays-active-when-removing-session-during-speech-recognition-expected.txt: Added. * LayoutTests/fast/mediastream/audio-session-stays-active-when-removing-session-during-speech-recognition.html: Added. * LayoutTests/http/tests/webrtc/audioSessionInFrames.html: * LayoutTests/platform/glib/TestExpectations: * Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp: (WebCore::MediaStreamTrack::stopTrack): (WebCore::MediaStreamTrack::trackMutedChanged): * Source/WebCore/Modules/speech/SpeechRecognition.cpp: (WebCore::SpeechRecognition::stop): (WebCore::SpeechRecognition::captureSourceCreated): * Source/WebCore/Modules/speech/SpeechRecognition.h: * Source/WebCore/Modules/speech/SpeechRecognitionConnection.h: (WebCore::SpeechRecognitionConnection::dispatchCaptureSourceCreated): * Source/WebCore/Modules/speech/SpeechRecognitionConnectionClient.h: (WebCore::SpeechRecognitionConnectionClient::captureSourceCreated): * Source/WebCore/platform/audio/AudioSession.cpp: (WebCore::AudioSession::tryToSetActive): (WebCore::AudioSession::setActive): * Source/WebCore/platform/audio/AudioSession.h: * Source/WebCore/platform/audio/MediaSessionManagerInterface.cpp: (WebCore::MediaSessionManagerInterface::audioCaptureSourceStateChanged): * Source/WebCore/platform/audio/MediaSessionManagerInterface.h: * Source/WebKit/GPUProcess/media/RemoteAudioSessionProxy.cpp: (WebKit::RemoteAudioSessionProxy::configuration): * Source/WebKit/GPUProcess/webrtc/UserMediaCaptureManagerProxy.cpp: * Source/WebKit/UIProcess/Media/RemoteMediaSessionManagerProxy.cpp: (WebKit::RemoteMediaSessionManagerProxy::tryToSetActiveInternal): * Source/WebKit/UIProcess/SpeechRecognitionRemoteRealtimeMediaSource.cpp: (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::create): (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::SpeechRecognitionRemoteRealtimeMediaSource): * Source/WebKit/UIProcess/SpeechRecognitionRemoteRealtimeMediaSource.h: (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::clientIdentifier const): * Source/WebKit/UIProcess/SpeechRecognitionRemoteRealtimeMediaSourceManager.cpp: (WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::addSource): * Source/WebKit/UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::handleRequest): * Source/WebKit/UIProcess/SpeechRecognitionServer.h: * Source/WebKit/UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::createRealtimeMediaSourceForSpeechRecognition): * Source/WebKit/UIProcess/WebPageProxy.h: * Source/WebKit/UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::createSpeechRecognitionServer): * Source/WebKit/WebProcess/GPU/media/RemoteAudioSession.cpp: (WebKit::RemoteAudioSession::gpuProcessConnectionDidClose): (WebKit::RemoteAudioSession::tryToSetActiveInternal): (WebKit::RemoteAudioSession::configurationChanged): * Source/WebKit/WebProcess/GPU/media/RemoteAudioSession.h: * Source/WebKit/WebProcess/GPU/media/RemoteAudioSessionConfiguration.h: * Source/WebKit/WebProcess/GPU/media/RemoteAudioSessionConfiguration.serialization.in: * Source/WebKit/WebProcess/Media/RemoteMediaSessionManager.cpp: (WebKit::RemoteMediaSessionManager::RemoteMediaSessionManager): * Source/WebKit/WebProcess/Speech/SpeechRecognitionRealtimeMediaSourceManager.cpp: (WebKit::SpeechRecognitionRealtimeMediaSourceManager::createSource): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::start): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::stop): * Source/WebKit/WebProcess/Speech/SpeechRecognitionRealtimeMediaSourceManager.h: * Source/WebKit/WebProcess/Speech/SpeechRecognitionRealtimeMediaSourceManager.messages.in: * Source/WebKit/WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.cpp: (WebKit::WebSpeechRecognitionConnection::dispatchCaptureSourceCreated): * Source/WebKit/WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.h: Canonical link: https://commits.webkit.org/315887@main
https://bugs.webkit.org/show_bug.cgi?id=317820 <rdar://problem/180631575> Reviewed by Abrar Rahman Protyasha. <body style="transform: scale(0.75)"> <div style="margin-top: 15.5px; font-size: 17px; text-decoration: underline">underlined text</div> </body> The underline should be one continuous line just below the text. Instead it was rounded up onto the text, and text-decoration-skip-ink then chopped it into pieces around the letters it now overlapped. CoreGraphics y axis points up while WebKit lays out with y pointing down, so any destination that paints into a flipped context (scale 1, -1) has a negative y scale in getCTM(). The snap always rounded toward larger device y, which is down the page (away from the text) only when the context is not flipped; in a flipped context that direction points up, into the text. Round toward increasing local y regardless of the flip: ceil the device y in an unflipped context and floor it in a flipped one, so the line always snaps to the device pixel away from the text. * LayoutTests/fast/text/text-decoration-underline-snapping-expected.html: Added. * LayoutTests/fast/text/text-decoration-underline-snapping.html: Added. * Source/WebCore/platform/graphics/GraphicsContext.cpp: (WebCore::GraphicsContext::computeLineBoundsAndAntialiasingModeForText): Snap the line away from the text whether or not the destination context flips y. Canonical link: https://commits.webkit.org/315888@main
https://bugs.webkit.org/show_bug.cgi?id=317746 rdar://180503395 Reviewed by Dan Glastonbury. Make all limits used in context creation be sent as initialization parameters. This way the initialization does not run extra synchronous queries to GPUP. Works towards avoiding open-ended queries to GPUP. * Source/WebCore/html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::initializeContextState): * Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::initializeContextState): * Source/WebCore/platform/graphics/GraphicsContextGL.h: * Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLANGLE::maxCombinedTextureImageUnits): (WebCore::GraphicsContextGLANGLE::maxVertexAttribs): (WebCore::GraphicsContextGLANGLE::maxTextureSize): (WebCore::GraphicsContextGLANGLE::maxCubeMapTextureSize): (WebCore::GraphicsContextGLANGLE::maxRenderbufferSize): (WebCore::GraphicsContextGLANGLE::maxViewportDims): (WebCore::GraphicsContextGLANGLE::maxSamples): (WebCore::GraphicsContextGLANGLE::maxTransformFeedbackSeparateAttribs): (WebCore::GraphicsContextGLANGLE::maxUniformBufferBindings): (WebCore::GraphicsContextGLANGLE::uniformBufferOffsetAlignment): (WebCore::GraphicsContextGLANGLE::max3DTextureSize): (WebCore::GraphicsContextGLANGLE::maxArrayTextureLayers): * Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h: * Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp: (WebKit::RemoteGraphicsContextGL::workQueueInitialize): * Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLInitializationState.h: * Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLInitializationState.serialization.in: * Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp: (WebKit::RemoteGraphicsContextGLProxy::initialize): * Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h: Canonical link: https://commits.webkit.org/315889@main
https://bugs.webkit.org/show_bug.cgi?id=317850 Reviewed by Carlos Alberto Lopez Perez. Python 3.14 removed the ast.Str member, which was first marked as deprecated in Python 3.8, breaking packages that still use it, like older pytest versions. This commit bumps pytest and related packages, alongside other packages that failed to install with 3.14 at the current version, to a newer version that suports 3.14. Note: This commit also drops the sqlalchemy-migrate autoinstall for buildbot, as since Buildbot 3.4.0 (Oct 2021) Alembic is used for migrations[1] (And we're running buildbot 4.3.0 nowadays). pytest: 7.2.0 -> 8.4.2 pluggy: 0.13.1 -> 1.5.0 pytest-asyncio: 0.18.3 -> 1.1.1 pytest-timeout: 2.1.0 -> 2.4.0 coverage: 7.6.1 -> 7.10.7 pyfakefs: 5.7.3 -> 5.10.2 pyyaml: 6.0.2 -> 6.0.3 zope-interface: 7.0.1 -> 8.1 (cond. Python >= 3.10) rapidfuzz: 3.4.0 -> 3.14.5 (cond. Python >=3.10) * Tools/Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py: * Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: * Tools/Scripts/webkitpy/__init__.py: * Tools/Scripts/webkitpy/autoinstalled/buildbot.py: [1] https://buildbot.readthedocs.io/en/v4.3.0/relnotes/3.x.html#buildbot-3-4-0-2021-10-15 Canonical link: https://commits.webkit.org/315890@main
… digital credentials https://bugs.webkit.org/show_bug.cgi?id=317840 rdar://180618646 Reviewed by Anne van Kesteren. DigitalCredential inherits Credential.type, which the Digital Credentials specification defines (section 8.4) as "digital". WebKit returned "digital-credential", so a page calling navigator.credentials.get({digital}) and reading the resolved credential's type observed the wrong value. Return "digital" to match the spec. The web-platform-test digital-credentials/mdoc/valid-roundtrip.https.html asserts credential.type === "digital". It is currently skipped pending the WebDriver virtual-wallet test infrastructure (bug 306292) and will exercise this fix once that infrastructure lands and the test is enabled. * Source/WebCore/Modules/credentialmanagement/BasicCredential.cpp: (WebCore::BasicCredential::type const): Canonical link: https://commits.webkit.org/315891@main
…traction failure https://bugs.webkit.org/show_bug.cgi?id=317922 Reviewed by Claudio Saavedra. ArgumentCoder<GRefPtr<GTlsCertificate>>::decode() unconditionally reads a vector of cert data as its first field. The encoder, however, fails to write anything if the certificate fails to produce its DER data. This means that the decoder will go out of sync, reading subsequent elements as if they were the certificate, which in turn can cause intermittent crashes afterwards. This is a regression from 278316@main. Before its refactoring, the certificate size was unconditionally written, and when 0 the decoder would handle it appropriately. After the refactoring, empty certificates are skipped, and the 0 size is not communicated. This ensures an empty vector is encoded on the failure path, so that decoder and encoder are kept in sync. No new tests: this would probably require IPC API tests to run for GLib platforms. * Source/WebKit/Shared/glib/ArgumentCodersGLib.cpp: (IPC::ArgumentCoder<GRefPtr<GTlsCertificate>>::encode): Canonical link: https://commits.webkit.org/315892@main
…o Requesting state before setting promise https://bugs.webkit.org/show_bug.cgi?id=309625 rdar://172236892 Reviewed by Anne van Kesteren. Maintain the invariant that the interaction state is 'idle' iff no current promise is set. Set the state and promise as an atomic pair at the top of prepareCredentialRequests (after the idle check), and route error paths through a new rejectTheCredentialRequestWith helper that implements §6.5 "Reject the credential request with": https://w3c-fedid.github.io/digital-credentials/#dfn-reject-the-credential-request-with Covered by existing digital-credentials tests. * Source/WebCore/Modules/identity/CredentialRequestCoordinator.cpp: (WebCore::CredentialRequestCoordinator::setCurrentPromise): (WebCore::CredentialRequestCoordinator::prepareCredentialRequests): (WebCore::CredentialRequestCoordinator::initiateTheCredentialRequest): (WebCore::CredentialRequestCoordinator::rejectTheCredentialRequestWith): (WebCore::CredentialRequestCoordinator::abortTheCredentialRequest): * Source/WebCore/Modules/identity/CredentialRequestCoordinator.h: Canonical link: https://commits.webkit.org/315893@main
https://bugs.webkit.org/show_bug.cgi?id=317930 rdar://180722527 Reviewed by Jonathan Bedard. Attempted build fix. Only changing bmalloc/WTF for now. Will loop back with a more comprehensive fix later. Canonical link: https://commits.webkit.org/315894@main
…not AbortError https://bugs.webkit.org/show_bug.cgi?id=313735 rdar://174895437 Reviewed by Abrar Rahman Protyasha. Reject with NotAllowedError (not AbortError) when the user cancels the credential chooser, per spec 'initiate the credential request' step 3c. AbortError is reserved for AbortSignal-driven cancellation. Test coverage requires mock credential provider (Bug 285651). * Source/WebCore/Modules/identity/CredentialRequestCoordinator.cpp: (WebCore::CredentialRequestCoordinator::processCredentialChooserResponse): Canonical link: https://commits.webkit.org/315895@main
https://bugs.webkit.org/show_bug.cgi?id=317727 rdar://180479954 Unreviewed. Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm * Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCVideoFrameUtilities.h: * Source/WebKit/WebProcess/cocoa/VideoPresentationManager.mm: * Source/WebKitLegacy/mac/DOM/DOMAbstractView.mm: * Source/WebKitLegacy/mac/DOM/DOMElement.mm: * Source/WebKitLegacy/mac/DOM/DOMHTMLAnchorElement.mm: * Source/WebKitLegacy/mac/DOM/DOMHTMLEmbedElement.mm: * Source/WebKitLegacy/mac/DOM/DOMHTMLIFrameElement.mm: * Source/WebKitLegacy/mac/DOM/DOMHTMLMapElement.mm: * Source/WebKitLegacy/mac/DOM/DOMHTMLMetaElement.mm: * Source/WebKitLegacy/mac/DOM/DOMHTMLParamElement.mm: * Source/WebKitLegacy/mac/Misc/WebSharingServicePickerController.mm: * Source/WebKitLegacy/mac/Plugins/WebPluginController.mm: * Source/WebKitLegacy/mac/WebView/WebClipView.mm: * Source/WebKitLegacy/mac/WebView/WebDataSource.mm: * Source/WebKitLegacy/mac/WebView/WebFrame.mm: * Source/WebKitLegacy/mac/WebView/WebFullScreenController.mm: * Source/WebKitLegacy/mac/WebView/WebHTMLView.mm: * Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm: * Source/WebKitLegacy/mac/WebView/WebPDFView.mm: * Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm: Canonical link: https://commits.webkit.org/315896@main
https://bugs.webkit.org/show_bug.cgi?id=317920 rdar://180711424 Reviewed by Geoffrey Garen. This rejigs the ownership of the back-forward list C++ message forwarder such that an extra reference is kept by the C++ wrapper shim, and thus there's no need to return something from a stack temporary which required a suppression from the clang static analysis checks. This was not (believed to be) a real memory safety problem but it's best to avoid the suppression anyway. There is no net behavioral difference here. Canonical link: https://commits.webkit.org/315897@main
…is passing reliably https://bugs.webkit.org/show_bug.cgi?id=317918 rdar://180708899 Unreviewed Test Gardening. It is now passing reliably, did 100 iterations locally and no flakiness. * LayoutTests/TestExpectations: * LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/prefer-targeted-element-both-axes-expected.txt: Canonical link: https://commits.webkit.org/315898@main
https://bugs.webkit.org/show_bug.cgi?id=317855 rdar://180633226 Reviewed by Tim Nguyen. Rewrites and splits up exisitng notch wpt test into individual tests per configuration. Adds notch border shape tests * LayoutTests/TestExpectations: * LayoutTests/imported/w3c/web-platform-tests/css/css-borders/corner-shape/corner-shape-notch-expected.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-borders/corner-shape/corner-shape-notch-mixed-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-borders/corner-shape/corner-shape-notch-mixed-ref.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-borders/corner-shape/corner-shape-notch-mixed.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-borders/corner-shape/corner-shape-notch.html. * LayoutTests/imported/w3c/web-platform-tests/css/css-borders/corner-shape/corner-shape-notch-ref.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-borders/corner-shape/corner-shape-notch.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-borders/corner-shape/corner-shape-superellipse-negative-100-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-borders/corner-shape/corner-shape-superellipse-negative-100-ref.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-borders/corner-shape/corner-shape-superellipse-negative-100.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-borders/corner-shape/corner-shape-notch.html. * LayoutTests/imported/w3c/web-platform-tests/css/css-borders/corner-shape/corner-shape-superellipse-negative-inf-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-borders/corner-shape/corner-shape-superellipse-negative-inf-ref.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-borders/corner-shape/corner-shape-superellipse-negative-inf.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-borders/corner-shape/corner-shape-notch.html. Canonical link: https://commits.webkit.org/315899@main
https://bugs.webkit.org/show_bug.cgi?id=317896 Reviewed by Geoffrey Garen. The Xcode build of MiniBrowser enables ARC via Base.xcconfig (CLANG_ENABLE_OBJC_ARC = YES), but the CMake port was compiling the same sources without ARC. The sources are written assuming ARC retain semantics: in AppDelegate.m, `static NSString *sTargetURL = [args objectAtIndex:...]` relies on __strong's auto-retain. Without ARC, sTargetURL ends up dangling and crashes -[BrowserAppDelegate targetURL] with EXC_BAD_ACCESS in objc_msgSend on first window open. (The crash is currently masked by a separate startup hang and surfaces once that's resolved.) Pass -fobjc-arc to the MiniBrowser target so the CMake build matches the Xcode port's ARC setting. No new tests; build system changes only. * Tools/MiniBrowser/mac/CMakeLists.txt: Canonical link: https://commits.webkit.org/315900@main
…be reported https://bugs.webkit.org/show_bug.cgi?id=317856 rdar://180634688 Reviewed by Jonathan Bedard and Aakash Jain. When TwistedAdditions.request hit the response-header timeout added in 309004@main, the swallowing onTimeoutCancel callback left the deferred fulfilled with None. The next line then called response.deliverBody on None and the catch-all `except Exception` logged the misleading "'NoneType' object has no attribute 'deliverBody'" message instead of the existing defer.TimeoutError handler running. The same pattern was in place on the body-delivery timeout. Downstream, ResultsDatabase.make_request collapsed both "request failed" and "successful empty response" to `{}`. For the SaferCPP path, that resulted in a normal-looking dict with does_result_match=False on network failures, and FindUnexpectedStaticAnalyzerResults.check_results_db then attributed the failing files to the PR author. The protective "fall back to tip-of-tree" branch in filter_results_using_results_db (which runs ScanBuildWithoutChange) was unreachable because the returned dict was truthy. * Tools/CISupport/ews-build/twisted_additions.py: (TwistedAdditions.request): Drop the swallowing onTimeoutCancel callbacks so addTimeout default-translates the cancel into a defer.TimeoutError that the existing handler logs cleanly. * Tools/CISupport/ews-build/results_db.py: (ResultsDatabase.make_request): Return None on infrastructure failure (no response or non-200) and preserve the response payload on 200. (ResultsDatabase.does_result_match): When the request failed, return None even if a `default` is provided. This triggers the existing `if not data:` fallback in check_results_db, which routes to the rebuild-without-change verification step instead of blaming the PR. (ResultsDatabase.is_test_pre_existing_failure): Guard against None data and expose a request_failed flag in the output dict for future call sites. * Tools/CISupport/ews-build/steps_unittest.py: (TestResultsDatabaseFailureHandling): Cover make_request, does_result_match, and is_test_pre_existing_failure behavior on both infrastructure failure and successful empty responses. Canonical link: https://commits.webkit.org/315901@main
…Board https://bugs.webkit.org/show_bug.cgi?id=317905 rdar://180159037 Reviewed by Per Arne Vollan. There are some daemons that use WebKit to load webpages, but which are not managed by RunningBoard. This doesn't work with ProcessStateMonitor, which we install once processes are in the background (which is basically all the time in daemons). In particular, a process that is not managed by RunningBoard may still get RunningBoard state updates. This causes `ProcessStateMonitor::checkRemainingRunTime()` to run. Then `checkRemainingRunTime()` asks RunningBoard how much time the process has to run before it suspends via `[[[RBSProcessHandle currentProcess] activeLimitations] runTime]`. For an unmanaged process, this may return 0. This then makes us think that the process is about to suspend immediately, which causes us to invalidate all of the activities tracked by the process, which then causes all WebKit auxiliary processes to suspend. In this patch, we disable ProcessStateMonitor for one of the problematic daemons specifically (textunderstandingd). This will be followed up by a patch that disables creation of the object for any process that is unmanaged (the only reason we're not doing that in this patch is to mitigate risk). This works because The only client of `ProcessStateMonitor::create` already understands how to deal with a null return value. * Source/WebKit/Platform/spi/ios/RunningBoardServicesSPI.h: * Source/WebKit/UIProcess/ios/ProcessStateMonitor.h: (WebKit::ProcessStateMonitor::create): Deleted. * Source/WebKit/UIProcess/ios/ProcessStateMonitor.mm: (WebKit::ProcessStateMonitor::create): Canonical link: https://commits.webkit.org/315902@main
…SoftLink.{h,mm}
https://bugs.webkit.org/show_bug.cgi?id=317797
rdar://180565005
Reviewed by Andres Gonzalez and Dominic Mazzoni.
AccessibilityPreferences.mm declared the libAccessibility library soft-link with
SOFT_LINK_LIBRARY_OPTIONAL(), and AuxiliaryProcessCocoa.mm relied on that
declaration to resolve libAccessibilityLibrary() for its own
SOFT_LINK_OPTIONAL(libAccessibility, _AXSUpdateWebAccessibilitySettings, ...).
SOFT_LINK_LIBRARY_OPTIONAL() and SOFT_LINK_OPTIONAL() generate static, file-local
symbols, so this only compiled because both files happened to land in the same
unified-sources translation unit. Adding or reordering files in Shared/Cocoa
would eventually break the build.
Move both soft-links into a dedicated LibAccessibilitySoftLink.{h,mm} that uses
the SOFT_LINK_LIBRARY_FOR_HEADER/_FOR_SOURCE and
SOFT_LINK_FUNCTION_MAY_FAIL_FOR_HEADER/_FOR_SOURCE macros, which emit extern,
namespaced symbols defined once and intended for sharing across source files.
* Source/WebKit/Shared/Cocoa/AccessibilityPreferences.mm:
(AXPreferenceHelpers::imageAnimationEnabled):
* Source/WebKit/Shared/Cocoa/AuxiliaryProcessCocoa.mm:
(WebKit::AuxiliaryProcess::handleAXPreferenceChange):
* Source/WebKit/SourcesCocoa.txt:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
Canonical link: https://commits.webkit.org/315903@main
…ist line instead of just formatting https://bugs.webkit.org/show_bug.cgi?id=317665 rdar://177210669 Reviewed by Wenson Hsieh. Currently, when backspacing immediately from the second list item of a smart list, the selection moves back to the first list item. Instead, the entire list formatting should be removed. This should be the case because a user could have accidently triggered list formatting and need a way out. So, if it is currently on the second list item of a newly created smart list, there is no text yet and a backspace is hit, then WebKit should remove the list formatting. This is the window in which the undo operation via backspace will be valid. To ensure this, a SmartListUndoData struct is created that stores all the information needed for the undo operation. This data is only set during that small window and will be a nullopt otherwise for all other operations. In performSmartListUndo, conditions are checked whether the undo operation is valid here. If so, divs are created and the text is then put in the divs that are located in the DOM right where the list element would be. The list element is then removed. If the user is on any other list item and backspaces, the list formatting is not removed because the conditions would not be met. Add three layout tests that cover these cases: 1. Backspace immediately once at the second list item of a smart list 2. Backspace after typing a character at the second list item of a smart list 3, Backspace immediately once at the third list item of a smart list * LayoutTests/editing/smart-lists/backspace-after-typing-in-smart-list-does-not-undo-list-expected.txt: Added. * LayoutTests/editing/smart-lists/backspace-after-typing-in-smart-list-does-not-undo-list.html: Added. * LayoutTests/editing/smart-lists/backspace-immediately-after-smart-list-creation-undoes-list-expected.txt: Added. * LayoutTests/editing/smart-lists/backspace-immediately-after-smart-list-creation-undoes-list.html: Added. * LayoutTests/editing/smart-lists/backspace-immediately-after-third-list-item-does-not-undo-list-expected.txt: Added. * LayoutTests/editing/smart-lists/backspace-immediately-after-third-list-item-does-not-undo-list.html: Added. * LayoutTests/platform/glib/TestExpectations: * Source/WebCore/editing/InsertTextCommand.cpp: (WebCore::InsertTextCommand::applySmartListsIfNeeded): * Source/WebCore/editing/InsertTextCommand.h: * Source/WebCore/editing/TypingCommand.cpp: (WebCore::TypingCommand::willAddTypingToOpenCommand): (WebCore::TypingCommand::insertTextRunWithoutNewlines): (WebCore::TypingCommand::deleteKeyPressed): (WebCore::TypingCommand::performSmartListUndo): * Source/WebCore/editing/TypingCommand.h: Canonical link: https://commits.webkit.org/315904@main
…AVFObjC for playback in the GPU process when MediaContainment is enabled https://bugs.webkit.org/show_bug.cgi?id=317846 rdar://180623633 Reviewed by Youenn Fablet. The registration policy lived in MediaPlayer::buildMediaEnginesVector with a hand-written MESSAGE_CHECK allowlist in RemoteMediaPlayerManagerProxy::createMediaPlayer. MediaPlayerPrivateWebM and MediaPlayerPrivateMediaSourceAVFObjC were registered in every process where their code compiled, including the GPU process; the MESSAGE_CHECK rejected attempts to instantiate them in GPU when MediaContainment was on, but the canDecodeExtendedType IPC had no way to express "answer codec capability queries from GPU without being instantiable." When MediaContainment is enabled, those engines demux in the WebContent process and only the renderer should live in GPU, so registering the full MediaPlayerPrivate in GPU was both unnecessary and a defence-in-depth weak point. This commit moves the decision of when and where a MediaPlayerFactory is registered into each MediaPlayerPrivate's static registerMediaEngine — the factory itself owns it. buildMediaEnginesVector becomes a flat list of registerMediaEngine calls (still gated by USE/ENABLE compile flags and the existing isAVFoundationEnabled / isGStreamerEnabled runtime gates); each engine's static decides between installing the local factory, delegating to a remote proxy via RemoteMediaPlayerSupport::registerRemoteEngineIfAvailable, or skipping. MediaPlayerFactory gains a MediaPlayerScope supportedScope(MediaContainmentEnabled) the describes how the MediaPlayerPrivate is to be used. MediaPlayer::supportsType and MediaPlayer::mediaEngine take a MediaPlayerEngineSelection { identifier, scope, mediaContainmentEnabled } struct, and engines are filtered by scope. MediaPlayerFactoryWebM and MediaPlayerFactoryMediaSourceAVFObjC override supportedScope to return RemoteRenderingCapability in the GPU process when MediaContainmentEnabled is Yes — they can answer canDecodeExtendedType IPCs from the WebContent demuxer but are not lookup-able for Playback. GPUConnectionToWebProcess::canDecodeExtendedType queries with MediaPlayerScope::RemoteRenderingCapability and the connection's MediaContainmentEnabled. RemoteMediaPlayerManagerProxy::{createMediaPlayer, getSupportedTypes, supportsTypeAndCodecs, supportsKeySystem} all funnel through a new playbackEngineForConnection helper that queries with MediaPlayerScope::Playback and the connection's preference; createMediaPlayer's old MESSAGE_CHECK allowlist is replaced by this registry lookup, so a containment-enabled connection asking the GPU to instantiate WebM or MSE AVF is rejected by the registry rather than a hand-maintained list. This is required to disable the use of MediaPlayerPrivateRemote (the WebContent-side remote proxy) with the WebM and MediaSource AVF players without breaking the WebContent-side demuxer's ability to query the GPU for codec capabilities. * Source/WebCore/platform/graphics/MediaPlayerEnums.h: Add MediaPlayerScope and MediaContainmentEnabled. * Source/WebCore/platform/graphics/MediaPlayer.h: * Source/WebCore/platform/graphics/MediaPlayer.cpp: (WebCore::buildMediaEnginesVector): (WebCore::bestMediaEngineForSupportParameters): (WebCore::MediaPlayer::mediaEngine): (WebCore::MediaPlayer::supportsType): (WebCore::RemoteMediaPlayerSupport::registerRemoteEngineIfAvailable): * Source/WebCore/platform/graphics/cocoa/MediaPlayerPrivateWebM.{h,mm}: (WebCore::MediaPlayerFactoryWebM::supportedScope): (WebCore::MediaPlayerPrivateWebM::registerMediaEngine): * Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.{h,mm}: (WebCore::MediaPlayerFactoryMediaSourceAVFObjC::supportedScope): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::registerMediaEngine): * Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.{h,mm}: (WebCore::MediaPlayerPrivateAVFoundationObjC::registerMediaEngine): * Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.{h,mm}: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::registerMediaEngine): * Source/WebCore/platform/graphics/MediaPlayerPrivateWirelessPlayback.{h,cpp}: (WebCore::MediaPlayerPrivateWirelessPlayback::registerMediaEngine): * Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.{h,cpp}: * Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.{h,cpp}: * Source/WebCore/platform/graphics/holepunch/MediaPlayerPrivateHolePunch.{h,cpp}: * Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.{h,cpp}: * Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.{h,cpp}: * Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::canDecodeExtendedType): * Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.{h,cpp}: (WebKit::RemoteMediaPlayerManagerProxy::playbackEngineForConnection): (WebKit::RemoteMediaPlayerManagerProxy::createMediaPlayer): (WebKit::RemoteMediaPlayerManagerProxy::getSupportedTypes): (WebKit::RemoteMediaPlayerManagerProxy::supportsTypeAndCodecs): (WebKit::RemoteMediaPlayerManagerProxy::supportsKeySystem): * Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp: (WebKit::RemoteMediaPlayerManager::setUseGPUProcess): Canonical link: https://commits.webkit.org/315905@main
…d of symlinking https://bugs.webkit.org/show_bug.cgi?id=317902 rdar://180688173 Reviewed by Per Arne Vollan. Symlinks in TestWebKitAPIResources.bundle resolve to their canonical path in the source tree, which is outside WEBKIT2_FRAMEWORK_DIR. The WebContent sandbox profile only allows file-issue-extension for subpaths of WEBKIT2_FRAMEWORK_DIR, so the kernel denies the extension and file URL loads fail. Copying instead of symlinking keeps the canonical path inside the build directory where the sandbox rule permits it. This fixes API test failures like SiteIsolation.LocalIframeOpensBlobURLFromFileMainFrame and WKWebView.LoadTwoFiles when running with a CMake-built TestWebKitAPI. * Tools/TestWebKitAPI/PlatformMac.cmake: Canonical link: https://commits.webkit.org/315906@main
…y::didPostMessage() https://bugs.webkit.org/show_bug.cgi?id=317910 rdar://178596735 Reviewed by Alex Christensen. WebProcessProxy::didPostMessage() MESSAGE_CHECKs that the page the message is posted to is associated with the sending WebContent process (added in 314178@main). WebPageProxy::close() synchronously calls WebProcessProxy::removeWebPage(), which disassociates the page from the process, but defers sending Messages::WebPage::Close to the next run loop iteration to avoid a white flash. Marking the page as pending-close happened inside sendPageCloseMessage(), so it was deferred along with the Close message. This left a window: after removeWebPage() but before the deferred Close ran, the page was in neither WebProcessProxy's page maps nor m_pagesPendingClose. An in-flight DidPostMessage IPC (e.g. a window.webkit.messageHandlers post from a content script during teardown) dispatched in that window would fail the MESSAGE_CHECK and terminate an otherwise well-behaved WebContent process. Mark every content process for the page as pending-close synchronously in close(), at the same time as removeWebPage(), and only clear the marker once the deferred WebPage::Close async reply arrives. isAssociatedWithPage() already consults m_pagesPendingClose, so the page stays associated for the whole teardown. Test: WKUserContentController.PostMessageDuringPageClose * Source/WebKit/UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::close): * Source/WebKit/UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::addPagePendingClose): (WebKit::WebProcessProxy::removePagePendingClose): * Source/WebKit/UIProcess/WebProcessProxy.h: * Tools/TestWebKitAPI/Tests/WebKit/WKWebView/UserContentController.mm: (TEST(WKUserContentController, PostMessageDuringPageClose)): Canonical link: https://commits.webkit.org/315907@main
https://bugs.webkit.org/show_bug.cgi?id=317675 rdar://180429446 Reviewed by Antti Koivisto. random-item() is an arbitrary substitution function, like var() and attr(). Per CSS Values 5 it is substituted at computed-value time, so at parse time only its argument grammar needs to be validated: <random-item-args> = random-item( <declaration-value>, [ <declaration-value>? ]# ) Add parse-time support for that grammar behind a new feature flag, CSSRandomItemFunctionEnabled (off by default). The substitution parser now accepts a random-item() function whose first argument is a non-empty <declaration-value>, followed by a comma-separated list of one or more (possibly empty) item values. Items use {}-grouping for internal commas and may not mix a brace block with other values, following the component-function-commas rules, similar to isValidAttrReference. The first argument is treated as an opaque <declaration-value> here, parsing it as a <random-key> and selecting one of the items happen at computed-value time and are handled in a follow-up. Forms such as random-item(foo, a, b) are now accepted at parse time and only resolved (or made invalid) at computed-value time. Spec: https://drafts.csswg.org/css-values-5/#funcdef-random-item Test: imported/w3c/web-platform-tests/css/css-values/random-item-parsing.html * LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-item-parsing-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-item-parsing.html: Added. * Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: * Source/WebCore/css/CSSValueKeywords.in: * Source/WebCore/css/parser/CSSParserContext.cpp: (WebCore::add): * Source/WebCore/css/parser/CSSParserContext.h: * Source/WebCore/css/parser/CSSSubstitutionParser.cpp: (WebCore::classifyBlock): (WebCore::isValidRandomItemReference): Canonical link: https://commits.webkit.org/315908@main
https://bugs.webkit.org/show_bug.cgi?id=317784 rdar://179831928 Reviewed by Abrar Rahman Protyasha, Pascoe, and Aditya Keerthi. Add support for the `device-imei1`, `device-imei2`, and `device-nal` values for the `autocomplete` attribute. Write an API test for these additional identifiers. * Source/WTF/wtf/PlatformHave.h: * Source/WebCore/html/Autofill.cpp: * Source/WebCore/html/Autofill.h: * Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in: * Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView contentTypeFromFieldName:]): * Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ios/KeyboardInputTestsIOS.mm: (TestWebKitAPI::TEST(KeyboardInputTests, AdditionalEsimDeviceAutoFill)): Canonical link: https://commits.webkit.org/315909@main
…process https://bugs.webkit.org/show_bug.cgi?id=317836 rdar://180609922 Reviewed by Youenn Fablet. Always make the MediaPlayerPrivateWebM runs in the web content process regardless of MediaContainment being enabled or not. * Source/WebCore/platform/graphics/MediaPlayer.cpp: (WebCore::WTF_REQUIRES_LOCK): * Source/WebCore/platform/graphics/cocoa/MediaPlayerPrivateWebM.mm: (WebCore::MediaPlayerPrivateWebM::createRenderer): * Source/WebKit/WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): Canonical link: https://commits.webkit.org/315910@main
https://bugs.webkit.org/show_bug.cgi?id=318076 rdar://180872461 Reviewed by Sosuke Suzuki. We no longer use op_try_get_by_id and @tryGetById. Remove them. * JSTests/microbenchmarks/try-get-by-id-basic.js: Removed. * JSTests/microbenchmarks/try-get-by-id-polymorphic.js: Removed. * JSTests/modules/namespace-object-try-get.js: Removed. * JSTests/stress/regress-156992.js: Removed. * JSTests/stress/regress-179619.js: (tryGetByIdText): Deleted. * JSTests/stress/try-get-by-id-poly-proto.js: Removed. * JSTests/stress/try-get-by-id-should-spill-registers-dfg.js: Removed. * JSTests/stress/try-get-by-id.js: Removed. * Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.h: * Source/JavaScriptCore/bytecode/BytecodeList.rb: * Source/JavaScriptCore/bytecode/BytecodeUseDef.cpp: (JSC::computeUsesForBytecodeIndexImpl): (JSC::computeDefsForBytecodeIndexImpl): * Source/JavaScriptCore/bytecode/CodeBlock.cpp: (JSC::CodeBlock::finishCreation): (JSC::CodeBlock::finalizeLLIntInlineCaches): * Source/JavaScriptCore/bytecode/GetByStatus.cpp: (JSC::GetByStatus::computeFromLLInt): * Source/JavaScriptCore/bytecode/Opcode.h: * Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitTryGetById): Deleted. * Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h: * Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp: (JSC::BytecodeIntrinsicNode::emit_intrinsic_tryGetById): Deleted. (JSC::BytecodeIntrinsicNode::emit_intrinsic_tryGetByIdWithWellKnownSymbol): Deleted. * Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleGetById): (JSC::DFG::ByteCodeParser::parseGetById): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::handleIteratorOpen): (JSC::DFG::ByteCodeParser::handleIteratorNext): * Source/JavaScriptCore/jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): * Source/JavaScriptCore/jit/JIT.h: * Source/JavaScriptCore/jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_try_get_by_id): Deleted. (JSC::JIT::emitSlow_op_try_get_by_id): Deleted. * Source/JavaScriptCore/llint/LLIntSlowPaths.cpp: * Source/JavaScriptCore/llint/LLIntSlowPaths.h: * Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm: * Source/JavaScriptCore/llint/LowLevelInterpreter64.asm: * Source/JavaScriptCore/lol/LOLJIT.cpp: (JSC::LOL::LOLJIT::privateCompileMainPass): (JSC::LOL::LOLJIT::privateCompileSlowCases): * Source/JavaScriptCore/lol/LOLJIT.h: Canonical link: https://commits.webkit.org/316104@main
https://bugs.webkit.org/show_bug.cgi?id=318079 rdar://180873581 Reviewed by Yijia Huang. If CharacterClass holds m_latin1Table and no m_matches32 / m_ranges32 exist, This is latin1 only CharacterClass. So we can use this table even in Char16 case with 0x100 guard. We also add the code using this table in interpreter too. * Source/JavaScriptCore/yarr/YarrInterpreter.cpp: (JSC::Yarr::Interpreter::testCharacterClass): * Source/JavaScriptCore/yarr/YarrJIT.cpp: Canonical link: https://commits.webkit.org/316105@main
https://bugs.webkit.org/show_bug.cgi?id=318008 Reviewed by Yusuke Suzuki. Every read of RegExp.prototype.flags performs eight generic property gets on the receiver, each landing in a host getter on RegExp.prototype, even when nothing is overridden. Add a fast path that builds the flags string directly from the RegExp's flag bits when the receiver is an unmodified RegExpObject covered by regExpPrimordialPropertiesWatchpointSet. Baseline Patched regexp-prototype-flags-getter 328.2361+-8.0599 ^ 32.6714+-0.8326 ^ definitely 10.0466x faster Tests: JSTests/microbenchmarks/regexp-prototype-flags-getter.js JSTests/stress/regexp-flags-getter-fast-path.js * JSTests/microbenchmarks/regexp-prototype-flags-getter.js: Added. * JSTests/stress/regexp-flags-getter-fast-path.js: Added. (shouldBe): (get global): (PlainSubclass): (OverridingSubclass.prototype.get global): (OverridingSubclass): * Source/JavaScriptCore/runtime/RegExpPrototype.cpp: (JSC::regExpFlagsWatchpointIsValid): (JSC::JSC_DEFINE_HOST_FUNCTION): Canonical link: https://commits.webkit.org/316106@main
<https://bugs.webkit.org/show_bug.cgi?id=313175> <rdar://175164594> Reviewed by Said Abou-Hallawa. `HTMLCanvasElement::getContext()` and `OffscreenCanvas::getContext()` check `m_context` at the top, then call `convert<IDLDictionary<...>>()` on the settings argument. Dictionary conversion invokes JS property getters, which can re-enter `getContext()` on the same canvas and assign `m_context`. The outer call then proceeds to `createContext2d()`/`createContextWebGL()`/ `createContextBitmapRenderer()`, which overwrites `m_context` with a new `unique_ptr`, destroying the inner context while its JS wrapper is still alive. `CanvasRenderingContext` forwards `ref()`/`deref()` to its owning `CanvasBase`, so the wrapper's ref does not keep the context alive; on GC sweep the wrapper's `deref()` reads `m_canvas` from a freed `this`. Re-check `m_context` (and `m_detached` for `OffscreenCanvas`) after dictionary conversion. If a re-entrant call set `m_context`, return the existing context when the type matches and null otherwise, matching the existing early-return semantics. Also upgrade `ASSERT(!m_context)` to `ASSERT_WITH_SECURITY_IMPLICATION(!m_context)` in all four `createContext*()` methods. These asserts guard the same invariant this bug violates -- that `m_context` is assigned at most once -- and a violation is security-relevant. Test: fast/canvas/canvas-getContext-reentrant.html * LayoutTests/fast/canvas/canvas-getContext-reentrant-expected.txt: Add. * LayoutTests/fast/canvas/canvas-getContext-reentrant.html: Add. * Source/WebCore/html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::getContext): (WebCore::HTMLCanvasElement::createContext2d): (WebCore::HTMLCanvasElement::createContextWebGL): (WebCore::HTMLCanvasElement::createContextBitmapRenderer): (WebCore::HTMLCanvasElement::createContextWebGPU): * Source/WebCore/html/OffscreenCanvas.cpp: (WebCore::OffscreenCanvas::getContext): Originally-landed-as: 305413.763@safari-7624-branch (40941e46f2d4). rdar://180436486 Canonical link: https://commits.webkit.org/316107@main
https://bugs.webkit.org/show_bug.cgi?id=318086 Reviewed by Yusuke Suzuki. FastStringifier bails out whenever the space argument is not undefined, so common pretty-printing calls like JSON.stringify(value, null, 2) always run the general Stringifier, which is several times slower than the fast path on typical config / logging shaped objects. This patch resolves the gap inside FastStringifier and writes the newline plus depth * gap indentation directly into the flat buffer. Numbers and 8-bit string spaces are handled; boxed primitives keep falling back since unwrapping them is observable, and so do 16-bit gap strings since the gap is stored as Latin-1. append() is templatized on HasGap so that the no-space instantiation compiles to the same code as before; a runtime-checked version regressed json-stringify-int32-array by 1.78x. baseline patched json-stringify-int32-array 18.9412+-0.8168 ? 19.1482+-0.7348 ? might be 1.0109x slower json-stringify-many-objects 144.2817+-1.2609 ? 145.7997+-0.7796 ? might be 1.0105x slower json-stringify-empty-array 20.6268+-0.8005 20.2796+-0.3744 might be 1.0171x faster json-stringify-pretty-tab 1128.9899+-15.1355 ^ 274.4653+-3.0505 ^ definitely 4.1134x faster json-stringify-array-replacer 13.6181+-0.1381 ? 13.7487+-0.2907 ? json-stringify-pretty 1191.4510+-7.5572 ^ 301.6980+-4.2533 ^ definitely 3.9492x faster json-stringify-many-objects-to-json 89.9216+-0.4452 ? 90.5576+-1.0200 ? vanilla-todomvc-json-stringify 40.9058+-0.6199 ^ 38.5172+-0.8057 ^ definitely 1.0620x faster Tests: JSTests/microbenchmarks/json-stringify-pretty-tab.js JSTests/microbenchmarks/json-stringify-pretty.js JSTests/stress/json-stringify-space-fast-path.js * JSTests/microbenchmarks/json-stringify-pretty-tab.js: Added. * JSTests/microbenchmarks/json-stringify-pretty.js: Added. * JSTests/stress/json-stringify-space-fast-path.js: Added. (f): (new.Date): (show): (const.space.of.spaces.const.value.of.values.catch): (print.string_appeared_here.slowErr.JSON.stringify): (print): * Source/JavaScriptCore/runtime/JSONObject.cpp: (JSC::gap): (JSC::bufferMode>::setGap): (JSC::bufferMode>::newLineAndIndentSize const): (JSC::bufferMode>::appendNewLineAndIndentUnchecked): (JSC::bufferMode>::append): (JSC::bufferMode>::appendInt32Array): (JSC::bufferMode>::stringify): Canonical link: https://commits.webkit.org/316108@main
…a sibling frameID, producing duplicate frameIDs in the BF tree https://bugs.webkit.org/show_bug.cgi?id=318112 rdar://180926736 Reviewed by Sihui Liu. This is the capture-side root cause behind bug 318015, which only added a defensive guard in the per-frame back/forward walk. Under UseUIProcessForBackForwardItemLoading, when a child frame performs a back/forward navigation, WebPageProxy::frameStateForBackForwardChildFrame looks up the child's stored FrameState in the target back/forward item positionally: it takes the live frame's document-order index (WebFrameProxy::indexInFrameTreeSiblings) and calls WebBackForwardList::findFrameStateInItem, which fetches the BF child via WebBackForwardListFrameItem::childItemAtIndex(index). But the BF item's children are stored in commit/append order (the order in which each iframe recorded its initial history item), which can differ from the live frame tree's document order. When a page has two sibling iframes and the second commits its initial history item before the first (e.g. the second has a script and the first is empty), the BF children end up reversed relative to the live tree. With that ordering mismatch, the positional lookup returns the wrong sibling's FrameState. frameStateForBackForwardChildFrame then sees frameState->frameID != live frame.frameID() and "corrects" it by calling WebBackForwardList::updateFrameIdentifier(storedID -> liveID), which walks all back/forward entries and rewrites the first frame carrying storedID. That rewrites the unaffected sibling's frameID onto the navigated frame's frameID, leaving two sibling frame items with the same frameID in a back/forward entry. The duplicate then makes the per-frame walk dispatch a second GoToBackForwardItem to the same live frame, clobbering the intended navigation -- the flaky timeout that bug 318015 fixed defensively. On Debug it also fires the HistoryItem::addChildItem duplicate-frameID assertion when the WebProcess reconstructs the HistoryItem from the corrupted FrameState. Fix: in findFrameStateInItem, match the child by the live frame's identifier first (childItemForFrameID), and fall back to the positional lookup only when that identifier is absent -- i.e. the stored identifiers no longer match the live frames, which happens after session restore or when a cross-site child frame is recreated (where updateFrameIdentifier then legitimately remaps the regenerated identifier). In the common live case the identifier matches, so the wrong sibling can no longer be selected and updateFrameIdentifier is no longer triggered spuriously. The change is mirrored in the Swift (ENABLE_BACK_FORWARD_LIST_SWIFT) implementation. Because the corruption is fixed at the source, the WebProcess never reconstructs a HistoryItem with a duplicate frameID, so the bug-317799 Debug skip for the overlapping-navigations cluster test is removed; the test passes on Debug with the fix. Covered by existing tests (SiteIsolation.NavigateFrameWithSiblingsBackForward, previously flaky; SiteIsolation.BackNavigationOverCrossSiteIframeWithoutBFCache; and the session-restore back/forward tests that exercise the positional fallback) and by http/wpt/site-isolation/overlapping-navigations-and-traversals/cross-document-traversal-cross-document-traversal.html on Debug. Verified on both the C++ and Swift back/forward list implementations: the duplicate-frameID corruption no longer appears across many iterations (it reproduced roughly one run in ten to twenty-five before), and the Debug assertion fires without the fix and is quiet with it. * LayoutTests/platform/mac-wk2/TestExpectations: Remove the bug-317799 Debug skip. * Source/WebKit/UIProcess/WebBackForwardList.cpp: (WebKit::WebBackForwardList::findFrameStateInItem): * Source/WebKit/UIProcess/WebBackForwardList.h: * Source/WebKit/UIProcess/WebBackForwardList.swift: * Source/WebKit/UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::frameStateForBackForwardChildFrame): Canonical link: https://commits.webkit.org/316109@main
https://bugs.webkit.org/show_bug.cgi?id=318128 rdar://180951143 Reviewed by Abrar Rahman Protyasha. We had some ideas for dictation tests to help increase our overall coverage for this area, but unfortunately they did not land as part of 316049@main since it got merged before I was able to get to it and add the tests. This is just a follow up to help add the discussed tests as well as some additional ones to just reinforce our changes. Also go through a couple of places and adopt RetainPtr where possible. * Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ios/UIWKInteractionViewProtocol.mm: (TestWebKitAPI::TEST(UIWKInteractionViewProtocol, TextInteractionCanBeginInExistingSelection)): (TestWebKitAPI::TEST(UIWKInteractionViewProtocol, ReplaceDictatedTextContainingEmojis)): (TestWebKitAPI::TEST(UIWKInteractionViewProtocol, SuppressSelectionChangesDuringDictation)): (TestWebKitAPI::TEST(UIWKInteractionViewProtocol, ReplaceDictatedTextStartsComposition)): (TestWebKitAPI::TEST(UIWKInteractionViewProtocol, ReplaceDictatedTextContinuesComposition)): Updated this test so that the dictated content is a little longer which may be a bit more representative of actual use. (TestWebKitAPI::TEST(UIWKInteractionViewProtocol, ReplaceDictatedTextClearingEmitsCompositionEnd)): (TestWebKitAPI::TEST(UIWKInteractionViewProtocol, ReplaceDictatedTextReplacesSelectedText)): (TestWebKitAPI::TEST(UIWKInteractionViewProtocol, ReplaceDictatedTextReplacesSelectedPortion)): (TestWebKitAPI::TEST(UIWKInteractionViewProtocol, ReplaceDictatedTextReplacesMultiWordSelection)): Make sure that dictation still occurs as expected if the user already had a selection in different scenarios. (TestWebKitAPI::TEST(UIWKInteractionViewProtocol, ReplaceDictatedTextEmitsCompositionEventSequence)): Make sure that we get full order of composition events as expected with a start event, multiple updates, and a final end event. Previous tests were really only checking a subset of the expected events. (TestWebKitAPI::TEST(UIWKInteractionViewProtocol, ReplaceDictatedTextPreservesSurroundingText)): Simple one just to make sure that we get the text as expected if dictation starts in the middle of some content. (TestWebKitAPI::TEST(UIWKInteractionViewProtocol, ReplaceDictatedTextHandlesShrinkingHypothesis)): It is possible for a subsequent hypothesis to be shorter than the previous one. Canonical link: https://commits.webkit.org/316110@main
…acking::paintIntoLayer https://bugs.webkit.org/show_bug.cgi?id=318153 rdar://180962809 Reviewed by Nikolas Zimmermann and Simon Fraser. paintOneLayer() evaluated `&layer == &m_owningLayer` twice back-to-back: once to conditionally assign svgPaintOrderItemRange, and again to open the block that actually consumes it. The std::optional was declared in the outer scope solely to bridge the two checks. svgPaintOrderItemRange is only read inside the second block (the paintLayerContents() calls), so fold the assignment into that block and scope the variable there. This evaluates the condition once and narrows the variable's lifetime. No change in behavior. * Source/WebCore/rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::paintIntoLayer): Canonical link: https://commits.webkit.org/316111@main
…een clone and pixelBuffer causes use-after-free rdar://175482151 Reviewed by Jean-Yves Avenard. We add a thread annotation to make sure the conversion callback cannot be modified without the pixel buffer lock. We update VideoFrameLibWebRTC::clone so that it holds the pixel buffer lock to ensure it gets a correct conversion callback. We also copy the pixel buffer with a lock, as it could be null on the cloned video frame if the conversion callback has already been called. Covered by LayoutTests/http/wpt/webcodecs/frame-clone-and-convert.html, which does the following: 1. Create a LibWebRTC VideoFrame. 2. Encode it using VP8 so that the VideoFrame pixelBuffer method is executed in a background queue. 3. In parallel, clone the VideoFrame to exercice the racy code path and encode the cloned frame. * LayoutTests/http/wpt/webcodecs/frame-clone-and-convert-expected.txt: Added. * LayoutTests/http/wpt/webcodecs/frame-clone-and-convert.html: Added. * Source/WebCore/platform/mediastream/libwebrtc/VideoFrameLibWebRTC.cpp: (WebCore::VideoFrameLibWebRTC::clone): * Source/WebCore/platform/mediastream/libwebrtc/VideoFrameLibWebRTC.h: Originally-landed-as: 305413.760@safari-7624-branch (f4c62c374952). rdar://180436627 Canonical link: https://commits.webkit.org/316112@main
https://bugs.webkit.org/show_bug.cgi?id=317938 rdar://180739848 Reviewed by Simon Fraser. Adds two geometry helpers to FloatSize needed for computing corner contour geometry per the CSS Borders 4 spec. normalized() returns a unit vector in the same direction (returning the original unchanged if its length is zero), and perpendicular() returns a 90° counter-clockwise rotation. No new tests needed * Source/WebCore/platform/graphics/FloatSize.h: (WebCore::FloatSize::normalized const): (WebCore::FloatSize::perpendicular const): Canonical link: https://commits.webkit.org/316113@main
https://bugs.webkit.org/show_bug.cgi?id=318169 rdar://170649898 Reviewed by David Kilzer. A search string that folds to an all-ignorable collation key produces a zero-length match at every offset. In WebFoundTextRangeController::findTextRangesForStringMatches() a zero-length match at the start of the main frame becomes a WebFoundTextRange equal to the HashMap empty value. Inserting it into m_cachedFoundRanges trips the HashMap key-validation RELEASE_ASSERT, crashing the Web Content process. To fix this, we stop the search when the match length is zero. An all-ignorable target matches nothing meaningful, so reporting no matches is correct. Tests: editing/find/ios/find-interaction-ignorable-character.html Tools/TestWebKitAPI/Tests/WebKit/WKWebView/FindInPage.mm * LayoutTests/editing/find/ios/find-interaction-ignorable-character-expected.txt: Added. * LayoutTests/editing/find/ios/find-interaction-ignorable-character.html: Added. * LayoutTests/resources/ui-helper.js: (window.UIHelper.findStringMatchesUsingFindInteraction.return.new.Promise): (window.UIHelper.findStringMatchesUsingFindInteraction): * Source/WebCore/editing/CachedMatchFinder.cpp: (WebCore::CachedMatchFinder::performSearch): * Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: * Tools/TestRunnerShared/UIScriptContext/UIScriptController.h: (WTR::UIScriptController::findStringMatchesUsingFindInteraction): * Tools/TestWebKitAPI/Tests/WebKit/WKWebView/FindInPage.mm: (TEST(WebKit, FindInPageIgnorableCharacterDoesNotCrash)): * Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h: * Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm: (-[WTRTextSearchAggregator initWithCompletionHandler:]): (-[WTRTextSearchAggregator allFoundRanges]): (-[WTRTextSearchAggregator foundRange:forSearchString:inDocument:]): (-[WTRTextSearchAggregator finishedSearching]): (-[WTRTextSearchAggregator invalidateFoundRange:inDocument:]): (-[WTRTextSearchAggregator invalidate]): (WTR::UIScriptControllerIOS::findStringMatchesUsingFindInteraction): Canonical link: https://commits.webkit.org/316114@main
… dropped Upstream 279137d removed the !defined(BUILDING_WITH_CMAKE) condition from the Darwin platform blocks in BPlatform.h and pas_platform.h, because its new CMake-on-macOS flow (WebKitXcodeSDK.cmake, xcrun, full Cocoa) is now a real Cocoa build. Our macOS artifacts come from a CMake build that targets Darwin from a Linux host (Dockerfile.macos) and compiles no Cocoa .mm sources. With the guard gone, BPLATFORM(COCOA) becomes true, ProcessCheck.h stops providing the inline gigacageEnabledForProcess() stub, and linking bin/jsc fails: ld64.lld: error: undefined symbol: bmalloc::gigacageEnabledForProcess() >>> referenced by Gigacage.cpp:282 pas_platform.h has the identical guard and the same commit removed it; dropping that one would silently flip PAS_PLATFORM(MAC) on for the shipped macOS artifacts too. Restore both, so a CMake build of bmalloc/libpas keeps the same platform identity it has always shipped with.
Upgrade to upstream WebKit ce481c4
…262) In moduleLoadTopSettled's rejected branch, the entire fetch/evaluation-error classification is gated on dynamicDowncast<ErrorInstance>. Bun rejects a single-message transpile failure with a BuildMessage, which is a plain JSDestructibleObject, so nothing is recorded on the registry entry at all. moduleLoadTopRejected then falls through its fetchError() check and records the value with setEvaluationError. That leaves the entry at EvaluationFailed with no fetch, module, or load promise. The next importer of the same key that goes through hostLoadImportedModule (a static import, or a dynamic import inside another module's graph load) finds a non-New entry with no fetchError and no loadPromise, creates a fresh pending fetchPromise via ensureModulePromise, and waits on it forever. Nothing ever settles it. // bad.ts contains "import {" (exactly one parser error, so the // rejection value is a BuildMessage, not an AggregateError) await import("./bad.ts").catch(() => {}); await import("./other.ts"); // other.ts statically imports bad.ts; hangs This microtask reacts to the embedder fetch promise, so every rejection that reaches it is a fetch failure by construction: the promise is either a fresh fetch() or a cached entry->ensureFetchPromise(), and the only rejector of an entry's fetch promise is setFetchError. Add the else branch so a non-Error rejection value is recorded the same way. This matches what the sibling nested-import path already does: moduleRegistryFetchSettled calls setFetchError unconditionally and only gates the attachErrorInfo metadata on the value being an ErrorInstance. With the entry at FetchFailed, moduleLoadTopRejected rejects with the cached fetchError() instead of calling setEvaluationError, and later importers take hostLoadImportedModule's fetchError short circuit instead of parking on a promise nothing settles. Independent of #258 (the import-attribute module map key): that change threads the attribute into ensureRegistered here but keeps the ErrorInstance gate, and this hang reproduces with no import attributes at all. The two apply cleanly together.
* DFG/FTL: have the Date.now() intrinsic honor overridenDateNow Date.now() is tagged DateNowIntrinsic, so once a call site gets hot the DFG bytecode parser inlines it as a DateNow node. Both the DFG and FTL lower that node to operationDateNow, which returned jsCurrentTime() and ignored JSGlobalObject::overridenDateNow. The LLInt/baseline host function (dateNow) reads the override, so after Date.now() tiered up it began returning the real wall clock while the interpreter path still returned the overridden time. Pass the global object to operationDateNow and return overridenDateNow when it is set, matching the dateNow host function. The DFG and FTL call sites now forward the global object, mirroring operationRandom. Fixes a case where a setSystemTime() override leaks into JIT-compiled Date.now() callers (oven-sh/bun#32793). * Unify the overridenDateNow readers on jsDateNow() and use NaN as the sentinel The five readers of JSGlobalObject::overridenDateNow decided "is an override active" with two different predicates: jsDateNow() (used by new Date()) checked `> -1`, while dateNow, dateNowImpl, callDate and operationDateNow checked `< 0`. Route all of them through jsDateNow() so every tier and every entry point reads the same value. jsCurrentTime() now has exactly one caller in JavaScriptCore. Switch the "no override" sentinel from -1 to NaN: - Soundness: the DFG abstract interpreter proves DateNow yields SpecDoubleReal (a non-NaN double), but a NaN stored in overridenDateNow passed the `ms < 0` check and was returned as-is, so LLInt/baseline Date.now() returned NaN while DFG/FTL returned the wall clock. This is reachable from Bun via jest.useFakeTimers({ now: NaN }). With `std::isnan(ms) ? jsCurrentTime() : ms` the result can never be NaN, so the type proof holds by construction. - Pre-epoch overrides work: every negative timestamp used to read as "unset", so setSystemTime(new Date("1960-01-01")) was silently ignored, and -1 itself (1969-12-31T23:59:59.999Z) could never be the frozen time. Bun's writers (src/jsc/bindings/JSMockFunction.cpp and src/runtime/test_runner/timers/FakeTimers.rs) store -1 to clear the override; the Bun PR that bumps past this commit must switch those to NaN.
* Remove redundant m_renderRange.start() null checks in RenderHighlight::highlightStateForRenderer
https://bugs.webkit.org/show_bug.cgi?id=318175
rdar://180977788
Reviewed by Alan Baradlay.
The branch is entered only when `&renderer == m_renderRange.start()`. Since
renderer is a reference, &renderer is never null, so m_renderRange.start() is
guaranteed non-null inside the block. The two further m_renderRange.start()
checks were therefore always true: the leading term of the Both test and the
guard on the Start return.
Drop both dead checks. The Start return becomes the unconditional fall-through
after the Both case, and the end() null check is retained since end() can
legitimately be null. No change in behavior.
* Source/WebCore/rendering/RenderHighlight.cpp:
(WebCore::RenderHighlight::highlightStateForRenderer):
Canonical link: https://commits.webkit.org/316115@main
* [GPUP] WebGPU BindGroup Validation-Cache Key Collision Leads to GPU OOB Write
https://bugs.webkit.org/show_bug.cgi?id=313360
rdar://174662781
Reviewed by Dan Glastonbury.
Share identifiers for render and compute pipelines to avoid
validation succeeding for a given bind group + render pipeline
which was validated for the hash key identical to the same
bind group but with a compute pipeline which has the same key.
* Source/WebGPU/WebGPU/ComputePipeline.mm:
* Source/WebGPU/WebGPU/Device.h:
* Source/WebGPU/WebGPU/RenderPipeline.mm:
Originally-landed-as: 305413.739@safari-7624-branch (427fc7a6307d). rdar://180429272
Canonical link: https://commits.webkit.org/316116@main
* Uninitialized-heap disclosure in convertImagePixelsFromFloat16ToFloat16 via color-space early-return
<https://bugs.webkit.org/show_bug.cgi?id=314590>
<rdar://176483321>
Reviewed by Gerald Squelart.
convertImagePixelsFromFloat16ToFloat16() early-returned on a color-space
mismatch without writing the destination. The destination buffer is allocated
via JSC::Float16Array::tryCreateUninitialized() and ImageBufferBackend::
getPixelBuffer() only zero-fills on a size mismatch, so an RGBA16F
getPixelBuffer() readback whose output color space differed from the backing
IOSurface's left the destination populated with uninitialized
Gigacage::Primitive heap. RemoteImageBuffer::getPixelBufferWithNewMemory()
then memcpy'd those bytes into WebContent-mapped shared memory causing a
WebContent<->GPUProcess heap disclosure.
Float16<->Float16 color-space conversion is unimplemented (the 8-bit sibling
path also doesn't perform it). Remove the early return so the destination
is always populated with the source pixels (alpha-format conversion applied),
matching the sibling's behavior and closing the disclosure.
Test: ipc/rgba16f-getpixelbuffer-colorspace-mismatch-heap-disclosure.html
* LayoutTests/ipc/rgba16f-getpixelbuffer-colorspace-mismatch-heap-disclosure-expected.txt: Added.
* LayoutTests/ipc/rgba16f-getpixelbuffer-colorspace-mismatch-heap-disclosure.html: Added.
* Source/WebCore/platform/graphics/PixelBufferConversion.cpp:
(WebCore::convertImagePixelsFromFloat16ToFloat16):
Originally-landed-as: 305413.933@safari-7624-branch (e7a0eda7b7ff). rdar://180428968
Canonical link: https://commits.webkit.org/316117@main
* [JSC] DFGArgumentsEliminationPhase removeViaKill should reset node scan index between InlineCallFrames
https://bugs.webkit.org/show_bug.cgi?id=314850
rdar://176966728
Reviewed by Yusuke Suzuki.
In DFGArgumentsEliminationPhase::eliminateCandidatesThatInterfere(), the removeViaKill
lambda contains two nested loops. The outer loop iterates over inline call frames. For
each frame, the inner loop is expected to iterate the nodes of the given basic block in
reverse order in the range [0, nodeIndex). However, because the inner loop mutates the
lambda parameter nodeIndex directly, this only works as intended for the first inline call
frame. Each subsequent call frame begins where the previous one left off.
The change introduces a separate iteration variable for the inner loop, which starts off
at nodeIndex for each inline call frame. nodeIndex parameter is marked as 'const' to make
explicit the expectation that it should not change.
Test: JSTests/stress/arguments-elimination-multiple-inline-call-frames.js
Originally-landed-as: 305413.912@safari-7624-branch (3270ebdb7366). rdar://180435783
Canonical link: https://commits.webkit.org/316118@main
* [Tools][WPE][browserperfdash-benchmark] browser-binary-size plan plugin should report the sizes of the stripped binaries and libs.
https://bugs.webkit.org/show_bug.cgi?id=318205
Reviewed by Nikolas Zimmermann.
Ensure to strip the binary and libraries before reporting the size.
That is done in a temporal file to not affect the original ones because
the user may want to keep those with debug symbols to use gdb or similar.
* Tools/Scripts/webkitpy/browserperfdash/plans/browser_binary_size.py:
(get_stripped_object_size):
(get_basenames_and_sizes):
(get_browser_relevant_objects_glib):
Canonical link: https://commits.webkit.org/316119@main
* Reject requestStorageAccess() without gesture should not synthesize user activation
https://bugs.webkit.org/show_bug.cgi?id=313478
rdar://174964081
Reviewed by Matthew Finkel.
The completion handler for requestStorageAccess() preserved the user gesture whenever the prompt was
not shown, including on the no-gesture fast-reject path. This synthesized a UserGestureIndicator
from nothing, allowing the .catch handler to call gesture-gated APIs from a cross-site iframe with
zero user interaction.
Gate gesture preservation on a real gesture having existed at call time.
Test: http/tests/storageAccess/request-storage-access-rejected-without-gesture-should-not-activate.html
* LayoutTests/http/tests/storageAccess/request-storage-access-rejected-without-gesture-should-not-activate-expected.txt: Added.
* LayoutTests/http/tests/storageAccess/request-storage-access-rejected-without-gesture-should-not-activate.html: Added.
* LayoutTests/http/tests/storageAccess/resources/request-storage-access-without-gesture-check-activation-iframe.html: Added.
* Source/WebCore/dom/DocumentStorageAccess.cpp:
(WebCore::DocumentStorageAccess::requestStorageAccess):
(WebCore::DocumentStorageAccess::requestStorageAccessQuirk):
* Source/WebCore/dom/DocumentStorageAccess.h:
* Source/WebCore/page/ChromeClient.h:
(WebCore::ChromeClient::requestStorageAccess):
* Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
* Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::requestStorageAccess):
* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h:
* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* Source/WebKit/Scripts/webkit/messages.py:
(headers_for_type):
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::requestStorageAccess):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::requestStorageAccess):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
Originally-landed-as: 305413.854@safari-7624-branch (6fae18f756d2). rdar://180436613
Canonical link: https://commits.webkit.org/316120@main
* MockSampleBox should not have negative timeScales and duration
rdar://174740124
https://bugs.webkit.org/show_bug.cgi?id=313917
Reviewed by Simon Fraser.
* Source/WebCore/platform/mock/mediasource/MockBox.cpp:
(WebCore::MockInitializationBox::MockInitializationBox):
(WebCore::MockSampleBox::MockSampleBox):
Originally-landed-as: 305413.813@safari-7624-branch (4f7a3cfefe44). rdar://180437504
Canonical link: https://commits.webkit.org/316121@main
* [cleanup] Rename RenderBox::setWidth()/setHeight() to setBorderBoxWidth()/setBorderBoxHeight()
https://bugs.webkit.org/show_bug.cgi?id=318039
<rdar://problem/180975454>
Reviewed by Antti Koivisto.
Follow-up to the width()/height() -> borderBoxWidth()/borderBoxHeight() rename.
setWidth()/setHeight() set the border box width/height, but the bare names
didn't say so -- the unqualified odd ones out next to setBorderBoxSize() and the
borderBox* getters. Name them for what they are.
Mechanical rename across WebCore; no behavior change.
* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(FlexLayout::layout):
(FlexLayout::updateRenderers):
* Source/WebCore/layout/integration/grid/LayoutIntegrationGridLayout.cpp:
(GridLayout::updateGridItemRenderers):
(GridLayout::updateFormattingContextRootRenderer):
* Source/WebCore/rendering/RenderBox.h:
* Source/WebCore/rendering/RenderBoxInlines.h:
(RenderBox::setLogicalHeight):
(RenderBox::setLogicalWidth):
* Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp:
(RenderDeprecatedFlexibleBox::layoutBlock):
(RenderDeprecatedFlexibleBox::layoutHorizontalBox):
(RenderDeprecatedFlexibleBox::layoutSingleClampedFlexItem):
(RenderDeprecatedFlexibleBox::layoutVerticalBox):
* Source/WebCore/rendering/RenderFrameSet.cpp:
(RenderFrameSet::layout):
(resetFrameRendererAndDescendants):
(RenderFrameSet::positionFrames):
* Source/WebCore/rendering/RenderListMarker.cpp:
(RenderListMarker::layout):
* Source/WebCore/rendering/RenderReplaced.cpp:
(RenderReplaced::layout):
* Source/WebCore/rendering/RenderScrollbarPart.cpp:
(RenderScrollbarPart::layoutHorizontalPart):
(RenderScrollbarPart::layoutVerticalPart):
(RenderScrollbarPart::computeScrollbarWidth):
(RenderScrollbarPart::computeScrollbarHeight):
(RenderScrollbarPart::paintIntoRect):
* Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp:
(RenderSVGForeignObject::updateLogicalWidth):
Canonical link: https://commits.webkit.org/316122@main
* [cleanup] Use RenderBox::borderBoxSize() in size-only callers of borderBoxRect()
https://bugs.webkit.org/show_bug.cgi?id=318020
Reviewed by Antti Koivisto.
These call sites only read the size of borderBoxRect(); none of them use its
location. borderBoxRect() is { 0, 0, borderBoxSize() }, so constructing the
positioned rect just to call .size()/.width()/.height()/.isEmpty() is wasteful
and hides the intent. Use the direct accessor (borderBoxSize(), borderBoxWidth(),
borderBoxHeight()) instead. No behavior change.
* Source/WebCore/rendering/RenderBox.cpp:
(RenderBox::reflectionOffset):
* Source/WebCore/rendering/svg/RenderSVGRoot.cpp:
(RenderSVGRoot::paint):
(RenderSVGRoot::boundingRects):
* Source/WebCore/style/values/transforms/StyleTransformList.cpp:
(Blending<TransformList>::blend):
Canonical link: https://commits.webkit.org/316123@main
* Use-after-free under WebsiteDataStore::beginAppBoundDomainCheck()
https://bugs.webkit.org/show_bug.cgi?id=314295
rdar://176438133
Reviewed by Ryosuke Niwa.
Stop capturing `host` and `protocol` by reference in the lambda since
the lambda can get called asynchronously.
* Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::beginAppBoundDomainCheck):
Originally-landed-as: 305413.851@safari-7624-branch (3602ee8745a7). rdar://180438476
Canonical link: https://commits.webkit.org/316124@main
* WebGL: Uninitialized FastMalloc heap disclosure in RemoteGraphicsContextGL::readPixelsInline
https://bugs.webkit.org/show_bug.cgi?id=312564
rdar://174640403
Reviewed by Dan Glastonbury.
Allocate the read pixels area with zero init.
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::readPixelsInline):
Originally-landed-as: 305413.708@safari-7624-branch (0c204da15932). rdar://180438472
Canonical link: https://commits.webkit.org/316125@main
* FilterImage may return uninitialized PixelBuffer
https://bugs.webkit.org/show_bug.cgi?id=314906
rdar://176813834
Reviewed by Darin Adler.
FilterImage provides three different representations of the image: ImageBuffer,
Unpremultiplied PixelBuffer and Premultiplied PixelBuffer. These three buffers
are lazily created. Each of them is created only when it is needed. But keep in
mind they are copies of each other. In other words, when one is created it has
to copy the pixels from the existing buffers. Otherwise it has to be zero-filled.
A problem may happen when copying the pixels from one buffer to a newly created
buffer fails. In this case we send uninitialized PixelBuffer which may expose user
private data. Not able to copy existing pixels to the PixelBuffer should be treated
as an error. So a null PixelBuffer should be returned in this case.
* Source/WebCore/platform/graphics/cpu/arm/filters/FEBlendNeonApplier.cpp:
(WebCore::FEBlendNeonApplier::apply const):
* Source/WebCore/platform/graphics/filters/FilterImage.cpp:
(WebCore::copyImageBytes):
(WebCore::FilterImage::pixelBuffer):
(WebCore::FilterImage::getPixelBuffer):
(WebCore::FilterImage::copyPixelBuffer):
* Source/WebCore/platform/graphics/filters/FilterImage.h:
Originally-landed-as: 305413.919@safari-7624-branch (dbf10417aa9e). rdar://180436188
Canonical link: https://commits.webkit.org/316126@main
* YarrJIT negativeOffsetIndexedAddress discards adjusted base register
https://bugs.webkit.org/show_bug.cgi?id=312415
rdar://174714198
Reviewed by Yijia Huang.
In YarrJIT negativeOffsetIndexedAddress computes a negative offset from
a base address but the function mistakenly uses the original value
instead of the adjusted value. This patch fixes it to use the adjusted
value.
Test: JSTests/stress/yarr-negative-offset.js
* JSTests/stress/yarr-negative-offset.js: Added.
(catch):
* Source/JavaScriptCore/yarr/YarrJIT.cpp:
Originally-landed-as: 305413.685@safari-7624-branch (30c8460241f3). rdar://180436598
Canonical link: https://commits.webkit.org/316127@main
* [JSC] Spread operator doesn't account for cellButterflyOnlyAtomStringsStructure in DFG
https://bugs.webkit.org/show_bug.cgi?id=313252
rdar://175498631
Reviewed by Yijia Huang.
This patch fixes the abstract interpreter's structure prediction for the spread operator.
Instead of only cellButterflyStructure(CopyOnWriteArrayWithContiguous), it now also takes
cellButterflyOnlyAtomStringsStructure into account.
Test: JSTests/stress/spread-with-OnlyAtomStringsStructure.js
* JSTests/stress/spread-with-OnlyAtomStringsStructure.js: Added.
(index):
* Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
Originally-landed-as: 305413.768@safari-7624-branch (62a1052dd1fe). rdar://180435430
Canonical link: https://commits.webkit.org/316128@main
* [CoreIPC] [NP] Heap UAF in WebCore::IDBServer::MemoryIndexCursor reverse iterator when a Prev/Prevunique cursor's next-higher index entry is deleted
<https://bugs.webkit.org/show_bug.cgi?id=313818>
<rdar://174678764>
Reviewed by Sihui Liu.
MemoryIndexCursor caches an IndexValueStore::Iterator across IPC messages.
For Prev/Prevunique cursors this wraps std::set<IDBKeyData>::reverse_iterator
objects (one for the outer IndexValueStore::m_orderedKeys set, one nested in
IndexValueEntry::Iterator for the inner per-index-key set). A
std::reverse_iterator stores a forward base() iterator pointing one element
past the logical position; for libc++ std::set that is a raw __tree_node*.
MemoryIndexCursor::indexValueChanged() only invalidates m_currentIterator
when the changed (key, primaryKey) equals the cursor's current logical
position. Deleting the next-higher index key (Variant A, outer set) or the
next-higher primary key under a shared index key (Variant B, inner set)
therefore frees exactly the __tree_node base() references while the guard
early-returns. The next IterateCursor IPC executes ++m_reverseIterator =>
--base() => __tree_prev_iter(freed_node), a heap-use-after-free in
com.apple.WebKit.Networking reachable from a compromised WebContent process
via NetworkStorageManager IPC with WCP-controlled
IDBDatabaseIdentifier.m_isTransient = true forcing MemoryIDBBackingStore.
Fix by gating the equality early-return on info().isDirectionForward(). For
reverse cursors we now invalidate m_currentIterator on any index mutation;
iterate() already re-seeks via reverseFind(m_currentKey, m_currentPrimaryKey)
when the iterator is invalid. Both removeEntriesWithValueKey() erase paths
(outer m_orderedKeys.erase() and inner IndexValueEntry::removeKey()) reach
indexValueChanged() through MemoryIndex::notifyCursorsOfValueChange(), so
both variants are closed.
* LayoutTests/storage/indexeddb/index-cursor-reverse-delete-next-higher-key-private-expected.txt: Added.
* LayoutTests/storage/indexeddb/index-cursor-reverse-delete-next-higher-key-private.html: Added.
* Source/WebCore/Modules/indexeddb/server/MemoryIndexCursor.cpp:
(WebCore::IDBServer::MemoryIndexCursor::indexValueChanged):
Originally-landed-as: 305413.842@safari-7624-branch (d14d12e915f3). rdar://180436983
Canonical link: https://commits.webkit.org/316129@main
* ANGLE: Metal: Inconsistent implementation of various DrawElements variations
https://bugs.webkit.org/show_bug.cgi?id=312470
rdar://174919762
Reviewed by Dan Glastonbury.
The implementation of DrawElements would be inconsistent:
The implementation has multiple stages of possible intermediate buffers.
At various stages, offsets and counts were mixed between incorrect
stages.
Historically the confusions were partly due to the logic loading
the primitive ranges sometimes from generate intermediary buffers,
sometimes from the original client-provided buffer. This was partly
fixed to load only from client-provided buffers and client arrays
in "WebGL: consecutive UNSIGNED_BYTE drawElements() draw in wrong
location", but this caused a regression by other part of the code
using counts from incorrect stages.
The implementation strategy would not working for non-strip topologies,
such as GL_TRIANGLES, in primitive restart cases when provoking vertex
rewrite was needed. The provoking vertex rewrite operates per primitive.
For strip topologies, this works as each vertex index also defines a
primitive. For non-strip topologies, this is not possible as the
provoking vertex generation shader cannot know where the primitive
starts. Example: GL_TRIANGLES of {0, ff, 1, 2, 3, 4} would be dispatched
as primitives starting at 0 and 2, but the proper dispatch list
would contain just primitive at 1.
Furthermore, the logic to determine drawn index ranges was based on
scanning for primitive restart ranges, and then converting those
to draw index ranges. This algorithm was brittle and contained
quite many confusions.
Fix by:
- Resolve the draw index ranges by resolving the draw index ranges
instead of restart ranges. These index ranges are then intersected
with the client provided offset and count, which define the first
index, last index range pair.
- Consistently resolve the draw index ranges ƒrom the client buffers.
- Keep all intermediate buffers consistent with the first index, count:
the intermediate buffers always have the similar unused prefix
than the original client-provided index buffer.
- Keep all the intermediate buffers offsets separated from the
client-provided offset (first index). The intermediate buffers are
allocated from the buffer pool, so they're not separate buffers but
buffer, offset pairs. Keep these buffer, offset pairs separate from
the client first index
- For non-strip topology draws, provide the draw ranges already to the
provoking vertex shader helper. The provoking vertex shader is
only run for the real draw indices instead of the full draw.
This allows the shader to function correctly.
* Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj:
* Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/BufferMtl.h:
(rx::DrawIndexRange::DrawIndexRange):
(rx::BufferMtl::DrawIndexRangeCache::DrawIndexRangeCache):
(rx::IndexRange::IndexRange): Deleted.
(rx::BufferMtl::RestartRangeCache::RestartRangeCache): Deleted.
* Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/BufferMtl.mm:
(rx::BufferMtl::markConversionBuffersDirty):
(rx::BufferMtl::clearConversionBuffers):
(rx::CalculateDrawIndexRanges):
(rx::BufferMtl::getDrawIndexRanges):
(rx::BufferMtl::GetDrawIndexRangesFromClientData):
(rx::IndexConversionBufferMtl::getRangeForConvertedBuffer): Deleted.
(rx::CalculateRestartRanges): Deleted.
(rx::BufferMtl::getRestartIndices): Deleted.
(rx::BufferMtl::GetRestartIndicesFromClientData): Deleted.
* Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ContextMtl.h:
(rx::ContextMtl::getProvokingVertexHelper):
* Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ContextMtl.mm:
(rx::ContextMtl::drawElementsImpl):
* Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ProvokingVertexHelper.h:
* Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ProvokingVertexHelper.mm:
(rx::ProvokingVertexHelper::preconditionIndexBuffer):
(rx::ProvokingVertexHelper::generateIndexBuffer):
* Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/VertexArrayMtl.h:
* Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/VertexArrayMtl.mm:
(rx::AppendDrawCommands):
(rx::AppendDrawCommandRanges):
(rx::VertexArrayMtl::resolveDrawElementsDraw):
(rx::VertexArrayMtl::getIndexBuffer): Deleted.
(rx::VertexArrayMtl::getDrawIndices): Deleted.
* Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/VertexArrayMtl_unittest.mm: Added.
* Source/ThirdParty/ANGLE/src/tests/gl_tests/DrawElementsTest.cpp:
(angle::convertIndexBufferContents):
Originally-landed-as: 305413.713@safari-7624-branch (23eba5e02916). rdar://180437073
Canonical link: https://commits.webkit.org/316130@main
* [WebGPU] signed-negation overflow on baseVertex==INT32_MIN in RenderPassEncoder::clampIndexBufferToValidValues
https://bugs.webkit.org/show_bug.cgi?id=315196
rdar://176882934
Reviewed by Mike Wyrzykowski.
RenderPassEncoder::clampIndexBufferToValidValues guards baseVertex magnitude with
-baseVertex > static_cast<int64_t>(minVertexCount), but the unary negation runs
in 32-bit signed arithmetic before the comparison widens, so baseVertex == INT32_MIN
wraps to itself and passes the guard. The fix widens baseVertex to int64_t before
negation and sign extension preserves all valid negative baseVertex values, so the
guard's behaviour is unchanged for every input except INT32_MIN, whose magnitude (2^31)
is now representable and correctly rejected.
Test: fast/webgpu/nocrash/fuzz-176882934.html
* LayoutTests/fast/webgpu/nocrash/fuzz-176882934-expected.txt: Added.
* LayoutTests/fast/webgpu/nocrash/fuzz-176882934.html: Added.
* Source/WebGPU/WebGPU/RenderPassEncoder.mm:
(WebGPU::RenderPassEncoder::clampIndexBufferToValidValues):
Originally-landed-as: 305413.952@safari-7624-branch (04553772a362). rdar://180436823
Canonical link: https://commits.webkit.org/316131@main
* [JSC] Unconditionally keep OMGOSREntryCallee alive while updating its callsites
https://bugs.webkit.org/show_bug.cgi?id=313063
rdar://174492346
Reviewed by Keith Miller.
After a re-tier, when a fresh BBQCallee replaces a retired one,
m_osrEntryCallees may hold a stale weak ref to an OMGOSREntryCallee not owned
by the current BBQCallee. Currently, updateCallsitesToCallUs will not track
this since it assumes that this OMGOSREntryCallee will be owned by the BBQCallee
This patch fixes it by unconditionally keeping the OMGOSREntryCallee alive
while we update all the callsites within it. The assert in ~BBQCallee is void
now since an OMGOSREntryCallee can now have multiple owners.
* Source/JavaScriptCore/wasm/WasmCallee.cpp:
(JSC::Wasm::BBQCallee::~BBQCallee):
* Source/JavaScriptCore/wasm/WasmCalleeGroup.cpp:
(JSC::Wasm::CalleeGroup::updateCallsitesToCallUs):
Originally-landed-as: 305413.784@safari-7624-branch (84a5f91f00a5). rdar://180437899
Canonical link: https://commits.webkit.org/316132@main
* Reject IndexedDB transactions during version change operation
https://bugs.webkit.org/show_bug.cgi?id=312391
rdar://173799670
Reviewed by Sihui Liu.
When an IndexedDB connection is closed while a version
change transaction is active, UniqueIDBDatabase::connectionClosedFromClient
successfully closes the version change transaction however it does
not clear any other pending transactions due to an early return
when clearing version change transactions.
Instead of being defensive and clearing the pending transaciton
in the case of the early return, we should reject any incoming
transactions which come on a version change connection.
Only whenever a version change operation completes, can
a new transaction be established. So, this patch rejects any
incoming transactions which come while a version change operation
is active.
The IndexedDB spec describes the steps for starting a new transaction:
The transaction(storeNames, mode, options) method steps are:
1. If a live upgrade transaction is associated with the connection, throw an "InvalidStateError" DOMException.
https://w3c.github.io/IndexedDB/#dom-idbdatabase-transaction
This check already happens in the web process during
IDBDatabase::transaction where it returns an "InvalidStateError"
in this state.
However, this doesn't account for a compromised web process
who avoids this client side check and makes it across IPC
to invoke transaction creation in the NetworkProcess.
This patch adds a check for this scenario of a comprimised web
process who manages to start a new transaction during a
version change, if this is detected, we return early and
don't move forward with creating the transaction
This patch checks that the current connection isn't the
stored UniqueIDBDatabase::m_versionChangeDatabaseConnection.
That member variable will point to the active version change connection,
if any, and it is cleared when the version change completes.
It also checks if m_versionChangeTransaction is non-null
since it will only be null once the version change transaction
is completed.
* LayoutTests/ipc/networksindexeddb-close-connection-during-version-change-expected.txt: Added.
* LayoutTests/ipc/networksindexeddb-close-connection-during-version-change.html: Added.
* Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::isVersionChangeTransactionActive const):
* Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h:
* Source/WebKit/NetworkProcess/storage/NetworkStorageManager.cpp:
(WebKit::NetworkStorageManager::establishTransaction):
(WebKit::NetworkStorageManager::databaseConnectionPendingClose):
Originally-landed-as: 305413.734@safari-7624-branch (6b2393e40648). rdar://180437837
Canonical link: https://commits.webkit.org/316133@main
* [WebGPU] Stale WeakPtr comparison in BindGroupLayout::errorValidatingBindGroupCompatibility allows incompatible auto/explicit layout pairing
https://bugs.webkit.org/show_bug.cgi?id=315496
rdar://176812014
Reviewed by Mike Wyrzykowski.
We were using weak pointers to compare the autogenerated pipeline layouts when
checking for compatibility of two bind groups, however the weak pointer can be
null in two scenarios: when the layout is explicit or when the pipeline layout
has been destroyed. That could result in incorrectly considering two bind groups
compatible when one is pipeline layout is explicit and the other has been destroyed.
In order to avoid that we explicitly check whether both bind groups use auto
generated layouts.
Test: fast/webgpu/regression/repro_176812014.html
* LayoutTests/fast/webgpu/regression/repro_176812014-expected.txt: Added.
* LayoutTests/fast/webgpu/regression/repro_176812014.html: Added.
* Source/WebGPU/WebGPU/BindGroupLayout.mm:
(WebGPU::BindGroupLayout::errorValidatingBindGroupCompatibility const):
Originally-landed-as: 305413.964@safari-7624-branch (48e38ee5acbc). rdar://180428905
Canonical link: https://commits.webkit.org/316134@main
* use-after-free in WebCodecsAudioData::memoryCost() via concurrent GC marker / close()
rdar://175520011
Reviewed by Jean-Yves Avenard
WebCodecsAudioData is annotated with ReportExtraMemoryCost, so the generated
JS wrapper's visitChildren calls WebCodecsAudioData::memoryCost() from a
concurrent GC marker thread. memoryCost() dereferenced m_data.audioData (a
RefPtr<PlatformRawAudioData>) without synchronization while close() on the
main thread assigns m_data.audioData = nullptr and frees the
PlatformRawAudioData, leading to a heap-use-after-free in
PlatformRawAudioDataCocoa::memoryCost().
Cache the memory cost in a std::atomic<size_t> on WebCodecsAudioData,
computed once at construction time on the main thread and zeroed in close(),
so the GC-thread memoryCost() never touches the RefPtr. This matches the
existing pattern in ImageBitmap.
* LayoutTests/fast/webcodecs/audio-data-close-during-gc-crash-expected.txt: Added.
* LayoutTests/fast/webcodecs/audio-data-close-during-gc-crash.html: Added.
* Source/WebCore/Modules/webcodecs/WebCodecsAudioData.cpp:
(WebCore::WebCodecsAudioData::WebCodecsAudioData):
(WebCore::WebCodecsAudioData::close):
* Source/WebCore/Modules/webcodecs/WebCodecsAudioData.h:
(WebCore::WebCodecsAudioData::memoryCost const):
Originally-landed-as: 305413.845@safari-7624-branch (2102c1dad1d3). rdar://180438342
Canonical link: https://commits.webkit.org/316135@main
* [WebKit Process Model] Use-after-free in WebExtensionContext::storageSet from HashMap mutation during keys() iteration
https://bugs.webkit.org/show_bug.cgi?id=315538
rdar://177375129
Reviewed by Timothy Hatcher.
When WebExtensionStorageSQLiteStore::setKeyedData hits an INSERT error
mid-batch (e.g. SQLITE_FULL), it returns a keysSuccessfullySet vector
that is non-empty but smaller than the input map. The completion lambda
in storageSet then iterated `data.keys()` while calling `data.remove()`
inside the loop. `keys()` returns a live iterator range backed by raw
pointers into the HashTable buffer, and remove() can shrink/rehash and
free that buffer, leaving the iterator dangling — a heap UAF in the UI
Process driven by IPC from the WebContent process.
Replace the iterate-and-mutate loop with HashMap::removeIf, which walks
the table safely.
* Source/WebKit/UIProcess/Extensions/API/WebExtensionContextAPIStorage.cpp:
(WebKit::WebExtensionContext::storageSet):
Originally-landed-as: 305413.961@safari-7624-branch (de9fb008197a). rdar://180427449
Canonical link: https://commits.webkit.org/316136@main
* [JSC] TypedArray.from() Out-of-Bounds Read via Resizable ArrayBuffer resize/transfer in mapFn callback.
https://bugs.webkit.org/show_bug.cgi?id=312513
rdar://174428778
Reviewed by Yusuke Suzuki.
Adjusts TypedArray.from to properly handle cases where the map function changes the bounds of the arraylike input.
Test: JSTests/stress/typedarray-from-oob.js
* JSTests/stress/typedarray-from-oob.js: Added.
(testResize):
(testDetach):
* Source/JavaScriptCore/builtins/TypedArrayConstructor.js:
(from):
Originally-landed-as: 305413.702@safari-7624-branch (e99a325bb9b8). rdar://180429231
Canonical link: https://commits.webkit.org/316137@main
* Fix animateMotion-spline-invalid-keyTimes.html
https://bugs.webkit.org/show_bug.cgi?id=318132
Reviewed by Nikolas Zimmermann.
Fix animateMotion-spline-invalid-keyTimes.html by keeping the animation invalid when keyTimes list does not end with 1
for the spline calcMode [1].
[1] https://svgwg.org/specs/animations/#KeyTimesAttribute
* LayoutTests/imported/w3c/web-platform-tests/svg/animations/animateMotion-spline-invalid-keyTimes-expected.txt:
* Source/WebCore/svg/SVGAnimationElement.cpp:
(WebCore::SVGAnimationElement::startedActiveInterval):
Canonical link: https://commits.webkit.org/316138@main
* [JSC] Insert barrier for MultiPutByOffset when it can reallocate storage
https://bugs.webkit.org/show_bug.cgi?id=314747
rdar://176792407
Reviewed by Keith Miller.
The DFG barrier insertion phase works by tracking an "epoch" serial number,
which is bumped every time it encounters a node that can GC. The assumption is
that each DFG node either does a store, which would need to be considered for
barrier insertion, or performs a GC.
MultiPutByOffset is a "fat" node that can GC and perform a store after that GC,
in sequence. The current analysis therefore incorrectly elides the barrier for
it. This PR fixes by special casing.
Test: JSTests/stress/multi-put-by-offset-reallocating-storage-needs-write-barrier.js
* JSTests/stress/multi-put-by-offset-reallocating-storage-needs-write-barrier.js: Added.
(foo):
* Source/JavaScriptCore/dfg/DFGStoreBarrierInsertionPhase.cpp:
Originally-landed-as: 305413.909@safari-7624-branch (2b4933eb1658). rdar://180427769
Canonical link: https://commits.webkit.org/316139@main
* REGRESSION(316095@main): error: initializer 'init(_:)' is not available due to missing import of defining module 'WebCore_Private' [#MemberImportVisibility]
https://bugs.webkit.org/show_bug.cgi?id=318219
rdar://181020438
Unreviewed build fix.
* Source/WebKit/UIProcess/mac/WKAppKitGestureController.swift:
Canonical link: https://commits.webkit.org/316140@main
* [LBSE] Rebaseline iOS specific results after 315674@main
https://bugs.webkit.org/show_bug.cgi?id=318220
Unreviewed gardening.
Forgot to reset LBSE specific results after 315674@main, fix that.
* LayoutTests/platform/ios/svg/compositing/anonymous-RenderSVGViewportContainer-no-repaints-expected.txt:
* LayoutTests/platform/ios/svg/compositing/segment-removed-after-anchor-decomposited-layer-tree-expected.txt: Added.
* LayoutTests/platform/ios/svg/compositing/transform-change-repainting-viewBox-repaintRects-expected.txt: Added.
* LayoutTests/platform/ios/svg/transforms/nested-svg-transform-attribute-creates-layer-expected.txt: Added.
Canonical link: https://commits.webkit.org/316141@main
* [JSC] Add ArrayStorage + GetByVal specific operation
https://bugs.webkit.org/show_bug.cgi?id=318180
rdar://180990441
Reviewed by Tadeu Zagallo.
This patch adds operationGetByValArrayStorageInt, which is tailored for
ArrayStorage slow path operation. DFG / FTL can use this when we already
speculate ArrayStorage, but it is a slow path.
ToT Patched
get-by-val-array-storage-sparse-hole 122.9244+-1.1533 ^ 62.5947+-9.6089 ^ definitely 1.9638x faster
get-by-val-array-storage-sparse 117.8623+-0.4612 ^ 84.7042+-0.5769 ^ definitely 1.3915x faster
Tests: JSTests/microbenchmarks/get-by-val-array-storage-sparse-hole.js
JSTests/microbenchmarks/get-by-val-array-storage-sparse.js
* JSTests/microbenchmarks/get-by-val-array-storage-sparse-hole.js: Added.
(get array):
* JSTests/microbenchmarks/get-by-val-array-storage-sparse.js: Added.
(get array):
* Source/JavaScriptCore/dfg/DFGOperations.cpp:
(JSC::DFG::getByValArrayStorageInt):
(JSC::DFG::JSC_DEFINE_JIT_OPERATION):
* Source/JavaScriptCore/dfg/DFGOperations.h:
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compileGetByVal):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compileGetByVal):
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileGetByValImpl):
Canonical link: https://commits.webkit.org/316142@main
* Need a process-specific `WebBackForwardListItem::allItems()` instead of the process-global map for better message checking
rdar://174702519
Reviewed by Ben Nham.
When considering whether a given web process should have access to a given back/forward entry,
the global map is the wrong tool.
Check on a per-process basis instead.
Test: Tools/TestWebKitAPI/Tests/WebKit/WKBackForwardListTests.mm
* Source/WebKit/UIProcess/WebBackForwardList.cpp:
(WebKit::messageCheckItemURLs):
(WebKit::WebBackForwardList::backForwardAddItemShared):
(WebKit::WebBackForwardList::backForwardSetChildItem):
(WebKit::WebBackForwardList::backForwardUpdateItem):
* Source/WebKit/UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::checkURLReceivedFromWebProcess):
* Tools/TestWebKitAPI/Tests/WebKit/WKBackForwardListTests.mm:
(<script>):
(ForgedFileURLItemIsRejected)):
Originally-landed-as: 305413.831@safari-7624-branch (249edf86a9f5). rdar://180428225
Canonical link: https://commits.webkit.org/316143@main
* Combining marks on SVG <textPath> render as dotted circles
https://bugs.webkit.org/show_bug.cgi?id=266832
rdar://120284006
Reviewed by Elika Etemad.
SVG text on a path (and any per-character-positioned text) was laid out one
Unicode code point at a time: SVGTextLayoutEngine opened a fresh
single-code-point fragment for every code point whenever a per-character
condition fired (text on a path, an explicit rotate, vertical text, …),
and SVGTextBoxPainter then shaped each fragment's substring in isolation. A lone
combining mark shaped on its own (e.g. U+0301, or the Devanagari virama U+094D)
makes the font emit a dotted circle.
SVG 2 section 11 addresses the text-positioning attributes (x/y/dx/dy/rotate)
per Unicode code point, but it also defines a "typographic character"
a UAX #29 grapheme cluster such as a base letter plus its
combining marks, or a Devanagari syllable
as an indivisible unit whose internal glyph arrangement is "not user
controllable". So code points are addressed, but typographic characters
are positioned and shaped. WebKit placed code points.
Compute grapheme-cluster boundaries over the renderer text with an ICU
character-break iterator, keyed by the same code-unit offset the layout loop
walks, and only let a cluster-start code point open a new fragment. A
continuation code point (a combining mark, a Devanagari continuation, the
second regional indicator of a flag) now joins the current fragment, so the
painter hands base + marks to the shaper together. This is font-independent, so
it groups base + mark even when the font has no composed glyph -- precisely the
dotted-circle case. Per-code-point metrics, character-data lookups, and the
getNumberOfChars / query contract are unchanged; the fragment simply spans
multiple metrics entries, which recordTextFragment already sums.
Matches Gecko and Blink, which both treat the typographic character as the
positioning unit. For pure ASCII / precomposed Latin-1 text every code point is
a grapheme boundary, so behavior is unchanged there.
Tests: imported/w3c/web-platform-tests/svg/text/reftests/textpath-combining-marks-ref.html
imported/w3c/web-platform-tests/svg/text/reftests/textpath-combining-marks.html
* LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textpath-combining-marks-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textpath-combining-marks-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/svg/text/reftests/textpath-combining-marks.html: Added.
* Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp:
(WebCore::SVGTextLayoutEngine::layoutTextOnLineOrPath):
Canonical link: https://commits.webkit.org/316144@main
* [macOS] Scroll pocket color may be lost in fullscreen after refresh
https://bugs.webkit.org/show_bug.cgi?id=317824
rdar://179516708
Reviewed by Wenson Hsieh and Abrar Rahman Protyasha.
In Safari, if the option to automatically hide the toolbar in fullscreen
is enabled, the top obscured content inset becomes zero while the toolbar
is hidden.
In WebPage::sidesRequiringFixedContainerEdges(), we skip the top edge
if the top obscured content inset is zero. This means that, if a user
is in fullscreen with the toolbar hidden, navigates to a website with
a fixed top header, scrolls down, and then reveals the toolbar, the
scroll pocket color will not match the header.
To fix this, we add an aditional case where we add the top edge:
when the window is in fullscreen, and the toolbar overlay height
is greater than zero.
Tested by new `ObscuredContentInsets` API tests
`ScrollPocketCoversFullScreenTitlebarAfterReload`
and `ScrollPocketCoversFullScreenTitlebarAfterMovingIntoFullScreenWindow`.
* Source/WebKit/Shared/WebPageCreationParameters.h:
* Source/WebKit/Shared/WebPageCreationParameters.serialization.in:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::setWindowIsInNativeFullScreen):
(WebKit::WebPageProxy::setFullScreenTitlebarOverlayIsRevealed):
* Source/WebKit/UIProcess/mac/WebViewImpl.h:
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(-[WKWindowVisibilityObserver startObserving:]):
(-[WKWindowVisibilityObserver _windowDidEnterFullScreen:]):
(-[WKWindowVisibilityObserver _windowDidExitFullScreen:]):
(WebKit::WebViewImpl::windowDidEnterOrExitFullScreen):
(WebKit::WebViewImpl::viewDidMoveToWindow):
(WebKit::WebViewImpl::setFullScreenTitlebarOverlayHeight):
(-[WKWindowVisibilityObserver _windowDidEnterOrExitFullScreen:]): Deleted.
* Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::sidesRequiringFixedContainerEdges const):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ObscuredContentInsets.mm:
(TestWebKitAPI::TEST(ObscuredContentInsets, ScrollPocketCoversFullScreenTitlebar)):
(TestWebKitAPI::createFullScreenCapableWindow):
(TestWebKitAPI::TEST(ObscuredContentInsets, ScrollPocketCoversFullScreenTitlebarAfterReload)):
(TestWebKitAPI::TEST(ObscuredContentInsets, ScrollPocketCoversFullScreenTitlebarAfterMovingIntoFullScreenWindow)):
Canonical link: https://commits.webkit.org/316145@main
* [MSE] Loosen gap tolerance during playback and seek
https://bugs.webkit.org/show_bug.cgi?id=317681
rdar://180439090
Reviewed by Jer Noble.
MediaSourcePrivate now owns a single gap policy consulted at every
buffered-range boundary. Three tolerances replace the prior fixed
timeFudgeFactor:
- Start-of-stream allowance: 1s. Per MSE 2 §presentation-start-time:
"implementations MAY choose to allow a current playback position at
or after presentation start time and before the first TimeRanges to
play the first TimeRanges if that TimeRanges starts within a
reasonably short time, like 1 second, after presentation start time".
Applied only when time is before ranges.start(0). HTMLMediaElement.
buffered reported to JS is unchanged.
- Mid-stream gap tolerance: 125 ms. Default tolerance for gaps between
buffered sub-ranges.
- Audio-covered gap tolerance: 250 ms. Widened tolerance when an active
audio track covers the gap position (typical video-only gap with
audio continuous through it).
setTimeFudgeFactor IPC and MediaSource::currentTimeFudgeFactor removed.
* LayoutTests/media/media-source/media-source-fudge-factor-expected.txt: Removed.
* LayoutTests/media/media-source/media-source-fudge-factor.html: Removed.
* LayoutTests/media/media-source/media-source-gap-policy-expected.txt: Added.
* LayoutTests/media/media-source/media-source-gap-policy.html: Added.
* LayoutTests/media/media-source/media-source-video-renders.html:
* Source/WebCore/Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::setPrivateAndOpen):
(WebCore::MediaSource::currentTimeFudgeFactor): Deleted.
* Source/WebCore/Modules/mediasource/MediaSource.h:
* Source/WebCore/platform/graphics/MediaSourcePrivate.cpp:
(WebCore::MediaSourcePrivate::hasFutureTime const):
(WebCore::MediaSourcePrivate::hasBufferedTime const):
(WebCore::MediaSourcePrivate::hasCurrentTime const):
(WebCore::MediaSourcePrivate::isBuffered const):
(WebCore::MediaSourcePrivate::cancelPendingWaitForTarget):
(WebCore::MediaSourcePrivate::updateBufferedRanges):
(WebCore::MediaSourcePrivate::nextStallTime const):
(WebCore::MediaSourcePrivate::gapToleranceAtTime const): returns the applicable tolerance for time,
consulted by hasFutureTime, hasBufferedTime, isBuffered, nextStallTime,
canCompleteWaitForTarget, and TrackBuffer's enqueue gap check.
(WebCore::MediaSourcePrivate::isWithinStartGapAllowance const):
* Source/WebCore/platform/graphics/MediaSourcePrivate.h:
* Source/WebCore/platform/graphics/PlatformTimeRanges.cpp:
(WebCore::PlatformTimeRanges::containWithEpsilon const): overload so
that isBuffered can apply a per-position tolerance at each gap.
* Source/WebCore/platform/graphics/PlatformTimeRanges.h:
* Source/WebCore/platform/graphics/SourceBufferPrivate.cpp:
(WebCore::SourceBufferPrivate::reenqueueMediaForTime):
(WebCore::SourceBufferPrivate::addTrackBuffer):
(WebCore::SourceBufferPrivate::isAudioBufferedAt const):
(WebCore::SourceBufferPrivate::audioBufferedRanges const):
* Source/WebCore/platform/graphics/SourceBufferPrivate.h:
(WebCore::SourceBufferPrivate::timeFudgeFactor const): Deleted.
* Source/WebCore/platform/graphics/TrackBuffer.cpp:
(WebCore::TrackBuffer::create):
(WebCore::TrackBuffer::TrackBuffer):
(WebCore::TrackBuffer::isAcceptableEnqueueGap const):
(WebCore::TrackBuffer::nextSample):
(WebCore::TrackBuffer::reenqueueMediaForTime):
* Source/WebCore/platform/graphics/TrackBuffer.h:
* Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::resetStallForTime): Move nextStallTime(time)
logic to MediaSourcePrivate.
* Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
* Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::timeFudgeFactor const): Deleted.
* Source/WebCore/platform/graphics/cocoa/MediaPlayerPrivateWebM.mm:
(WebCore::MediaPlayerPrivateWebM::reenqueueMediaForTime):
(WebCore::MediaPlayerPrivateWebM::addTrackBuffer):
(WebCore::MediaPlayerPrivateWebM::monitorReadyState):
* Source/WebKit/GPUProcess/media/RemoteMediaSourceProxy.cpp:
(WebKit::RemoteMediaSourceProxy::setTimeFudgeFactor): Deleted.
* Source/WebKit/GPUProcess/media/RemoteMediaSourceProxy.h:
* Source/WebKit/GPUProcess/media/RemoteMediaSourceProxy.messages.in:
* Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::currentTimeWithLockHeld const):
* Source/WebKit/WebProcess/GPU/media/MediaSourcePrivateRemote.cpp:
(WebKit::MediaSourcePrivateRemote::setTimeFudgeFactor): Deleted.
* Source/WebKit/WebProcess/GPU/media/MediaSourcePrivateRemote.h:
Canonical link: https://commits.webkit.org/316146@main
* [cleanup] Use RenderBox::borderBoxSize() in size-only callers of frameRect()
https://bugs.webkit.org/show_bug.cgi?id=318045
Reviewed by Antti Koivisto.
Follow-up to 318020, which swept the size-only callers of borderBoxRect() but
not the frameRect().size() spelling of the same thing. These RenderTableCell
paint helpers only want the border box size, and frameRect().size() is exactly
borderBoxSize() (both are m_frameRect.size()), so use the direct accessor. No
behavior change.
* Source/WebCore/rendering/RenderTableCell.cpp:
(RenderTableCell::paintCollapsedBorders):
(RenderTableCell::paintBoxDecorations):
(RenderTableCell::paintMask):
Canonical link: https://commits.webkit.org/316147@main
* Add findIfCached / insert to TinyLRUCache
https://bugs.webkit.org/show_bug.cgi?id=314417
Reviewed by Keith Miller.
This is useful for cases when you need to cache something that can't
created statically.
We also add a generated test to gently exercise this new code.
We also add a new safe iterator mechanism to ensure that this new API
can't be used unsafely.
* Source/WTF/wtf/TinyLRUCache.h:
(WTF::TinyLRUCache::~TinyLRUCache):
(WTF::TinyLRUCache::TinyLRUCache):
(WTF::TinyLRUCache::operator=):
(WTF::TinyLRUCache::FindResult::~FindResult):
(WTF::TinyLRUCache::FindResult::operator bool const):
(WTF::TinyLRUCache::FindResult::operator* const):
(WTF::TinyLRUCache::FindResult::operator-> const):
(WTF::TinyLRUCache::FindResult::FindResult):
(WTF::TinyLRUCache::FindResult::assertValid const):
(WTF::TinyLRUCache::get):
(WTF::TinyLRUCache::findIfCached):
(WTF::TinyLRUCache::insert):
(WTF::TinyLRUCache::clear):
(WTF::TinyLRUCache::size const):
(WTF::TinyLRUCache::trackFindResult):
(WTF::TinyLRUCache::invalidateIterators):
(WTF::TinyLRUCache::findInternal):
(WTF::TinyLRUCache::insertInternal):
* Tools/TestWebKitAPI/CMakeLists.txt:
* Tools/TestWebKitAPI/Tests/WTF/TinyLRUCache.cpp: Added.
(TestWebKitAPI::CountingPolicy::createValueForKey):
(TestWebKitAPI::TEST(WTF_TinyLRUCache, GetCachesOnHit)):
(TestWebKitAPI::TEST(WTF_TinyLRUCache, GetEvictsLRU)):
(TestWebKitAPI::NullKeyPolicy::isKeyNull):
(TestWebKitAPI::NullKeyPolicy::createValueForNullKey):
(TestWebKitAPI::NullKeyPolicy::createValueForKey):
(TestWebKitAPI::TEST(WTF_TinyLRUCache, GetWithNullKeyReturnsNullValueAndDoesNotStore)):
(TestWebKitAPI::TEST(WTF_TinyLRUCache, FindIfCachedReturnsNullOnMiss)):
(TestWebKitAPI::TEST(WTF_TinyLRUCache, FindIfCachedHitsAfterInsert)):
(TestWebKitAPI::TEST(WTF_TinyLRUCache, InsertEvictsLRU)):
(TestWebKitAPI::TEST(WTF_TinyLRUCache, FindIfCachedPromotesToMRU)):
(TestWebKitAPI::TEST(WTF_TinyLRUCache, ClearReleasesEntriesAndResetsSize)):
(TestWebKitAPI::TrackedRefCounted::create):
(TestWebKitAPI::TrackedRefCounted::value const):
(TestWebKitAPI::TrackedRefCounted::~TrackedRefCounted):
(TestWebKitAPI::TrackedRefCounted::TrackedRefCounted):
(TestWebKitAPI::TEST(WTF_TinyLRUCache, ClearReleasesRefsImmediately)):
(TestWebKitAPI::TEST(WTF_TinyLRUCache, EvictionViaInsertReleasesRef)):
(TestWebKitAPI::TEST(WTF_TinyLRUCache, FindIfCachedDoesNotConsumeEntry)):
(TestWebKitAPI::TEST(WTF_TinyLRUCache, FindIfCachedAfterClearMisses)):
(TestWebKitAPI::TEST(WTF_TinyLRUCache, FindOrComputeWorkflow)):
(TestWebKitAPI::TEST(WTF_TinyLRUCache, FindResultSafeAfterCacheDestroyed)):
(TestWebKitAPI::TEST(WTF_TinyLRUCache, InsertInvalidatesFindResult)):
(TestWebKitAPI::TEST(WTF_TinyLRUCache, ClearInvalidatesFindResult)):
(TestWebKitAPI::TEST(WTF_TinyLRUCache, SubsequentFindInvalidatesPriorFindResult)):
(TestWebKitAPI::TEST(WTF_TinyLRUCacheDeathTest, UseAfterInsertDeathTest)):
(TestWebKitAPI::TEST(WTF_TinyLRUCacheDeathTest, UseAfterClearDeathTest)):
(TestWebKitAPI::TEST(WTF_TinyLRUCacheDeathTest, UseAfterSubsequentFindDeathTest)):
Canonical link: https://commits.webkit.org/316148@main
* Validate several ITP and storage access IPC messages
https://bugs.webkit.org/show_bug.cgi?id=312798
rdar://174708437
Reviewed by Matthew Finkel.
ResourceLoadStatisticsUpdated, LogUserInteraction, and RequestStorageAccessUnderOpener accept
WebContent-supplied data with no validation. A WCP can forge storageAccessUnderTopFrameDomains and
isPrevalentResource in the ITP database, then obtain cross-origin cookie access without a user
prompt.
Verify that ResourceLoadStatisticsUpdated only contains fields the WebContent process legitimately
observes, and that LogUserInteraction and RequestStorageAccessUnderOpener are called with domains
the process owns.
Test: ipc/forged-resource-load-statistics-storage-access.html
* LayoutTests/ipc/forged-resource-load-statistics-storage-access-expected.txt: Added.
* LayoutTests/ipc/forged-resource-load-statistics-storage-access.html: Added.
* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::logUserInteraction):
(WebKit::resourceLoadStatisticsContainsOnlyObservableFields):
(WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated):
(WebKit::NetworkConnectionToWebProcess::requestStorageAccessUnderOpener):
Originally-landed-as: 305413.716@safari-7624-branch (9d8f969c538a). rdar://180428563
Canonical link: https://commits.webkit.org/316149@main
* [WebCore][bindings] Empty JSValue returned to script from callPromisePairFunction when argument conversion throws
https://bugs.webkit.org/show_bug.cgi?id=313618
rdar://175673155
Reviewed by Ryosuke Niwa.
callPromisePairFunction stored the functor's EncodedJSValue and returned it
after passing the catch scope through rejectPromiseWithExceptionIfAny. When the
generated operation body threw during IDL argument conversion, it returned
encodedJSValue() (the empty JSValue sentinel) with a pending exception. The
first rejectPromiseWithExceptionIfAny call cleared that exception to reject the
first promise, so the second call was a no-op — leaving the second promise
unrejected — and RETURN_IF_EXCEPTION did not fire. The empty sentinel was then
returned to JavaScript as a script-visible value.
Fix by:
- Introducing rejectPromisesWithExceptionIfAny, which saves the error value
before clearing the exception and rejects both promises. Shared
takeNonTerminationException helper factors out the check-save-clear logic
from rejectPromiseWithExceptionIfAny.
- Adding a DictionaryType template parameter to callPromisePairFunction. When
the functor returns an empty JSValue (the error-path sentinel),
callPromisePairFunction reconstructs a valid result dictionary from the
rejected promises via convertDictionaryToJS.
- Threading the concrete dictionary type (e.g. Navigation::Result) from the
code generator through callReturningPromisePair to callPromisePairFunction.
Test: navigation-api/navigation-navigate-throwing-argument-conversion.html
* LayoutTests/navigation-api/navigation-navigate-throwing-argument-conversion-expected.txt: Added.
* LayoutTests/navigation-api/navigation-navigate-throwing-argument-conversion.html: Added.
* Source/WebCore/bindings/js/JSDOMOperationReturningPromise.h:
(WebCore::IDLOperationReturningPromise::callReturningPromisePair):
* Source/WebCore/bindings/js/JSDOMPromiseDeferred.cpp:
(WebCore::takeNonTerminationException):
(WebCore::rejectPromiseWithExceptionIfAny):
(WebCore::rejectPromisesWithExceptionIfAny):
* Source/WebCore/bindings/js/JSDOMPromiseDeferred.h:
(WebCore::callPromisePairFunction):
* Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:
(GenerateOperationTrampolineDefinition):
* Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSC_DEFINE_HOST_FUNCTION):
Originally-landed-as: 305413.776@safari-7624-branch (332eff8c4870). rdar://180436895
Canonical link: https://commits.webkit.org/316150@main
* Use-after-free in SVGGeometryElement::getPointAtLength — raw renderer pointer held across nested updateLayout
https://bugs.webkit.org/show_bug.cgi?id=314326
rdar://175670940
Reviewed by Simon Fraser.
Between the call to `updateLayoutIgnorePendingStylesheets()` and the call to
`SVGGeometryElement::getTotalLength()`, `SVGGeometryElement::getPointAtLength()`
caches its renderer() in a raw pointer. The problem is `getTotalLength()` also
calls `updateLayoutIgnorePendingStylesheets()` which may delete the renderer.
This will make `getPointAtLength()` use-after-free the cached raw pointer renderer.
Rearrange the code such that `updateLayoutIgnorePendingStylesheets()` is called
only once per `getPointAtLength()` and read `this->renderer()` exactly before it
is referenced.
* Source/WebCore/svg/SVGGeometryElement.cpp:
(WebCore::SVGGeometryElement::calculateTotalLength const):
(WebCore::SVGGeometryElement::getTotalLength const):
(WebCore::SVGGeometryElement::calculatePointAtLength const):
(WebCore::SVGGeometryElement::getPointAtLength const):
* Source/WebCore/svg/SVGGeometryElement.h:
Originally-landed-as: 305413.857@safari-7624-branch (d1e59347508c). rdar://180437982
Canonical link: https://commits.webkit.org/316151@main
* [JSC] Disallow defining private names on WasmGC objects
https://bugs.webkit.org/show_bug.cgi?id=314438
rdar://176445615
Reviewed by Yusuke Suzuki.
While the spec currently technically allows for defining private fields and
methods on WasmGC objects, this is against the spirit of those objects being
fixed-layout.
For compat, both V8 and SpiderMonkey also disallow addition of private names on
WasmGC objects.
Test: JSTests/wasm/gc/private-fields-and-methods.js
* JSTests/wasm/gc/private-fields-and-methods.js: Added.
(testPrivateMethodOnStruct.B):
(testPrivateMethodOnStruct.D.prototype.m):
(testPrivateMethodOnStruct.D):
(testPrivateMethodOnStruct):
(testPrivateFieldOnStruct.B):
(testPrivateFieldOnStruct.D):
(testPrivateFieldOnStruct):
(testPrivateMethodOnArray.B):
(testPrivateMethodOnArray.D.prototype.m):
(testPrivateMethodOnArray.D):
(testPrivateMethodOnArray):
(testPrivateFieldOnArray.B):
(testPrivateFieldOnArray.D):
(testPrivateFieldOnArray):
(testPrivateGetterOnStruct.B):
(testPrivateGetterOnStruct.D.prototype.get x):
(testPrivateGetterOnStruct.D):
(testPrivateGetterOnStruct):
(testGCSurvival.B):
(testGCSurvival.D.prototype.m):
(testGCSurvival.D):
(testGCSurvival):
* Source/JavaScriptCore/runtime/JSObjectInlines.h:
(JSC::JSObject::getPrivateField):
(JSC::JSObject::setPrivateField):
(JSC::JSObject::definePrivateField):
(JSC::JSObject::setPrivateBrand):
Originally-landed-as: 305413.881@safari-7624-branch (525600a227a6). rdar://180438063
Canonical link: https://commits.webkit.org/316152@main
* Uninitialized result of FEGaussianBlur if the input isAlphaImage
https://bugs.webkit.org/show_bug.cgi?id=314345
rdar://175674593
Reviewed by Simon Fraser.
`FEGaussianBlurSoftwareApplier::apply()` creates uninitialized `tempBuffer`
through `createScratchPixelBuffer()`.
-- If the stdDeviation of feGaussianBlur is asymmetric, e.g. "5 0", then applying
this filter falls back to `boxBlurUnaccelerated()`.
-- If the input of feGaussianBlur isAlphaImage, e.g. feColorMatrix(luminanceToAlpha),
then `boxBlur()` short-circuits to `boxBlurAlphaOnly()`, which writes only
the alpha channel of each pixel.
-- If one of the stdDeviation is zero, e.g. "5 0", `boxBlurUnaccelerated()` will
copy the `tempBuffer` to the `destinationPixelBuffer` with three uninitialized
channels before it returns.
If isAlphaImage is true Make sure `tempBuffer` is zero-filled.
* Source/WebCore/platform/graphics/filters/software/FEGaussianBlurSoftwareApplier.cpp:
(WebCore::FEGaussianBlurSoftwareApplier::boxBlurGeneric):
Originally-landed-as: 305413.858@safari-7624-branch (96b0a368415e). rdar://180437556
Canonical link: https://commits.webkit.org/316153@main
* Sort TestWebKitAPI pbxproj file after 316044@main
https://bugs.webkit.org/show_bug.cgi?id=318227
rdar://181029069
Reviewed by Lily Spiniolas.
In this patch, we let Xcode sort the entries in this project file after
the addition of AttributedStringFontCache.mm in 316044@main.
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
Canonical link: https://commits.webkit.org/316154@main
* WebGL: GraphicsContextGLANGLE PACK_* state is modifiable through pixelStorei
https://bugs.webkit.org/show_bug.cgi?id=312566
rdar://174740214
Reviewed by Dan Glastonbury.
Filter out pixelStorei parameters.
* Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLANGLE::pixelStorei):
Originally-landed-as: 305413.710@safari-7624-branch (dd484347691b). rdar://180435316
Canonical link: https://commits.webkit.org/316155@main
* Marked-text highlight pseudo-element fill color is taken from the stroke color
https://bugs.webkit.org/show_bug.cgi?id=318073
rdar://180871490
Reviewed by Antti Koivisto.
This patch aligns WebKit with Gecko / Firefox and Blink / Chromium.
computeStyleForPseudoElementStyle() set the text fill color from
usedStrokeColor() — a copy/paste from the strokeColor line below it. As a
result, marked text styled via a highlight pseudo-element (::highlight(),
::target-text, ::spelling-error, ::grammar-error) rendered its glyph fill
using the stroke color rather than the text/fill color, and ignored any
applied color filter.
Set fillColor from visitedDependentTextFillColorApplyingColorFilter(),
matching how the fill color is resolved in TextPaintStyle.cpp.
Tests: fast/css/highlight-pseudo-fill-applies-color-filter.html
imported/w3c/web-platform-tests/css/css-pseudo/highlight-fill-color-ignores-stroke-color-ref.html
imported/w3c/web-platform-tests/css/css-pseudo/highlight-fill-color-ignores-stroke-color.html
* LayoutTests/fast/css/highlight-pseudo-fill-applies-color-filter-expected.html: Added.
* LayoutTests/fast/css/highlight-pseudo-fill-applies-color-filter.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/highlight-fill-color-ignores-stroke-color-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/highlight-fill-color-ignores-stroke-color-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/highlight-fill-color-ignores-stroke-color.html: Added.
* Source/WebCore/rendering/StyledMarkedText.cpp:
(WebCore::computeStyleForPseudoElementStyle):
Canonical link: https://commits.webkit.org/316156@main
* Add size limit to Yarr generated code
https://bugs.webkit.org/show_bug.cgi?id=314589
rdar://176137052
Reviewed by Yusuke Suzuki.
Patterns with many sequential non-greedy quantified parenthesized groups
(e.g. (?:a){0,2}? repeated thousands of times) cause O(N^2) code emission
in saveParenContext/restoreParenContext, as each group saves/restores all
frame slots for the entire pattern. This patch adds a code size limit in
VM options above which the code bails out to the interpreter.
Test: JSTests/stress/regexp-many-non-greedy-paren-groups.js
* JSTests/stress/regexp-many-non-greedy-paren-groups.js: Added.
(testLargeNonGreedyParens):
* Source/JavaScriptCore/runtime/OptionsList.h:
* Source/JavaScriptCore/yarr/YarrJIT.cpp:
(JSC::Yarr::dumpCompileFailure):
* Source/JavaScriptCore/yarr/YarrJIT.h:
Originally-landed-as: 305413.923@safari-7624-branch (e6d449d59b50). rdar://180427748
Canonical link: https://commits.webkit.org/316157@main
* DOM XSS in committers-autocomplete.js
https://bugs.webkit.org/show_bug.cgi?id=318161
rdar://180319278
Reviewed by Alexey Proskuryakov.
Construct the autocomplete suggestion menu with createElement and
behavior.
* Websites/bugs.webkit.org/committers-autocomplete.js:
(updateMenu.appendSpan):
(updateMenu):
Canonical link: https://commits.webkit.org/316158@main
* GetPixelBuffer should zeroFill the destination if any error happens
https://bugs.webkit.org/show_bug.cgi?id=312945
rdar://174640273
Reviewed by Kimmo Kinnunen.
RemoteImageBuffer fails to GetPixelBuffer if the destination colorSpace is non-RGB
model (e.g. kCGColorSpaceGenericCMYK). In this case the PixelBuffer is allocated
but never be initialized. So stale heap can be exposed to callers.
To fix this an IPC validator is needed to ensure the colorSpace is indeed RGB model.
And to handle other possible unknown failures, the destination PixelBuffer will
be zero-filled if vImage fails to do the conversion the colorSpace conversion.
* Source/WebCore/platform/graphics/DestinationColorSpace.cpp:
(WebCore::DestinationColorSpace::usesRGBColorModel const):
* Source/WebCore/platform/graphics/DestinationColorSpace.h:
* Source/WebCore/platform/graphics/PixelBufferConversion.cpp:
(WebCore::convertImagePixelsAccelerated):
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Tools/TestWebKitAPI/Tests/WebCore/ImageBufferTests.cpp:
(TestWebKitAPI::TEST(ImageBufferTests, GetPixelBufferAllZeros)):
Originally-landed-as: 305413.874@safari-7624-branch (8e2784fd0807). rdar://180429216
* Source/WebKit/Shared/WebCoreArgumentCodersPlatform.serialization.in:
Canonical link: https://commits.webkit.org/316159@main
* Lowercase CSP directive names eagerly
https://bugs.webkit.org/show_bug.cgi?id=317730
rdar://180530658
Reviewed by Anne van Kesteren.
Lowercase each CSP directive name as soon as it is read, aligning with the 'Parse a serialized CSP'
section of the CSP Level 3 spec (https://w3c.github.io/webappsec-csp/#parse-serialized-policy).
The case insensitive name comparisons become plain equality checks, and the extra lowercasing in the
reporting path is removed. When an author writes a directive name in some casing other than the spec's
lowercase form, it now behaves like the lowercase form.
Test: http/tests/security/contentSecurityPolicy/directive-name-case-insensitive.html
http/tests/security/contentSecurityPolicy/directive-name-case-insensitive-strict-dynamic.html
* LayoutTests/http/tests/security/contentSecurityPolicy/directive-name-case-insensitive-expected.txt: Added.
* LayoutTests/http/tests/security/contentSecurityPolicy/directive-name-case-insensitive-strict-dynamic-expected.txt: Added.
* LayoutTests/http/tests/security/contentSecurityPolicy/directive-name-case-insensitive-strict-dynamic.html: Added.
* LayoutTests/http/tests/security/contentSecurityPolicy/directive-name-case-insensitive.html: Added.
* Source/WebCore/page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::reportViolation const):
* Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp:
(WebCore::ContentSecurityPolicyDirectiveList::parse):
(WebCore::ContentSecurityPolicyDirectiveList::parseDirective):
(WebCore::ContentSecurityPolicyDirectiveList::addDirective):
* Source/WebCore/page/csp/ContentSecurityPolicySourceList.cpp:
(WebCore::ContentSecurityPolicySourceList::isProtocolAllowedByStar const):
Canonical link: https://commits.webkit.org/316160@main
* [Site Isolation] Per-frame back/forward walk regresses iframe to stale initial about:blank
https://bugs.webkit.org/show_bug.cgi?id=317458
rdar://180077264
Reviewed by Sihui Liu.
Under UseUIProcessForBackForwardItemLoading, WebPageProxy::dispatchPerFrameTraversals
walks the (current, target) BF frame trees and dispatches a per-frame
GoToBackForwardItem whenever itemSequenceNumber differs. When the target entry
holds the stale "initial about:blank" state for an iframe whose live document has
since loaded a real URL, the walk dispatches a navigation back to about:blank and
regresses the live iframe.
The HTML spec (https://html.spec.whatwg.org/#initialise-the-document-object)
re…
Every workflow run now fails before it starts:
The action actions/github-script@v7 is not allowed in oven-sh/WebKit
because all actions must be pinned to a full-length commit SHA.
Pin each action to the commit its current tag points at, so nothing changes
except the form of the reference. The version is kept in a trailing comment.
The data filter removed the whole rbnf/ tree on the grounds that bun never
calls the RuleBasedNumberFormat API. It doesn't, but ICU reaches rbnf/ on its
own: numberingSystems.res declares 19 algorithmic numbering systems whose rules
live in rbnf/, and SimpleDateFormat applies them through the number overrides
CLDR attaches to calendar patterns.
Two of those overrides sit on the default path for CJK dates:
- smpdtfmt.cpp hardcodes "y=jpanyear" whenever the locale is ja, the
calendar is japanese, and the pattern contains the han year character.
Without rbnf/ja.res the NumberFormat lookup returns
U_MISSING_RESOURCE_ERROR, udat_open() fails, and
Intl.DateTimeFormat("ja", { calendar: "japanese", year: "numeric" })
throws "failed to initialize DateTimeFormat".
- zh + the chinese calendar carries "d=hanidays" in its full/long date
patterns. The SimpleDateFormat constructor fails the same way, and
DateFormat::create() falls back to gDefaultPattern ("yMMdd hh:mm a"), so
{ dateStyle: "full" } silently returns a mashed-together date with a
time in it.
Only four locales are named by those rulesets, so keep rbnf/root.res (the bare
"%ruleset" descs resolve there), rbnf/ja.res, rbnf/zh.res, rbnf/zh_Hant.res and
the tree's res_index. That is 35 KB raw, 7.7 KB after per-item zstd, against
621 KB / 108 KB for the whole tree. It matters on android and freebsd, which do
not run compress-data.ts and would otherwise pay the full 621 KB.
Dockerfile grows a guard that re-derives the reachable locale set from
numberingSystems.res and fails the build if a CLDR bump ever names one the
keep-list is missing, so the list cannot rot into the bug it is fixing.
Verified against a stock icu4c-75_1 build whose libicudata was rebuilt from the
allowlisted package, so there is no fallthrough to a second data package: gannen
still renders 平成元年, zh chinese full dates keep their cyclic year, and
jpanyear/hanidays/hant/hebr/roman all open. Output is identical to keeping the
whole tree.
macOS is unaffected (USE_APPLE_ICU, system libicucore).
…an async context is active (#278) * DFG/FTL: bail out of the PerformPromiseThenOneHandler fast path when an async context is active The PerformPromiseThenOneHandler fast path stores the handler directly on the promise as an inline reaction. Inline reactions cannot carry Bun's async context (performPromiseThen already falls back to a full reaction in that case), so once the calling code tiered up to the DFG, AsyncLocalStorage.getStore() returned undefined inside .then() continuations. Check globalObject->m_asyncContextData and take the slow path, which captures the context, when one is active. Fixes oven-sh/bun#33806. * DFG: allocate asyncContext GPRTemporary before any slow-path branch Allocating a GPRTemporary can emit a spill store; doing so after the first slowCases branch means that store only runs on the fall-through path and can desync the register state assumed by addSlowPathGenerator. Hoist the allocation next to the packed temporary and drop the now unnecessary block scope.
…283) * Add Linux mimalloc build matrix entries (amd64/arm64, release + LTO) Adds a USE_EXTERNAL_MIMALLOC CMake option (requires USE_MIMALLOC=ON) that compiles bmalloc/WTF/JSC against the mimalloc v3 headers but leaves every mi_* symbol unresolved in libbmalloc.a/libWTF.a/libJavaScriptCore.a. Bun links its own vendored mimalloc (oven-sh/mimalloc) to satisfy them, so a second copy is not archived into the WebKit tarball. The vendored mimalloc object library is still built and linked into the jsc shell directly so bin/jsc stays runnable. Wires the option through Dockerfile and release.sh as build args, and adds four Linux glibc matrix entries (amd64/arm64 x release/LTO) plus the matching download/rename/release steps. Also drops an unused #include <mimalloc/types.h> from StructureAlignedMemoryAllocator.cpp; the include path for it was never wired into JavaScriptCore and nothing from that header is referenced. * Dockerfile: unset C_INCLUDE_PATH for the WebKit build step C_INCLUDE_PATH points at gcc-13's compiler-builtin header directory. clang searches it ahead of its own resource dir, so any C translation unit that includes <immintrin.h> resolves to gcc's incompatible copy and fails to compile. mimalloc's static.c hits this under -march=haswell via bits.h. clang ships its own freestanding and intrinsic headers, so the gcc directory is not needed here. * StructureAlignedMemoryAllocator: fix mimalloc structure-heap arena under fork() and Malloc=1 Two bugs in the USE(MIMALLOC) path: 1. OSAllocator::tryReserveUncommittedAligned applies MADV_DONTFORK to the structure-heap reservation on Linux. mi_manage_os_memory_ex stores mi_arena_t and per-thread theap structs inside that region and registers them in mimalloc's process-wide subproc->arenas[] and subproc->heaps lists, which _mi_process_fork_child walks in the child before exec. After fork() those pages are unmapped in the child, so the walk segfaults. Undo DONTFORK on the region after registering it with mimalloc. 2. The mimalloc branch ran unconditionally without the m_useSystemHeap guard the libpas branch has. With Malloc=1 (m_useSystemHeap=true), tryMallocStructureBlock uses the bitvector fallback while the constructor still created a mimalloc arena whose mi_arena_t sits at the 64KiB-aligned start of the passed range; the bitvector was also never seeded with set(0), so it handed out block 0 (empty-StructureID conflict) and block 4 (overwriting mi_arena_t). Guard on m_useSystemHeap and seed the bitvector in the else branch, matching libpas. Also drive mimalloc's purge from Heap::didFinishCollection after a full GC via releaseFastMallocFreeMemoryForThisThread, since mimalloc has no background scavenger and otherwise only purges from allocation slow paths. * Enable USE_MIMALLOC/USE_EXTERNAL_MIMALLOC on all non-asan release targets Replaces the four separate -mimalloc Linux matrix entries with USE_MIMALLOC=ON + USE_EXTERNAL_MIMALLOC=ON on every non-asan, non-debug release target across linux (glibc, musl, android), macos, windows and freebsd. The -mimalloc archive name suffix is dropped; the regular release archives now ship with mi_* symbols unresolved for the consumer to link its own mimalloc. * Revert Heap::didFinishCollection mi_collect hook The consumer's mimalloc now runs a demand-driven scavenger thread (woken from mi_arena_schedule_purge) that handles arena purge off the GC thread. The synchronous force-collect here costs ~13% on allocation- heavy workloads without further RSS benefit once the scavenger is present. * bmalloc: add force param to scavengeThisThread; call it force=false after full GC With the consumer's mimalloc scavenger thread handling arena madvise in the background, a force=true collect on the GC thread after every full GC is just synchronous cost (~13% on allocation-heavy workloads). force=false processes retired theap pages and schedules arena purges (waking the scavenger) without draining them inline. * StructureAlignedMemoryAllocator: re-inherit the structure heap on macOS too tryReserveUncommittedAligned maps this region with mach_vm_map(..., VM_INHERIT_NONE) on Darwin, so the same fork-child walk into mimalloc's in-region mi_arena_t/theap structs applies there. Restore VM_INHERIT_COPY after registering the region with mimalloc, mirroring the Linux MADV_DOFORK branch. Also reword the USE_EXTERNAL_MIMALLOC help string from "Implies" to "Requires" to match WEBKIT_OPTION_DEPEND's actual semantics.
CMake 4.4.0 fails to configure any static build with:
CMake Error at Source/cmake/WebKitMacros.cmake:551 (if):
if given arguments:
"(" "NOT" "_linked_into" ")" "OR" "(" "JavaScriptCore" "STREQUAL" ")"
"OR" "(" "NOT" "IN_LIST" "jsc_FRAMEWORKS" ")"
Unknown arguments specified
<framework>_LINKED_INTO is only ever set for SHARED libraries, so in a
static build get_property leaves _linked_into unset and the unquoted
${_linked_into} expands to nothing. That leaves STREQUAL without a
right-hand operand and IN_LIST without a value. This is an argument-count
error raised while parsing the if(), so the leading (NOT _linked_into)
cannot short-circuit past it. Older CMake tolerated the malformed
arguments; 4.4.0 does not.
Quote both operands so the empty expansion stays a single empty argument.
The comparisons are unaffected: no framework name is also a bare variable,
and _LINKED_INTO only ever holds a single target name, so the quoted and
unquoted forms compare the same values.
Verified by configuring JSCOnly with ENABLE_STATIC_JSC=ON under both
CMake 4.3.1 and 4.4.0 for USE_MIMALLOC/USE_EXTERNAL_MIMALLOC ON/ON, ON/OFF
and OFF/OFF; the generated link libraries are byte-identical to a 4.3.1
configure of the unpatched macro in all three.
…ion promise (#295) InternalMicrotask::AsyncFunctionResume restored Bun's async context before calling promise->resolve()/reject() when the async function body completed. JSPromise::resolvePromise captures the current async context when it queues PromiseResolveThenableJob (and performs Get(resolution, "then") synchronously), so a thenable returned from an async function that had suspended at least once ran its then() with an empty AsyncLocalStorage context. Settle the promise before restoring the outer context, matching the ordering PromiseReactionJob and the await-suspension path already use. Fixes oven-sh/bun#34266
…er build (#298) * Dockerfile.windows: enable assertions for the sanitizer build Matches the Linux/macOS Dockerfiles, which set ENABLE_ASSERTS=ON whenever ENABLE_SANITIZERS is non-empty. Without this, bun-webkit-windows-amd64-asan ships with ASSERT_ENABLED=0, so ASSERT_ENABLED-gated symbols that the JSC headers reference from inline code (ObjectInitializationScope, DoesGCCheck::verifyCanGC, StrongRefTracker, Structure::checkConsistency, MarkedBlock::assertMarksNotStale, ...) are absent from the .lib. Consumers that compile with ASSERT_ENABLED=1 then fail to link, and consumers that compile with ASSERT_ENABLED=0 get a different WTF struct layout than the Linux/macOS asan artifacts (ASSERT_ENABLED gates fields like RefCountedBase::m_deletionHasBegun). * Dockerfile.windows: disable /GF string pooling for the sanitizer build clang-cl /O2 implies /GF, which emits each string literal as a SELECT_ANY COMDAT sized to the original string. The ASAN descriptor for that literal records size_with_redzone, so at runtime __asan_register_globals poisons past the end of the COMDAT section into whatever the linker placed next. In the bun link (larger .rdata than jsc.exe) that manifests as a global-buffer-overflow on first VM init when ICU reads its own empty string literal (merged with an instrumented WTF/JSC literal by the linker). With /GF-, string literals are private unnamed constants and the ASAN padding is part of the section.
… builder exceptions (#282) * Defer termination across static-hashtable PropertyCallback builders LazyPropertyCallback runs inside reifyStaticProperty -> setUpStaticFunctionSlot -> getOwnPropertySlot, none of which check for exceptions after the builder. When worker.terminate() arms the termination trap while a builder enters JS, the trap fires inside the builder and the TerminationException stays pending after it returns; getOwnPropertySlot then returns true with an exception pending and trips EXCEPTION_ASSERT(!scope.exception() || !hasSlot) in JSValue::get / JSObject::getOwnPropertyDescriptor. LazyProperty::callFunc already wraps its initializer in DeferTerminationForAWhile for the same reason. Do the same for the PropertyCallback arm of reifyStaticProperty, covering both callers (setUpStaticFunctionSlot from getOwnPropertySlot and reifyAllStaticProperties from deleteProperty). * Move the defer to the call sites and propagate exceptions Per review: keep the include out of Lookup.h. DeferTerminationForAWhile now wraps the reifyStaticProperty call in setUpStaticFunctionSlot (Lookup.cpp) and the reify loop in JSObject::reifyAllStaticProperties. Also propagate a non-termination exception from a PropertyCallback builder: reifyStaticProperty skips the putDirect when the callback returns empty, setUpStaticFunctionSlot returns false (slot not found) when an exception is pending so JSValue::get / getOwnPropertyDescriptor's EXCEPTION_ASSERT(!scope.exception() || !result) holds, and reifyAllStaticProperties leaves the remaining properties lazy. * Use a ThrowScope instead of exceptionForInspection at the reify call sites exceptionForInspection() is for assertions/diagnostics only (every other use in JSC is inside ASSERT or #if ASSERT_ENABLED). It bypasses exception scope verification because it doesn't clear m_needExceptionCheck. Declare a ThrowScope and use RETURN_IF_EXCEPTION, matching the pattern at JSGlobalObject.cpp tryInstallSpeciesWatchpoint / JSBoundFunction.cpp nameSlow. In setUpStaticFunctionSlot the defer scope ends before the check so a suspended termination that is re-thrown on defer exit is observed and we return false, satisfying the caller's EXCEPTION_ASSERT(!scope.exception() || !hasSlot).
…wapScope (#301) * Add AsyncContextSwapScope RAII helper for Bun async context save/restore Introduces a small stack-only RAII helper that encapsulates the "read tuple, save current, swap in, run, restore" pattern currently open-coded at every InternalMicrotask case that runs user code under a captured AsyncLocalStorage context. The helper is header-only and ALWAYS_INLINE so codegen is unchanged; the fast path (asyncContext undefined) remains a single branch. Static helpers cover the adjacent snapshot-side patterns (reading the current context and wrapping/unwrapping it in an InternalFieldTuple alongside a user context). No callers yet; the mechanical replacements follow in separate commits. * Use AsyncContextSwapScope helpers on the capture side (JSPromise / JSPromisePrototype) Mechanical replacement of the snapshot-side blocks with the static helpers introduced in the previous commit: - performPromiseThen / resolveWithInternalMicrotaskForAsyncAwait / JSPromisePrototype finally(): wrapWithCurrent(vm, globalObject, userContext) - resolvePromise thenable-job queuing: current(globalObject) performPromiseThenWithContext keeps its original "wrap whenever userContext is defined" rule (using current() for the asyncContext read) rather than wrapWithCurrent: callers may pass their own InternalFieldTuple as userContext (ReadableStream async iterator does), and PromiseReactionJob would otherwise mistake it for a [_, asyncContext] wrapper. No semantic change. * Use AsyncContextSwapScope for every restore-side block in JSMicrotask.cpp Mechanical replacement of the per-InternalMicrotask-case open-coded "read tuple, save current, swap in, run, restore" blocks with AsyncContextSwapScope (plus unwrapContextTuple where the async context arrives as field 1 of an InternalFieldTuple). AsyncFunctionResume's error / completed-generator branches keep their existing "restore before promise->reject / promise->resolve" ordering via restoreEarly(), as does BunPerformMicrotaskJob's "restore before error reporting" step. Everywhere else the scope naturally restores at return. PromiseReactionJob previously had no restore on the two RETURN_IF_EXCEPTION paths after promiseOrCapability.get(reject / resolve) throws; the RAII scope now restores on those paths as well. All other call sites are byte-for-byte equivalent when the scope is a no-op (asyncContext empty or undefined), which is the common path. --------- Co-authored-by: Jarred Sumner <[email protected]>
…tonicTime on Windows (#304) * WTF: use GetSystemTimePreciseAsFileTime for WallTime::now() on Windows The upstream Windows implementation reads GetSystemTimeAsFileTime (15.6ms tick) and corrects it with QueryPerformanceCounter, periodically re-syncing against the low-resolution clock. That interpolation can disagree with the kernel's precise system clock by about a millisecond, and it keeps mutable static state (qpcLast, syncedTime, lastUTCTime, ...) without synchronization even though WallTime::now() is reached from multiple threads (ThreadingWin condition-variable timeouts, workers calling Date.now()). Bun's native wall clock already uses GetSystemTimePreciseAsFileTime (Rust's std::time::SystemTime on Windows, and Zig's std.time.milliTimestamp before the Rust port via RtlGetSystemTimePrecise). Using the same API here makes Date.now() / new Date() / Intl read the same clock as Bun.randomUUIDv7(), File.lastModified, and the rest of the runtime, and drops the racy static state along with the timeBeginPeriod(1) resolution toggle. GetSystemTimePreciseAsFileTime is available on Windows 8 / Server 2012 and later, which is already below Bun's minimum supported Windows version. Gated behind USE(BUN_JSC_ADDITIONS); the upstream path is kept verbatim under the #else so upstream merges stay mechanical. * Note that GetSystemTimePreciseAsFileTime needs a fallback on pre-Win8 * WTF: give MonotonicTime/ContinuousTime/ContinuousApproximateTime::now() a QPC-based Windows branch On Windows these three functions fall through to the #else arms, which call currentTime() (wall clock) and clamp with an unsynchronized static double lastTime. That is the same bug class as the one removed from currentTime() in the previous commit, and the callers (ParkingLot, SamplingProfiler, GC scheduler, DFG compiler thread) are the multi-threaded ones. Under USE(BUN_JSC_ADDITIONS) on Windows, read QueryPerformanceCounter directly for all three. QPC is monotonic by construction so no lastTime clamp is needed, and there is no mutable static state (the frequency reciprocal is a thread-safe-initialized const). This also makes Windows consistent with Linux/macOS where MonotonicTime::now() is boot-relative (CLOCK_MONOTONIC / mach_absolute_time), not Unix-epoch-relative, and aligns with performance.now() which is already QPC-backed in Bun via Rust's std::time::Instant. The approximate<T>() clock conversions are delta-based (this - FromClock::now() + ToClock::now()), so the epoch change cancels out. All 54 JSC/WTF MonotonicTime::now() call sites use it for relative deltas only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )
Summary by cubic
Pulls upstream changes to add Claude automation for
git-webkit, expand cross‑platform build support (new CMake presets and Dockerfiles for Android, macOS cross, Windows cross, FreeBSD, musl), and land a large batch of JS tests and microbenchmarks. CI, project settings, and build configs are updated and pinned for reproducibility.New Features
git-webkitskills (checkout, classify, find, pull) andreduce-header-includesinclude-cleanup tool..wkdev-sdk-versionand local Claude settings.Build & CI
Written for commit 722f2a8. Summary will update on new commits.