WebKit-https.git
41 min agoRemove StringBuilder::appendNumber master
darin@apple.com [Thu, 13 May 2021 16:18:32 +0000 (16:18 +0000)]
Remove StringBuilder::appendNumber
https://bugs.webkit.org/show_bug.cgi?id=225732

Reviewed by Sam Weinig.

Source/JavaScriptCore:

* API/JSContextRef.cpp:
(BacktraceFunctor::operator() const): Use append instead of appendNumber.
* API/tests/PingPongStackOverflowTest.cpp:
(PingPongStackOverflowObject_hasInstance): Ditto.
* heap/HeapSnapshotBuilder.cpp:
(JSC::HeapSnapshotBuilder::json): Ditto.

* interpreter/StackVisitor.cpp:
(JSC::StackVisitor::Frame::toString const): Use makeString instead of StringBuilder.

* runtime/ConsoleClient.cpp:
(JSC::appendURLAndPosition): Ditto.
(JSC::ConsoleClient::printConsoleMessageWithArguments): Use append instead of appendNumber.
* runtime/JSONObject.cpp:
(JSC::Stringifier::appendStringifiedValue): Ditto.
* runtime/Options.cpp:
(JSC::OptionReader::Option::dump const): Ditto.

* runtime/StackFrame.cpp:
(JSC::StackFrame::toString const): Use makeString instead of StringBuilder.

Source/WebCore:

* Modules/indexeddb/server/IndexValueStore.cpp:
(WebCore::IDBServer::IndexValueStore::loggingString const):
Use append instead of appendNumber.

* Modules/websockets/WebSocketHandshake.cpp:
(WebCore::hostName): Use makeString instead of StringBuilder.

* contentextensions/CombinedURLFilters.cpp:
(WebCore::ContentExtensions::prefixTreeVertexToString):
Use append instead of appendNumber.
* contentextensions/Term.h:
(WebCore::ContentExtensions::Term::toString const): Ditto.
* css/CSSFontFeatureValue.cpp:
(WebCore::CSSFontFeatureValue::customCSSText const): Ditto.
* css/CSSTimingFunctionValue.cpp:
(WebCore::CSSStepsTimingFunctionValue::customCSSText const): Ditto.

* dom/Document.cpp:
(WebCore::Document::downgradeReferrerToRegistrableDomain): Use
makeString instead of StringBuilder.
* editing/MarkupAccumulator.cpp:
(WebCore::MarkupAccumulator::generateUniquePrefix): Ditto.

* editing/cocoa/DataDetection.mm:
(WebCore::dataDetectorStringForPath): Use append instead of appendNumber.
* html/HTMLAnchorElement.cpp:
(WebCore::appendServerMapMousePosition): Ditto.

* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::createContext2d): Use makeString
instead of StringBuilder.
(WebCore::HTMLCanvasElement::createImageBuffer const): Ditto.

* loader/ResourceLoadStatistics.cpp:
(WebCore::ResourceLoadStatistics::toString const): Use append instead
of appendNumber.

* loader/SubresourceIntegrity.cpp:
(WebCore::integrityMismatchDescription): Use makeString instead of
StringBuilder.

* page/IntersectionObserver.cpp:
(WebCore::IntersectionObserver::rootMargin const): Use append instead
of appendNumber.

* page/SecurityOriginData.cpp:
(WebCore::SecurityOriginData::databaseIdentifier const): Use makeString
instead of StringBuilder.

* platform/Decimal.cpp:
(WebCore::Decimal::toString const): Use append instead of appendNumber.

* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::animationNameForTransition): Use makeString
instead of StringBuilder.
* platform/graphics/ca/TileController.cpp:
(WebCore::TileController::createTileLayer): Ditto.

* platform/graphics/ca/win/PlatformCALayerWin.cpp:
(printTransform): Use single append instead of a run of them.
(printLayer): Ditto, and use append instead of apppendNumber.
(PlatformCALayerWin::layerTreeAsString const): Ditto.

* platform/mediarecorder/MediaRecorderPrivateMock.cpp:
(WebCore::MediaRecorderPrivateMock::generateMockCounterString):
Use append instead of appendNumber.
* platform/network/ProxyServer.cpp:
(WebCore::appendProxyServerString): Ditto.
* rendering/RenderTreeAsText.cpp:
(WebCore::nodePosition): Ditto.
* svg/SVGPathUtilities.cpp:
(WebCore::buildStringFromPath): Ditto.

* testing/Internals.cpp:
(WebCore::Internals::parserMetaData): Use makeString instead of
StringBuilder.
(WebCore::appendOffsets): Use append instead of appendNumber.

* testing/MockPageOverlayClient.cpp:
(WebCore::MockPageOverlayClient::drawRect): Use makeString instead
of StringBuilder.
(WebCore::MockPageOverlayClient::mouseEvent): Ditto.

* xml/XMLErrors.cpp:
(WebCore::XMLErrors::appendErrorMessage): Use append instead of
appendNumber.

Source/WebDriver:

* SessionHost.cpp:
(WebDriver::SessionHost::sendCommandToBackend): Use append instead
of appendNumber.
* socket/HTTPServerSocket.cpp:
(WebDriver::HTTPRequestHandler::packHTTPMessage const): Ditto.

Source/WebKit:

* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::buildList): Use append instead of appendNumber.
(WebKit::ResourceLoadStatisticsDatabaseStore::findNotVeryPrevalentResources): Ditto.
(WebKit::ResourceLoadStatisticsDatabaseStore::resourceToString const): Ditto.
(WebKit::ResourceLoadStatisticsDatabaseStore::attributionToString): Ditto.
(WebKit::ResourceLoadStatisticsDatabaseStore::privateClickMeasurementToString): Ditto.
* Shared/WebMemorySampler.cpp:
(WebKit::WebMemorySampler::appendCurrentMemoryUsageToFile): Ditto.
* UIProcess/API/glib/WebKitWebView.cpp:
(webkitWebViewRunJavaScriptCallback): Ditto.
* UIProcess/WebBackForwardList.cpp:
(WebKit::WebBackForwardList::loggingString): Ditto.

* WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
(PageResourceLoadClient::didReceiveResponseForResource): Use makeString instead
of StringBuilder.

* WebProcess/Plugins/PluginView.cpp:
(WebKit::buildHTTPHeaders): Use append instead of appendNumber.

Source/WebKitLegacy/win:

* WebKitStatistics.cpp:
(WebKitStatistics::comClassNameCounts): Use append instead of
appendNumber.

Source/WTF:

We originally added StringBuilder::appendNumber to resolve the ambiguity
between UChar and uint16_t, but that problem was solved long ago and it
is safe to use StringBuilder::append, including the variadic form, on all
types of numbers and we'll get the same results we did with appendNumber.

* wtf/JSONValues.cpp:
(WTF::JSONImpl::Value::writeJSON const): Use append instead of appendNumber.

* wtf/text/StringBuilder.cpp:
(WTF::StringBuilder::appendNumber): Deleted.
* wtf/text/StringBuilder.h: Removed appendNumber.

* wtf/text/TextStream.cpp:
(WTF::TextStream::operator<<): Use append instead of appendNumber.

Tools:

* TestWebKitAPI/Tests/WTF/StringBuilder.cpp:
Test append with a number instead of appendNumber.

* TestWebKitAPI/Tests/WebKitGLib/TestAutomationSession.cpp:
Use append instead of appendNumber.

* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::dumpResponseDescriptionSuitableForTestResult): Use append instead
of appendNumber.
(WTR::dumpFrameScrollPosition): Ditto.
(WTR::InjectedBundlePage::didFinishDocumentLoadForFrame): Use makeString
instead of StringBuilder.
(WTR::InjectedBundlePage::shouldCacheResponse): Ditto.

* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(WTR::attributesOfElement): Use append instead of appendNumber.
(WTR::AccessibilityUIElement::attributedStringForRange): Ditto.
(WTR::stringAtOffset): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277437 268f45cc-cd09-0410-ab3c-d52691b4dbfc

58 min ago[Flatpak SDK] Update WPEBackend-fdo to 1.8.4
lmoura@igalia.com [Thu, 13 May 2021 16:01:26 +0000 (16:01 +0000)]
[Flatpak SDK] Update WPEBackend-fdo to 1.8.4
https://bugs.webkit.org/show_bug.cgi?id=225735

Reviewed by Adrian Perez de Castro.

* elements/sdk/wpebackend-fdo.bst:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277436 268f45cc-cd09-0410-ab3c-d52691b4dbfc

119 min ago[css-flexbox] Flex item construction may affect sibling flex item height computation
zalan@apple.com [Thu, 13 May 2021 15:00:12 +0000 (15:00 +0000)]
[css-flexbox] Flex item construction may affect sibling flex item height computation
https://bugs.webkit.org/show_bug.cgi?id=225489

Reviewed by Sergio Villar Senin.

Source/WebCore:

Flex item construction triggers layout both on the flex item and on its descendants (see constructFlexItem).
During this layout a percent height descendant may indirectly set an incorrect value on the flex container's
m_hasDefiniteHeight (this is due to the odd way we choose to resolve percent height values on the ancestor chain,
see setOverridingContainingBlockContentLogicalHeight(WTF::nullopt)).
Now this incorrect m_hasDefiniteHeight value (Indefinite) causes the next sibling's (also) percent height
resolve fail as it tells the flex item that the flex container can't help with resolving the percent height value.
As the result we end up with an incorrect, 0px height value for this sibling.
e.g.
<div style="height: 100px; display: flex; flex-direction: column;">
  <div id=flexItemA style="height: 50px;"><div style="height: 100%;"></div></div>
  <div id=flexItemB style="height: 50%;"></div>
</div>
By the time we get to the construction of flexItemB, the RenderFlexibleBox's (flex container) m_hasDefiniteHeight
is already (and incorrectly) set to Indefinite as the result of us trying to resolve flexItemA's descendant height percentage.
This Indefinite value makes the flexItemB's height resolution fail as we believe that the flex container has indefinite height
e.g "height: auto", while it is clearly resolvable (50% of 100px).
Now if we flip the order and flexItemB comes first, the test case passes fine.
It is very unfortunate that some descendant height resolving process can trigger a state change on the ancestor RenderFlexibleBox, but
fixing it would certainly require some substantial architectural change.
In this patch, we just reset the m_hasDefiniteHeight flag inside the loop to ensure that each flex item
starts with a fresh height percent resolve state.

Test: fast/flexbox/flex-column-with-percent-height-descendants.html

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutFlexItems):

LayoutTests:

* fast/flexbox/flex-column-with-percent-height-descendants-expected.html: Added.
* fast/flexbox/flex-column-with-percent-height-descendants.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277435 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 hours agoAX: Crash at WebCore::Document::updateLayout
cfleizach@apple.com [Thu, 13 May 2021 14:30:23 +0000 (14:30 +0000)]
AX: Crash at WebCore::Document::updateLayout
https://bugs.webkit.org/show_bug.cgi?id=225677

Reviewed by Alan Bujtas.

Source/WebCore:

Handling notifications while during layout is risky because we can call back into an update method.
We have handled many other cases like this by deferring the notification, as we do here.
Special note: this test can't be made to crash because actual crash requires the accessibility
runtime to be initialized and posting real notifications to the system. But, we can verify that the
notification is still sent correctly under conditions that could lead to a crash.

Test: accessibility/mac/menu-selection-notification-crash.html

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::deferMenuListValueChange):
(WebCore::AXObjectCache::performDeferredCacheUpdate):
* accessibility/AXObjectCache.h:
* accessibility/AccessibilityMenuList.cpp:
(WebCore::AccessibilityMenuList::didUpdateActiveOption):

LayoutTests:

* accessibility/mac/menu-selection-notification-crash-expected.txt: Added.
* accessibility/mac/menu-selection-notification-crash.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277434 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 hours agoSubtitles in Safari fail to appear after switching language
peng.liu6@apple.com [Thu, 13 May 2021 14:12:22 +0000 (14:12 +0000)]
Subtitles in Safari fail to appear after switching language
https://bugs.webkit.org/show_bug.cgi?id=225738

Reviewed by Jer Noble.

`TextTrackPrivateRemote::setMode()` calls `InbandTextTrackPrivate::setMode()`, but
it does not set the value of `TextTrackPrivateRemote::mode` properly. Therefore,
`TextTrackPrivateRemote::mode` will always be `Disabled`. When we switch text track
in the WebContent process side, we will only send the IPC message `TextTrackSetMode`
to `RemoteMediaPlayerProxy` in the GPU process to change the mode from `Disabled`
to `Showing`, but cannot change its value back to `Disabled`. When a user keeps
switching text track, all text tracks in the GPU process will become `Showing`,
and `MediaPlayerPrivateAVFoundation` cannot deal with that. As a result,
the WebContent process won't get the correct subtitles from the GPU process.
`cueFormat()` has the similar issue, it does not impact the functionality though.

Actually, `TextTrackPrivateRemote` can simply use the implementations of its
base class `InbandTextTrackPrivate` regarding mode and cue format.

In addition, `TextTrackPrivateRemote` does not need to get the "mode" value from
`RemoteTextTrackProxy` in the GPU process. So this patch removes the `mode` attribute
of `TextTrackPrivateRemoteConfiguration`.

* GPUProcess/media/RemoteTextTrackProxy.cpp:
(WebKit::RemoteTextTrackProxy::configuration):
* GPUProcess/media/TextTrackPrivateRemoteConfiguration.h:
(WebKit::TextTrackPrivateRemoteConfiguration::encode const):
(WebKit::TextTrackPrivateRemoteConfiguration::decode):
* WebProcess/GPU/media/TextTrackPrivateRemote.cpp:
(WebKit::TextTrackPrivateRemote::setMode):
(WebKit::TextTrackPrivateRemote::updateConfiguration):
* WebProcess/GPU/media/TextTrackPrivateRemote.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277433 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 hours ago[GStreamer] media/track/in-band/track-in-band-srt-mkv-kind.html is a flaky crash
eocanha@igalia.com [Thu, 13 May 2021 13:54:43 +0000 (13:54 +0000)]
[GStreamer] media/track/in-band/track-in-band-srt-mkv-kind.html is a flaky crash
https://bugs.webkit.org/show_bug.cgi?id=225697

Source/WebCore:

This is a tentative fix for the flaky crash (I can't reproduce it locally after 10000
repetitions). It makes sure that mediaPlayerPrivate and any parameter passed to
handleTextSample() can either survive or detected to be invalid when the lambda is ran in
the main thread.

Reviewed by Alicia Boya Garcia.

Covered by existing tests.

* platform/graphics/gstreamer/TextSinkGStreamer.cpp:
(webkitTextSinkHandleSample): Protect mediaPlayerPrivate and streadId and check if the mediaPlayerPrivate WeakRef is still alive.

LayoutTests:

Reviewed by Alicia Boya Garcia.

* platform/glib/TestExpectations: Unskipped test.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277432 268f45cc-cd09-0410-ab3c-d52691b4dbfc

5 hours agoAdd dbezhetskov as a commiter
dbezhetskov@igalia.com [Thu, 13 May 2021 11:57:22 +0000 (11:57 +0000)]
Add dbezhetskov as a commiter
https://bugs.webkit.org/show_bug.cgi?id=225742

Reviewed by Caio Araujo Neponoceno de Lima.

* Scripts/webkitpy/common/config/contributors.json:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277431 268f45cc-cd09-0410-ab3c-d52691b4dbfc

5 hours agoImport new and updated css-scroll-snap WPT tests
mrobinson@webkit.org [Thu, 13 May 2021 11:10:07 +0000 (11:10 +0000)]
Import new and updated css-scroll-snap WPT tests
https://bugs.webkit.org/show_bug.cgi?id=225653

Reviewed by Sergio Villar Senin.

LayoutTests/imported/w3c:

* resources/import-expectations.json:
* web-platform-tests/css/css-scroll-snap/input/keyboard-expected.txt:
* web-platform-tests/css/css-scroll-snap/input/keyboard.html:
* web-platform-tests/css/css-scroll-snap/nested-scrollIntoView-snaps-expected.txt:
* web-platform-tests/css/css-scroll-snap/nested-scrollIntoView-snaps.html:
* web-platform-tests/css/css-scroll-snap/scroll-margin-visibility-check-expected.txt: Added.
* web-platform-tests/css/css-scroll-snap/scroll-margin-visibility-check.html: Added.
* web-platform-tests/css/css-scroll-snap/scroll-padding-and-margin-expected.txt: Added.
* web-platform-tests/css/css-scroll-snap/scroll-padding-and-margin.html: Added.
* web-platform-tests/css/css-scroll-snap/scroll-snap-root-001-expected.html: Added.
* web-platform-tests/css/css-scroll-snap/scroll-snap-root-001.html: Added.
* web-platform-tests/css/css-scroll-snap/scroll-snap-root-002-expected.html: Added.
* web-platform-tests/css/css-scroll-snap/scroll-snap-root-002.html: Added.
* web-platform-tests/css/css-scroll-snap/scroll-snap-root-003-expected.html: Added.
* web-platform-tests/css/css-scroll-snap/scroll-snap-root-003.html: Added.
* web-platform-tests/css/css-scroll-snap/snap-after-initial-layout/direction-rtl.html:
* web-platform-tests/css/css-scroll-snap/snap-after-initial-layout/scroll-snap-initial-layout-000-expected.html: Added.
* web-platform-tests/css/css-scroll-snap/snap-after-initial-layout/scroll-snap-initial-layout-000.html: Added.
* web-platform-tests/css/css-scroll-snap/snap-after-initial-layout/scroll-snap-writing-mode-000-expected.html: Added.
* web-platform-tests/css/css-scroll-snap/snap-after-initial-layout/scroll-snap-writing-mode-000.html: Added.
* web-platform-tests/css/css-scroll-snap/snap-after-initial-layout/w3c-import.log:
* web-platform-tests/css/css-scroll-snap/snap-after-initial-layout/writing-mode-horizontal-tb.html:
* web-platform-tests/css/css-scroll-snap/snap-after-initial-layout/writing-mode-vertical-lr.html:
* web-platform-tests/css/css-scroll-snap/snap-after-initial-layout/writing-mode-vertical-rl.html:
* web-platform-tests/css/css-scroll-snap/snap-after-relayout/resnap-to-focused-expected.txt: Added.
* web-platform-tests/css/css-scroll-snap/snap-after-relayout/resnap-to-focused.html: Added.
* web-platform-tests/css/css-scroll-snap/snap-after-relayout/w3c-import.log:
* web-platform-tests/css/css-scroll-snap/snap-at-user-scroll-end-expected.txt: Added.
* web-platform-tests/css/css-scroll-snap/snap-at-user-scroll-end.html: Added.
* web-platform-tests/css/css-scroll-snap/support/common.js:
(async keyPress):
* web-platform-tests/css/css-scroll-snap/w3c-import.log:

LayoutTests:

* TestExpectations:
* platform/ios-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277430 268f45cc-cd09-0410-ab3c-d52691b4dbfc

6 hours agoResizeReversePaginatedWebView fails on some OS versions on some hardware
timothy_horton@apple.com [Thu, 13 May 2021 10:39:13 +0000 (10:39 +0000)]
ResizeReversePaginatedWebView fails on some OS versions on some hardware
https://bugs.webkit.org/show_bug.cgi?id=224699
<rdar://76782199>

Reviewed by Megan Gardner.

* TestWebKitAPI/Tests/WebKit/ResizeReversePaginatedWebView.cpp:
(TestWebKitAPI::didLayout):
This test does *not* care about the specific number of pages that are
generated; the key to the test is the scroll position check.

Since the page-count check in this test has caused lots of trouble
in the past (see the history) just remove it and replace it with a
check that we ended up paginated at all.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277429 268f45cc-cd09-0410-ab3c-d52691b4dbfc

7 hours agoREGRESSION(r277262): test imported/w3c/web-platform-tests/css/selectors/focus-visible...
carlosgc@webkit.org [Thu, 13 May 2021 09:53:20 +0000 (09:53 +0000)]
REGRESSION(r277262): test imported/w3c/web-platform-tests/css/selectors/focus-visible-002.html is crashing
https://bugs.webkit.org/show_bug.cgi?id=225659

Reviewed by Adrian Perez de Castro.

Do not try to grab focus on WebView widget for synthesized mouse press and release events if the widget has
already the focus or is not the current toplevel focus widget.

* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseSynthesizeMouseEvent):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277428 268f45cc-cd09-0410-ab3c-d52691b4dbfc

7 hours agoUnreviewed, reverting r277258.
commit-queue@webkit.org [Thu, 13 May 2021 09:49:27 +0000 (09:49 +0000)]
Unreviewed, reverting r277258.
https://bugs.webkit.org/show_bug.cgi?id=225740

