https://bugs.webkit.org/show_bug.cgi?id=227907
Reviewed by Antti Koivisto.
Test: imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-showModal.html
Test expectations are unchanged because the test uses elementFromPoint, meaning that behaviour difference isn't noticeable
until top layer rendering bits are implemented (which would change elementFromPoint's result by shuffling z-order based on top layer elements).
* dom/Element.h:
(WebCore::Element::isInTopLayer const):
* html/HTMLDialogElement.cpp:
(WebCore::HTMLDialogElement::showModal):
(WebCore::HTMLDialogElement::close):
Canonical link: https://commits.webkit.org/240504@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281014 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=229068
rdar://80100092
Reviewed by Youenn Fablet.
Map between MediaSession action next/previousTrack and RemoteControlCommandType ones
were inverted.
There is no infrastrure in place to ensure that the right MRMediaRemoteCommand is
used with the MediaRemote backend, which prevents automating the test.
* Modules/mediasession/MediaSession.cpp:
(WebCore::platformCommandForMediaSessionAction):
Canonical link: https://commits.webkit.org/240503@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281013 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=226795
Reviewed by Darin Adler.
The MockMediaPlayerMediaSource uses callOnMainThread() to execute advanceCurrentTime(). It might
happen that the object is destructed before the callback is executed as it isn't a ref counted
object. That leads to a crash on ASAN builds.
Made the object capable of creating weak ptrs so that we could check whether the _this_ object
has been freed in the meantime or not. For the former case we just bail out.
* platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:
(WebCore::MockMediaPlayerMediaSource::play): Create a WeakPtr.
(WebCore::MockMediaPlayerMediaSource::seekWithTolerance): Ditto.
(WebCore::MockMediaPlayerMediaSource::seekCompleted): Ditto.
* platform/mock/mediasource/MockMediaPlayerMediaSource.h: inherit from CanMakeWeakPtr.
Canonical link: https://commits.webkit.org/240501@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281011 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228999
Reviewed by Ryan Haddad.
Tools:
* Scripts/webkitpy/layout_tests/controllers/layout_test_finder.py:
(LayoutTestFinder._is_test_file): Added a list of patterns for tests to skip
and ensured that 'boot.xml' and 'root.xml' (spurious files created during
the run of the WebKit1 bot) are on the list.
* Scripts/webkitpy/layout_tests/controllers/layout_test_finder_unittest.py:
(LayoutTestFinderTests.test_is_test_file): Added a test for the changes.
LayoutTests:
* TestExpectations: Remove expectation for non-existent test.
* platform/ios-simulator/TestExpectations: Ditto.
* platform/ios-wk2/TestExpectations: Ditto.
* platform/ios/TestExpectations: Dito.
* platform/mac-wk1/TestExpectations: Ditto. Also, the expectations for the non-test
'boot.xml' and 'root.xml' have been moved to workarounds in webkitpy.
* platform/mac/TestExpectations: Remove references to non-existent tests. Also combined
one expectation that was not linting due to a problem like the one described in bug
120081.
* platform/win/TestExpectations: Ditto.
Canonical link: https://commits.webkit.org/240500@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281010 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=229066
<rdar://81850871>
Reviewed by Simon Fraser.
When the whitespace string length is maximumWhitespaceStringLength,
we read from and write to one element past the end of m_codes and
m_indexes. Since we don't need to store codes and indexes for zero
length strings, subtract one from the index we use.
* html/parser/HTMLConstructionSite.cpp:
(WebCore::WhitespaceCache::lookup):
* html/parser/HTMLConstructionSite.h:
Canonical link: https://commits.webkit.org/240498@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=229040
Reviewed by Eric Carlson.
Function `AudioSessionRoutingArbitratorProxy::processDidTerminate()` should
be called only in the case that the corresponding WebContent process exits,
whereas `GPUProcessConnection::didClose()` (in WebContent process) deals with
the case that the GPU process crashes.
No new tests. Fix an API test failure.
* UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm:
(WebKit::AudioSessionRoutingArbitratorProxy::processDidTerminate):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::gpuProcessExited):
Canonical link: https://commits.webkit.org/240497@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281007 268f45cc-cd09-0410-ab3c-d52691b4dbfc
<https://webkit.org/b/229014>
<rdar://problem/81817224>
Reviewed by Chris Dumez.
This turned out to be a false-positive since reads and writes
are protected differently, and it's okay if a read returns data
from the ring buffer that is one slot older than the current
write.
Covered by layout tests running with TSan:
fast/mediastream/getUserMedia-webaudio.html
fast/mediastream/mediastreamtrack-audio-clone.html
imported/w3c/web-platform-tests/webrtc/RTCDTMFSender-insertDTMF.https.html
imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-iceConnectionState.https.html
imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-track-stats.https.html
imported/w3c/web-platform-tests/webrtc/protocol/missing-fields.html
webrtc/audio-peer-connection-g722.html
webrtc/audio-peer-connection-webaudio.html
webrtc/audio-replace-track.html
webrtc/peer-connection-audio-mute.html
webrtc/peer-connection-audio-mute2.html
webrtc/peer-connection-createMediaStreamDestination.html
webrtc/peer-connection-remote-audio-mute.html
webrtc/peer-connection-remote-audio-mute2.html
* platform/audio/cocoa/CARingBuffer.cpp:
(WebCore::CARingBufferStorageVector::getCurrentFrameBounds):
(WebCore::CARingBufferStorageVector::currentStartFrame const):
(WebCore::CARingBufferStorageVector::currentEndFrame const):
- Add SUPPRESS_TSAN attribute since reads are protected by
std::atomic<int32_t> m_timeBoundsQueuePtr only being
incremented after the next m_timeBoundsQueue slot is updated.
Writes are potected by
Locker locker { m_currentFrameBoundsLock }.
Canonical link: https://commits.webkit.org/240494@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281001 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=229054
Reviewed by Keith Miller and Robin Morisset.
This patch only refactors ARM64EHash code by moving some methods into the private
section, and removing some unneeded static_casts.
Verified with a diff of `otool -tv` dumps of the built JavaScriptCore binaries,
that there are no diffs in the generated code from this change.
* assembler/AssemblerBuffer.h:
(JSC::ARM64EHash::ARM64EHash):
(JSC::ARM64EHash::update):
(JSC::ARM64EHash::makeDiversifier):
(JSC::ARM64EHash::nextValue):
(JSC::ARM64EHash::bitsForDiversifier):
(JSC::ARM64EHash::currentHash):
Canonical link: https://commits.webkit.org/240492@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280996 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=229053
Reviewed by Devin Rousso.
Add a handler for execution contexts being added to update the display of the execution context list, as when
there is only a single context at page load the dropdown will be hidden and thus needs to be shown when an
execution context is added after page load.
* UserInterface/Views/QuickConsole.js:
(WI.QuickConsole):
(WI.QuickConsole.prototype._handleFrameExecutionContextAdded):
Canonical link: https://commits.webkit.org/240488@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280989 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228285
rdar://81118724
Reviewed by Tim Horton and Aditya Keerthi.
Source/WebKit:
Add SPI declarations. See Tools/ChangeLog for more details.
* Platform/spi/ios/TextInputSPI.h:
* Platform/spi/ios/UIKitSPI.h:
Tools:
These three editing tests occasionally fail when synthesizing a double-tap gesture in order to select a word in
editable content. This happens because unless UIKit has observed at least one keypress event (e.g. from a
previous editing test), it presents the software keyboard underneath `-[UIKeyboardImpl showKeyboardIfNeeded]`
when setting the selection via UITextSelectionInteraction. This causes the input view frame to expand from the
collapsed (UCB) height of 44pt to the full software keyboard height, which in turn causes the second touch in
the synthesized double tap gesture to _sometimes_ hit-test to the wrong location, resulting in these test
failures.
To mitigate this, ensure that we have consistent behavior in layout tests when changing the text selection in
editable content by directly setting a TextInput default to make the keyboard behave as if it has previously
seen a keypress via the hardware keyboard.
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):
LayoutTests:
Remove the flaky test failure expectations.
* platform/ios-wk2/TestExpectations:
Canonical link: https://commits.webkit.org/240486@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228969
<rdar://81761078>
Reviewed by Simon Fraser.
Terminating the GPUProcess is very stressful situation which has to be
handled carefully. The side effect of each function which is called through
gpuProcessConnectionDidClose() has to be understood to get the right
sequence of calls. There are problems in releasing all kinds of resources.
- Releasing NativeImage: Calling clearNativeImageMap() after clearing the
backend of the ImageBuffers was causing a problem. When clearing the
backend of an ImageBuffer, it will clear its DisplayList which may have
the last reference to a NativeImage. The destructor of NativeImage calls
releaseRemoteResource() before it is removed from the the NativeImageMap.
This will send a message to the relaunched GPUP to release a NativeImage
which is not in its cache.
- Releasing Font: clearFontMap() was always calling releaseRemoteResource()
even if it is called form remoteResourceCacheWasDestroyed(). This should
not happen because the connection with GPUProcess has been closed.
- Releasing ImageBuffer: This happen when a DisplayList of an ImageBuffer
'A' holds the last reference to another ImageBuffer 'B' and we call
clearBackend() for 'A'. clearBackend() will clear the DisplayList of 'A'
and causes the deletion of 'B'. In this case we should not call
releaseImageBuffer() for 'B' because the GPUPProcess is closed.
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
(WebKit::RemoteImageBufferProxy::~RemoteImageBufferProxy):
If the ImageBuffer is being released because of the clean-up we do when
the GPUProcess is terminated, we should not release the corresponding
RemoteImageBuffer since it is already gone.
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
(WebKit::RemoteRenderingBackendProxy::isGPUProcessConnectionClosed const):
This will return true if we are deleting a RemoteImageBufferProxy through
RemoteResourceCacheProxy::remoteResourceCacheWasDestroyed().
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:
(WebKit::RemoteResourceCacheProxy::releaseAllRemoteFonts):
This function will be used to release the remote fonts. It should be called
from RemoteResourceCacheProxy::releaseMemory() where we sure the GPUP is
alive and all the fonts are cached there.
(WebKit::RemoteResourceCacheProxy::clearFontMap):
The part of releasing the remote fonts was moved from this function to
releaseAllRemoteFonts().
(WebKit::RemoteResourceCacheProxy::remoteResourceCacheWasDestroyed):
1. Clearing the NativeImages and the Fonts has to come before clearing
the backends of the ImageBuffers. The reason is clearBackend() clears the
DisplayList which may release the last reference of a NativeImage or Font.
We want to detach the NativeImages and the Fonts from the cache before then.
2. We should have two different loops: one for clearing the backends of
the ImageBuffers and another one for recreating these backends. The reason
for this is clearBackend() clears the DisplayList which may release the
last reference of a another source RemoteImageBufferProxy used by a
DrawImageBuffer item for example.
(WebKit::RemoteResourceCacheProxy::releaseMemory):
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.h:
Canonical link: https://commits.webkit.org/240482@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280981 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=229016
Reviewed by Tim Horton.
Source/WebKit:
Test: remote-layer-tree/ios/uiview-tree-basic.html
* UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* UIProcess/API/ios/WKWebViewTestingIOS.mm:
(allowListedClassToString):
(dumpUIView):
(-[WKWebView _uiViewTreeAsText]):
Add partner SPI called _uiViewTreeAsText that dumps the WKWebView's
UIView tree as constructed via remote layer creation. It currently
dumps some basic properties of each view and uses an allow list of
class names so changes to implementation details in frameworks below
us, like UIKit, don't cause tests to fail.
Tools:
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.h:
(WTR::UIScriptController::uiViewTreeAsText const):
* WebKitTestRunner/ios/UIScriptControllerIOS.h:
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptControllerIOS::uiViewTreeAsText const):
Pipe new _uiViewTreeAsText SPI through to UIScriptController, matching the pattern
established by scrollingTreeAsText.
LayoutTests:
* remote-layer-tree: Added.
* remote-layer-tree/ios: Added.
* remote-layer-tree/ios/uiview-tree-basic-expected.txt: Added.
* remote-layer-tree/ios/uiview-tree-basic.html: Added.
Add basic test case excercising UIView tree dumping to ensure
it is working properly.
* resources/ui-helper.js:
(window.UIHelper.getUIViewTree):
Add helper to use get the UIView tree as text.
* TestExpectations:
* platform/ios/TestExpectations:
Ensure these tests are only run on iOS.
Canonical link: https://commits.webkit.org/240481@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280980 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=229044
Patch by Alex Christensen <achristensen@webkit.org> on 2021-08-12
Reviewed by Geoff Garen.
Covered by existing tests.
There should be no change in behavior.
* page/Performance.cpp:
(WebCore::Performance::Performance):
(WebCore::Performance::addResourceTiming):
(WebCore::Performance::dispatchResourceTimingBufferFullEvent):
(WebCore::Performance::contextDestroyed): Deleted.
(WebCore::Performance::resourceTimingBufferFullTimerFired): Deleted.
* page/Performance.h:
Canonical link: https://commits.webkit.org/240480@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280977 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=229039
<rdar://79150656>
Reviewed by Eric Carlson.
Source/WebCore:
Add a new utility method to calculate the available screen rect taking menu bar
hiding into account.
* platform/PlatformScreen.h:
* platform/mac/PlatformScreenMac.mm:
(WebCore::screenRectAvoidingMenuBar):
Source/WebKit:
When entering fullscreen, if a user has unchecked the "auto-hide menu bar in fullscreen"
setting, the fullscreen animation will enter to the full screen frame, then snap down once
the animation completes to reveal the menu bar. Instead, use a WebCore utility method to
calculate the screen's frame taking that menu bar into account, and use it for the initial
enter fullscreen animation.
* UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController enterFullScreen:]):
Canonical link: https://commits.webkit.org/240479@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280976 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=229013
<rdar://problem/81215696>
Reviewed by Timothy Hatcher.
Source/WebCore:
`NSAttributedString` now uses WK2, which has caused us to discover some inconsistencies (and bugs).
Tests: NSAttributedStringWebKitAdditions.DefaultFontSize
NSAttributedStringWebKitAdditions.MultipleParagraphs
* editing/cocoa/HTMLConverter.mm:
(HTMLConverter::_blockLevelElementForNode):
Check the given node before looking at the parent as it could already be a block. This
allows for sequental `<p>` to each have their own positioning instead of only the first one.
(HTMLConverter::computedAttributesForElement):
Fix typo that used `margin-right` instead of `margin-bottom` when setting `paragraphSpacing`.
Source/WebKit:
`NSAttributedString` now uses WK2, which has caused us to discover some inconsistencies (and bugs).
* UIProcess/API/Cocoa/NSAttributedString.mm:
(+[_WKAttributedStringWebViewCache configuration]):
Change the default font size to 12 to match WK1.
Tools:
* TestWebKitAPI/Tests/WebKitCocoa/NSAttributedStringWebKitAdditions.mm: Added.
(TEST.NSAttributedStringWebKitAdditions.DefaultFontSize):
(TEST.NSAttributedStringWebKitAdditions.MultipleParagraphs):
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
Canonical link: https://commits.webkit.org/240477@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280973 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=229032
Reviewed by Michael Catanzaro.
We don't really need to have a different process to test a11y. We can remove AccessibilityTestServer and use the
same test executable. That way we don't need to spawn a process and use DBus for the communication.
* TestWebKitAPI/Tests/WebKitGtk/AccessibilityTestServer.cpp: Removed.
* TestWebKitAPI/Tests/WebKitGtk/TestWebKitAccessibility.cpp:
(AccessibilityTest::findTestApplication): Find the accessible application corresponding to the test executable.
(AccessibilityTest::waitUntilChildrenRemoved): Use the WebViewTest main loop.
(testAtspiBasicHierarchy): Use WebViewTest::loadHtml.
* TestWebKitAPI/glib/PlatformGTK.cmake:
* TestWebKitAPI/glib/WebKitGLib/TestMain.cpp:
(main): Set the program name to the executable name. It helps to a11y test to find the accessible app.
Canonical link: https://commits.webkit.org/240472@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280966 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=229031
Reviewed by Michael Catanzaro.
This is because it uses exec_prefix variable from atspi2 pkg-config file to try to find the executables, but
atspi2 pkg-config file doesn't have a exec_prefix variable anymore. It was always set to $prefix, so we can just
use prefix variable instead.
* Scripts/run-gtk-tests:
(GtkTestRunner._lookup_atspi2_binary):
Canonical link: https://commits.webkit.org/240471@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280965 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228821
<rdar://problem/81562236>
Patch by Kimmo Kinnunen <kkinnunen@apple.com> on 2021-08-12
Reviewed by Kenneth Russell.
When uploading the WebGL texture content from videos, use the video
visible data size instead of video element size. The video data can
be scaled with its filters, but we should upload only the original
pixels.
The GPU codepath already did this, but CPU codepath did not.
This change fixes the CPU codepath.
Fixes webgl/1.0.x/conformance/textures/misc/texture-corner-case-videos.html
webgl/2.0.y/conformance/textures/misc/texture-corner-case-videos.html
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::texImageSourceHelper):
(WebCore::WebGLRenderingContextBase::videoFrameToImage):
(WebCore::WebGLRenderingContextBase::LRUImageBufferCache::imageBuffer):
* html/canvas/WebGLRenderingContextBase.h:
Canonical link: https://commits.webkit.org/240469@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280963 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228926
<rdar://problem/81715332>
Reviewed by Eric Carlson.
isFeatureFlagEnabled is called when creating/initializing WebPreferences.
It used to check for WebView, which triggers the execution of WebView initialize method
while DumpRenderTree is in the middle of creating its testing setup, including its storage testing sessions.
Instead, check for WebResource to remove this side effect and get back to past DumpRenderTree initialization.
* WebView/WebPreferencesDefaultValues.mm:
(WebKit::isFeatureFlagEnabled):
Canonical link: https://commits.webkit.org/240467@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280961 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228986
Patch by Kimmo Kinnunen <kkinnunen@apple.com> on 2021-08-12
Reviewed by Kenneth Russell.
Remove following from ANGLE (dynamic) target:
- HLSL translator and tree ops used only by it
- Vulkan translator output
- libgl API validation implementation
- API trace capture implementation (was only partially compiled)
The features are not part of Cocoa use of ANGLE, and should
not be compiled as such.
Does not affect the binary size more than few kilobytes.
* ANGLE.xcodeproj/project.pbxproj:
* Configurations/ANGLE-dynamic.xcconfig:
Canonical link: https://commits.webkit.org/240465@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280959 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=229017
<rdar://81813732>
Reviewed by Tim Horton.
There are multiple issues in the current implementation of `isFeatureFlagEnabled()`.
1. `_os_feature_enabled_impl()` expects compile-time static strings as arguments.
So we should not use `String` here.
2. As Simon Fraser pointed out, `String::characters8()` is not null terminated.
Source/WebKit:
* Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:
(WebKit::isFeatureFlagEnabled):
* Shared/WebPreferencesDefaultValues.cpp:
(WebKit::isFeatureFlagEnabled):
* Shared/WebPreferencesDefaultValues.h:
Source/WebKitLegacy/mac:
* WebView/WebPreferencesDefaultValues.h:
* WebView/WebPreferencesDefaultValues.mm:
(WebKit::isFeatureFlagEnabled):
Canonical link: https://commits.webkit.org/240463@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280957 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228754
Reviewed by Alex Christensen.
LayoutTests/imported/w3c:
Rebaseline COEP WPT tests now that we are passing more checks.
* web-platform-tests/html/cross-origin-embedder-policy/blob.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/coep-frame-javascript.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/coep-on-response-from-service-worker.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/credentialless/iframe-coep-require-corp.tentative.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/cross-origin-isolated-permission.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/data.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/dedicated-worker-cache-storage.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/dedicated-worker.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/header-parsing.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/javascript.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/multi-globals/workers-coep-report.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/no-secure-context-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/none-sw-from-require-corp.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/none.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/reporting-to-endpoint.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/require-corp-about-blank-expected.txt: Removed.
* web-platform-tests/html/cross-origin-embedder-policy/require-corp-about-blank.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/require-corp-about-srcdoc-expected.txt: Removed.
* web-platform-tests/html/cross-origin-embedder-policy/require-corp-about-srcdoc.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/require-corp-load-from-cache-storage.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/require-corp-sw-from-none.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/require-corp-sw-from-require-corp.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/require-corp-sw.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/require-corp.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/sandbox.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/service-worker-cache-storage.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/srcdoc.https-expected.txt:
Source/WebCore:
Add initial support for Cross-Origin-Embedder-Policy (COEP) behind a runtime feature flag, off by default:
- https://html.spec.whatwg.org/multipage/origin.html#coep
The COEP header has the following impacts:
- When a document with `Cross-Origin-Embedder-Policy: require-corp` loads an iframe or a worker script, if the network
response for that iframe doesn't also contain `Cross-Origin-Embedder-Policy: require-corp`, then we fail the load.
- When a document with `Cross-Origin-Embedder-Policy: require-corp` loads cross-origin subresources, then either CORS
must be used or the resource response must be allowed by Cross-Origin-Resource-Policy (CORP) header.
Support is only for WK2 and checks are done in the network process for better security. Support for workers and service
workers (including cache storage) is included.
Most of the Web-Platform-Tests for COEP are passing with this patch. The exceptions are:
- Some tests relying on Blob are failing. Similarly to COOP, Blobs need to inherit COEP from their
creator. This is currently unimplemented as the change will likely be non-trivial. I will follow-up
to fix Blob support for both COOP and COEP.
- Tests in the credentialless/ folder are failing because we do not support `Cross-Origin-Embedder-Policy: credentialless`.
This seems to be a fairly recent extension proposed by Google and it is not part of the HTML specification yet.
- Some tests expect violation reporting and they are failing and we do not implement reporting yet.
Note that `self.crossOriginIsolated` still returns false, even if the pages opts into both COOP & COEP, and APIs such
as SharedArrayBuffer still are not permitted to use. In order to support this, we will have to actually implement process
swapping so that we know a process is not actually shared by several origins.
Test: http/wpt/html/cross-origin-embedder-policy/require-corp.https.html
* Modules/cache/DOMCache.cpp:
(WebCore::DOMCache::queryCache):
* Modules/cache/DOMCacheEngine.cpp:
(WebCore::DOMCacheEngine::convertToException):
* Modules/cache/DOMCacheEngine.h:
* Modules/cache/RetrieveRecordsOptions.h:
(WebCore::RetrieveRecordsOptions::isolatedCopy const):
(WebCore::RetrieveRecordsOptions::encode const):
(WebCore::RetrieveRecordsOptions::decode):
* dom/Document.cpp:
(WebCore::Document::initSecurityContext):
* dom/SecurityContext.h:
(WebCore::SecurityContext::crossOriginEmbedderPolicy const):
(WebCore::SecurityContext::setCrossOriginEmbedderPolicy):
* loader/CrossOriginAccessControl.cpp:
(WebCore::shouldCrossOriginResourcePolicyCancelLoad):
(WebCore::validateCrossOriginResourcePolicy):
* loader/CrossOriginAccessControl.h:
* loader/CrossOriginEmbedderPolicy.cpp:
(WebCore::obtainCrossOriginEmbedderPolicy):
(WebCore::CrossOriginEmbedderPolicy::isolatedCopy const):
* loader/CrossOriginEmbedderPolicy.h:
(WebCore::CrossOriginEmbedderPolicy::encode const):
(WebCore::CrossOriginEmbedderPolicy::decode):
* loader/CrossOriginOpenerPolicy.cpp:
(WebCore::obtainCrossOriginOpenerPolicy):
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::loadResourceSynchronously):
(WebCore::DocumentThreadableLoader::create):
(WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
(WebCore::DocumentThreadableLoader::crossOriginEmbedderPolicy const):
* loader/DocumentThreadableLoader.h:
* loader/DocumentWriter.cpp:
(WebCore::DocumentWriter::begin):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::didBeginDocument):
* loader/ResourceLoaderOptions.h:
* loader/WorkerThreadableLoader.cpp:
(WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource):
* page/SecurityOrigin.h:
* platform/network/HTTPParsers.cpp:
(WebCore::parseCrossOriginResourcePolicyHeader):
* platform/network/HTTPParsers.h:
* workers/Worker.cpp:
(WebCore::Worker::notifyFinished):
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::WorkerGlobalScope):
* workers/WorkerGlobalScopeProxy.h:
* workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
* workers/WorkerMessagingProxy.h:
* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::loadSynchronously):
(WebCore::WorkerScriptLoader::loadAsynchronously):
(WebCore::WorkerScriptLoader::didReceiveResponse):
* workers/WorkerScriptLoader.h:
(WebCore::WorkerScriptLoader::crossOriginEmbedderPolicy const):
* workers/WorkerThread.cpp:
(WebCore::WorkerParameters::isolatedCopy const):
* workers/WorkerThread.h:
* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
* workers/service/ServiceWorkerContainer.h:
* workers/service/ServiceWorkerContextData.cpp:
(WebCore::ServiceWorkerContextData::isolatedCopy const):
* workers/service/ServiceWorkerContextData.h:
(WebCore::ServiceWorkerContextData::encode const):
(WebCore::ServiceWorkerContextData::decode):
* workers/service/ServiceWorkerFetchResult.h:
(WebCore::ServiceWorkerFetchResult::isolatedCopy const):
(WebCore::serviceWorkerFetchError):
(WebCore::ServiceWorkerFetchResult::encode const):
(WebCore::ServiceWorkerFetchResult::decode):
* workers/service/ServiceWorkerJob.cpp:
(WebCore::ServiceWorkerJob::notifyFinished):
* workers/service/ServiceWorkerJobClient.h:
* workers/service/context/ServiceWorkerThread.cpp:
(WebCore::ServiceWorkerThread::ServiceWorkerThread):
* workers/service/server/RegistrationDatabase.cpp:
(WebCore::RegistrationDatabase::doPushChanges):
(WebCore::RegistrationDatabase::importRecords):
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::addRegistrationFromStore):
(WebCore::SWServer::updateWorker):
(WebCore::SWServer::installContextData):
* workers/service/server/SWServer.h:
* workers/service/server/SWServerJobQueue.cpp:
(WebCore::SWServerJobQueue::scriptFetchFinished):
* workers/service/server/SWServerWorker.cpp:
(WebCore::SWServerWorker::SWServerWorker):
(WebCore::SWServerWorker::contextData const):
* workers/service/server/SWServerWorker.h:
Source/WebKit:
As mentioned in the WebCore changelog, we do all the COEP checks in the network process
instead of WebCore for added security. As a result, we need to pass more information
to the network process when doing loads in order to do those checks. The checks are done
in NetworkResourceLoader for navigations & worker script loads (similarly to CSP,
X-FrameOptions) and in NetworkLoadChecker for CORP checks of subresource loads (similarly
to CORS checks).
* NetworkProcess/NetworkLoadChecker.cpp:
(WebKit::NetworkLoadChecker::NetworkLoadChecker):
(WebKit::NetworkLoadChecker::validateResponse):
* NetworkProcess/NetworkLoadChecker.h:
(WebKit::NetworkLoadChecker::setParentCrossOriginEmbedderPolicy):
(WebKit::NetworkLoadChecker::setCrossOriginEmbedderPolicy):
* NetworkProcess/NetworkResourceLoadParameters.cpp:
(WebKit::NetworkResourceLoadParameters::parentOrigin const):
(WebKit::NetworkResourceLoadParameters::encode const):
(WebKit::NetworkResourceLoadParameters::decode):
* NetworkProcess/NetworkResourceLoadParameters.h:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions):
(WebKit::NetworkResourceLoader::shouldInterruptNavigationForCrossOriginEmbedderPolicy):
(WebKit::NetworkResourceLoader::shouldInterruptWorkerLoadForCrossOriginEmbedderPolicy):
(WebKit::NetworkResourceLoader::didReceiveResponse):
(WebKit::NetworkResourceLoader::willSendRedirectedRequest):
* NetworkProcess/NetworkResourceLoader.h:
* NetworkProcess/PingLoad.cpp:
(WebKit::PingLoad::PingLoad):
(WebKit::PingLoad::initialize):
* NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
(WebKit::ServiceWorkerFetchTask::didReceiveResponse):
* NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.cpp:
(WebKit::ServiceWorkerSoftUpdateLoader::processResponse):
(WebKit::ServiceWorkerSoftUpdateLoader::didFinishLoading):
* NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.h:
* NetworkProcess/cache/CacheStorageEngineCache.cpp:
(WebKit::CacheStorage::Cache::retrieveRecords):
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::addParametersShared):
(WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
Source/WTF:
Add experimental feature flag for Cross-Origin-Embedder-Policy (COEP), off by default.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
LayoutTests:
Update test expectations now that we support COEP on WK2.
* TestExpectations:
* http/wpt/html/cross-origin-embedder-policy/require-corp.https-expected.txt: Added.
* http/wpt/html/cross-origin-embedder-policy/require-corp.https.html: Added.
* http/wpt/html/cross-origin-embedder-policy/require-corp.https.html.headers: Added.
* platform/mac-wk1/TestExpectations:
* platform/win/TestExpectations:
Canonical link: https://commits.webkit.org/240459@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280953 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228852
Reviewed by Sam Weinig.
Source/WebKit:
* UIProcess/mac/WKTextFinderClient.mm:
(-[WKTextFinderClient findMatchesForString:relativeToMatch:findOptions:maxResults:resultCollector:]):
Test the deduction guide by writing RetainPtr instead of RetainPtr<NSProgress>.
Source/WTF:
* wtf/RetainPtr.h: Sort includes. Made many functions constexpr including the move
constructors and adoptCF. Use using instead of typedef in most places. Use
remove_pointer_t, conditional_t, is_convertible_v, is_same_v, and other such templates
to simplify expressions. Initialize the m_ptr data member and use the default constructor.
Removed unneeded StorageType synonym for CFTypeRef. Move some inline function bodies out
of the class template definition. Use if constexpr to get rid of the need for the overloaded
autoreleaseHelper function. Added a deduction guide so we can use expressions with the
type RetainPtr on the left side, and an Objective-C pointer or CFTypeRef on the right side,
and have the appropriate RetainPtr type deduced.
Canonical link: https://commits.webkit.org/240458@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280952 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=227728
<rdar://problem/80237464>
Reviewed by Jer Noble.
Source/WebKit:
After the GPU process crashes, the UI process will clean up the
`SharedRoutingArbitrator`, while a WebContent process might be resuming
the media playback and setup `AudioSessionRoutingArbitrator`.
There is a race condition here. If the WebContent process runs faster,
`SharedRoutingArbitrator` in the UI process will try to begin a duplicated
routing arbitration and lead to an assertion failure.
No new tests. Fixed following two API test failures:
- TestWebKitAPI.WebKit2.CrashGPUProcessWhileCapturing
- TestWebKitAPI.GPUProcess.CrashWhilePlayingAudioViaCreateMediaElementSource
* UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm:
(WebKit::AudioSessionRoutingArbitratorProxy::processDidTerminate):
* WebProcess/GPU/GPUProcessConnection.cpp:
(WebKit::GPUProcessConnection::didClose):
Tools:
* TestWebKitAPI/Tests/WebKitCocoa/GPUProcess.mm:
(TEST):
Canonical link: https://commits.webkit.org/240457@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280951 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228732
rdar://problem/81447014
Reviewed by Eric Carlson.
Source/WebCore:
It is necessary to call repeatedly ExtAudioFileRead until it explicitly indicates that
it reached EOF.
Test: webaudio/decode-audio-data-wav.html.
* platform/audio/cocoa/AudioFileReaderCocoa.cpp:
(WebCore::AudioFileReader::createBus): Ensure that all frames have been decoded and
trim length to the actual number of frames returned.
This was already done for the webm case.
LayoutTests:
* platform/mac/TestExpectations:
* webaudio/decode-audio-data-wav-expected.txt: Added.
* webaudio/decode-audio-data-wav.html: Added.
* webaudio/pinknoise.wav: Added. Generated with command
sox -b 16 -r 44100 -n pinknoise.wav synth 4 pinknoise
Canonical link: https://commits.webkit.org/240456@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280948 268f45cc-cd09-0410-ab3c-d52691b4dbfc