Caused layout test failures

Reverted changeset:

"[GTK] Use always async scrolling in accelerated compositing
mode"
https://bugs.webkit.org/show_bug.cgi?id=225512
https://trac.webkit.org/changeset/277258

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277427 268f45cc-cd09-0410-ab3c-d52691b4dbfc

8 hours ago[GTK][WPE] Add ArgumentCoder for GTlsCertificate
carlosgc@webkit.org [Thu, 13 May 2021 08:00:14 +0000 (08:00 +0000)]
[GTK][WPE] Add ArgumentCoder for GTlsCertificate
https://bugs.webkit.org/show_bug.cgi?id=225509

Reviewed by Adrian Perez de Castro.

Move the GTlsCertificate serialization from CertificateInfo ArgumentCoder to its own.

* Shared/glib/ArgumentCodersGLib.cpp:
(IPC::ArgumentCoder<GRefPtr<GVariant>>::encode):
(IPC::ArgumentCoder<GRefPtr<GVariant>>::decode):
(IPC::ArgumentCoder<GRefPtr<GTlsCertificate>>::encode):
(IPC::ArgumentCoder<GRefPtr<GTlsCertificate>>::decode):
(IPC::encode): Deleted.
(IPC::decode): Deleted.
* Shared/glib/ArgumentCodersGLib.h:
* Shared/glib/UserMessage.cpp:
(WebKit::UserMessage::encode const):
(WebKit::UserMessage::decode):
* Shared/soup/WebCoreArgumentCodersSoup.cpp:
(IPC::ArgumentCoder<CertificateInfo>::encode):
(IPC::ArgumentCoder<CertificateInfo>::decode):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277426 268f45cc-cd09-0410-ab3c-d52691b4dbfc

10 hours agoRELEASE_ASSERT(m_selection->isNone()) fails in Document::removedLastRef
commit-queue@webkit.org [Thu, 13 May 2021 06:45:07 +0000 (06:45 +0000)]
RELEASE_ASSERT(m_selection->isNone()) fails in Document::removedLastRef
https://bugs.webkit.org/show_bug.cgi?id=225434

Patch by Frederic Wang <fwang@igalia.com> on 2021-05-12
Reviewed by Ryosuke Niwa.

Document::removedLastRef asserts that the document's selection is not set. However, setting
that selection is possible in FrameSelection::setSelectionWithoutUpdatingAppearance when the
document has not been destroyed yet but is already detached from its frame. This patch
instead clears the selection in that case.

No new tests.

* editing/FrameSelection.cpp:
(WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance): Clears the selection when
newSelection is in a detached document. Given the other conditions, this is actually
checking equivalent to !m_document->frame().

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277425 268f45cc-cd09-0410-ab3c-d52691b4dbfc

11 hours ago[iPad] SourceBufferPrivateAVFObjC should not report an error to the web page when...
peng.liu6@apple.com [Thu, 13 May 2021 05:37:17 +0000 (05:37 +0000)]
[iPad] SourceBufferPrivateAVFObjC should not report an error to the web page when the video playback is interrupted
https://bugs.webkit.org/show_bug.cgi?id=225620

Reviewed by Jer Noble.

If `SourceBufferPrivateAVFObjC` reports an error to a web page when
`AVSampleBufferDisplayLayer` reports `AVErrorOperationInterrupted` (the playback
was interrupted), the web page will likely destroy the video player (and teardown
the video element). That behavior will lead to an empty picture-in-picture window
if the video was playing in picture-in-picture.

With this patch, `SourceBufferPrivateAVFObjC` will not report an error to the
web page in case of playback interruption. Instead, it takes a note that
the playback was interrupted, so that when we try to resume the playback later,
it will flush the `AVSampleBufferDisplayLayer` to recover the playback state.

In addition, we need to enqueue an IDR frame first before we enqueue more
samples after flushing the `AVSampleBufferDisplayLayer`. That is guaranteed
by `SourceBufferPrivate::reenqueSamples()`.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::playInternal):
* platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
(WebCore::MediaSourcePrivateAVFObjC::flushActiveSourceBuffersIfNeeded):
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::flushIfNeeded):
(WebCore::SourceBufferPrivateAVFObjC::layerDidReceiveError):
(WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277424 268f45cc-cd09-0410-ab3c-d52691b4dbfc

11 hours agoUpdate the MotionMark 1.1 plan file
simon.fraser@apple.com [Thu, 13 May 2021 05:03:20 +0000 (05:03 +0000)]
Update the MotionMark 1.1 plan file

Unreviewed.

Update MotionMark 1.1 to use the version from r277406, which removes the
Focus subtest.

* Scripts/webkitpy/benchmark_runner/data/plans/motionmark1.1.plan:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277421 268f45cc-cd09-0410-ab3c-d52691b4dbfc

11 hours agoNotification.requestPermission() should return a Promise
cdumez@apple.com [Thu, 13 May 2021 05:02:45 +0000 (05:02 +0000)]
Notification.requestPermission() should return a Promise
https://bugs.webkit.org/show_bug.cgi?id=225712

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Drop manual test that should not have been imported from WPT. The test happened to be using Notification.requestPermission()
internally.

* web-platform-tests/service-workers/service-worker/fetch-event-within-sw-manual.https-expected.txt: Removed.
* web-platform-tests/service-workers/service-worker/fetch-event-within-sw-manual.https.html: Removed.

Source/WebCore:

Notification.requestPermission() should return a Promise as per the specification:
- https://notifications.spec.whatwg.org/#notification

Both Firefox and Chrome already support this.

Test: http/tests/notifications/request-with-promise.html

* Modules/notifications/Notification.cpp:
(WebCore::Notification::requestPermission):
* Modules/notifications/Notification.h:
* Modules/notifications/Notification.idl:
* Modules/notifications/NotificationClient.h:

Source/WebKit:

Update code now that WebCore passes a CompletionHandler instead of a
NotificationPermissionCallback.

* WebProcess/Notifications/NotificationPermissionRequestManager.cpp:
(WebKit::NotificationPermissionRequestManager::~NotificationPermissionRequestManager):
(WebKit::NotificationPermissionRequestManager::startRequest):
* WebProcess/Notifications/NotificationPermissionRequestManager.h:
* WebProcess/WebCoreSupport/WebNotificationClient.cpp:
(WebKit::WebNotificationClient::requestPermission):
* WebProcess/WebCoreSupport/WebNotificationClient.h:

Source/WebKitLegacy/mac:

Update code now that WebCore passes a CompletionHandler instead of a
NotificationPermissionCallback.

* WebCoreSupport/WebNotificationClient.h:
* WebCoreSupport/WebNotificationClient.mm:
(WebNotificationClient::requestPermission):
(-[WebNotificationPolicyListener initWithCompletionHandler:]):
(-[WebNotificationPolicyListener allow]):
(-[WebNotificationPolicyListener deny]):

Source/WebKitLegacy/win:

Update code now that WebCore passes a CompletionHandler instead of a
NotificationPermissionCallback.

* WebCoreSupport/WebDesktopNotificationsDelegate.cpp:
(WebDesktopNotificationsDelegate::requestPermission):
* WebCoreSupport/WebDesktopNotificationsDelegate.h:

LayoutTests:

* http/tests/notifications/notification-in-non-secure-context-expected.txt:
Rebaseline test now that we log an error message in the JS console when trying to call
Notification.requestPermission() in a non-secure context.

* http/tests/notifications/request-with-promise-expected.txt: Added.
* http/tests/notifications/request-with-promise.html: Added.
Add layout test coverage.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277420 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 hours ago[GLIB] http/tests/security/contentSecurityPolicy/report-only-from-header.py is a...
dpino@igalia.com [Thu, 13 May 2021 03:46:57 +0000 (03:46 +0000)]
[GLIB] http/tests/security/contentSecurityPolicy/report-only-from-header.py is a flaky text failure

Unreviewed test gardening.

Sometimes there's an extra console log error message. Dump all JS console output and emit new baseline.

* platform/glib/TestExpectations:
* platform/glib/http/tests/security/contentSecurityPolicy/report-only-from-header-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277419 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 hours agoSome webgl/2.0.0/conformance/textures/image_bitmap_from_image_data tests are failing...
Hironori.Fujii@sony.com [Thu, 13 May 2021 02:59:05 +0000 (02:59 +0000)]
Some webgl/2.0.0/conformance/textures/image_bitmap_from_image_data tests are failing after r277369 if !USE(ACCELERATE)
https://bugs.webkit.org/show_bug.cgi?id=225725

Reviewed by Sam Weinig.

* platform/graphics/PixelBufferConversion.cpp:
(WebCore::convertImagePixels): Fixed the wrong condition of destination.alphaFormat.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277418 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 hours ago[WinCairo] Failed to open WebInspector UI since r277231
Hironori.Fujii@sony.com [Thu, 13 May 2021 02:35:32 +0000 (02:35 +0000)]
[WinCairo] Failed to open WebInspector UI since r277231
https://bugs.webkit.org/show_bug.cgi?id=225715

Reviewed by Don Olmstead.

Windows WebKit2 failed to open WebInspector UI after r277231
changed Filesystem::pathByAppendingComponent.
"inspector-resource:///Main.html" was wrongly mapped to
"C:\\Main.html".

requestURL.fileSystemPath() returns "\Main.html". The preceding
"\" should be removed before concatenating it with the bundle path
by using FileSystem::pathByAppendingComponent.

* UIProcess/Inspector/win/InspectorResourceURLSchemeHandler.cpp:
(WebKit::InspectorResourceURLSchemeHandler::platformStartTask): Removed the preceding "\".

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277417 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 hours ago[Cocoa] Permit sysctl-read operations needed by Metal and other system frameworks
bfulgham@apple.com [Thu, 13 May 2021 01:13:33 +0000 (01:13 +0000)]
[Cocoa] Permit sysctl-read operations needed by Metal and other system frameworks
https://bugs.webkit.org/show_bug.cgi?id=225720
<rdar://problem/77438105>

Reviewed by Per Arne Vollan.

Further testing of iOS and macOS have revealed a handful of sysctl-read operations we should allow to improve
performance and correctness of OpenGL/Metal and other high-performance math routines.

* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
* WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277416 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 hours ago[Angle METAL] Remove thread qualifiers and pass-by-reference qualifiers for cast...
kpiddington@apple.com [Thu, 13 May 2021 00:36:16 +0000 (00:36 +0000)]
[Angle METAL] Remove thread qualifiers and pass-by-reference qualifiers for cast functions
https://bugs.webkit.org/show_bug.cgi?id=225702
<rdar://76799461>

Cast functions fail to compile when casting from user uniforms. Update cast functions to remove pass-by-reference
qualifiers.

Reviewed by Dean Jackson.

* src/compiler/translator/TranslatorMetalDirect/ProgramPrelude.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277415 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 hours agoSimplify / Modernize Notification permission implementation
cdumez@apple.com [Thu, 13 May 2021 00:31:44 +0000 (00:31 +0000)]
Simplify / Modernize Notification permission implementation
https://bugs.webkit.org/show_bug.cgi?id=225711

Reviewed by Alex Christensen.

Simplify / Modernize Notification permission implementation. The main change was
adopting sendWithAsyncReply() for the IPC instead of using 2 separate IPC messages
for the request and the decision. As a result, we don't have to deal with request
identifiers.

No new tests, no behavior change and covered by existing API tests.

* Sources.txt:
* UIProcess/API/APIUIClient.h:
(API::UIClient::decidePolicyForNotificationPermissionRequest):
* UIProcess/API/C/WKNotificationPermissionRequest.cpp:
(WKNotificationPermissionRequestAllow):
(WKNotificationPermissionRequestDeny):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageUIClient):
* UIProcess/API/glib/WebKitNotificationPermissionRequest.cpp:
(webkitNotificationPermissionRequestAllow):
(webkitNotificationPermissionRequestDeny):
* UIProcess/API/glib/WebKitUIClient.cpp:
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::UIClient::decidePolicyForNotificationPermissionRequest):
* UIProcess/Notifications/NotificationPermissionRequest.h:
(WebKit::NotificationPermissionRequest::create):
(WebKit::NotificationPermissionRequest::~NotificationPermissionRequest):
(WebKit::NotificationPermissionRequest::didReceiveDecision):
(WebKit::NotificationPermissionRequest::NotificationPermissionRequest):
* UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp: Removed.
* UIProcess/Notifications/NotificationPermissionRequestManagerProxy.h: Removed.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::resetState):
(WebKit::WebPageProxy::requestNotificationPermission):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/Notifications/NotificationPermissionRequestManager.cpp:
(WebKit::NotificationPermissionRequestManager::startRequest):
* WebProcess/Notifications/NotificationPermissionRequestManager.h:
* WebProcess/WebPage/WebPage.cpp:
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277414 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 hours ago[WebXR] Implement XRDeviceProxy::submitFrame
commit-queue@webkit.org [Thu, 13 May 2021 00:21:32 +0000 (00:21 +0000)]
[WebXR] Implement XRDeviceProxy::submitFrame
https://bugs.webkit.org/show_bug.cgi?id=225718

Patch by Ada Chan <ada.chan@apple.com> on 2021-05-12
Reviewed by Sam Weinig.

* Shared/Cocoa/XRDeviceProxy.h:
* Shared/Cocoa/XRDeviceProxy.mm:
(WebKit::XRDeviceProxy::submitFrame):
* UIProcess/Cocoa/PlatformXRCoordinator.h:
(WebKit::PlatformXRCoordinator::submitFrame):
* UIProcess/Cocoa/PlatformXRSystem.h:
* UIProcess/Cocoa/PlatformXRSystem.messages.in:
* UIProcess/Cocoa/PlatformXRSystem.mm:
(WebKit::PlatformXRSystem::submitFrame):
* WebProcess/cocoa/PlatformXRSystemProxy.h:
* WebProcess/cocoa/PlatformXRSystemProxy.mm:
(WebKit::PlatformXRSystemProxy::submitFrame):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277413 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 hours ago[BigSur Wk1 Release] imported/w3c/web-platform-tests/css/css-will-change/will-change...
amir_mark@apple.com [Thu, 13 May 2021 00:17:44 +0000 (00:17 +0000)]
[BigSur Wk1 Release] imported/w3c/web-platform-tests/css/css-will-change/will-change-fixpos-cb-transform-1.html is a flaky image failure
https://bugs.webkit.org/show_bug.cgi?id=225704

Unreviewed test gardening.

* platform/mac-wk1/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277412 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 hours agoASSERTION FAILED: actualVTablePointer == expectedVTablePointer in toJSNewlyCreated...
cdumez@apple.com [Thu, 13 May 2021 00:09:38 +0000 (00:09 +0000)]
ASSERTION FAILED: actualVTablePointer == expectedVTablePointer in toJSNewlyCreated(JSC::JSGlobalObject *, WebCore::JSDOMGlobalObject *, Ref<WebCore::AudioNode> &&)
https://bugs.webkit.org/show_bug.cgi?id=225719
<rdar://77828031>

Reviewed by Geoffrey Garen.

Source/WebCore:

AudioNode has (a lot of) subclasses that are exposed to JS (for which we call toJS() for).
As a result, AudioNode needs a custom toJS() implementation which returns the correct subclass
wrapper, instead of a generic JSAudioNode.

Test: webaudio/event-relatedTarget-audionode.html

* Modules/webaudio/AudioNode.idl:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSAudioNodeCustom.cpp: Added.
(WebCore::toJSNewlyCreated):
(WebCore::toJS):

LayoutTests:

Add layout test coverage. This test was reliably crashing before the fix.

* webaudio/event-relatedTarget-audionode-expected.txt: Added.
* webaudio/event-relatedTarget-audionode.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277411 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 hours ago[ BigSur Release wk2 arm64 ] http/tests/appcache/fail-on-update-2.html (layout-test...
jenner@apple.com [Thu, 13 May 2021 00:03:52 +0000 (00:03 +0000)]
[ BigSur Release wk2 arm64 ] http/tests/appcache/fail-on-update-2.html (layout-test) is a flaky timeout
https://bugs.webkit.org/show_bug.cgi?id=225665

Unreviewed test gardening.

Updating expectations to (DumpJSConsoleLogInStdErr Slow ) to stop the constant text failures, and improve the flaky timeouts.

* platform/mac-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277410 268f45cc-cd09-0410-ab3c-d52691b4dbfc

17 hours ago[MotionMark] Apply r277406 to Websites/browserbench.org/MotionMark1.2
mmaxfield@apple.com [Wed, 12 May 2021 23:27:30 +0000 (23:27 +0000)]
[MotionMark] Apply r277406 to Websites/browserbench.org/MotionMark1.2
https://bugs.webkit.org/show_bug.cgi?id=225722

Rubber-stamped by Geoffrey Garen.

Just copy over the change, so the website gets updated.

This doesn't bump the version number, which is okay, because we never actually
"released" version 1.2; we just made a folder on a website, and didn't update any
links to point to it.

* MotionMark1.2/resources/runner/tests.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277409 268f45cc-cd09-0410-ab3c-d52691b4dbfc

17 hours ago[LayoutTests] http/tests/misc/last-modified-parsing.html handles non-standard dates...
cgambrell@apple.com [Wed, 12 May 2021 23:24:22 +0000 (23:24 +0000)]
[LayoutTests] http/tests/misc/last-modified-parsing.html handles non-standard dates differently in PHP than Python
https://bugs.webkit.org/show_bug.cgi?id=224933
<rdar://problem/77020039>

Reviewed by Jonathan Bedard.

* http/tests/misc/last-modified-parsing-expected.txt: Removed.
* http/tests/misc/last-modified-parsing.html: Removed.
* http/tests/misc/no-last-modified-expected.txt: Removed.
* http/tests/misc/no-last-modified.html: Removed.
* http/tests/resources/last-modified.php: Removed.
* http/wpt/misc: Added.
* http/wpt/misc/last-modified-parsing-expected.txt: Added.
* http/wpt/misc/last-modified-parsing.html: Added.
* http/wpt/misc/no-last-modified-expected.txt: Added.
* http/wpt/misc/no-last-modified.html: Added.
* http/wpt/misc/resources: Added.
* http/wpt/misc/resources/last-modified-utilities.js: Added.
(async getLastModified):
* platform/win/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277408 268f45cc-cd09-0410-ab3c-d52691b4dbfc

17 hours ago[MotionMark] Update plan file after r277406
mmaxfield@apple.com [Wed, 12 May 2021 23:22:58 +0000 (23:22 +0000)]
[MotionMark] Update plan file after r277406
https://bugs.webkit.org/show_bug.cgi?id=225721

Rubber-stamped by Geoffrey Garen.

Just update the plan.

* Scripts/webkitpy/benchmark_runner/data/plans/motionmark1.1.plan:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277407 268f45cc-cd09-0410-ab3c-d52691b4dbfc

17 hours ago[MotionMark] Temporarily remove the focus test
mmaxfield@apple.com [Wed, 12 May 2021 23:18:49 +0000 (23:18 +0000)]
[MotionMark] Temporarily remove the focus test
https://bugs.webkit.org/show_bug.cgi?id=225714

Reviewed by Geoffrey Garen.

The focus test is causing unacceptably high variance on test results. Initial investigation
indicates that this is related to secondary and tertiary interactions between the browser's
runloop and the compositor's runloop. Not only that, but the variable cost of the focus test
seems to affect the variance on the subtests which run after it.

This patch temporarily removes the focus test, just so we can get a stronger signal of
browsers' true performance, while we do a deeper analysis of the focus test.

Because the focus test's score is lower than the average score of the subtests, removing it
causes scores in all browsers to increase:

                     | WebKit | Chrome | Firefox
================================================
Score with Focus     |   1020 |    550 |    962
Score without Focus  |   1623 |    874 |   1101
Stddev with Focus    |   9.3% |   2.3% |   2.9%
Stddev without Focus |   0.7% |   0.5% |   7.9%

* MotionMark/resources/runner/tests.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277406 268f45cc-cd09-0410-ab3c-d52691b4dbfc

17 hours ago[ Catalina+ wk2 ] http/tests/webAPIStatistics/screen-functions-accessed-data-collecti...
jenner@apple.com [Wed, 12 May 2021 23:16:43 +0000 (23:16 +0000)]
[ Catalina+ wk2 ] http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html (layout-test) is a flaky timeout
https://bugs.webkit.org/show_bug.cgi?id=225667

Unreviewed test gardening.

Updating expectation to Slow to see if test conditions improve.

* platform/mac/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277405 268f45cc-cd09-0410-ab3c-d52691b4dbfc

17 hours ago[ BigSur ] webaudio/AudioContext/audiocontext-close-basic.html (layout-test) is a...
jenner@apple.com [Wed, 12 May 2021 23:01:25 +0000 (23:01 +0000)]
[ BigSur ] webaudio/AudioContext/audiocontext-close-basic.html (layout-test) is a flaky timeout
https://bugs.webkit.org/show_bug.cgi?id=225670

Unreviewed test gardening.

Updating expectations to slow to see if test will pass.

* platform/mac/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277403 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 hours ago[Cocoa] Silence uninteresting sandbox reports
bfulgham@apple.com [Wed, 12 May 2021 22:59:16 +0000 (22:59 +0000)]
[Cocoa] Silence uninteresting sandbox reports
https://bugs.webkit.org/show_bug.cgi?id=225713
<rdar://problem/77483132>

Reviewed by Per Arne Vollan.

Telemetry from the recently released iOS and macOS updates show a set of uninteresting sandbox violations. Most of
these are harmless, but all of them involve some runtime cost and may prevent code from making the best use of
available hardware and should be permitted.

These changes also bring the various sandboxes into better alignment, as many of these items had previously been
added to one of the other sandboxes.

* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
* WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277400 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 hours ago[ BigSur wk2 arm64 ] editing/selection/move-by-character-brute-force.html (layout...
jenner@apple.com [Wed, 12 May 2021 22:53:46 +0000 (22:53 +0000)]
[ BigSur wk2 arm64 ] editing/selection/move-by-character-brute-force.html (layout-test) is a flaky timeout
https://bugs.webkit.org/show_bug.cgi?id=225664

Unreviewed test gardening.

Updating test expectations to slow.

* platform/mac-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277398 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 hours ago[build.webkit.org] Bots should automatically recover from svn checkout is already...
aakash_jain@apple.com [Wed, 12 May 2021 22:07:49 +0000 (22:07 +0000)]
[build.webkit.org] Bots should automatically recover from svn checkout is already locked issue
https://bugs.webkit.org/show_bug.cgi?id=225717

Reviewed by Jonathan Bedard.

* CISupport/build-webkit-org/steps.py:
(CheckOutSource): Set haltOnFailure to False so that cleanup step can run. Also set the step name while we are at it.
(CheckOutSource.__init__): Also set logEnviron to False.
(CheckOutSource.getResultSummary): Run SVNCleanup step in case of failure.
(SVNCleanup):
(SVNCleanup.__init__):
(SVNCleanup.evaluateCommand):
* CISupport/build-webkit-org/steps_unittest.py: Added unit-tests for the new step.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277395 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 hours ago[ Catalina+ wk2 ] imported/w3c/web-platform-tests/css/css-transitions/transition...
jenner@apple.com [Wed, 12 May 2021 22:02:32 +0000 (22:02 +0000)]
[ Catalina+ wk2 ] imported/w3c/web-platform-tests/css/css-transitions/transition-base-response-002.html (layout-test) is a flaky text failure
https://bugs.webkit.org/show_bug.cgi?id=225669

Unreviewed test gardening.

Updating expectations to Pass Failure for macOS Release and Debug.

* platform/mac-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277394 268f45cc-cd09-0410-ab3c-d52691b4dbfc

19 hours agoUnreviewed follow-up to r277376.
cdumez@apple.com [Wed, 12 May 2021 21:57:39 +0000 (21:57 +0000)]
Unreviewed follow-up to r277376.

Enable the API tests only if ENABLE(NOTIFICATIONS). It is important since
notifications are enabled on macOS but not iOS currently.

* TestWebKitAPI/Tests/WebKitCocoa/NotificationAPI.mm:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277393 268f45cc-cd09-0410-ab3c-d52691b4dbfc

19 hours ago[ BigSur Release ] TestWebKitAPI.IndexedDB.KillWebProcessWithOpenConnection is a...
sihui_liu@apple.com [Wed, 12 May 2021 21:56:12 +0000 (21:56 +0000)]
[ BigSur Release ] TestWebKitAPI.IndexedDB.KillWebProcessWithOpenConnection is a constant failure
https://bugs.webkit.org/show_bug.cgi?id=225372
<rdar://problem/77532291>

Reviewed by Chris Dumez.

Ensure IDB data is cleared before test and make error logging more detailed.

* TestWebKitAPI/Tests/WebKitCocoa/KillWebProcessWithOpenConnection-1.html:
* TestWebKitAPI/Tests/WebKitCocoa/KillWebProcessWithOpenConnection-2.html:
* TestWebKitAPI/Tests/WebKitCocoa/WebProcessKillIDBCleanup.mm: Listen to version change event because it
indicates that server starts handling second open request in KillWebProcessWithOpenConnection-2.html.
(-[IndexedDBWebProcessKillMessageHandler userContentController:didReceiveScriptMessage:]):
(getNextMessage):
(TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277392 268f45cc-cd09-0410-ab3c-d52691b4dbfc

19 hours agoWrong position for orthogonal positioned element with writing-mode: vertical-rl
commit-queue@webkit.org [Wed, 12 May 2021 21:43:31 +0000 (21:43 +0000)]
Wrong position for orthogonal positioned element with writing-mode: vertical-rl
https://bugs.webkit.org/show_bug.cgi?id=180633

Patch by Ziran Sun <zsun@igalia.com> on 2021-05-12
Reviewed by Javier Fernandez.

LayoutTests/imported/w3c:

Re-sync the following 3 tests with WPT. grid-self-alignment-non-static-positioned-items-009.html and
grid-self-alignment-non-static-positioned-items-010.html are now passing.
grid-self-alignment-non-static-positioned-items-011.html is now producing the same test results as those
in Chromium.

* web-platform-tests/css/css-grid/alignment/grid-self-alignment-non-static-positioned-items-009.html:
* web-platform-tests/css/css-grid/alignment/grid-self-alignment-non-static-positioned-items-010.html:
* web-platform-tests/css/css-grid/alignment/grid-self-alignment-non-static-positioned-items-011.html:

Source/WebCore:

When calculating offset position for orthogonal positioned element with writing mode vertical-rl,
we also need to take into account of borders and paddings. This change corrects computations
for both topOffset and leftOffset.

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computePositionedLogicalWidthUsing const):
(WebCore::RenderBox::computePositionedLogicalHeightUsing const):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277391 268f45cc-cd09-0410-ab3c-d52691b4dbfc

19 hours agoTapStorage::lock freed while locked in AudioSourceProviderAVFObjC::destroyMixIfNeeded()
jer.noble@apple.com [Wed, 12 May 2021 21:19:06 +0000 (21:19 +0000)]
TapStorage::lock freed while locked in AudioSourceProviderAVFObjC::destroyMixIfNeeded()
https://bugs.webkit.org/show_bug.cgi?id=225706
<rdar://77719381>

Reviewed by Ryosuke Niwa.

In r275933, an update was made to protect access to TapStorage during destruction by
locking its lock inside destroyMixIfNeeded(), but if TapStorage has a refCount==1
during that teardown, the lock itself is destroyed while it is still held. Add an
explicit scoping to the lock holder, and only deref the TapStorage outside that
locking scope.

* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
(WebCore::AudioSourceProviderAVFObjC::destroyMixIfNeeded):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277390 268f45cc-cd09-0410-ab3c-d52691b4dbfc

19 hours agoPlumb some more metadata to QuickLook when revealing images
wenson_hsieh@apple.com [Wed, 12 May 2021 21:08:35 +0000 (21:08 +0000)]
Plumb some more metadata to QuickLook when revealing images
https://bugs.webkit.org/show_bug.cgi?id=225709
rdar://77864866

Reviewed by Devin Rousso.

Add plumbing to supply QuickLook with some additional information about the image URL and current page URL when
revealing images.

* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::handleContextMenuRevealImage):
* UIProcess/ios/WKActionSheetAssistant.h:
* UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant handleElementActionWithType:element:needsInteraction:]):
* UIProcess/mac/WKImageExtractionPreviewController.h:
* UIProcess/mac/WKImageExtractionPreviewController.mm:
(-[WKImageExtractionPreviewItem initWithFileURL:title:imageURL:pageURL:]):
(-[WKImageExtractionPreviewItem dealloc]):
(-[WKImageExtractionPreviewItem previewItemURL]):
(-[WKImageExtractionPreviewItem previewOptions]):
(-[WKImageExtractionPreviewController initWithPage:fileURL:title:imageURL:]):

Rename the `URL` argument to `fileURL`, to avoid confusion with the new `imageURL` that's passed in. Note that
this is temporary, since we'll adopt new QuickLook SPI on macOS once the fix for rdar://74299451 is available.

(-[WKImageExtractionPreviewItem initWithURL:title:]): Deleted.
(-[WKImageExtractionPreviewController initWithPage:url:title:]): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277389 268f45cc-cd09-0410-ab3c-d52691b4dbfc

19 hours agoConservativeRoots triggers page demand on Speedometer
ggaren@apple.com [Wed, 12 May 2021 21:06:35 +0000 (21:06 +0000)]
ConservativeRoots triggers page demand on Speedometer
https://bugs.webkit.org/show_bug.cgi?id=225676

Reviewed by Filip Pizlo.

Use a 2048 item / 16kB inline buffer. That's about 10% bigger than the
max capacity observed on Speedometer, and small enough to reasonably fit
on the stack.

Removed the separate out of line capacity because it was smaller than
the new inline capacity.

* heap/ConservativeRoots.cpp:
(JSC::ConservativeRoots::grow):
* heap/ConservativeRoots.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277388 268f45cc-cd09-0410-ab3c-d52691b4dbfc

20 hours ago[TestWebKitAPI] Explicitly exit after completing tests
jbedard@apple.com [Wed, 12 May 2021 20:40:51 +0000 (20:40 +0000)]
[TestWebKitAPI] Explicitly exit after completing tests
https://bugs.webkit.org/show_bug.cgi?id=225703
<rdar://problem/77673980>

Reviewed by Alexey Proskuryakov.

* TestWebKitAPI/ios/mainIOS.mm:
(main): Explicitly exit the testing process.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277387 268f45cc-cd09-0410-ab3c-d52691b4dbfc

20 hours agoREGRESSION (r275297): Unexpected autofocus when switching tabs
akeerthi@apple.com [Wed, 12 May 2021 20:40:15 +0000 (20:40 +0000)]
REGRESSION (r275297): Unexpected autofocus when switching tabs
https://bugs.webkit.org/show_bug.cgi?id=225710
<rdar://problem/77542939>

Reviewed by Wenson Hsieh.

r275297 introduced logic to handle a focus environment change by
advancing to the next or previous focusable element, depending on the
focus context's heading direction. This logic enables a tab or a
shift+tab to change the focus from browser chrome directly to an
element on a web page.

However, the focus environment can change through mechanisms other than
tab / shift+tab. One example of this is when a user switches tabs. In
these cases, the UIFocusHeading supplied by the focus context is
UIFocusHeadingNone. Nevertheless, we unconditionally call
`-[WKContentView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]`
when the focus context changes. Consequently, an element on the web page
is always focused when the WKContentView gains focus.

* UIProcess/ios/WKContentView.mm:
(-[WKContentView didUpdateFocusInContext:withAnimationCoordinator:]):

To fix, ensure we only focus an element on the page if the focus heading
is UIFocusHeadingNext or UIFocusHeadingPrevious. UIFocusHeadingNext will
focus the first focusable element, while UIFocusHeadingPrevious will focus
the last focusable element.

Note that a call to `-[WKContentView becomeFirstResponder]` is not made
if the focus heading is UIFocusHeadingNone. From my testing, I observed
that the view already was the first responder in that case.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277386 268f45cc-cd09-0410-ab3c-d52691b4dbfc

20 hours agoRemoving the transform CSS property from the SVG element does not cause invalidation
said@apple.com [Wed, 12 May 2021 20:13:55 +0000 (20:13 +0000)]
Removing the transform CSS property from the SVG element does not cause invalidation
https://bugs.webkit.org/show_bug.cgi?id=225366

Reviewed by Simon Fraser.

Source/WebCore:

If the new or the old RenderStyle includes a transform, the renderer of
the SVG element needs to be repainted.

Test: svg/css/svg-css-transform-dynamic-remove.html

* rendering/svg/RenderSVGModelObject.cpp:
(WebCore::RenderSVGModelObject::styleDidChange):

LayoutTests:

* svg/css/svg-css-transform-dynamic-remove-expected.html: Added.
* svg/css/svg-css-transform-dynamic-remove.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277385 268f45cc-cd09-0410-ab3c-d52691b4dbfc

20 hours agoRemove inline annoatations for static functions in PixelBufferConversion
weinig@apple.com [Wed, 12 May 2021 20:11:20 +0000 (20:11 +0000)]
Remove inline annoatations for static functions in PixelBufferConversion
https://bugs.webkit.org/show_bug.cgi?id=225708

Reviewed by Darin Adler.

Remove inline annoatations for static functions in PixelBufferConversion
as suggested by Darin. The theory here is that outside of a header, the
use of 'inline' serves no purpose as the compiler is perfectly allowed
and capable of inlining these functions.

* platform/graphics/PixelBufferConversion.cpp:
(WebCore::makeVImageBuffer):
(WebCore::convertImagePixelsAccelerated):
(WebCore::convertSinglePixelPremultipliedToPremultiplied):
(WebCore::convertSinglePixelPremultipliedToUnpremultiplied):
(WebCore::convertSinglePixelUnpremultipliedToPremultiplied):
(WebCore::convertSinglePixelUnpremultipliedToUnpremultiplied):
(WebCore::convertFunctor):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277384 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 hours agoImplement some common Baseline JIT slow paths using JIT thunks.
mark.lam@apple.com [Wed, 12 May 2021 19:11:25 +0000 (19:11 +0000)]
Implement some common Baseline JIT slow paths using JIT thunks.
https://bugs.webkit.org/show_bug.cgi?id=225682

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

This patch implements the following changes:

1. Implement exception handling thunks:
   a. handleExceptionGenerator, which calls operationLookupExceptionHandler().
   b. handleExceptionWithCallFrameRollbackGenerator, which calls
      operationLookupExceptionHandlerFromCallerFrame().

   All the JIT tiers were emitting their own copy of these routines to call these
   operation, one per CodeBlock.  We now emit 2 thunks for these and have all the
   tiers just jump to them.

   PolymorphicAccess also now uses the handleExceptionGenerator thunk.

   DFG::JITCompiler::compileExceptionHandlers() has one small behavior difference
   before it calls operationLookupExceptionHandlerFromCallerFrame(): it first
   re-sets the top of stack for the function where we are about to throw a
   StackOverflowError from.  This re-setting of top of stack is useless because
   we're imminently unwinding out of at least this frame for the StackOverflowError.
   Hence, it is ok to use the handleExceptionWithCallFrameRollbackGenerator thunk
   here as well.  Note that no other tiers does this re-setting of top of stack.

   FTLLowerDFGToB3 has one case using operationLookupExceptionHandlerFromCallerFrame()
   which cannot be refactored to use these thunks because it does additional
   work to throw a StackOverflowError.  A different thunk will be needed.  I left
   it alone for now.

2. Introduce JITThunks::existingCTIStub(ThunkGenerator, NoLockingNecessaryTag) so
   that a thunk can get a pointer to another thunk without locking the JITThunks
   lock.  Otherwise, deadlock ensues.

3. Change SlowPathCall to emit and use thunks instead of emitting a blob of code
   to call a slow path function for every bytecode in a CodeBlock.

4. Introduce JITThunks::ctiSlowPathFunctionStub() to manage these SlowPathFunction
   thunks.

5. Introduce JITThunks::preinitializeAggressiveCTIThunks() to initialize these
   thunks at VM initialization time.  Pre-initializing them has multiple benefits:
   a. the thunks are not scattered through out JIT memory, thereby reducing
      fragmentation.
   b. we don't spend time at runtime compiling them when the user is interacting
      with the VM.  Conceptually, these thunks can be VM independent and can be
      shared by VMs process-wide.  However, it will require some additional work.
      For now, the thunks remain bound to a specific VM instance.

These changes are only enabled when ENABLE(EXTRA_CTI_THUNKS), which is currently
only available for ARM64 and non-Windows x86_64.

This patch has passed JSC tests on AS Mac.

With this patch, --dumpLinkBufferStats shows the following changes in emitted
JIT code size (using a single run of the CLI version of JetStream2 on AS Mac):

                Base                     New                      Diff

   BaselineJIT: 89089964 (84.962811 MB)  84624776 (80.704475 MB)  0.95x (reduction)
           DFG: 39117360 (37.305222 MB)  36415264 (34.728302 MB)  0.93x (reduction)
         Thunk: 23230968 (22.154778 MB)  23130336 (22.058807 MB)  1.00x
   InlineCache: 22027416 (21.006981 MB)  21969728 (20.951965 MB)  1.00x
           FTL: 6575772 (6.271145 MB)    6097336 (5.814873 MB)    0.93x (reduction)
          Wasm: 2302724 (2.196049 MB)    2301956 (2.195316 MB)    1.00x
       YarrJIT: 1538956 (1.467663 MB)    1522488 (1.451958 MB)    0.99x
        CSSJIT: 0                        0
 Uncategorized: 0                        0

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Sources.txt:
* bytecode/CodeBlock.h:
(JSC::CodeBlock::offsetOfInstructionsRawPointer):
* bytecode/PolymorphicAccess.cpp:
(JSC::AccessGenerationState::emitExplicitExceptionHandler):
* dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::compileExceptionHandlers):
(JSC::DFG::JITCompiler::link):
* dfg/DFGJITCompiler.h:
* ftl/FTLCompile.cpp:
(JSC::FTL::compile):
* ftl/FTLLink.cpp:
(JSC::FTL::link):
* jit/JIT.cpp:
(JSC::JIT::link):
(JSC::JIT::privateCompileExceptionHandlers):
* jit/JIT.h:
* jit/JITThunks.cpp:
(JSC::JITThunks::existingCTIStub):
(JSC::JITThunks::ctiSlowPathFunctionStub):
(JSC::JITThunks::preinitializeExtraCTIThunks):
* jit/JITThunks.h:
* jit/SlowPathCall.cpp: Added.
(JSC::JITSlowPathCall::call):
(JSC::JITSlowPathCall::generateThunk):
* jit/SlowPathCall.h:
* jit/ThunkGenerators.cpp:
(JSC::handleExceptionGenerator):
(JSC::handleExceptionWithCallFrameRollbackGenerator):
(JSC::popThunkStackPreservesAndHandleExceptionGenerator):
* jit/ThunkGenerators.h:
* runtime/CommonSlowPaths.h:
* runtime/SlowPathFunction.h: Added.
* runtime/VM.cpp:
(JSC::VM::VM):

Source/WTF:

Introduce ENABLE(EXTRA_CTI_THUNKS) flag to guard the use of these new thunks.
Currently, the thunks are 64-bit only, and only supported for ARM64 and non-Windows
X86_64.  The reason it is not supported for Windows as well is because Windows
only has 4 argument registers.  In this patch, the thunks do not use that many
registers yet, but there will be more thunks coming that will require the use
of up to 6 argument registers.

* wtf/PlatformEnable.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277383 268f45cc-cd09-0410-ab3c-d52691b4dbfc

22 hours agoUse HashSet<RefPtr<Node>> instead of HashSet<Node*>
achristensen@apple.com [Wed, 12 May 2021 18:40:38 +0000 (18:40 +0000)]
Use HashSet<RefPtr<Node>> instead of HashSet<Node*>
https://bugs.webkit.org/show_bug.cgi?id=220464

Reviewed by Chris Dumez and Ryosuke Niwa.

This makes us more resistent to lifetime bugs.

liveNodeSet() and ignoreSet() need to be WeakHashSet, and they are only used in debug builds so that's fine.

MutationObserver::observedNodes() is not called on the main thread, but it's called during garbage collection.
I replaced it with MutationObserver::isReachableFromOpaqueRoots which eliminates the HashSet allocation and hashing,
and it can return true early if it finds a contained opaque root, resulting in less work in several ways.
This should only increase our performance slightly while getting the same behavior.

* accessibility/AXObjectCache.cpp:
(WebCore::conditionallyAddNodeToFilterList):
(WebCore::filterVectorPairForRemoval):
(WebCore::filterMapForRemoval):
(WebCore::filterListForRemoval):
(WebCore::AXObjectCache::prepareForDocumentDestruction):
* bindings/js/JSMutationObserverCustom.cpp:
(WebCore::JSMutationObserverOwner::isReachableFromOpaqueRoots):
* dom/MutationObserver.cpp:
(WebCore::MutationObserver::isReachableFromOpaqueRoots const):
(WebCore:: const): Deleted.
* dom/MutationObserver.h:
* dom/MutationObserverRegistration.cpp:
(WebCore::MutationObserverRegistration::isReachableFromOpaqueRoots const):
(WebCore::MutationObserverRegistration::addRegistrationNodesToSet const): Deleted.
* dom/MutationObserverRegistration.h:
* dom/Node.cpp:
(WebCore::liveNodeSet):
(WebCore::stringForRareDataUseType):
(WebCore::Node::dumpStatistics):
(WebCore::ignoreSet):
(WebCore::Node::trackForDebugging):
(WebCore::Node::~Node):
* editing/AppendNodeCommand.cpp:
(WebCore::AppendNodeCommand::getNodesInCommand):
* editing/AppendNodeCommand.h:
* editing/CompositeEditCommand.cpp:
(WebCore::EditCommandComposition::getNodesInCommand):
* editing/CompositeEditCommand.h:
* editing/DeleteFromTextNodeCommand.cpp:
(WebCore::DeleteFromTextNodeCommand::getNodesInCommand):
* editing/DeleteFromTextNodeCommand.h:
* editing/EditCommand.cpp:
(WebCore::SimpleEditCommand::addNodeAndDescendants):
* editing/EditCommand.h:
* editing/InsertIntoTextNodeCommand.cpp:
(WebCore::InsertIntoTextNodeCommand::getNodesInCommand):
* editing/InsertIntoTextNodeCommand.h:
* editing/InsertNodeBeforeCommand.cpp:
(WebCore::InsertNodeBeforeCommand::getNodesInCommand):
* editing/InsertNodeBeforeCommand.h:
* editing/MergeIdenticalElementsCommand.cpp:
(WebCore::MergeIdenticalElementsCommand::getNodesInCommand):
* editing/MergeIdenticalElementsCommand.h:
* editing/RemoveNodeCommand.cpp:
(WebCore::RemoveNodeCommand::getNodesInCommand):
* editing/RemoveNodeCommand.h:
* editing/ReplaceNodeWithSpanCommand.cpp:
(WebCore::ReplaceNodeWithSpanCommand::getNodesInCommand):
* editing/ReplaceNodeWithSpanCommand.h:
* editing/SetNodeAttributeCommand.cpp:
(WebCore::SetNodeAttributeCommand::getNodesInCommand):
* editing/SetNodeAttributeCommand.h:
* editing/SetSelectionCommand.h:
* editing/SpellingCorrectionCommand.cpp:
* editing/SplitElementCommand.cpp:
(WebCore::SplitElementCommand::getNodesInCommand):
* editing/SplitElementCommand.h:
* editing/SplitTextNodeCommand.cpp:
(WebCore::SplitTextNodeCommand::getNodesInCommand):
* editing/SplitTextNodeCommand.h:
* editing/WrapContentsInDummySpanCommand.cpp:
(WebCore::WrapContentsInDummySpanCommand::getNodesInCommand):
* editing/WrapContentsInDummySpanCommand.h:
* editing/cocoa/HTMLConverter.mm:
(HTMLConverterCaches::cacheAncestorsOfStartToBeConverted):
* inspector/agents/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::highlightSelector):
* xml/XPathFunctions.cpp:
(WebCore::XPath::FunId::evaluate const):
* xml/XPathNodeSet.cpp:
(WebCore::XPath::sortBlock):
(WebCore::XPath::NodeSet::traversalSort const):
* xml/XPathPath.cpp:
(WebCore::XPath::LocationPath::evaluate const):
* xml/XPathPredicate.cpp:
(WebCore::XPath::Union::evaluate const):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277382 268f45cc-cd09-0410-ab3c-d52691b4dbfc

22 hours agoUnreviewed, reverting r277346.
commit-queue@webkit.org [Wed, 12 May 2021 18:34:55 +0000 (18:34 +0000)]
Unreviewed, reverting r277346.
https://bugs.webkit.org/show_bug.cgi?id=225705

Introduced a (rare) deadlock

Reverted changeset:

"ConservativeRoots triggers page demand on Speedometer"
https://bugs.webkit.org/show_bug.cgi?id=225676
https://trac.webkit.org/changeset/277346

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277381 268f45cc-cd09-0410-ab3c-d52691b4dbfc

22 hours agoUnreviewed follow-up to r277376.
cdumez@apple.com [Wed, 12 May 2021 18:28:25 +0000 (18:28 +0000)]
Unreviewed follow-up to r277376.

Fix bad early return in NotificationPermissionRequestManager::didReceiveNotificationPermissionDecision().

* WebProcess/Notifications/NotificationPermissionRequestManager.cpp:
(WebKit::NotificationPermissionRequestManager::didReceiveNotificationPermissionDecision):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277380 268f45cc-cd09-0410-ab3c-d52691b4dbfc

22 hours agoHTMLMediaElement::mediaLoadingFailedFatally() does direct dispatch of events; should...
jer.noble@apple.com [Wed, 12 May 2021 18:00:23 +0000 (18:00 +0000)]
HTMLMediaElement::mediaLoadingFailedFatally() does direct dispatch of events; should enqueue
https://bugs.webkit.org/show_bug.cgi?id=225700
<rdar://75576322>

Reviewed by Eric Carlson.

In r274559, an update was made to mediaLoadingFailedFatally to adopt recent spec changes, and as
part of that change, an "error" event was changed from being enqueued to being directly dispatched.
However, directly dispatching events exposes the element to JS and has the potential to cause the
element to be garbage collected, deleting the object and potentially other objects in the backtrace.
Events should always be enqueued, rather than directy dispatched, for this reason.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaLoadingFailedFatally):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277379 268f45cc-cd09-0410-ab3c-d52691b4dbfc

23 hours agoASSERTION FAILED: m_clients.contains(&client) in CSSFontFace::removeClient via CSSSeg...
svillar@igalia.com [Wed, 12 May 2021 17:58:17 +0000 (17:58 +0000)]
ASSERTION FAILED: m_clients.contains(&client) in CSSFontFace::removeClient via CSSSegmentedFontFace::~CSSSegmentedFontFace()
https://bugs.webkit.org/show_bug.cgi?id=223790

Reviewed by Ryosuke Niwa.

Source/WebCore:

CSSFontFace does not support adding the same client twice as it uses a HashSet to track them. This means that
it's a mistake to call removeClient() more than once. This could happen when specifying the same font
family more than once in a <font-face> element inside a svg container.

Test: fast/css/svg-font-face-duplicate-crash.html

* css/CSSFontFaceSet.cpp:
(WebCore::CSSFontFaceSet::fontFace): Skip duplicate CSSFontFace's when before calling appendFontFace().

LayoutTests:

* fast/css/svg-font-face-duplicate-crash-expected.txt: Added.
* fast/css/svg-font-face-duplicate-crash.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277378 268f45cc-cd09-0410-ab3c-d52691b4dbfc

23 hours agoQueue notification permission requests for the same origin on WebKit side
cdumez@apple.com [Wed, 12 May 2021 17:52:38 +0000 (17:52 +0000)]
Queue notification permission requests for the same origin on WebKit side
https://bugs.webkit.org/show_bug.cgi?id=225701
<rdar://76804977>

Reviewed by Geoffrey Garen.

Source/WebCore:

Remove some dead code.

* Modules/notifications/NotificationClient.h:

Source/WebKit:

If there are parallel notification permission requests for the same origin, we now queue them on WebKit
side and only ask the client once for the origin. Once we've received the permission from the client,
we respond to all JS requests at this point.

This patch also removes some dead code to facilitate refactoring the code to support this.
In a follow-up I am planning to use sendWithAsyncReply() and refactor this code further.

* WebProcess/Notifications/NotificationPermissionRequestManager.cpp:
(WebKit::NotificationPermissionRequestManager::startRequest):
(WebKit::NotificationPermissionRequestManager::permissionLevel):
(WebKit::NotificationPermissionRequestManager::didReceiveNotificationPermissionDecision):
* WebProcess/Notifications/NotificationPermissionRequestManager.h:
* WebProcess/Notifications/WebNotificationManager.cpp:
(WebKit::WebNotificationManager::policyForOrigin const):
* WebProcess/Notifications/WebNotificationManager.h:
* WebProcess/WebCoreSupport/WebNotificationClient.cpp:
(WebKit::WebNotificationClient::requestPermission):
(WebKit::WebNotificationClient::checkPermission):
* WebProcess/WebCoreSupport/WebNotificationClient.h:

Source/WebKitLegacy/mac:

Remove some dead code.

* WebCoreSupport/WebNotificationClient.h:
* WebCoreSupport/WebNotificationClient.mm:

Source/WebKitLegacy/win:

Remove some dead code.

* WebCoreSupport/WebDesktopNotificationsDelegate.cpp:
* WebCoreSupport/WebDesktopNotificationsDelegate.h:

Tools:

Add API test coverage.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/NotificationAPI.mm: Added.
(-[NotificationPermissionMessageHandler userContentController:didReceiveScriptMessage:]):
(-[NotificationPermissionUIDelegate initWithHandler:]):
(-[NotificationPermissionUIDelegate _webView:requestNotificationPermissionForSecurityOrigin:decisionHandler:]):
(TestWebKitAPI::runRequestPermissionTest):
(TestWebKitAPI::TEST):
(TestWebKitAPI::runParallelPermissionRequestsTest):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277376 268f45cc-cd09-0410-ab3c-d52691b4dbfc

23 hours agoCrash in WebPageProxy::endColorPicker()
commit-queue@webkit.org [Wed, 12 May 2021 17:46:26 +0000 (17:46 +0000)]
Crash in WebPageProxy::endColorPicker()
https://bugs.webkit.org/show_bug.cgi?id=225679

Patch by Julian Gonzalez <julian_a_gonzalez@apple.com> on 2021-05-12
Reviewed by Ryosuke Niwa.

Make sure that endColorPicker() and didEndColorPicker()
do not both attempt to null-out m_colorPicker.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::endColorPicker):
(WebKit::WebPageProxy::didEndColorPicker):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277375 268f45cc-cd09-0410-ab3c-d52691b4dbfc

23 hours agoSource/WebCore:
rniwa@webkit.org [Wed, 12 May 2021 17:13:20 +0000 (17:13 +0000)]
Source/WebCore:
REGRESSION: Release assert in SlotAssignment::assignedNodesForSlot via ComposedTreeIterator::traverseNextInShadowTree
in Element::insertedIntoAncestor
https://bugs.webkit.org/show_bug.cgi?id=225684

Reviewed by Darin Adler.

The release assertion failure was caused by RenderTreeUpdater::tearDownRenderers end up traversing the parts of the DOM
for which Element::insertedIntoAncestor had not been called yet. Since HTMLSlotElement::insertedIntoAncestor is where
SlotAssignment::Slot is updated for a newly inserted slot, SlotAssignment::Slot may not contain this slot element.

Fixed the bug by returning early in SlotAssignment::assignedNodesForSlot when this condition holds, which is when
the shadow root is connected to a document but HTMLSlotElement isn't since its connected flag has not been updated yet.

Test: fast/shadow-dom/insert-host-child-with-slot-renderer-teardown-crash.html

* dom/SlotAssignment.cpp:
(WebCore::SlotAssignment::assignedNodesForSlot):

LayoutTests:
REGRESSION: Release assert in SlotAssignment::assignedNodesForSlot via ComposedTreeIterator::traverseNextInShadowTree in Element::insertedIntoAncestor
https://bugs.webkit.org/show_bug.cgi?id=225684

Reviewed by Darin Adler.

Added a regression test.

* fast/shadow-dom/insert-host-child-with-slot-renderer-teardown-crash-expected.txt: Added.
* fast/shadow-dom/insert-host-child-with-slot-renderer-teardown-crash.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277373 268f45cc-cd09-0410-ab3c-d52691b4dbfc

24 hours agoImplement TextTrackPrivateRemote::inBandMetadataTrackDispatchType()
peng.liu6@apple.com [Wed, 12 May 2021 16:59:44 +0000 (16:59 +0000)]
Implement TextTrackPrivateRemote::inBandMetadataTrackDispatchType()
https://bugs.webkit.org/show_bug.cgi?id=225674

Reviewed by Eric Carlson.

Source/WebCore:

Remove an unused function in `InbandTextTrackPrivate`.

* platform/graphics/InbandTextTrackPrivate.h:
(WebCore::InbandTextTrackPrivate::textTrackIndex const): Deleted.

Source/WebKit:

This patch ensures that `InbandTextTrack::inBandMetadataTrackDispatchType()`
behaviors the same no matter "Media in GPU Process" is enabled or not.

* GPUProcess/media/RemoteTextTrackProxy.cpp:
(WebKit::RemoteTextTrackProxy::configuration):
* WebProcess/GPU/media/TextTrackPrivateRemote.cpp:
(WebKit::TextTrackPrivateRemote::updateConfiguration):
* WebProcess/GPU/media/TextTrackPrivateRemote.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277372 268f45cc-cd09-0410-ab3c-d52691b4dbfc

24 hours ago[css-flexbox] Do not use margins when computing aspect ratio cross sizes
svillar@igalia.com [Wed, 12 May 2021 15:59:48 +0000 (15:59 +0000)]
[css-flexbox] Do not use margins when computing aspect ratio cross sizes
https://bugs.webkit.org/show_bug.cgi?id=221210
LayoutTests/imported/w3c:

<rdar://problem/74097534>

Reviewed by Javier Fernandez.

* web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-row-013-expected.txt:
 Replaced FAIL by PASS expectations + new expectations.
* web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-row-013.html: Imported
latest changes from upstream WPT.

Source/WebCore:

Reviewed by Javier Fernandez.

In r270578 we implemented section 9.8.1 of the flexbox specs which allowed us to compute child's
indefinite cross sizes as definite when the flexbox container had a definite cross size and a couple
of other conditions. However we did not take into account that the child might have some margins in
in the cross direction. Aspect ratio computations must use the content box and thus, we need to
substract the margin extent before trying to compute a cross size based on an aspect ratio.

Note that when computeMainSizeFromAspectRatioUsing() is called the child might not have been ever
laid out. This means that the margins wouldn't have been computed and thus marginXXX() would always
return 0. That's why crossAxisMarginExtentForChild() was also modified so that it actually computes
the margins in case the child needs to be laid out.

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::crossAxisMarginExtentForChild const):
(WebCore::RenderFlexibleBox::computeMainSizeFromAspectRatioUsing const):

LayoutTests:

Reviewed by Javier Fernandez.

* TestExpectations: Unskipped flex-aspect-ratio-img-row-013.html which is now passing.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277371 268f45cc-cd09-0410-ab3c-d52691b4dbfc

25 hours agoRemove dead code around ENABLE(OPCODE_SAMPLING) and ENABLE(CODEBLOCK_SAMPLING).
mark.lam@apple.com [Wed, 12 May 2021 15:48:26 +0000 (15:48 +0000)]
Remove dead code around ENABLE(OPCODE_SAMPLING) and ENABLE(CODEBLOCK_SAMPLING).
https://bugs.webkit.org/show_bug.cgi?id=225699

Reviewed by Tadeu Zagallo.

This code revolves around an Interpreter::sampler() method which returns a
SamplingTool*.  Neither the Interpreter method nor the SamplingTool class exists
anymore.

* jit/JIT.cpp:
(JSC::JIT::privateCompileMainPass):
(JSC::JIT::compileWithoutLinking):
* jit/JIT.h:
* jit/JITCall.cpp:
(JSC::JIT::compileCallEval):
(JSC::JIT::compileCallEvalSlowCase):
(JSC::JIT::compileOpCall):
(JSC::JIT::compileOpCallSlowCase):
* jit/JITCall32_64.cpp:
(JSC::JIT::compileCallEval):
(JSC::JIT::compileCallEvalSlowCase):
(JSC::JIT::compileOpCall):
(JSC::JIT::compileOpCallSlowCase):
* jit/JITInlines.h:
(JSC::JIT::sampleInstruction): Deleted.
(JSC::JIT::sampleCodeBlock): Deleted.
* jit/JITOperations.cpp:
* jit/SlowPathCall.h:
(JSC::JITSlowPathCall::call):
* runtime/ScriptExecutable.h:
(JSC::ScriptExecutable::finishCreation): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277370 268f45cc-cd09-0410-ab3c-d52691b4dbfc

26 hours agoFactor copyImagePixels pixel conversion code into its own file
weinig@apple.com [Wed, 12 May 2021 14:51:31 +0000 (14:51 +0000)]
Factor copyImagePixels pixel conversion code into its own file
https://bugs.webkit.org/show_bug.cgi?id=225673

Reviewed by Darin Adler.

Removes virtual ImageBufferBackend::copyImagePixels() function and
moves functionality to new PixelBufferConversion.h/cpp.

Merge USE(ACCELERATE) code from ImageBufferCGBackend into the same
file and do some light cleanup.

- Function renamed to covert convertImagePixels to convey that it is
  doing more than copying.
- Add PixelBufferConversionView/ConstPixelBufferConversionView structs
  to hold parameters for the conversions, including a ColorSpace member
  that is not yet used but will be shortly.
- Uses constexpr conditionals in unaccelerated cases to hoist branch
  checking for pixel format conversion requirements outside the main
  loop.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
Add new files.

* platform/graphics/PixelBufferConversion.cpp: Added.
(WebCore::makeVImageBuffer):
(WebCore::convertImagePixelsAccelerated):
(WebCore::convertSinglePixelPremultipliedToPremultiplied):
(WebCore::convertSinglePixelPremultipliedToUnpremultiplied):
(WebCore::convertSinglePixelUnpremultipliedToPremultiplied):
(WebCore::convertSinglePixelUnpremultipliedToUnpremultiplied):
(WebCore::convertFunctor):
(WebCore::convertImagePixels):
* platform/graphics/PixelBufferConversion.h: Added.
Move existing copyImagePixels implementations here.

* platform/graphics/ImageBufferBackend.cpp:
(WebCore::ImageBufferBackend::toBGRAData const):
(WebCore::ImageBufferBackend::getPixelBuffer const):
(WebCore::ImageBufferBackend::putPixelBuffer):
(WebCore::copyPremultipliedToPremultiplied): Deleted.
(WebCore::copyPremultipliedToUnpremultiplied): Deleted.
(WebCore::copyUnpremultipliedToPremultiplied): Deleted.
(WebCore::copyUnpremultipliedToUnpremultiplied): Deleted.
(WebCore::copyFunctor): Deleted.
(WebCore::ImageBufferBackend::copyImagePixels const): Deleted.
* platform/graphics/ImageBufferBackend.h:
* platform/graphics/cg/ImageBufferCGBackend.cpp:
(WebCore::makeVImageBuffer): Deleted.
(WebCore::copyImagePixelsAccelerated): Deleted.
(WebCore::ImageBufferCGBackend::copyImagePixels const): Deleted.
* platform/graphics/cg/ImageBufferCGBackend.h:
Remove existing copyImagePixels() implementation and call new
convertImagePixels() instead.

* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::copyUnmultipliedResult):
(WebCore::FilterEffect::copyPremultipliedResult):
(WebCore::FilterEffect::createUnmultipliedImageResult):
(WebCore::FilterEffect::createPremultipliedImageResult):
Fix pixel format for the PixelBuffers to match existing behaviors.
These are not being used at the moment but will in the future
and new assert in putPixelBuffer caught these being incorrect.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277369 268f45cc-cd09-0410-ab3c-d52691b4dbfc

26 hours ago[GLIB] Unreviewed test gardening. media/track/in-band/track-in-band-srt-mkv-kind...
dpino@igalia.com [Wed, 12 May 2021 14:33:51 +0000 (14:33 +0000)]
[GLIB] Unreviewed test gardening. media/track/in-band/track-in-band-srt-mkv-kind.html is a flaky crash.

* platform/glib/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277368 268f45cc-cd09-0410-ab3c-d52691b4dbfc

26 hours agoUnreviewed, reverting r277320 and r277329.
commit-queue@webkit.org [Wed, 12 May 2021 14:17:38 +0000 (14:17 +0000)]
Unreviewed, reverting r277320 and r277329.
https://bugs.webkit.org/show_bug.cgi?id=225698

Added broken test fast/css/visited-link-mix-blend-mode.html

Reverted changesets:

"Don't allow :visited link style in subtrees that use mix-
blend-mode"
https://bugs.webkit.org/show_bug.cgi?id=225446
https://trac.webkit.org/changeset/277320

"Don't allow :visited link style in subtrees that use mix-
blend-mode"
https://bugs.webkit.org/show_bug.cgi?id=225446
https://trac.webkit.org/changeset/277329

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277367 268f45cc-cd09-0410-ab3c-d52691b4dbfc

27 hours ago[GTK] Unreviewed test gardening. Update baselines for GTK.
dpino@igalia.com [Wed, 12 May 2021 13:37:43 +0000 (13:37 +0000)]
[GTK] Unreviewed test gardening. Update baselines for GTK.

Remove stale GTK baseline after r277321.
Emit new GTK baseline after WPT update in r277160.

* platform/gtk/imported/w3c/web-platform-tests/css/css-flexbox/flex-item-contains-strict-expected.txt: Removed.
* platform/gtk/imported/w3c/web-platform-tests/css/mediaqueries/test_media_queries-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277366 268f45cc-cd09-0410-ab3c-d52691b4dbfc

28 hours agoAdopt CoreMedia SPI to identify audio-only playback for MSE clients
jya@apple.com [Wed, 12 May 2021 12:47:55 +0000 (12:47 +0000)]
Adopt CoreMedia SPI to identify audio-only playback for MSE clients
https://bugs.webkit.org/show_bug.cgi?id=225647
rdar://76138365

Reviewed by Youenn Fablet.

Source/WebCore:

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
  tells whether the AVSBAR is attached to an <audio> or <video> element.

Source/WebCore/PAL:

* pal/spi/cocoa/AVFoundationSPI.h: Add forward declaration for new methods
  while this isn't in SDK yet.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277365 268f45cc-cd09-0410-ab3c-d52691b4dbfc

32 hours agoIntroduce an internal unit to render audio MediaStreamTrack(s)
youenn@apple.com [Wed, 12 May 2021 08:57:38 +0000 (08:57 +0000)]
Introduce an internal unit to render audio MediaStreamTrack(s)
https://bugs.webkit.org/show_bug.cgi?id=225601

Reviewed by Eric Carlson.

Source/WebCore:

Move files from platform/mediastream/mac to platform/mediastream/cocoa since they are used in both iOS and macOS.
Move Audio Unit functionality out of AudioMediaStreamTrackRendererUnit.
AudioMediaStreamTrackRendererUnit is responsible to manage sources and do the mixing.
To actually render audio, it will use an InternalUnit, which is currently done in process.

A future work will add support for a remote InternalUnit, that would run on GPUProcess.
To prepare for that, a callback allows customizing the Internal Unit creation.
We also change renderer start to be asynchronous, since it requires fetching the audio description from GPUProcess.

No change of behavior, covered by existing tests.

* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/audio/cocoa/AudioSampleBufferList.h:
* platform/mediastream/AudioMediaStreamTrackRenderer.h:
* platform/mediastream/AudioTrackPrivateMediaStream.cpp:
(WebCore::AudioTrackPrivateMediaStream::startRenderer):
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererCocoa.cpp: Renamed from Source/WebCore/platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.cpp.
(WebCore::AudioMediaStreamTrackRendererCocoa::start):
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererCocoa.h: Copied from Source/WebCore/platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.h.
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererInternalUnit.cpp: Renamed from Source/WebCore/platform/mediastream/mac/AudioMediaStreamTrackRendererUnit.cpp.
(WebCore::AudioMediaStreamTrackRendererInternalUnit::createLocalInternalUnit):
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::LocalAudioMediaStreamTrackRendererInternalUnit):
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::retrieveFormatDescription):
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::setAudioOutputDevice):
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::start):
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::stop):
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::createAudioUnitIfNeeded):
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::renderingCallback):
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererInternalUnit.h: Renamed from Source/WebCore/platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.h.
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererUnit.cpp: Added.
(WebCore::getCreateInternalUnitFunction):
(WebCore::AudioMediaStreamTrackRendererUnit::setCreateInternalUnitFunction):
(WebCore::createInternalUnit):
(WebCore::AudioMediaStreamTrackRendererUnit::singleton):
(WebCore::AudioMediaStreamTrackRendererUnit::AudioMediaStreamTrackRendererUnit):
(WebCore::AudioMediaStreamTrackRendererUnit::~AudioMediaStreamTrackRendererUnit):
(WebCore::AudioMediaStreamTrackRendererUnit::setAudioOutputDevice):
(WebCore::AudioMediaStreamTrackRendererUnit::addSource):
(WebCore::AudioMediaStreamTrackRendererUnit::removeSource):
(WebCore::AudioMediaStreamTrackRendererUnit::start):
(WebCore::AudioMediaStreamTrackRendererUnit::stop):
(WebCore::AudioMediaStreamTrackRendererUnit::retrieveFormatDescription):
(WebCore::AudioMediaStreamTrackRendererUnit::render):
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererUnit.h: Renamed from Source/WebCore/platform/mediastream/mac/AudioMediaStreamTrackRendererUnit.h.

Source/WebKit:

Update according new WebCore API.

* GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp:
(WebKit::RemoteAudioMediaStreamTrackRenderer::start):
* WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.cpp:
(WebKit::AudioMediaStreamTrackRenderer::start):
* WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277364 268f45cc-cd09-0410-ab3c-d52691b4dbfc

32 hours ago[GTK] Unreviewed test gardening. Gardened several test failures from GTK post-commit...
dpino@igalia.com [Wed, 12 May 2021 08:48:25 +0000 (08:48 +0000)]
[GTK] Unreviewed test gardening. Gardened several test failures from GTK post-commit bot.

* platform/gtk/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277363 268f45cc-cd09-0410-ab3c-d52691b4dbfc

32 hours agoREGRESSION(r277083): Proximity scroll snap is broken on iOS
commit-queue@webkit.org [Wed, 12 May 2021 08:09:06 +0000 (08:09 +0000)]
REGRESSION(r277083): Proximity scroll snap is broken on iOS
https://bugs.webkit.org/show_bug.cgi?id=225649

Patch by Martin Robinson <mrobinson@igalia.com> on 2021-05-12
Reviewed by Simon Fraser.

No new tests. iOS does not have great support for the event sending test
infrastructure used to test scroll snap.

* Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
(ArgumentCoder<FloatScrollSnapOffsetsInfo>::encode): Include the snap type when encoding ScrollSnapOffsetsInfo.
(ArgumentCoder<FloatScrollSnapOffsetsInfo>::decode): Include the snap type when decoding ScrollSnapOffsetsInfo.
* Shared/WebCoreArgumentCoders.h: Added EnumTraits for ScrollSnapStrictness.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277362 268f45cc-cd09-0410-ab3c-d52691b4dbfc

32 hours agoEnumerate AVCaptureDevice list in a background thread
youenn@apple.com [Wed, 12 May 2021 08:05:19 +0000 (08:05 +0000)]
Enumerate AVCaptureDevice list in a background thread
https://bugs.webkit.org/show_bug.cgi?id=225643
<rdar://problem/77820002>

Reviewed by Eric Carlson.

Enumerate AVCaptureDevice in a background queue asynchronously.
Delay getUserMedia and enumerateDevices until this is completed.

Update RealtimeMediaSourceCenter accordingly and introduce RealtimeMediaSourceCenter::enumerateDevices for that purpose.
Replace getCaptureDevices by computeCaptureDevices to do the async computation.
Continue using captureDevices() getters.

Manually tested.

* platform/mediastream/CaptureDevice.h:
(WebCore::CaptureDevice::CaptureDevice):
(WebCore::CaptureDevice::isolatedCopy):
* platform/mediastream/CaptureDeviceManager.h:
* platform/mediastream/RealtimeMediaSourceCenter.cpp:
(WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices):
(WebCore::RealtimeMediaSourceCenter::enumerateDevices):
(WebCore::RealtimeMediaSourceCenter::validateRequestConstraints):
(WebCore::RealtimeMediaSourceCenter::validateRequestConstraintsAfterEnumeration):
* platform/mediastream/RealtimeMediaSourceCenter.h:
* platform/mediastream/RealtimeMediaSourceFactory.h:
(WebCore::AudioCaptureFactory::computeSpeakerDevices const):
* platform/mediastream/ios/AVAudioSessionCaptureDevice.mm:
(WebCore::AVAudioSessionCaptureDevice::AVAudioSessionCaptureDevice):
* platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h:
* platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
(WebCore::AVAudioSessionCaptureDeviceManager::scheduleUpdateCaptureDevices):
(WebCore::AVAudioSessionCaptureDeviceManager::computeCaptureDevices):
* platform/mediastream/mac/AVCaptureDeviceManager.h:
* platform/mediastream/mac/AVCaptureDeviceManager.mm:
(WebCore::AVCaptureDeviceManager::computeCaptureDevices):
(WebCore::AVCaptureDeviceManager::captureDevices):
(WebCore::AVCaptureDeviceManager::updateCachedAVCaptureDevices):
(WebCore::AVCaptureDeviceManager::retrieveCaptureDevices):
(WebCore::AVCaptureDeviceManager::refreshCaptureDevices):
(WebCore::AVCaptureDeviceManager::AVCaptureDeviceManager):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277361 268f45cc-cd09-0410-ab3c-d52691b4dbfc

33 hours ago[ macOS wk2 ] http/wpt/mediarecorder/set-srcObject-MediaStream-Blob.html (layout...
youenn@apple.com [Wed, 12 May 2021 07:56:39 +0000 (07:56 +0000)]
[ macOS wk2 ] http/wpt/mediarecorder/set-srcObject-MediaStream-Blob.html (layout-test) is a flaky text failure
https://bugs.webkit.org/show_bug.cgi?id=225500
<rdar://problem/77636573>

Reviewed by Eric Carlson.

* http/wpt/mediarecorder/set-srcObject-MediaStream-Blob.html:
Make sure video1 is playing to get its duration.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277360 268f45cc-cd09-0410-ab3c-d52691b4dbfc

33 hours agofast/mediastream/getUserMedia-webaudio.html is flaky
youenn@apple.com [Wed, 12 May 2021 07:54:27 +0000 (07:54 +0000)]
fast/mediastream/getUserMedia-webaudio.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=225655
<rdar://74158395>

Reviewed by Eric Carlson.

* fast/mediastream/getUserMedia-webaudio.html:
Retry several time instead of just once when detecting no noise to improve robustness.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277359 268f45cc-cd09-0410-ab3c-d52691b4dbfc

34 hours agoInclude reasons for compositing in showLayerTree output
heycam@apple.com [Wed, 12 May 2021 06:04:18 +0000 (06:04 +0000)]
Include reasons for compositing in showLayerTree output
https://bugs.webkit.org/show_bug.cgi?id=225640

Reviewed by Simon Fraser.

Source/WebCore:

Since it seems useful to know why a layer is composited.

The logging code was only including one reason, rather than the
whole set of reasons, and that's unchanged (except for the function
name to make that clearer), although we could also just make that
include all of the reasons too.

There were two reason strings missing, which are also added --
OverflowScrollPositioning and WillChange -- which the use of a
switch should help catch in the future.

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::logLayerInfo):
(WebCore::compositingReasonToString):
(WebCore::RenderLayerCompositor::logReasonsForCompositing):
(WebCore::operator<<):
* rendering/RenderLayerCompositor.h:
* rendering/RenderTreeAsText.cpp:

LayoutTests:

* fast/harness/render-tree-as-text-options-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277358 268f45cc-cd09-0410-ab3c-d52691b4dbfc

35 hours agoPort WTF::FileSystem::listDirectory to std::filesystem
cdumez@apple.com [Wed, 12 May 2021 05:55:23 +0000 (05:55 +0000)]
Port WTF::FileSystem::listDirectory to std::filesystem
https://bugs.webkit.org/show_bug.cgi?id=225633

Reviewed by Darin Adler.

Source/WebCore:

Update FileSystem::listDirectory() call sites to deal with the fact that:
- The function now returns file names instead of full file paths
- The callers now have to do filtering by themselves if they need it

* Modules/entriesapi/DOMFileSystem.cpp:
(WebCore::listDirectoryWithMetadata):
* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::getAllDatabaseNamesAndVersions):
(WebCore::IDBServer::collectOriginsForVersion):
(WebCore::IDBServer::removeAllDatabasesForFullOriginPath):
(WebCore::IDBServer::removeAllDatabasesForOriginPath):
(WebCore::IDBServer::IDBServer::removeDatabasesModifiedSinceForVersion):
(WebCore::IDBServer::IDBServer::removeDatabasesWithOriginsForVersion):
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::fullDatabaseDirectoryWithUpgrade):
(WebCore::IDBServer::SQLiteIDBBackingStore::databasesSizeForDirectory):
* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::usage):
(WebCore::DatabaseTracker::deleteOrigin):
* html/DirectoryFileListCreator.cpp:
(WebCore::appendDirectoryFiles):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::uriDecodeBinElementAddedCallback):
(WebCore::MediaPlayerPrivateGStreamer::purgeOldDownloadFiles):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
* platform/text/hyphen/HyphenationLibHyphen.cpp:
(WebCore::extractLocaleFromDictionaryFileName):
(WebCore::scanDirectoryForDictionaries):

Source/WebKit:

Update FileSystem::listDirectory() call sites to deal with the fact that:
- The function now returns file names instead of full file paths
- The callers now have to do filtering by themselves if they need it

* NetworkProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
(WebKit::LocalStorageDatabaseTracker::origins const):
* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::getDirectorySize):
(WebKit::CacheStorage::Engine::getDirectories):
(WebKit::CacheStorage::Engine::clearAllCachesFromDisk):
* NetworkProcess/cache/NetworkCacheFileSystem.cpp:
(WebKit::NetworkCache::traverseDirectory):
* UIProcess/API/APIContentRuleListStore.cpp:
(API::ContentRuleListStore::getAvailableContentRuleListIdentifiers):
(API::ContentRuleListStore::synchronousRemoveAllContentRuleLists):
* UIProcess/DeviceIdHashSaltStorage.cpp:
(WebKit::DeviceIdHashSaltStorage::loadStorageFromDisk):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::mediaKeyOrigins):
(WebKit::WebsiteDataStore::removeMediaKeys):
* WebProcess/InjectedBundle/API/glib/WebKitExtensionManager.cpp:
(WebKit::WebKitExtensionManager::scanModules):
* WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
(WebKit::WebMediaKeyStorageManager::getMediaKeyOrigins):
(WebKit::removeAllMediaKeyStorageForOriginPath):
(WebKit::WebMediaKeyStorageManager::deleteMediaKeyEntriesModifiedBetweenDates):
(WebKit::WebMediaKeyStorageManager::deleteAllMediaKeyEntries):

Source/WebKitLegacy:

Update FileSystem::listDirectory() call sites to deal with the fact that:
- The function now returns file names instead of full file paths
- The callers now have to do filtering by themselves if they need it

* Storage/StorageTracker.cpp:
(WebKit::StorageTracker::syncFileSystemAndTrackerDatabase):

Source/WebKitLegacy/win:

Update FileSystem::listDirectory() call sites to deal with the fact that:
- The function now returns file names instead of full file paths
- The callers now have to do filtering by themselves if they need it

* Plugins/PluginDatabase.cpp:
(WebCore::PluginDatabase::getPluginPathsInDirectories const):

Source/WTF:

Port WTF::FileSystem::listDirectory to std::filesystem with the following 2 changes:
- The function no longer takes a (blob-style) filter parameter
- The function now returns file names instead of file paths, allowing the call sites
  to more easily filter based on prefixes.

* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::listDirectory):
* wtf/FileSystem.h:
* wtf/glib/FileSystemGlib.cpp:
* wtf/posix/FileSystemPOSIX.cpp:
* wtf/win/FileSystemWin.cpp:

Tools:

Add API test coverage.

* TestWebKitAPI/Tests/WTF/FileSystem.cpp:
(TestWebKitAPI::createTestFile):
(TestWebKitAPI::TEST_F):
* TestWebKitAPI/Tests/WebCore/cocoa/DatabaseTrackerTest.mm:
(TestWebKitAPI::removeDirectoryAndAllContents):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277357 268f45cc-cd09-0410-ab3c-d52691b4dbfc

35 hours agoAdd SPI to suspend / resume a WKWebView
cdumez@apple.com [Wed, 12 May 2021 05:53:13 +0000 (05:53 +0000)]
Add SPI to suspend / resume a WKWebView
https://bugs.webkit.org/show_bug.cgi?id=225333
<rdar://77462543>

Reviewed by Geoff Garen.

Source/WebCore:

Add new function to BackForwardCache to suspend a page and return a CachedPage
instead of requiring a HistoryItem and storing the CachedPage on that history
item. This is useful when we want to suspend the page in-place and do not want
to require a history item (or a navigation).

* Headers.cmake:
* history/BackForwardCache.cpp:
(WebCore::BackForwardCache::trySuspendPage):
(WebCore::BackForwardCache::addIfCacheable):
(WebCore::BackForwardCache::suspendPage):
* history/BackForwardCache.h:
* history/CachedPage.h:

Source/WebKit:

Add SPI to suspend / resume a WKWebView. This suspends the page as if it was in
the back/forward cache but the suspension happens in-place, no need to navigate.
The suspended page is also not part of the Back/Forward cache so its cap on the
number of suspended pages does not apply here.

Most of WKWebView's API / SPI will throw an exception when called on a suspended
view (The WKPageRefAPI will RELEASE_ASSERT()). Some of the basic API will stay
functional (URL, isLoading, title, ...). It is also safe to deallocate / close
a suspended WKWebView.

* UIProcess/API/C/WKPage.cpp:
(crashIfPageIsSuspended):
(WKPageLoadURL):
(WKPageLoadURLWithShouldOpenExternalURLsPolicy):
(WKPageLoadURLWithUserData):
(WKPageLoadURLRequest):
(WKPageLoadURLRequestWithUserData):
(WKPageLoadFile):
(WKPageLoadFileWithUserData):
(WKPageLoadData):
(WKPageLoadDataWithUserData):
(WKPageLoadHTMLString):
(WKPageLoadHTMLStringWithUserData):
(WKPageLoadAlternateHTMLString):
(WKPageLoadAlternateHTMLStringWithUserData):
(WKPageLoadPlainTextString):
(WKPageLoadPlainTextStringWithUserData):
(WKPageLoadWebArchiveData):
(WKPageLoadWebArchiveDataWithUserData):
(WKPageStopLoading):
(WKPageReload):
(WKPageReloadWithoutContentBlockers):
(WKPageReloadFromOrigin):
(WKPageReloadExpiredOnly):
(WKPageTryClose):
(WKPageClose):
(WKPageGoForward):
(WKPageGoBack):
(WKPageGoToBackForwardListItem):
(WKPageTryRestoreScrollPosition):
(WKPageUpdateWebsitePolicies):
(WKPageSetApplicationNameForUserAgent):
(WKPageSetCustomUserAgent):
(WKPageSetCustomTextEncodingName):
(WKPageTerminate):
(WKPageRestoreFromSessionState):
(WKPageRestoreFromSessionStateWithoutNavigation):
(WKPageSetCustomBackingScaleFactor):
(WKPageSetTextZoomFactor):
(WKPageSetPageZoomFactor):
(WKPageSetPageAndTextZoomFactors):
(WKPageSetScaleFactor):
(WKPageSetUseFixedLayout):
(WKPageSetFixedLayoutSize):
(WKPageListenForLayoutMilestones):
(WKPageSetSuppressScrollbarAnimations):
(WKPageSetRubberBandsAtLeft):
(WKPageSetRubberBandsAtRight):
(WKPageSetRubberBandsAtTop):
(WKPageSetRubberBandsAtBottom):
(WKPageSetEnableVerticalRubberBanding):
(WKPageSetEnableHorizontalRubberBanding):
(WKPageSetBackgroundExtendsBeyondPage):
(WKPageSetPaginationMode):
(WKPageSetPaginationBehavesLikeColumns):
(WKPageSetPageLength):
(WKPageSetGapBetweenPages):
(WKPageSetPaginationLineGridEnabled):
(WKPageSetMaintainsInactiveSelection):
(WKPageCenterSelectionInVisibleArea):
(WKPageFindStringMatches):
(WKPageGetImageForFindMatch):
(WKPageSelectFindMatch):
(WKPageFindString):
(WKPageHideFindUI):
(WKPageCountStringMatches):
(WKPageSetPageContextMenuClient):
(WKPageSetPageFindClient):
(WKPageSetPageFindMatchesClient):
(WKPageSetPageInjectedBundleClient):
(WKPageSetPageFormClient):
(WKPageSetPageLoaderClient):
(WKPageSetPagePolicyClient):
(WKPageSetPageUIClient):
(WKPageSetPageNavigationClient):
(WKPageSetPageStateClient):
(WKPageRunJavaScriptInMainFrame):
(WKPageRunJavaScriptInMainFrame_b):
(WKPageRenderTreeExternalRepresentation):
(WKPageGetSourceForFrame):
(WKPageGetContentsAsString):
(WKPageGetBytecodeProfile):
(WKPageGetSamplingProfilerOutput):
(WKPageGetSelectionAsWebArchiveData):
(WKPageGetContentsAsMHTMLData):
(WKPageForceRepaint):
(WKPageValidateCommand):
(WKPageExecuteCommand):
(WKPageComputePagesForPrinting):
(WKPageDrawPagesToPDF):
(WKPageBeginPrinting):
(WKPageEndPrinting):
(WKPageSetControlledByAutomation):
(WKPageSetAllowsRemoteInspection):
(WKPageSetMediaVolume):
(WKPageSetMuted):
(WKPageSetMediaCaptureEnabled):
(WKPageDidAllowPointerLock):
(WKPageClearUserMediaState):
(WKPageDidDenyPointerLock):
(WKPageSetMayStartMediaWhenInWindow):
(WKPageSelectContextMenuItem):
(WKPageSetScrollPinningBehavior):
(WKPageSetAddsVisitedLinks):
(WKPageClearWheelEventTestMonitor):
(WKPageCallAfterNextPresentationUpdate):
(WKPageSetIgnoresViewportScaleLimits):
(WKPageGetApplicationManifest_b):
(WKPageDumpPrivateClickMeasurement):
(WKPageClearPrivateClickMeasurement):
(WKPageSetPrivateClickMeasurementOverrideTimerForTesting):
(WKPageMarkAttributedPrivateClickMeasurementsAsExpiredForTesting):
(WKPageSimulateResourceLoadStatisticsSessionRestart):
(WKPageSetPrivateClickMeasurementTokenPublicKeyURLForTesting):
(WKPageSetPrivateClickMeasurementTokenSignatureURLForTesting):
(WKPageSetPrivateClickMeasurementAttributionReportURLsForTesting):
(WKPageMarkPrivateClickMeasurementsAsExpiredForTesting):
(WKPageSetPCMFraudPreventionValuesForTesting):
(WKPageSetMockCameraOrientation):
(WKPageLoadedSubresourceDomains):
(WKPageClearLoadedSubresourceDomains):
(WKPageSetMediaCaptureReportingDelayForTesting):
(WKPageDispatchActivityStateUpdateForTesting):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView loadRequest:]):
(-[WKWebView loadFileURL:allowingReadAccessToURL:]):
(-[WKWebView loadHTMLString:baseURL:]):
(-[WKWebView loadData:MIMEType:characterEncodingName:baseURL:]):
(-[WKWebView startDownloadUsingRequest:completionHandler:]):
(-[WKWebView resumeDownloadFromResumeData:completionHandler:]):
(-[WKWebView goToBackForwardListItem:]):
(-[WKWebView goBack]):
(-[WKWebView goForward]):
(-[WKWebView reload]):
(-[WKWebView reloadFromOrigin]):
(-[WKWebView stopLoading]):
(-[WKWebView evaluateJavaScript:completionHandler:]):
(-[WKWebView evaluateJavaScript:inFrame:inContentWorld:completionHandler:]):
(-[WKWebView callAsyncJavaScript:arguments:inFrame:inContentWorld:completionHandler:]):
(-[WKWebView closeAllMediaPresentationsWithCompletionHandler:]):
(-[WKWebView pauseAllMediaPlaybackWithCompletionHandler:]):
(-[WKWebView setAllMediaPlaybackSuspended:completionHandler:]):
(-[WKWebView requestMediaPlaybackStateWithCompletionHandler:]):
(-[WKWebView setMicrophoneCaptureState:completionHandler:]):
(-[WKWebView setCameraCaptureState:completionHandler:]):
(-[WKWebView _evaluateJavaScript:asAsyncFunction:withSourceURL:withArguments:forceUserGesture:inFrame:inWorld:completionHandler:]):
(-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
(-[WKWebView setAllowsBackForwardNavigationGestures:]):
(-[WKWebView setCustomUserAgent:]):
(-[WKWebView setAllowsLinkPreview:]):
(-[WKWebView setPageZoom:]):
(-[WKWebView findString:withConfiguration:completionHandler:]):
(-[WKWebView setMediaType:]):
(-[WKWebView setInteractionState:]):
(-[WKWebView setAllowsMagnification:]):
(-[WKWebView setMagnification:centeredAtPoint:]):
(-[WKWebView setMagnification:]):
(-[WKWebView printOperationWithPrintInfo:]):
(-[WKWebView createPDFWithConfiguration:completionHandler:]):
(-[WKWebView createWebArchiveDataWithCompletionHandler:]):
(-[WKWebView loadSimulatedRequest:response:responseData:]):
(-[WKWebView loadSimulatedRequest:withResponse:responseData:]):
(-[WKWebView loadSimulatedRequest:responseHTMLString:]):
(-[WKWebView loadSimulatedRequest:withResponseHTMLString:]):
(-[WKWebView loadFileRequest:allowingReadAccessToURL:]):
(-[WKWebView _toggleStrikeThrough:]):
(-[WKWebView _increaseListLevel:]):
(-[WKWebView _decreaseListLevel:]):
(-[WKWebView _changeListType:]):
(-[WKWebView _setViewportSizeForCSSViewportUnits:]):
(-[WKWebView _didEnableBrowserExtensions:]):
(-[WKWebView _didDisableBrowserExtensions:]):
(-[WKWebView _setEditable:]):
(-[WKWebView _executeEditCommand:argument:completion:]):
(-[WKWebView _startTextManipulationsWithConfiguration:completion:]):
(-[WKWebView _completeTextManipulation:completion:]):
(-[WKWebView _completeTextManipulationForItems:completion:]):
(-[WKWebView _takeFindStringFromSelection:]):
(-[WKWebView _updateMediaPlaybackControlsManager]):
(-[WKWebView _togglePictureInPicture]):
(-[WKWebView _closeAllMediaPresentations]):
(-[WKWebView _stopMediaCapture]):
(-[WKWebView _stopAllMediaPlayback]):
(-[WKWebView _suspendAllMediaPlayback]):
(-[WKWebView _resumeAllMediaPlayback]):
(-[WKWebView _restoreAppHighlights:]):
(-[WKWebView _restoreAndScrollToAppHighlight:]):
(-[WKWebView _addAppHighlight]):
(-[WKWebView _loadAlternateHTMLString:baseURL:forUnreachableURL:]):
(-[WKWebView _loadData:MIMEType:characterEncodingName:baseURL:userData:]):
(-[WKWebView _loadRequest:shouldOpenExternalURLs:]):
(-[WKWebView _loadRequest:shouldOpenExternalURLsPolicy:]):
(-[WKWebView _grantAccessToAssetServices]):
(-[WKWebView _revokeAccessToAssetServices]):
(-[WKWebView _switchFromStaticFontRegistryToUserFontRegistry]):
(-[WKWebView _appBoundNavigationDataForDomain:completionHandler:]):
(-[WKWebView _suspendPage:]):
(-[WKWebView _resumePage:]):
(-[WKWebView _setApplicationNameForUserAgent:]):
(-[WKWebView _killWebContentProcess]):
(-[WKWebView _reloadWithoutContentBlockers]):
(-[WKWebView _reloadExpiredOnly]):
(-[WKWebView _killWebContentProcessAndResetState]):
(-[WKWebView _takePDFSnapshotWithConfiguration:completionHandler:]):
(-[WKWebView _getPDFFirstPageSizeInFrame:completionHandler:]):
(-[WKWebView _restoreFromSessionStateData:]):
(-[WKWebView _restoreSessionState:andNavigate:]):
(-[WKWebView _close]):
(-[WKWebView _tryClose]):
(-[WKWebView _insertAttachmentWithFilename:contentType:data:options:completion:]):
(-[WKWebView _insertAttachmentWithFileWrapper:contentType:options:completion:]):
(-[WKWebView _insertAttachmentWithFileWrapper:contentType:completion:]):
(-[WKWebView _attachmentForIdentifier:]):
(-[WKWebView _simulateDeviceOrientationChangeWithAlpha:beta:gamma:]):
(-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]):
(-[WKWebView _showSafeBrowsingWarningWithURL:title:warning:details:completionHandler:]):
(-[WKWebView _showSafeBrowsingWarningWithURL:title:warning:detailsWithLinks:completionHandler:]):
(-[WKWebView _isJITEnabled:]):
(-[WKWebView _evaluateJavaScriptWithoutUserGesture:completionHandler:]):
(-[WKWebView _callAsyncJavaScript:arguments:inFrame:inContentWorld:completionHandler:]):
(-[WKWebView _evaluateJavaScript:inFrame:inContentWorld:completionHandler:]):
(-[WKWebView _evaluateJavaScript:withSourceURL:inFrame:inContentWorld:completionHandler:]):
(-[WKWebView _updateWebpagePreferences:]):
(-[WKWebView _notifyUserScripts]):
(-[WKWebView _deferrableUserScriptsNeedNotification]):
(-[WKWebView _setAllowsRemoteInspection:]):
(-[WKWebView _setRemoteInspectionNameOverride:]):
(-[WKWebView _setAddsVisitedLinks:]):
(-[WKWebView _getMainResourceDataWithCompletionHandler:]):
(-[WKWebView _getWebArchiveDataWithCompletionHandler:]):
(-[WKWebView _getContentsAsStringWithCompletionHandler:]):
(-[WKWebView _getContentsOfAllFramesAsStringWithCompletionHandler:]):
(-[WKWebView _getContentsAsAttributedStringWithCompletionHandler:]):
(-[WKWebView _getApplicationManifestWithCompletionHandler:]):
(-[WKWebView _setPaginationMode:]):
(-[WKWebView _setPaginationBehavesLikeColumns:]):
(-[WKWebView _setPageLength:]):
(-[WKWebView _setGapBetweenPages:]):
(-[WKWebView _setPaginationLineGridEnabled:]):
(-[WKWebView _setTextZoomFactor:]):
(-[WKWebView _setPageZoomFactor:]):
(-[WKWebView _countStringMatches:options:maxCount:]):
(-[WKWebView _findString:options:maxCount:]):
(-[WKWebView _hideFindUI]):
(-[WKWebView _saveBackForwardSnapshotForItem:]):
(-[WKWebView _clearServiceWorkerEntitlementOverride:]):
(-[WKWebView _preconnectToServer:]):
(-[WKWebView _setCanUseCredentialStorage:]):
(-[WKWebView _setLayoutMode:]):
(-[WKWebView _setFixedLayoutSize:]):
(-[WKWebView _setBackgroundExtendsBeyondPage:]):
(-[WKWebView _setViewScale:]):
(-[WKWebView _setCORSDisablingPatterns:]):
(-[WKWebView _getProcessDisplayNameWithCompletionHandler:]):
(-[WKWebView _setMinimumEffectiveDeviceWidth:]):
(-[WKWebView _grantAccessToPreferenceService]):
(-[WKWebView _setScrollPerformanceDataCollectionEnabled:]):
(-[WKWebView _setAllowsMediaDocumentInlinePlayback:]):
(-[WKWebView _setMediaCaptureEnabled:]):
(-[WKWebView _setPageMuted:]):
(-[WKWebView _removeDataDetectedLinks:]):
(-[WKWebView _doAfterNextPresentationUpdate:]):
(-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForPainting:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::handleTouchEvent):
(WebKit::WebPageProxy::resumeActiveDOMObjectsAndAnimations):
(WebKit::WebPageProxy::suspendActiveDOMObjectsAndAnimations):
(WebKit::WebPageProxy::suspend):
(WebKit::WebPageProxy::resume):
(WebKit::WebPageProxy::requestMediaPlaybackState):
(WebKit::WebPageProxy::resetStateAfterProcessExited):
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::suspend):
(WebKit::WebPage::resume):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

Tools:

Add API test coverage.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/ProcessSuspension.mm:
(TEST):
* TestWebKitAPI/Tests/WebKitCocoa/postMessage-regularly.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277356 268f45cc-cd09-0410-ab3c-d52691b4dbfc

36 hours agoRemove the String::toInt family of functions
darin@apple.com [Wed, 12 May 2021 04:23:30 +0000 (04:23 +0000)]
Remove the String::toInt family of functions
https://bugs.webkit.org/show_bug.cgi?id=225599

Reviewed by Anders Carlsson.

Source/WebCore:

* platform/graphics/GLContext.cpp:
(WebCore::GLContext::version): Use
parseIntegerAllowingTrailingJunk<unsigned> instead of String::toUInt.

* platform/graphics/GlyphBuffer.h:
(WebCore::GlyphBuffer::checkedStringOffsetAt const): Fix code that was
assuming GlyphBufferStringOffset was signed to compile without a warning
regardless of whether it's signed or unsigned. This was making GTK
builds have tons and tons of warnings, which was distracting while
working on the other fixes here.

* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(CachedResourceStreamingClient::responseReceived): Use
parseIntegerAllowingTrailingJunk<uint64_t> instead of String::toUInt64.

Source/WebKit:

* Shared/win/AuxiliaryProcessMainWin.cpp:
(WebKit::AuxiliaryProcessMainCommon::parseCommandLine): Use
parseIntegerAllowingTrailingJunk<uint64_t> instead of String::toUInt64.
* UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
(WebKit::ScriptMessageClient::didPostMessage): Ditto.
* UIProcess/win/WebProcessPoolWin.cpp:
(WebKit::initializeRemoteInspectorServer): Use
parseIntegerAllowingTrailingJunk<uint16_t> instead of StringView::toUInt64.
This is a 16-bit port number, so not valuable to parse larger integers.

Source/WTF:

* wtf/text/AtomString.h: Deleted AtomString::toInt.

* wtf/text/StringImpl.cpp:
(WTF::StringImpl::toIntStrict): Deleted.
(WTF::StringImpl::toUIntStrict): Deleted.
(WTF::StringImpl::toInt64Strict): Deleted.
(WTF::StringImpl::toUInt64Strict): Deleted.
(WTF::StringImpl::toIntPtrStrict): Deleted.
(WTF::StringImpl::toInt): Deleted.
(WTF::StringImpl::toUInt): Deleted.
(WTF::StringImpl::toInt64): Deleted.
(WTF::StringImpl::toUInt64): Deleted.
(WTF::StringImpl::toIntPtr): Deleted.
* wtf/text/StringImpl.h: Deleted the above functions.

* wtf/text/StringToIntegerConversion.h: Removed toIntegralType.

* wtf/text/StringView.cpp:
(WTF::parseUInt16): Deleted.

* wtf/text/StringView.h: Deleted StringView::toInt,
StringView::toIntStrict, StringView::toUInt64Strict,
StringView::toInt64Strict, and parseUInt16. Changed the constructor
that takes a const char* to work when passed nullptr. StringView has
a null value, and converting a null const char* should produce that.

* wtf/text/WTFString.cpp:
(WTF::String::toIntStrict const): Deleted.
(WTF::String::toUIntStrict const): Deleted.
(WTF::String::toInt64Strict const): Deleted.
(WTF::String::toUInt64Strict const): Deleted.
(WTF::String::toIntPtrStrict const): Deleted.
(WTF::String::toInt const): Deleted.
(WTF::String::toUInt const): Deleted.
(WTF::String::toInt64 const): Deleted.
(WTF::String::toUInt64 const): Deleted.
(WTF::String::toIntPtr const): Deleted.
(WTF::lengthOfCharactersAsInteger): Deleted.
(WTF::charactersToIntStrict): Deleted.
(WTF::charactersToUIntStrict): Deleted.
(WTF::charactersToInt64Strict): Deleted.
(WTF::charactersToUInt64Strict): Deleted.
(WTF::charactersToIntPtrStrict): Deleted.
(WTF::charactersToInt): Deleted.
(WTF::charactersToUInt): Deleted.
(WTF::charactersToInt64): Deleted.
(WTF::charactersToUInt64): Deleted.
(WTF::charactersToIntPtr): Deleted.
* wtf/text/WTFString.h: Deleted the above functions.

Tools:

* TestWebKitAPI/CMakeLists.txt: Added StringToIntegerConversion.cpp.
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Ditto.

* TestWebKitAPI/Tests/WTF/StringToIntegerConversion.cpp: Added.
Contains tests moved and adapted from the files below so we don't
lose test coverage. We and and should add many more tests.

* TestWebKitAPI/Tests/WTF/StringView.cpp: Removed tests for parseUInt16
and StringView::toIntStrict.

* TestWebKitAPI/Tests/WTF/WTFString.cpp: Removed tests for String::toInt.

* TestWebKitAPI/Tests/WebKitCocoa/WKURLSchemeHandler-1.mm: Use
parseInteger<uint64_t> instead of StringView::toUInt64Strict.
* TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm: Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277355 268f45cc-cd09-0410-ab3c-d52691b4dbfc

37 hours ago[macCatalyst] should have CSS `hover: hover` and `pointer: fine`
drousso@apple.com [Wed, 12 May 2021 03:55:46 +0000 (03:55 +0000)]
[macCatalyst] should have CSS `hover: hover` and `pointer: fine`
https://bugs.webkit.org/show_bug.cgi?id=225672

Reviewed by Tim Horton.

Source/WebKit:

Test: iOSMouseSupport.MouseAlwaysConnected

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::isMousePrimaryPointingDevice): Added.
(WebKit::hasAccessoryMousePointingDevice): Added.
(WebKit::hasAccessoryStylusPointingDevice): Added.
(WebKit::WebPage::hoverSupportedByPrimaryPointingDevice const):
(WebKit::WebPage::hoverSupportedByAnyAvailablePointingDevice const):
(WebKit::WebPage::pointerCharacteristicsOfPrimaryPointingDevice const):
(WebKit::WebPage::pointerCharacteristicsOfAllAvailablePointingDevices const):
(WebKit::hasMouseDevice): Deleted.
macCatalyst should consider the mouse as the primary pointing device, just like macOS:
 - `hover` and `any-hover` should always be `hover`
 - `pointer` and `any-pointer` should always be `fine` (instead of only if an accessory mouse/stylus is connected)

* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):
* UIProcess/WebProcessProxy.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::notifyHasMouseDeviceChanged): Added.
(WebKit::WebProcessProxy::notifyHasStylusDeviceChanged):
* UIProcess/ios/WebProcessProxyIOS.mm:
(WebKit::WebProcessProxy::platformInitialize):
(WebKit::WebProcessProxy::platformDestroy):
(WebKit::WebProcessProxy::notifyHasMouseDeviceChanged): Deleted.
* UIProcess/ios/WKMouseDeviceObserver.h:
* UIProcess/ios/WKMouseDeviceObserver.mm:
* Shared/WebProcessCreationParameters.h:
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):
* WebProcess/WebProcess.messages.in:
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
Clean up macro usage to avoid unnecessary work on macCatalyst.
Drive-by: Move non-platform code to non-platform files.
Source/WTF:

* wtf/PlatformHave.h:
Add `HAVE_MOUSE_DEVICE_OBSERVATION` and `HAVE_STYLUS_DEVICE_OBSERVATION` to make callsites
clearer instead of having a somewhat unrelated connection to `HAVE_UIKIT_WITH_MOUSE_SUPPORT`
and `HAVE_PENCILKIT_TEXT_INPUT` (not to mention both of them are `PLATFORM(MACCATALYST)`
which isn't desirable since macCatalyst should consider the mouse as the primary pointing
device, just like macOS).

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm:
(TEST.iOSMouseSupport.MouseAlwaysConnected):
* TestWebKitAPI/Tests/WebKitCocoa/iOSStylusSupport.mm:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277354 268f45cc-cd09-0410-ab3c-d52691b4dbfc

37 hours agoUnreviewed, reverting r277341.
commit-queue@webkit.org [Wed, 12 May 2021 03:49:57 +0000 (03:49 +0000)]
Unreviewed, reverting r277341.
https://bugs.webkit.org/show_bug.cgi?id=225685

Caused WK2 layout tests to exit with an exception

Reverted changeset:

"Add SPI to suspend / resume a WKWebView"
https://bugs.webkit.org/show_bug.cgi?id=225333
https://trac.webkit.org/changeset/277341

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277353 268f45cc-cd09-0410-ab3c-d52691b4dbfc

37 hours ago[iOS] Mail compose web view doesn't scroll to reveal the selection in certain configu...
wenson_hsieh@apple.com [Wed, 12 May 2021 03:46:21 +0000 (03:46 +0000)]
[iOS] Mail compose web view doesn't scroll to reveal the selection in certain configurations
https://bugs.webkit.org/show_bug.cgi?id=225675
rdar://77095886

Reviewed by Tim Horton.

Source/WebKit:

Currently when computing input view bounds upon receiving `UIKeyboardDidChangeFrameNotification`, we attempt to
map the on-screen bounds of the keyboard to the window's coordinate space, and save the result in an ivar in
`WKWebView`, `_inputViewBounds`. The keyboard frame (which corresponds to `UIKeyboardFrameEndUserInfoKey` in the
notification's userInfo dictionary) is given to us in screen coordinates, and we currently pass this through
`-convertRect:fromWindow:`, with a nil `UIWindow`.

However, this results in mapping the rect from the coordinate space of the window's `UIWindowScene` rather than
the window screen. In shipping Mail on iOS, this doesn't matter because the window containing the compose web
view shares the same coordinate space as the screen. In some other configurations of MobileMail, however, the
compose web view appears inside its own `UIWindow`. This causes the above coordinate conversion logic to fail,
since we attempt to map a rect given to us in screen coordinates from the compose web view's window scene's
coordinate space, instead of the screen's coordinate space.

We fix this by using `-convertRect:fromCoordinateSpace:` instead, and explicitly pass in
`self.window.screen.coordinateSpace`.

* UIProcess/API/Cocoa/WKWebViewInternal.h:
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _updateScrollViewForTransaction:]):
(-[WKWebView _zoomToFocusRect:selectionRect:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
(-[WKWebView _contentRectForUserInteraction]):
(-[WKWebView _updateVisibleContentRects]):
(-[WKWebView _keyboardChangedWithInfo:adjustScrollView:]):

Rename `_inputViewBounds` to `_inputViewBoundsInWindow` for clarity.

* UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* UIProcess/API/ios/WKWebViewTestingIOS.mm:
(-[WKWebView _inputViewBoundsInWindow]):
(-[WKWebView _inputViewBounds]): Deleted.

Tools:

Rename some testing SPI. See WebKit/ChangeLog for more information.

* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptControllerIOS::inputViewBounds const):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277352 268f45cc-cd09-0410-ab3c-d52691b4dbfc

37 hours agoCrash in DisplayLink::incrementFullSpeedRequestClientCount()
simon.fraser@apple.com [Wed, 12 May 2021 03:40:45 +0000 (03:40 +0000)]
Crash in DisplayLink::incrementFullSpeedRequestClientCount()
https://bugs.webkit.org/show_bug.cgi?id=225683
<rdar://77716330>

Reviewed by Tim Horton.

Crash data suggest that in WebPageProxy::updateWheelEventActivityAfterProcessSwap()
the connection might be null. Protect against that an an unset DisplayID, as we do
in wheelEventHysteresisUpdated().

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::updateWheelEventActivityAfterProcessSwap):
* UIProcess/mac/DisplayLink.cpp:
(WebKit::DisplayLink::incrementFullSpeedRequestClientCount): Remove an extra semicolon.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277351 268f45cc-cd09-0410-ab3c-d52691b4dbfc

38 hours agoDisplay-frequency animations in ScrollController should be externally driven
simon.fraser@apple.com [Wed, 12 May 2021 02:45:51 +0000 (02:45 +0000)]
Display-frequency animations in ScrollController should be externally driven
https://bugs.webkit.org/show_bug.cgi?id=225663

Reviewed by Tim Horton.

Display-frequency animations (i.e. those driven by 1/60_s timers) should ultimately
be driven by Page::updateRendering(), since their output should be synchronized with
rendering updates.

As the first step, remove m_snapRubberbandTimer and m_scrollSnapTimer from
ScrollController and have it expose functions that tell its client to start and stop
the animation, and a per-frame callback. Give ScrollAnimator a 1/60_s timer
to drive this, temporarily.

* page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
* page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
(WebCore::ScrollingTreeScrollingNodeDelegateMac::startAnimationCallback):
(WebCore::ScrollingTreeScrollingNodeDelegateMac::stopAnimationCallback):
(WebCore::ScrollingTreeScrollingNodeDelegateMac::scrollControllerAnimationTimerFired):
* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::ScrollAnimator):
(WebCore::ScrollAnimator::startAnimationCallback):
(WebCore::ScrollAnimator::stopAnimationCallback):
(WebCore::ScrollAnimator::scrollControllerAnimationTimerFired):
* platform/ScrollAnimator.h:
* platform/ScrollController.cpp:
(WebCore::ScrollController::animationCallback):
(WebCore::ScrollController::startOrStopAnimationCallbacks):
(WebCore::ScrollController::setIsAnimatingRubberBand):
(WebCore::ScrollController::setIsAnimatingScrollSnap):
(WebCore::ScrollController::updateScrollSnapAnimatingState):
(WebCore::ScrollController::updateRubberBandAnimatingState):
* platform/ScrollController.h:
* platform/ScrollSnapAnimatorState.cpp:
(WebCore::ScrollSnapAnimatorState::currentAnimatedScrollOffset const):
* platform/ScrollSnapAnimatorState.h:
* platform/mac/ScrollController.mm:
(WebCore::ScrollController::stopAllTimers):
(WebCore::ScrollController::handleWheelEvent):
(WebCore::ScrollController::updateRubberBandAnimatingState):
(WebCore::ScrollController::isScrollSnapInProgress const):
(WebCore::ScrollController::stopRubberbanding):
(WebCore::ScrollController::startRubberbandAnimation):
(WebCore::ScrollController::stopSnapRubberbandAnimation):
(WebCore::ScrollController::snapRubberBand):
(WebCore::ScrollController::isRubberBandInProgressInternal const):
(WebCore::ScrollController::scheduleStatelessScrollSnap):
(WebCore::ScrollController::statelessSnapTransitionTimerFired):
(WebCore::ScrollController::processWheelEventForScrollSnap):
(WebCore::ScrollController::startScrollSnapAnimation):
(WebCore::ScrollController::stopScrollSnapAnimation):
(WebCore::ScrollController::updateScrollSnapAnimatingState):
(WebCore::ScrollController::snapRubberBandTimerFired): Deleted.
(WebCore::ScrollController::startSnapRubberbandTimer): Deleted.
(WebCore::ScrollController::stopSnapRubberbandTimer): Deleted.
(WebCore::ScrollController::startScrollSnapTimer): Deleted.
(WebCore::ScrollController::stopScrollSnapTimer): Deleted.
(WebCore::ScrollController::scrollSnapTimerFired): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277350 268f45cc-cd09-0410-ab3c-d52691b4dbfc

39 hours agoFix the CGDisplayListImageBufferBackend build
timothy_horton@apple.com [Wed, 12 May 2021 01:25:50 +0000 (01:25 +0000)]
Fix the CGDisplayListImageBufferBackend build
https://bugs.webkit.org/show_bug.cgi?id=225681

Unreviewed.

* Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.cpp:
(WebKit::CGDisplayListImageBufferBackend::getPixelBuffer const):
* Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277349 268f45cc-cd09-0410-ab3c-d52691b4dbfc

39 hours agoUnreviewed, reverting r277319.
commit-queue@webkit.org [Wed, 12 May 2021 01:16:12 +0000 (01:16 +0000)]
Unreviewed, reverting r277319.
https://bugs.webkit.org/show_bug.cgi?id=225680

Always enabling AsyncOverflowScrolling made many tests fail or
crash

Reverted changeset:

"[GTK] compositing/overflow/dynamic-composited-scrolling-
status.html is failing"
https://bugs.webkit.org/show_bug.cgi?id=225644
https://trac.webkit.org/changeset/277319

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277348 268f45cc-cd09-0410-ab3c-d52691b4dbfc

40 hours agoFunction.prototype.toString triggers page demand on Speedometer
ggaren@apple.com [Wed, 12 May 2021 00:54:26 +0000 (00:54 +0000)]
Function.prototype.toString triggers page demand on Speedometer
https://bugs.webkit.org/show_bug.cgi?id=225678

Reviewed by Mark Lam.

Some JS libraries -- e.g. jQuery, Ember-Debug, Angular -- like to
toString() JS functions in order to enforce return type, argument type,
or deprecation invariants. This triggers pathological page demand if
we keep throwing away the underlying script string.

* loader/cache/CachedResource.cpp:
(WebCore::deadDecodedDataDeletionIntervalForResourceType): Let's try 5s.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277347 268f45cc-cd09-0410-ab3c-d52691b4dbfc

40 hours agoConservativeRoots triggers page demand on Speedometer
ggaren@apple.com [Wed, 12 May 2021 00:52:09 +0000 (00:52 +0000)]
ConservativeRoots triggers page demand on Speedometer
https://bugs.webkit.org/show_bug.cgi?id=225676

Reviewed by Saam Barati.

Use a Vector instead of OSAllocator to avoid mmap() and page fault --
and, like, come on.

Bump default inlineCapacity up to 1024 because we seem to overflow
frequently.

* heap/ConservativeRoots.cpp:
(JSC::ConservativeRoots::ConservativeRoots):
(JSC::ConservativeRoots::~ConservativeRoots):
(JSC::ConservativeRoots::genericAddPointer):
(JSC::ConservativeRoots::grow): Deleted.
* heap/ConservativeRoots.h:
(JSC::ConservativeRoots::roots const):
(JSC::ConservativeRoots::size const): Deleted.
* heap/SlotVisitor.cpp:
(JSC::SlotVisitor::append):
* heap/VerifierSlotVisitor.cpp:
(JSC::VerifierSlotVisitor::append):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277346 268f45cc-cd09-0410-ab3c-d52691b4dbfc

40 hours ago[MSE] QuotaExceededError Exception not thrown even if the sum of totalTrackBufferSize...
commit-queue@webkit.org [Wed, 12 May 2021 00:46:17 +0000 (00:46 +0000)]
[MSE] QuotaExceededError Exception not thrown even if the sum of totalTrackBufferSize and appendBuffer size exceeds maximumBufferSize.
https://bugs.webkit.org/show_bug.cgi?id=225630

Patch by Toshio Ogasawara <toshio.ogasawara@access-company.com> on 2021-05-11
Reviewed by Eric Carlson.

Source/WebCore:

Test: media/media-source/media-source-append-buffer-full-quota-exceeded-error.html

* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::appendBufferInternal):
* platform/graphics/SourceBufferPrivate.cpp:
(WebCore::SourceBufferPrivate::evictCodedFrames):
* platform/graphics/SourceBufferPrivate.h:

LayoutTests:

* media/media-source/media-source-append-buffer-full-quota-exceeded-error-expected.txt: Added.
* media/media-source/media-source-append-buffer-full-quota-exceeded-error.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277345 268f45cc-cd09-0410-ab3c-d52691b4dbfc

40 hours agoRemove xpc_connection_kill
commit-queue@webkit.org [Wed, 12 May 2021 00:05:49 +0000 (00:05 +0000)]
Remove xpc_connection_kill
https://bugs.webkit.org/show_bug.cgi?id=225602

Patch by Alex Christensen <achristensen@webkit.org> on 2021-05-11
Reviewed by Alexey Proskuryakov.

Source/WebKit:

* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::terminateWithReason):

Source/WTF:

* wtf/PlatformHave.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277344 268f45cc-cd09-0410-ab3c-d52691b4dbfc

41 hours agoUse one VM per thread for IDB serialization work
sihui_liu@apple.com [Tue, 11 May 2021 23:41:22 +0000 (23:41 +0000)]
Use one VM per thread for IDB serialization work
https://bugs.webkit.org/show_bug.cgi?id=225658

Reviewed by Chris Dumez.

Source/WebCore:

The vm map in IDBSerializationContext uses sessionID as key instead of thread identifier. Normally IDB has one
thread per session (see WebIDBServer and CrossThreadTaskHandler), so we are using one vm per thread. With
r275799, we remove WebIDBServer more aggressively (when no web process is not using IDB) to make sure its thread
does not stay around, and WebIDBServer will be destroyed after it finishes scheduled tasks on the background
thread. Then, it's possible that while a WebIDBServer for some session is removed and finishing last tasks,
a new IDB request for the same session comes in and we create a new WebIDBServer for the session. In this case,
two threads ends up using the same VM.

VM is generally not designed to be used on multiple threads, otherwise we need to acquire lock for each
WTF::String operation to get correct AtomStringTable. So let's just make sure we are using one VM per thread by
making the map in IDBSerializationContext keyed by thread pointer.

New API test: IndexedDB.OneVMPerThread

* Modules/indexeddb/server/IDBSerializationContext.cpp:
(WebCore::IDBServer::IDBSerializationContext::getOrCreateIDBSerializationContext):
(WebCore::IDBServer::IDBSerializationContext::~IDBSerializationContext):
(WebCore::IDBServer::IDBSerializationContext::vm):
(WebCore::IDBServer::IDBSerializationContext::globalObject):
(WebCore::IDBServer::IDBSerializationContext::IDBSerializationContext):
* Modules/indexeddb/server/IDBSerializationContext.h:
* Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
(WebCore::IDBServer::MemoryIDBBackingStore::MemoryIDBBackingStore):
* Modules/indexeddb/server/MemoryObjectStore.cpp:
(WebCore::IDBServer::MemoryObjectStore::MemoryObjectStore):
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::SQLiteIDBBackingStore):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/IndexedDBDatabaseProcessKill.mm:
(-[DatabaseProcessKillMessageHandler userContentController:didReceiveScriptMessage:]):
(TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277343 268f45cc-cd09-0410-ab3c-d52691b4dbfc

43 hours agoAdd SPI to suspend / resume a WKWebView
cdumez@apple.com [Tue, 11 May 2021 21:39:13 +0000 (21:39 +0000)]
Add SPI to suspend / resume a WKWebView
https://bugs.webkit.org/show_bug.cgi?id=225333
<rdar://77462543>

Reviewed by Geoffrey Garen.

Source/WebCore:

Add new function to BackForwardCache to suspend a page and return a CachedPage
instead of requiring a HistoryItem and storing the CachedPage on that history
item. This is useful when we want to suspend the page in-place and do not want
to require a history item (or a navigation).

* Headers.cmake:
* history/BackForwardCache.cpp:
(WebCore::BackForwardCache::trySuspendPage):
(WebCore::BackForwardCache::addIfCacheable):
(WebCore::BackForwardCache::suspendPage):
* history/BackForwardCache.h:
* history/CachedPage.h:

Source/WebKit:

Add SPI to suspend / resume a WKWebView. This suspends the page as if it was in
the back/forward cache but the suspension happens in-place, no need to navigate.
The suspended page is also not part of the Back/Forward cache so its cap on the
number of suspended pages does not apply here.

Most of WKWebView's API / SPI will throw an exception when called on a suspended
view (The WKPageRefAPI will RELEASE_ASSERT()). Some of the basic API will stay
functional (URL, isLoading, title, ...). It is also safe to deallocate / close
a suspended WKWebView.

* UIProcess/API/C/WKPage.cpp:
(crashIfPageIsSuspended):
(WKPageLoadURL):
(WKPageLoadURLWithShouldOpenExternalURLsPolicy):
(WKPageLoadURLWithUserData):
(WKPageLoadURLRequest):
(WKPageLoadURLRequestWithUserData):
(WKPageLoadFile):
(WKPageLoadFileWithUserData):
(WKPageLoadData):
(WKPageLoadDataWithUserData):
(WKPageLoadHTMLString):
(WKPageLoadHTMLStringWithUserData):
(WKPageLoadAlternateHTMLString):
(WKPageLoadAlternateHTMLStringWithUserData):
(WKPageLoadPlainTextString):
(WKPageLoadPlainTextStringWithUserData):
(WKPageLoadWebArchiveData):
(WKPageLoadWebArchiveDataWithUserData):
(WKPageStopLoading):
(WKPageReload):
(WKPageReloadWithoutContentBlockers):
(WKPageReloadFromOrigin):
(WKPageReloadExpiredOnly):
(WKPageTryClose):
(WKPageClose):
(WKPageGoForward):
(WKPageGoBack):
(WKPageGoToBackForwardListItem):
(WKPageTryRestoreScrollPosition):
(WKPageUpdateWebsitePolicies):
(WKPageSetApplicationNameForUserAgent):
(WKPageSetCustomUserAgent):
(WKPageSetCustomTextEncodingName):
(WKPageTerminate):
(WKPageRestoreFromSessionState):
(WKPageRestoreFromSessionStateWithoutNavigation):
(WKPageSetCustomBackingScaleFactor):
(WKPageSetTextZoomFactor):
(WKPageSetPageZoomFactor):
(WKPageSetPageAndTextZoomFactors):
(WKPageSetScaleFactor):
(WKPageSetUseFixedLayout):
(WKPageSetFixedLayoutSize):
(WKPageListenForLayoutMilestones):
(WKPageSetSuppressScrollbarAnimations):
(WKPageSetRubberBandsAtLeft):
(WKPageSetRubberBandsAtRight):
(WKPageSetRubberBandsAtTop):
(WKPageSetRubberBandsAtBottom):
(WKPageSetEnableVerticalRubberBanding):
(WKPageSetEnableHorizontalRubberBanding):
(WKPageSetBackgroundExtendsBeyondPage):
(WKPageSetPaginationMode):
(WKPageSetPaginationBehavesLikeColumns):
(WKPageSetPageLength):
(WKPageSetGapBetweenPages):
(WKPageSetPaginationLineGridEnabled):
(WKPageSetMaintainsInactiveSelection):
(WKPageCenterSelectionInVisibleArea):
(WKPageFindStringMatches):
(WKPageGetImageForFindMatch):
(WKPageSelectFindMatch):
(WKPageFindString):
(WKPageHideFindUI):
(WKPageCountStringMatches):
(WKPageSetPageContextMenuClient):
(WKPageSetPageFindClient):
(WKPageSetPageFindMatchesClient):
(WKPageSetPageInjectedBundleClient):
(WKPageSetPageFormClient):
(WKPageSetPageLoaderClient):
(WKPageSetPagePolicyClient):
(WKPageSetPageUIClient):
(WKPageSetPageNavigationClient):
(WKPageSetPageStateClient):
(WKPageRunJavaScriptInMainFrame):
(WKPageRunJavaScriptInMainFrame_b):
(WKPageRenderTreeExternalRepresentation):
(WKPageGetSourceForFrame):
(WKPageGetContentsAsString):
(WKPageGetBytecodeProfile):
(WKPageGetSamplingProfilerOutput):
(WKPageGetSelectionAsWebArchiveData):
(WKPageGetContentsAsMHTMLData):
(WKPageForceRepaint):
(WKPageValidateCommand):
(WKPageExecuteCommand):
(WKPageComputePagesForPrinting):
(WKPageDrawPagesToPDF):
(WKPageBeginPrinting):
(WKPageEndPrinting):
(WKPageSetControlledByAutomation):
(WKPageSetAllowsRemoteInspection):
(WKPageSetMediaVolume):
(WKPageSetMuted):
(WKPageSetMediaCaptureEnabled):
(WKPageDidAllowPointerLock):
(WKPageClearUserMediaState):
(WKPageDidDenyPointerLock):
(WKPageSetMayStartMediaWhenInWindow):
(WKPageSelectContextMenuItem):
(WKPageSetScrollPinningBehavior):
(WKPageSetAddsVisitedLinks):
(WKPageClearWheelEventTestMonitor):
(WKPageCallAfterNextPresentationUpdate):
(WKPageSetIgnoresViewportScaleLimits):
(WKPageGetApplicationManifest_b):
(WKPageDumpPrivateClickMeasurement):
(WKPageClearPrivateClickMeasurement):
(WKPageSetPrivateClickMeasurementOverrideTimerForTesting):
(WKPageMarkAttributedPrivateClickMeasurementsAsExpiredForTesting):
(WKPageSimulateResourceLoadStatisticsSessionRestart):
(WKPageSetPrivateClickMeasurementTokenPublicKeyURLForTesting):
(WKPageSetPrivateClickMeasurementTokenSignatureURLForTesting):
(WKPageSetPrivateClickMeasurementAttributionReportURLsForTesting):
(WKPageMarkPrivateClickMeasurementsAsExpiredForTesting):
(WKPageSetPCMFraudPreventionValuesForTesting):
(WKPageSetMockCameraOrientation):
(WKPageLoadedSubresourceDomains):
(WKPageClearLoadedSubresourceDomains):
(WKPageSetMediaCaptureReportingDelayForTesting):
(WKPageDispatchActivityStateUpdateForTesting):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView loadRequest:]):
(-[WKWebView loadFileURL:allowingReadAccessToURL:]):
(-[WKWebView loadHTMLString:baseURL:]):
(-[WKWebView loadData:MIMEType:characterEncodingName:baseURL:]):
(-[WKWebView startDownloadUsingRequest:completionHandler:]):
(-[WKWebView resumeDownloadFromResumeData:completionHandler:]):
(-[WKWebView goToBackForwardListItem:]):
(-[WKWebView goBack]):
(-[WKWebView goForward]):
(-[WKWebView reload]):
(-[WKWebView reloadFromOrigin]):
(-[WKWebView stopLoading]):
(-[WKWebView evaluateJavaScript:completionHandler:]):
(-[WKWebView evaluateJavaScript:inFrame:inContentWorld:completionHandler:]):
(-[WKWebView callAsyncJavaScript:arguments:inFrame:inContentWorld:completionHandler:]):
(-[WKWebView closeAllMediaPresentationsWithCompletionHandler:]):
(-[WKWebView pauseAllMediaPlaybackWithCompletionHandler:]):
(-[WKWebView setAllMediaPlaybackSuspended:completionHandler:]):
(-[WKWebView requestMediaPlaybackStateWithCompletionHandler:]):
(-[WKWebView setMicrophoneCaptureState:completionHandler:]):
(-[WKWebView setCameraCaptureState:completionHandler:]):
(-[WKWebView _evaluateJavaScript:asAsyncFunction:withSourceURL:withArguments:forceUserGesture:inFrame:inWorld:completionHandler:]):
(-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
(-[WKWebView setAllowsBackForwardNavigationGestures:]):
(-[WKWebView setCustomUserAgent:]):
(-[WKWebView setAllowsLinkPreview:]):
(-[WKWebView setPageZoom:]):
(-[WKWebView findString:withConfiguration:completionHandler:]):
(-[WKWebView setMediaType:]):
(-[WKWebView setInteractionState:]):
(-[WKWebView setAllowsMagnification:]):
(-[WKWebView setMagnification:centeredAtPoint:]):
(-[WKWebView setMagnification:]):
(-[WKWebView printOperationWithPrintInfo:]):
(-[WKWebView createPDFWithConfiguration:completionHandler:]):
(-[WKWebView createWebArchiveDataWithCompletionHandler:]):
(-[WKWebView loadSimulatedRequest:response:responseData:]):
(-[WKWebView loadSimulatedRequest:withResponse:responseData:]):
(-[WKWebView loadSimulatedRequest:responseHTMLString:]):
(-[WKWebView loadSimulatedRequest:withResponseHTMLString:]):
(-[WKWebView loadFileRequest:allowingReadAccessToURL:]):
(-[WKWebView _toggleStrikeThrough:]):
(-[WKWebView _increaseListLevel:]):
(-[WKWebView _decreaseListLevel:]):
(-[WKWebView _changeListType:]):
(-[WKWebView _setViewportSizeForCSSViewportUnits:]):
(-[WKWebView _didEnableBrowserExtensions:]):
(-[WKWebView _didDisableBrowserExtensions:]):
(-[WKWebView _setEditable:]):
(-[WKWebView _executeEditCommand:argument:completion:]):
(-[WKWebView _startTextManipulationsWithConfiguration:completion:]):
(-[WKWebView _completeTextManipulation:completion:]):
(-[WKWebView _completeTextManipulationForItems:completion:]):
(-[WKWebView _takeFindStringFromSelection:]):
(-[WKWebView _updateMediaPlaybackControlsManager]):
(-[WKWebView _togglePictureInPicture]):
(-[WKWebView _closeAllMediaPresentations]):
(-[WKWebView _stopMediaCapture]):
(-[WKWebView _stopAllMediaPlayback]):
(-[WKWebView _suspendAllMediaPlayback]):
(-[WKWebView _resumeAllMediaPlayback]):
(-[WKWebView _restoreAppHighlights:]):
(-[WKWebView _restoreAndScrollToAppHighlight:]):
(-[WKWebView _addAppHighlight]):
(-[WKWebView _loadAlternateHTMLString:baseURL:forUnreachableURL:]):
(-[WKWebView _loadData:MIMEType:characterEncodingName:baseURL:userData:]):
(-[WKWebView _loadRequest:shouldOpenExternalURLs:]):
(-[WKWebView _loadRequest:shouldOpenExternalURLsPolicy:]):
(-[WKWebView _grantAccessToAssetServices]):
(-[WKWebView _revokeAccessToAssetServices]):
(-[WKWebView _switchFromStaticFontRegistryToUserFontRegistry]):
(-[WKWebView _appBoundNavigationDataForDomain:completionHandler:]):
(-[WKWebView _suspendPage:]):
(-[WKWebView _resumePage:]):
(-[WKWebView _setApplicationNameForUserAgent:]):
(-[WKWebView _killWebContentProcess]):
(-[WKWebView _reloadWithoutContentBlockers]):
(-[WKWebView _reloadExpiredOnly]):
(-[WKWebView _killWebContentProcessAndResetState]):
(-[WKWebView _takePDFSnapshotWithConfiguration:completionHandler:]):
(-[WKWebView _getPDFFirstPageSizeInFrame:completionHandler:]):
(-[WKWebView _restoreFromSessionStateData:]):
(-[WKWebView _restoreSessionState:andNavigate:]):
(-[WKWebView _close]):
(-[WKWebView _tryClose]):
(-[WKWebView _insertAttachmentWithFilename:contentType:data:options:completion:]):
(-[WKWebView _insertAttachmentWithFileWrapper:contentType:options:completion:]):
(-[WKWebView _insertAttachmentWithFileWrapper:contentType:completion:]):
(-[WKWebView _attachmentForIdentifier:]):
(-[WKWebView _simulateDeviceOrientationChangeWithAlpha:beta:gamma:]):
(-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]):
(-[WKWebView _showSafeBrowsingWarningWithURL:title:warning:details:completionHandler:]):
(-[WKWebView _showSafeBrowsingWarningWithURL:title:warning:detailsWithLinks:completionHandler:]):
(-[WKWebView _isJITEnabled:]):
(-[WKWebView _evaluateJavaScriptWithoutUserGesture:completionHandler:]):
(-[WKWebView _callAsyncJavaScript:arguments:inFrame:inContentWorld:completionHandler:]):
(-[WKWebView _evaluateJavaScript:inFrame:inContentWorld:completionHandler:]):
(-[WKWebView _evaluateJavaScript:withSourceURL:inFrame:inContentWorld:completionHandler:]):
(-[WKWebView _updateWebpagePreferences:]):
(-[WKWebView _notifyUserScripts]):
(-[WKWebView _deferrableUserScriptsNeedNotification]):
(-[WKWebView _setAllowsRemoteInspection:]):
(-[WKWebView _setRemoteInspectionNameOverride:]):
(-[WKWebView _setAddsVisitedLinks:]):
(-[WKWebView _getMainResourceDataWithCompletionHandler:]):
(-[WKWebView _getWebArchiveDataWithCompletionHandler:]):
(-[WKWebView _getContentsAsStringWithCompletionHandler:]):
(-[WKWebView _getContentsOfAllFramesAsStringWithCompletionHandler:]):
(-[WKWebView _getContentsAsAttributedStringWithCompletionHandler:]):
(-[WKWebView _getApplicationManifestWithCompletionHandler:]):
(-[WKWebView _setPaginationMode:]):
(-[WKWebView _setPaginationBehavesLikeColumns:]):
(-[WKWebView _setPageLength:]):
(-[WKWebView _setGapBetweenPages:]):
(-[WKWebView _setPaginationLineGridEnabled:]):
(-[WKWebView _setTextZoomFactor:]):
(-[WKWebView _setPageZoomFactor:]):
(-[WKWebView _countStringMatches:options:maxCount:]):
(-[WKWebView _findString:options:maxCount:]):
(-[WKWebView _hideFindUI]):
(-[WKWebView _saveBackForwardSnapshotForItem:]):
(-[WKWebView _clearServiceWorkerEntitlementOverride:]):
(-[WKWebView _preconnectToServer:]):
(-[WKWebView _setCanUseCredentialStorage:]):
(-[WKWebView _setLayoutMode:]):
(-[WKWebView _setFixedLayoutSize:]):
(-[WKWebView _setBackgroundExtendsBeyondPage:]):
(-[WKWebView _setViewScale:]):
(-[WKWebView _setCORSDisablingPatterns:]):
(-[WKWebView _getProcessDisplayNameWithCompletionHandler:]):
(-[WKWebView _setMinimumEffectiveDeviceWidth:]):
(-[WKWebView _grantAccessToPreferenceService]):
(-[WKWebView _setScrollPerformanceDataCollectionEnabled:]):
(-[WKWebView _setAllowsMediaDocumentInlinePlayback:]):
(-[WKWebView _setMediaCaptureEnabled:]):
(-[WKWebView _setPageMuted:]):
(-[WKWebView _removeDataDetectedLinks:]):
(-[WKWebView _doAfterNextPresentationUpdate:]):
(-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForPainting:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::handleTouchEvent):
(WebKit::WebPageProxy::resumeActiveDOMObjectsAndAnimations):
(WebKit::WebPageProxy::suspendActiveDOMObjectsAndAnimations):
(WebKit::WebPageProxy::suspend):
(WebKit::WebPageProxy::resume):
(WebKit::WebPageProxy::requestMediaPlaybackState):
(WebKit::WebPageProxy::resetStateAfterProcessExited):
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::suspend):
(WebKit::WebPage::resume):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

Tools:

Add API test coverage.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/ProcessSuspension.mm:
(TEST):
* TestWebKitAPI/Tests/WebKitCocoa/postMessage-regularly.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277341 268f45cc-cd09-0410-ab3c-d52691b4dbfc

43 hours ago[ BigSur wk2 arm64 ] editing/selection/move-by-character-brute-force.html (layout...
jenner@apple.com [Tue, 11 May 2021 21:22:02 +0000 (21:22 +0000)]
[ BigSur wk2 arm64 ] editing/selection/move-by-character-brute-force.html (layout-test) is a flaky timeout
https://bugs.webkit.org/show_bug.cgi?id=225664

Unreviewed test gardening.

Updating expectations to Pass Timeout for BigSur wk2 arm64.

* platform/mac-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277340 268f45cc-cd09-0410-ab3c-d52691b4dbfc

44 hours ago[ BigSur Release wk2 arm64 ] http/tests/appcache/fail-on-update-2.html (layout-test...
jenner@apple.com [Tue, 11 May 2021 20:46:05 +0000 (20:46 +0000)]
[ BigSur Release wk2 arm64 ] http/tests/appcache/fail-on-update-2.html (layout-test) is a flaky timeout
https://bugs.webkit.org/show_bug.cgi?id=225665

Unreviewed test gardening.

Updating test expectations to Pass Timeout for BigSur Release wk2 arm64.

* platform/mac-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277339 268f45cc-cd09-0410-ab3c-d52691b4dbfc

44 hours agoFailing sandbox check for media permissions should not generate a violation report
nham@apple.com [Tue, 11 May 2021 20:45:18 +0000 (20:45 +0000)]
Failing sandbox check for media permissions should not generate a violation report
https://bugs.webkit.org/show_bug.cgi?id=225662

Reviewed by Geoffrey Garen.

We sandbox_check the UIProcess for camera and video permissions. But if the process doesn't
have those permissions, sandbox_check fails and generates an expensive violation report that
task_suspends the process. We need to suppress the reporting with SANDBOX_CHECK_NO_REPORT.

* UIProcess/Cocoa/MediaPermissionUtilities.mm:
(WebKit::checkSandboxRequirementForType):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277338 268f45cc-cd09-0410-ab3c-d52691b4dbfc

45 hours ago[ BigSur wk2 arm64 ] http/tests/cache/disk-cache/redirect-chain-limits.html (layout...
jenner@apple.com [Tue, 11 May 2021 19:48:21 +0000 (19:48 +0000)]
[ BigSur wk2 arm64 ] http/tests/cache/disk-cache/redirect-chain-limits.html (layout-test) is a flaky timeout
Nhttps://bugs.webkit.org/show_bug.cgi?id=225666

Unreviewed test gardening.

Updating expectations to Pass timeout.

* platform/mac-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277337 268f45cc-cd09-0410-ab3c-d52691b4dbfc

45 hours agoAdd SPI to restrict networking to a set of hosts
commit-queue@webkit.org [Tue, 11 May 2021 19:47:50 +0000 (19:47 +0000)]
Add SPI to restrict networking to a set of hosts
https://bugs.webkit.org/show_bug.cgi?id=225426
<rdar://77571521>

Patch by Alex Christensen <achristensen@webkit.org> on 2021-05-11
Reviewed by Tim Horton.

Source/WebCore:

In r259392 I added SPI to turn network access on and off, but a client needs finer grained control.
This uses the same infrastructure to add a set of hosts to allow.  Setting it to nil (the default) allows all hosts,
but setting it to an empty set allows no network access.  This accomplishes the same ability as the old SPI, so I'm deprecating it
with this as a replacement.  The new ability to specify a finite number of hosts to allow creates a limited WKWebView.

* Modules/websockets/ThreadableWebSocketChannel.cpp:
(WebCore::ThreadableWebSocketChannel::validateURL):
* loader/ResourceLoadNotifier.cpp:
(WebCore::ResourceLoadNotifier::dispatchWillSendRequest):
* page/Page.cpp:
(WebCore::Page::allowsLoadFromURL const):
* page/Page.h:
(WebCore::Page::loadsFromNetwork const): Deleted.
* page/PageConfiguration.h:

Source/WebKit:

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* UIProcess/API/APIPageConfiguration.cpp:
(API::PageConfiguration::copy const):
* UIProcess/API/APIPageConfiguration.h:
(API::PageConfiguration::allowedNetworkHosts const):
(API::PageConfiguration::setAllowedNetworkHosts):
(API::PageConfiguration::loadsFromNetwork const): Deleted.
(API::PageConfiguration::setLoadsFromNetwork): Deleted.
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration _setLoadsFromNetwork:]):
(-[WKWebViewConfiguration _loadsFromNetwork]):
(-[WKWebViewConfiguration _setAllowedNetworkHosts:]):
(-[WKWebViewConfiguration _allowedNetworkHosts]):
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_lastNavigationWasAppBound):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/ContentRuleListNotification.mm:
(TEST):
(webSocketAcceptValue): Deleted.
* TestWebKitAPI/Tests/WebKitCocoa/WKURLSchemeHandler-1.mm:
* TestWebKitAPI/cocoa/HTTPServer.h:
(TestWebKitAPI::Connection::webSocketHandshake):
* TestWebKitAPI/cocoa/HTTPServer.mm:
(TestWebKitAPI::Connection::webSocketHandshake):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277336 268f45cc-cd09-0410-ab3c-d52691b4dbfc

45 hours agoREGRESSION (r277071): imported/w3c/web-platform-tests/css/mediaqueries/test_media_que...
ryanhaddad@apple.com [Tue, 11 May 2021 19:02:56 +0000 (19:02 +0000)]
REGRESSION (r277071): imported/w3c/web-platform-tests/css/mediaqueries/test_media_queries.html is failing
https://bugs.webkit.org/show_bug.cgi?id=225469

Unreviewed test gardening.

* platform/ios-wk2/TestExpectations: Mark the test as failing for iOS, too.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277335 268f45cc-cd09-0410-ab3c-d52691b4dbfc

46 hours ago[BigSur Wk2 Arm64] http/tests/privateClickMeasurement/store-private-click-measurement...
amir_mark@apple.com [Tue, 11 May 2021 18:22:55 +0000 (18:22 +0000)]
[BigSur Wk2 Arm64] http/tests/privateClickMeasurement/store-private-click-measurement-with-source-nonce.html is flaky failing
https://bugs.webkit.org/show_bug.cgi?id=224783

Unreviewed test gardening.

* platform/mac-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277334 268f45cc-cd09-0410-ab3c-d52691b4dbfc

46 hours agojs/dom/Promise-reject-large-string.html is a flaky failure
jenner@apple.com [Tue, 11 May 2021 18:05:28 +0000 (18:05 +0000)]
js/dom/Promise-reject-large-string.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=225258

Unreviewed test gardening.

Updating expectation to Pass Failure for arm64 only.

* platform/mac/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277333 268f45cc-cd09-0410-ab3c-d52691b4dbfc

46 hours agoImprove usrsctp restart handling
youenn@apple.com [Tue, 11 May 2021 18:01:25 +0000 (18:01 +0000)]
Improve usrsctp restart handling
https://bugs.webkit.org/show_bug.cgi?id=225638
<rdar://77582953>

Reviewed by Alex Christensen.

* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_input.c:
(sctp_process_cookie_existing):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277332 268f45cc-cd09-0410-ab3c-d52691b4dbfc

46 hours ago[macOS] Extend access to 'com.apple.print.normalizerd' when canvas drawing is done...
bfulgham@apple.com [Tue, 11 May 2021 18:00:26 +0000 (18:00 +0000)]
[macOS] Extend access to 'com.apple.print.normalizerd' when canvas drawing is done in the WebContent process
https://bugs.webkit.org/show_bug.cgi?id=225623
<rdar://problem/77354349>

Reviewed by Per Arne Vollan.

We need to dynamically extend access to 'com.apple.print.normalizerd' when the GPU Process is not handling canvas drawing.
WebKit needs this access to properly draw EPS images.

Tested by fast/images/eps-as-image.html

* UIProcess/WebPageProxy.cpp:
(WebKit::gpuMachServices): Add 'com.apple.print.normalizerd' to set of required services.
* WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in: Remove 'com.apple.print.normalizerd' since it is
not possible to use from the Web Authentication process.
* WebProcess/com.apple.WebProcess.sb.in: Expect the extension to be dynamically extended on all releases.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277331 268f45cc-cd09-0410-ab3c-d52691b4dbfc

47 hours agoFactor out find bounce layer
megan_gardner@apple.com [Tue, 11 May 2021 17:46:40 +0000 (17:46 +0000)]
Factor out find bounce layer
https://bugs.webkit.org/show_bug.cgi?id=225557

Reviewed by Tim Horton.

Factor out the text indicator bounce layer in preparation of making this
compatable with iOS.

No behavior change.

* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* page/mac/TextIndicatorWindow.h:
* page/mac/TextIndicatorWindow.mm:
(WebCore::TextIndicatorWindow::setAnimationProgress):
(WebCore::TextIndicatorWindow::clearTextIndicator):
(WebCore::TextIndicatorWindow::setTextIndicator):
(WebCore::TextIndicatorWindow::closeWindow):
(WebCore::TextIndicatorWindow::startFadeOut):
(indicatorWantsBounce): Deleted.
(indicatorWantsContentCrossfade): Deleted.
(indicatorWantsFadeIn): Deleted.
(indicatorWantsManualAnimation): Deleted.
(-[WebTextIndicatorView initWithFrame:textIndicator:margin:offset:]): Deleted.
(createBounceAnimation): Deleted.
(createContentCrossfadeAnimation): Deleted.
(createShadowFadeAnimation): Deleted.
(createFadeInAnimation): Deleted.
(-[WebTextIndicatorView _animationDuration]): Deleted.
(-[WebTextIndicatorView hasCompletedAnimation]): Deleted.
(-[WebTextIndicatorView present]): Deleted.
(-[WebTextIndicatorView hideWithCompletionHandler:]): Deleted.
(-[WebTextIndicatorView setAnimationProgress:]): Deleted.
(-[WebTextIndicatorView isFlipped]): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277330 268f45cc-cd09-0410-ab3c-d52691b4dbfc

47 hours agoDon't allow :visited link style in subtrees that use mix-blend-mode
antti@apple.com [Tue, 11 May 2021 17:45:56 +0000 (17:45 +0000)]
Don't allow :visited link style in subtrees that use mix-blend-mode
https://bugs.webkit.org/show_bug.cgi?id=225446
rdar://65686091

Unreviewed build fix.

* rendering/style/RenderStyle.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277329 268f45cc-cd09-0410-ab3c-d52691b4dbfc

47 hours agoUnreviewed, reverting r277322.
commit-queue@webkit.org [Tue, 11 May 2021 17:16:06 +0000 (17:16 +0000)]
Unreviewed, reverting r277322.
https://bugs.webkit.org/show_bug.cgi?id=225657

Causing build failure

Reverted changeset:

"Adopt CoreMedia SPI to identify audio-only playback for MSE
clients"
https://bugs.webkit.org/show_bug.cgi?id=225647
https://trac.webkit.org/changeset/277322

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277328 268f45cc-cd09-0410-ab3c-d52691b4dbfc

47 hours ago[Cocoa] Add _STAttributionDisplayName to macOS and iOS GPUProcess Info.plist
eric.carlson@apple.com [Tue, 11 May 2021 17:14:16 +0000 (17:14 +0000)]
[Cocoa] Add _STAttributionDisplayName to macOS and iOS GPUProcess Info.plist
https://bugs.webkit.org/show_bug.cgi?id=225626
rdar://77019240

Reviewed by Youenn Fablet.

* GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-OSX.plist:
* GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-iOS.plist:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277327 268f45cc-cd09-0410-ab3c-d52691b4dbfc