WebKit-https.git
6 months agoUpdate WPT mediacapture-streams tests
eric.carlson@apple.com [Mon, 11 Nov 2019 19:24:55 +0000 (19:24 +0000)]
Update WPT mediacapture-streams tests
https://bugs.webkit.org/show_bug.cgi?id=204073

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

* resources/import-expectations.json:
* web-platform-tests/mediacapture-streams/GUM-deny.https.html:
* web-platform-tests/mediacapture-streams/GUM-impossible-constraint.https.html:
* web-platform-tests/mediacapture-streams/GUM-optional-constraint.https.html:
* web-platform-tests/mediacapture-streams/GUM-trivial-constraint.https.html:
* web-platform-tests/mediacapture-streams/MediaDevices-IDL-all-expected.txt: Removed.
* web-platform-tests/mediacapture-streams/MediaDevices-IDL-all.html: Removed.
* web-platform-tests/mediacapture-streams/MediaDevices-IDL-enumerateDevices-expected.txt: Removed.
* web-platform-tests/mediacapture-streams/MediaDevices-IDL-enumerateDevices.html: Removed.
* web-platform-tests/mediacapture-streams/MediaDevices-enumerateDevices.https-expected.txt:
* web-platform-tests/mediacapture-streams/MediaDevices-enumerateDevices.https.html:
* web-platform-tests/mediacapture-streams/MediaDevices-getUserMedia.https-expected.txt:
* web-platform-tests/mediacapture-streams/MediaDevices-getUserMedia.https.html:
* web-platform-tests/mediacapture-streams/MediaStream-MediaElement-preload-none.https-expected.txt: Removed.
* web-platform-tests/mediacapture-streams/MediaStream-MediaElement-preload-none.https.html: Removed.
* web-platform-tests/mediacapture-streams/MediaStream-MediaElement-srcObject.https-expected.txt:
* web-platform-tests/mediacapture-streams/MediaStream-MediaElement-srcObject.https.html:
* web-platform-tests/mediacapture-streams/MediaStream-add-audio-track.https.html:
* web-platform-tests/mediacapture-streams/MediaStream-audio-only.https.html:
* web-platform-tests/mediacapture-streams/MediaStream-default-feature-policy.https-expected.txt:
* web-platform-tests/mediacapture-streams/MediaStream-default-feature-policy.https.html:
* web-platform-tests/mediacapture-streams/MediaStream-finished-add.https.html:
* web-platform-tests/mediacapture-streams/MediaStream-gettrackid.https.html:
* web-platform-tests/mediacapture-streams/MediaStream-idl.https.html:
* web-platform-tests/mediacapture-streams/MediaStream-removetrack.https-expected.txt:
* web-platform-tests/mediacapture-streams/MediaStream-removetrack.https.html:
* web-platform-tests/mediacapture-streams/MediaStreamTrack-MediaElement-disabled-audio-is-silence.https.html:
* web-platform-tests/mediacapture-streams/MediaStreamTrack-MediaElement-disabled-video-is-black.https-expected.txt:
* web-platform-tests/mediacapture-streams/MediaStreamTrack-MediaElement-disabled-video-is-black.https.html:
* web-platform-tests/mediacapture-streams/MediaStreamTrack-end-manual.https-expected.txt:
* web-platform-tests/mediacapture-streams/MediaStreamTrack-end-manual.https.html:
* web-platform-tests/mediacapture-streams/MediaStreamTrack-getSettings.https-expected.txt:
* web-platform-tests/mediacapture-streams/MediaStreamTrack-getSettings.https.html:
* web-platform-tests/mediacapture-streams/MediaStreamTrack-id.https.html:
* web-platform-tests/mediacapture-streams/OWNERS: Removed.
* web-platform-tests/mediacapture-streams/historical.html: Removed.
* web-platform-tests/mediacapture-streams/w3c-import.log:

LayoutTests:

* tests-options.json:

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

6 months agoUnreviewed, rolling out r252151.
jlewis3@apple.com [Mon, 11 Nov 2019 19:01:51 +0000 (19:01 +0000)]
Unreviewed, rolling out r252151.

This broke internal builds and tests along with
https://bugs.webkit.org/show_bug.cgi?id=167729#c18. For more
information discuss with your reviewers.

Reverted changeset:

"Keep None value at the end of the ListStyleType enum"
https://bugs.webkit.org/show_bug.cgi?id=203883
https://trac.webkit.org/changeset/252151

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

6 months ago[iOS] Unable to view .pages files
pvollan@apple.com [Mon, 11 Nov 2019 18:38:50 +0000 (18:38 +0000)]
[iOS] Unable to view .pages files
https://bugs.webkit.org/show_bug.cgi?id=204076
<rdar://problem/57079557>

Reviewed by Brent Fulgham.

This is caused by a syscall being blocked by the sandbox. The syscall was previously unused in the
WebContent process.

* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:

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

6 months agoRegression r252309: API Test TestWebKitAPI._WKActivatedElementInfo.InfoForLinkAroundI...
dino@apple.com [Mon, 11 Nov 2019 18:28:29 +0000 (18:28 +0000)]
Regression r252309: API Test TestWebKitAPI._WKActivatedElementInfo.InfoForLinkAroundImage is failing consistently
https://bugs.webkit.org/show_bug.cgi?id=204058
<rdar://problem/57056000>

Unreviewed.

Remove test that looks at screen dimensions, because it fails on iPad.

* TestWebKitAPI/Tests/WebKitCocoa/WKRequestActivatedElementInfo.mm:
(TestWebKitAPI::TEST):

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

6 months agoEnsure MediaRemote callback always called.
jer.noble@apple.com [Mon, 11 Nov 2019 18:06:45 +0000 (18:06 +0000)]
Ensure MediaRemote callback always called.
https://bugs.webkit.org/show_bug.cgi?id=204072
<rdar://problem/56301651>

Reviewed by Eric Carlson.

MediaRemote.framework will complain if the callback passed in via MRMediaRemoteAddAsyncCommandHandlerBlock()
is not called for each invocation of the handler. Make sure we always call the completion handler, even in
the case of unsupported commands, or if the listener object has already been destroyed.

* platform/mac/RemoteCommandListenerMac.mm:
(WebCore::RemoteCommandListenerMac::RemoteCommandListenerMac):

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

6 months ago[Picture-in-Picture Web API] Support picture-in-picture CSS pseudo-class
commit-queue@webkit.org [Mon, 11 Nov 2019 18:01:20 +0000 (18:01 +0000)]
[Picture-in-Picture Web API] Support picture-in-picture CSS pseudo-class
https://bugs.webkit.org/show_bug.cgi?id=203493

Patch by Peng Liu <peng.liu6@apple.com> on 2019-11-11
Reviewed by Dean Jackson.

Source/WebCore:

Add CSS pseudo class ":picture-in-picture" for a video element in the picture-in-picture mode.

Test: media/picture-in-picture/picture-in-picture-api-css-selector.html

* Modules/pictureinpicture/HTMLVideoElementPictureInPicture.cpp:
(WebCore::HTMLVideoElementPictureInPicture::didEnterPictureInPicture):
(WebCore::HTMLVideoElementPictureInPicture::didExitPictureInPicture):
* css/CSSSelector.cpp:
(WebCore::CSSSelector::selectorText const):
* css/CSSSelector.h:
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne const):
* css/SelectorCheckerTestFunctions.h:
(WebCore::matchesPictureInPicturePseudoClass):
* css/SelectorPseudoClassAndCompatibilityElementMap.in:
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addPseudoClassType):

LayoutTests:

* media/picture-in-picture/picture-in-picture-api-css-selector-expected.txt: Added.
* media/picture-in-picture/picture-in-picture-api-css-selector.html: Added.

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

6 months ago[EWS] Use named arguments in factories.py
aakash_jain@apple.com [Mon, 11 Nov 2019 17:49:17 +0000 (17:49 +0000)]
[EWS] Use named arguments in factories.py
https://bugs.webkit.org/show_bug.cgi?id=204071

Reviewed by Jonathan Bedard.

* BuildSlaveSupport/ews-build/factories.py:
(Factory.__init__):
(StyleFactory.__init__):
(WatchListFactory.__init__):
(BindingsFactory.__init__):
(WebKitPerlFactory.__init__):
(WebKitPyFactory.__init__):
(BuildFactory.__init__):
(TestFactory.__init__):
(JSCTestsFactory.__init__):
(WindowsFactory.__init__):
(WinCairoFactory.__init__):
(GTKFactory.__init__):
(WPEFactory.__init__):
(ServicesFactory.__init__):

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

6 months agoTypo in assertion in validateCPS in DFGValidate.cpp ("Unexecpted")
commit-queue@webkit.org [Mon, 11 Nov 2019 17:29:02 +0000 (17:29 +0000)]
Typo in assertion in validateCPS in DFGValidate.cpp ("Unexecpted")
https://bugs.webkit.org/show_bug.cgi?id=204066

Patch by Tuomas Karkkainen <tuomas.webkit@apple.com> on 2019-11-11
Reviewed by Antti Koivisto.

* dfg/DFGValidate.cpp:

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

6 months agoUnreviewed, rolling out r251460.
commit-queue@webkit.org [Mon, 11 Nov 2019 16:24:49 +0000 (16:24 +0000)]
Unreviewed, rolling out r251460.
https://bugs.webkit.org/show_bug.cgi?id=204070

This patch caused a crash due to synchronous event firing
(Requested by jernoble on #webkit).

Reverted changeset:

"media/W3C/video/networkState/networkState_during_progress.html
is flaky"
https://bugs.webkit.org/show_bug.cgi?id=76280
https://trac.webkit.org/changeset/251460

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

6 months agoEWS should retry build in case of kill-old-processes failure
aakash_jain@apple.com [Mon, 11 Nov 2019 16:23:25 +0000 (16:23 +0000)]
EWS should retry build in case of kill-old-processes failure
https://bugs.webkit.org/show_bug.cgi?id=203858

Reviewed by Jonathan Bedard.

* BuildSlaveSupport/ews-build/steps.py:
(KillOldProcesses.evaluateCommand): Retry the build in case of failure.
(KillOldProcesses.getResultSummary): Update the build-step summary string.
* BuildSlaveSupport/ews-build/steps_unittest.py: Updated unit-tests.

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

6 months agoWebDriver: implement proxy support
carlosgc@webkit.org [Mon, 11 Nov 2019 15:16:16 +0000 (15:16 +0000)]
WebDriver: implement proxy support
https://bugs.webkit.org/show_bug.cgi?id=180408

Reviewed by Carlos Alberto Lopez Perez.

Source/JavaScriptCore:

Add optional Proxy struct to session capabilities.

* inspector/remote/RemoteInspector.h:
* inspector/remote/glib/RemoteInspectorServer.cpp:
(Inspector::processSessionCapabilities):

Source/WebDriver:

Handle proxy object in capabilities.

* Capabilities.h: Add Proxy struct.
* WebDriverService.cpp:
(WebDriver::deserializeProxy): Deserialize the proxy from capabilities.
(WebDriver::WebDriverService::parseCapabilities const): Get the deserialized proxy.
(WebDriver::WebDriverService::validatedCapabilities const): Ensure proxy object is valid.
(WebDriver::WebDriverService::matchCapabilities const): Check proxy type is supported by the platform.
(WebDriver::WebDriverService::createSession): Only set an empty proxy object in capabilities if we don't have a
deserialized proxy.
* WebDriverService.h:
* glib/SessionHostGlib.cpp:
(WebDriver::SessionHost::buildSessionCapabilities const): Send the proxy settings to the browser.
* glib/WebDriverServiceGLib.cpp:
(WebDriver::WebDriverService::platformSupportProxyType const): Return false if proxy type is "pac".

Source/WebKit:

* UIProcess/API/glib/WebKitAutomationSession.cpp:
(parseProxyCapabilities): Parse the proxy settings from capabilities.
(webkitAutomationSessionCreate): Set the proxy settings received from capabilities.

WebDriverTests:

Unskip the tests that are now passing.

* TestExpectations.json:

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

6 months ago[LFC][IFC] Line::m_trimmableRuns does not need to be a ListHashSet
zalan@apple.com [Mon, 11 Nov 2019 15:13:37 +0000 (15:13 +0000)]
[LFC][IFC] Line::m_trimmableRuns does not need to be a ListHashSet
https://bugs.webkit.org/show_bug.cgi?id=204061
<rdar://problem/57064178>

Reviewed by Antti Koivisto.

Switch from ListHashSet to Vector.

* layout/inlineformatting/InlineLine.cpp:
(WebCore::Layout::Line::removeTrailingTrimmableContent):
(WebCore::Layout::Line::appendTextContent):
* layout/inlineformatting/InlineLine.h:

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

6 months agoiOS: fast/events/scroll-subframe-in-rendering-update.html always fails
rniwa@webkit.org [Mon, 11 Nov 2019 05:39:22 +0000 (05:39 +0000)]
iOS: fast/events/scroll-subframe-in-rendering-update.html always fails
https://bugs.webkit.org/show_bug.cgi?id=204045

Reviewed by Wenson Hsieh.

Enable async & frame scrolling to make the test work in iOS.

* fast/events/scroll-subframe-in-rendering-update.html:

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

6 months ago[LFC][IFC] Move Line::Run's line layout specific logic to InlineItemRun
zalan@apple.com [Mon, 11 Nov 2019 04:09:59 +0000 (04:09 +0000)]
[LFC][IFC] Move Line::Run's line layout specific logic to InlineItemRun
https://bugs.webkit.org/show_bug.cgi?id=204055
<rdar://problem/57053232>

Reviewed by Antti Koivisto.

Line::Run started getting a bit overloaded through supporting the line layout logic and providing the 'run' interface
to the caller (e.g. merging multiple runs happens at the very end of the line layout, when the line is being closed. When a run
is expanded some of the properties do not make sense anymore. It makes part of the Run's logic unnecessarily complicated).
This patch introduces the InlineItemRun structure to support the line layout logic. We construct InlineItemRuns
as InlineItems are getting appended to the line and when the line is getting closed, we turn them into Line::Runs (InlineItems are never merged, only Line::Runs are).

* layout/displaytree/DisplayRun.h:
(WebCore::Display::Run::TextContext::setExpansion):
(WebCore::Display::Run::Run):
(WebCore::Display::Run::TextContext::resetExpansion): Deleted.
* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::setDisplayBoxesForLine):
* layout/inlineformatting/InlineFormattingContextQuirks.cpp:
(WebCore::Layout::InlineFormattingContext::Quirks::lineDescentNeedsCollapsing const):
* layout/inlineformatting/InlineLine.cpp:
(WebCore::Layout::InlineItemRun::layoutBox const):
(WebCore::Layout::InlineItemRun::logicalRect const):
(WebCore::Layout::InlineItemRun::textContext const):
(WebCore::Layout::InlineItemRun::isText const):
(WebCore::Layout::InlineItemRun::isBox const):
(WebCore::Layout::InlineItemRun::isContainerStart const):
(WebCore::Layout::InlineItemRun::isContainerEnd const):
(WebCore::Layout::InlineItemRun::type const):
(WebCore::Layout::InlineItemRun::setIsCollapsed):
(WebCore::Layout::InlineItemRun::isCollapsed const):
(WebCore::Layout::InlineItemRun::isCollapsedToZeroAdvanceWidth const):
(WebCore::Layout::InlineItemRun::isCollapsible const):
(WebCore::Layout::InlineItemRun::isWhitespace const):
(WebCore::Layout::InlineItemRun::hasExpansionOpportunity const):
(WebCore::Layout::InlineItemRun::InlineItemRun):
(WebCore::Layout::InlineItemRun::setCollapsesToZeroAdvanceWidth):
(WebCore::Layout::Line::Run::Run):
(WebCore::Layout::Line::Run::adjustExpansionBehavior):
(WebCore::Layout::Line::Run::expansionBehavior const):
(WebCore::Layout::Line::Run::setHasExpansionOpportunity):
(WebCore::Layout::Line::Run::setComputedHorizontalExpansion):
(WebCore::Layout::Line::Run::expand):
(WebCore::Layout::Line::~Line):
(WebCore::Layout::Line::isVisuallyEmpty const):
(WebCore::Layout::Line::close):
(WebCore::Layout::Line::alignContentVertically const):
(WebCore::Layout::Line::justifyRuns const):
(WebCore::Layout::Line::alignContentHorizontally const):
(WebCore::Layout::Line::removeTrailingTrimmableContent):
(WebCore::Layout::Line::trailingTrimmableWidth const):
(WebCore::Layout::Line::appendNonBreakableSpace):
(WebCore::Layout::Line::appendTextContent):
(WebCore::Layout::Line::appendNonReplacedInlineBox):
(WebCore::Layout::Line::appendReplacedInlineBox): Need to find a better place for setImage.
(WebCore::Layout::Line::appendLineBreak):
(WebCore::Layout::Line::alignContentVertically): Deleted.
(WebCore::Layout::Line::justifyRuns): Deleted.
(WebCore::Layout::Line::alignContentHorizontally): Deleted.
* layout/inlineformatting/InlineLine.h:
(WebCore::Layout::Line::Run::layoutBox const):
(WebCore::Layout::Line::Run::logicalRect const):
(WebCore::Layout::Line::Run::textContext const):
(WebCore::Layout::Line::Run::isCollapsedToVisuallyEmpty const):
(WebCore::Layout::Line::Run::adjustLogicalTop):
(WebCore::Layout::Line::Run::moveHorizontally):
(WebCore::Layout::Line::Run::moveVertically):
(WebCore::Layout::Line::Run::setTextContext):
(WebCore::Layout::Line::Run::setIsCollapsedToVisuallyEmpty):
(WebCore::Layout::Line::Run::hasExpansionOpportunity const):
(WebCore::Layout::Line::Run::expansionOpportunityCount const):
(WebCore::Layout::Line::Run::displayRun const): Deleted.
(WebCore::Layout::Line::Run::isCollapsed const): Deleted.
(WebCore::Layout::Line::Run::isCollapsible const): Deleted.
(WebCore::Layout::Line::Run::hasTrailingCollapsedContent const): Deleted.
(WebCore::Layout::Line::Run::isWhitespace const): Deleted.
(WebCore::Layout::Line::Run::setIsCollapsed): Deleted.
(WebCore::Layout::Line::Run::isCollapsedToZeroAdvanceWidth const): Deleted.
(WebCore::Layout::Line::Run::setCollapsesToZeroAdvanceWidth): Deleted.
(WebCore::Layout::Line::Run::expansionBehavior const): Deleted.
(WebCore::Layout::Line::Run::setHasExpansionOpportunity): Deleted.
(WebCore::Layout::Line::Run::adjustExpansionBehavior): Deleted.
(WebCore::Layout::Line::Run::setComputedHorizontalExpansion): Deleted.

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

6 months ago[Clipboard API] Add some infrastructure to resolve ClipboardItems into pasteboard...
wenson_hsieh@apple.com [Mon, 11 Nov 2019 00:16:47 +0000 (00:16 +0000)]
[Clipboard API] Add some infrastructure to resolve ClipboardItems into pasteboard data for writing
https://bugs.webkit.org/show_bug.cgi?id=203707

Reviewed by Ryosuke Niwa.

Implements a new method that will be used in a future patch to aggregate data vended by ClipboardItems when
writing items to the platform pasteboard. See below for more details; no new tests, since there is no change in
behavior yet.

* Modules/async-clipboard/ClipboardItem.cpp:
(WebCore::ClipboardItem::collectDataForWriting):

Add a new virtual `collectDataForWriting` method, which is used when writing ClipboardItem data to the
pasteboard. This allows ClipboardItems to asynchronously convert data to a PasteboardCustomData after resolving
promises to strings or blobs; or alternately, cancel all data loading if a promise is rejected.

In order to convert items into a list of PasteboardCustomData, we do the following:

set up a PasteboardCustomData corresponding to each clipboard item
for each clipboard item:
    for each type in the clipboard item:
        try to resolve the promise
        if the promise resolved to a string:
            write the string to custom data under the type
        if the promise resolved to a blob:
            load the blob data as either text or an ArrayBuffer (depending on the type)
            write either the loaded string or buffer to custom data under the type
        if the promise rejected or resolved to an unsupported value, bail from these steps

* Modules/async-clipboard/ClipboardItem.h:
* Modules/async-clipboard/ClipboardItemBindingsDataSource.cpp:
(WebCore::documentFromClipboard):
(WebCore::readTypeForMIMEType):
(WebCore::ClipboardItemBindingsDataSource::collectDataForWriting):
(WebCore::ClipboardItemBindingsDataSource::invokeCompletionHandler):
(WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::ClipboardItemTypeLoader):
(WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::~ClipboardItemTypeLoader):

Add a helper class to hold state associated with loading each clipboard type. This includes the final data
itself (a variant that holds either a String or Blob), as well as a FileReaderLoader which may be present in the
case where the clipboard item type resolves to a blob.

(WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::didFinishLoading):
(WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::didFail):

Each ClipboardItemType is also the client for its FileReaderLoader, if present; when the FileReaderLoader
finishes loading or fails, we then extract data from the loader and invoke the completion handler.

(WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::invokeCompletionHandler):
(WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::didResolveToBlob):
(WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::didFailToResolve):
(WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::didResolveToString):

One of these three methods is called when the promise corresponding to a clipboard type is either resolved or
rejected. If rejected or resolved to an incompatible type, we call the completion handler immediately with no
data; if we resolve to a string, we simply store the string in `m_data` and invoke the completion handler;
otherwise, if we resolve to a blob, we create a new loader to fetch either the string or data buffer for the
blob, and wait until either didFinishLoading or didFail is called.

* Modules/async-clipboard/ClipboardItemBindingsDataSource.h:
(WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::create):
(WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::type):
(WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::data):
* Modules/async-clipboard/ClipboardItemDataSource.h:
* Modules/async-clipboard/ClipboardItemPasteboardDataSource.cpp:
(WebCore::ClipboardItemPasteboardDataSource::collectDataForWriting):

For the time being, leave this unimplemented; a future patch will add support for writing ClipboardItems that
came from the platform pasteboard, as opposed to those created by the page.

* Modules/async-clipboard/ClipboardItemPasteboardDataSource.h:

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

6 months agoStorageManagerSet.m_storageAreas should use weak pointers to StorageArea
ddkilzer@apple.com [Sun, 10 Nov 2019 23:45:00 +0000 (23:45 +0000)]
StorageManagerSet.m_storageAreas should use weak pointers to StorageArea
<https://webkit.org/b/204048>
<rdar://problem/55342744>

Reviewed by Geoffrey Garen.

* NetworkProcess/WebStorage/StorageArea.h:
(class WebKit::StorageArea):
- Inherit from CanMakeWeakPtr<StorageArea>.
* NetworkProcess/WebStorage/StorageManagerSet.cpp:
(WebKit::StorageManagerSet::removeConnection):
(WebKit::StorageManagerSet::waitUntilSyncingLocalStorageFinished):
(WebKit::StorageManagerSet::connectToLocalStorageArea):
(WebKit::StorageManagerSet::connectToTransientLocalStorageArea):
(WebKit::StorageManagerSet::connectToSessionStorageArea):
(WebKit::StorageManagerSet::disconnectFromStorageArea):
(WebKit::StorageManagerSet::getValues): Initialize `quotaError`
stack value since it is not guaranteed to be set.
(WebKit::StorageManagerSet::setItem):
(WebKit::StorageManagerSet::removeItem):
(WebKit::StorageManagerSet::clear):
- Use makeWeakPtr() to add StorageArea pointers to
  m_storageAreas.
- Use `const auto&` to store WeakPtr<StorageArea> values from
  m_storageAreas.
- Add nullptr checks before using WeakPtr<StorageArea> values.
* NetworkProcess/WebStorage/StorageManagerSet.h:
(WebKit::StorageManagerSet::m_storageAreas):
- Use WeakPtr<StorageArea>.

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

6 months agoStack allocate StyleResolver state
antti@apple.com [Sun, 10 Nov 2019 08:01:51 +0000 (08:01 +0000)]
Stack allocate StyleResolver state
https://bugs.webkit.org/show_bug.cgi?id=204053

Reviewed by Zalan Bujtas.

State is currently awkwardly a member that gets cleared. It should be stack allocated and
passed around where needed.

* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::updateBlendingKeyframes):
* css/DOMCSSRegisterCustomProperty.cpp:
(WebCore::DOMCSSRegisterCustomProperty::registerProperty):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::builderContext):

Helper for initializing Style::Builder from resolver state.

(WebCore::StyleResolver::styleForElement):
(WebCore::StyleResolver::styleForKeyframe):
(WebCore::StyleResolver::keyframeStylesForAnimation):
(WebCore::StyleResolver::pseudoStyleForElement):
(WebCore::StyleResolver::styleForPage):
(WebCore::StyleResolver::defaultStyleForElement):
(WebCore::StyleResolver::pseudoStyleRulesForElement):
(WebCore::StyleResolver::applyMatchedProperties):
(WebCore::StyleResolver::State::clear): Deleted.

Nothing to clear, state is transient.

(WebCore::StyleResolver::setNewStateWithElement): Deleted.
(WebCore::StyleResolver::applyPropertyToStyle): Deleted.
(WebCore::StyleResolver::applyPropertyToCurrentStyle): Deleted.

Style::Builder can be used directly to apply properties instead of via these functions that require state setup.

(WebCore::StyleResolver::initializeFontStyle): Deleted.
* css/StyleResolver.h:
(WebCore::StyleResolver::inspectorCSSOMWrappers):
(WebCore::StyleResolver::style const): Deleted.
(WebCore::StyleResolver::parentStyle const): Deleted.
(WebCore::StyleResolver::rootElementStyle const): Deleted.
(WebCore::StyleResolver::element const): Deleted.
(WebCore::StyleResolver::state): Deleted.
(WebCore::StyleResolver::state const): Deleted.
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::setFont):

Use Style::Builder directly to apply properties.

* style/StyleBuilder.cpp:
(WebCore::Style::Builder::Builder):

Encapsulte immutable arguments into BuilderContext type.

(WebCore::Style::Builder::applyPropertyValue):
* style/StyleBuilder.h:
* style/StyleBuilderState.cpp:
(WebCore::Style::BuilderState::BuilderState):
(WebCore::Style::BuilderState::updateFontForZoomChange):
(WebCore::Style::BuilderState::updateFontForGenericFamilyChange):
* style/StyleBuilderState.h:
(WebCore::Style::BuilderState::parentStyle const):
(WebCore::Style::BuilderState::rootElementStyle const):
(WebCore::Style::BuilderState::document const):
(WebCore::Style::BuilderState::element const):
(WebCore::Style::BuilderState::parentFontDescription):

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

6 months agoiOS: fast/events/scroll-subframe-in-rendering-update.html always fails
rniwa@webkit.org [Sun, 10 Nov 2019 07:12:10 +0000 (07:12 +0000)]
iOS: fast/events/scroll-subframe-in-rendering-update.html always fails
https://bugs.webkit.org/show_bug.cgi?id=204045

Reviewed by Alexey Proskuryakov.

Add a failing test expectation for now while we investigate how to fix the test.

* platform/ios/TestExpectations:

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

6 months agoiOS: fast/events/scroll-subframe-in-rendering-update.html always fails
rniwa@webkit.org [Sun, 10 Nov 2019 03:30:09 +0000 (03:30 +0000)]
iOS: fast/events/scroll-subframe-in-rendering-update.html always fails
https://bugs.webkit.org/show_bug.cgi?id=204045

Reviewed by Alexey Proskuryakov.

Disable the frame flattening to make the test work on iOS.

* fast/events/scroll-subframe-in-rendering-update.html:

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

6 months ago[WebAssembly] Improve bytecode dumping
tzagallo@apple.com [Sat, 9 Nov 2019 23:35:11 +0000 (23:35 +0000)]
[WebAssembly] Improve bytecode dumping
https://bugs.webkit.org/show_bug.cgi?id=204051

Reviewed by Keith Miller.

This patch improves the bytecode dumping for Wasm by:
- Adding a new option that dumps only the Wasm bytecode. It can be quite hard to find
  the Wasm bytecode in the middle of a ton of JS bytecode dumps.
- Adding a header with name of the function and stats, similar to the JS dump.
- Using Wasm types to properly print constants, and including the type in constants
  table at the end of the dump.

Here's an example of the updated bytecode dump:

<?>.wasm-function[26] : (I32) -> [I32]
wasm size: 4 bytes
bytecode: 6 instructions (0 16-bit instructions, 0 32-bit instructions); 14 bytes; 1 parameter(s); 18 local(s); 22 callee register(s)
[   0] enter
[   1] mov                loc18, null(const0)
[   4] mov                loc20, loc4
[   7] mov                loc19, loc20
[  10] mov                loc4, loc19
[  13] ret

Constants:
   const0 : Anyref = null

* JavaScriptCore.xcodeproj/project.pbxproj:
* bytecode/BytecodeDumper.cpp:
(JSC::Wasm::BytecodeDumper::dumpBlock):
(JSC::Wasm::BytecodeDumper::dumpConstants):
(JSC::Wasm::BytecodeDumper::constantName const):
(JSC::Wasm::BytecodeDumper::formatConstant const):
* bytecode/BytecodeDumper.h:
(JSC::BytecodeDumper::~BytecodeDumper):
* runtime/OptionsList.h:
* wasm/WasmFunctionCodeBlock.cpp:
* wasm/WasmFunctionCodeBlock.h:
(JSC::Wasm::FunctionCodeBlock::functionIndex const):
(JSC::Wasm::FunctionCodeBlock::numVars const):
(JSC::Wasm::FunctionCodeBlock::numCalleeLocals const):
(JSC::Wasm::FunctionCodeBlock::numArguments const):
(JSC::Wasm::FunctionCodeBlock::constantTypes const):
(JSC::Wasm::FunctionCodeBlock::constants const):
(JSC::Wasm::FunctionCodeBlock::instructions const):
(JSC::Wasm::FunctionCodeBlock::getConstantType const):
* wasm/WasmGeneratorTraits.h: Added.
* wasm/WasmLLIntGenerator.cpp:
(JSC::Wasm::LLIntGenerator::addConstant):
* wasm/WasmLLIntPlan.cpp:
(JSC::Wasm::LLIntPlan::didCompleteCompilation):

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

6 months agoClicky Orbing support.apple.com categories shows a PNG instead of the web page previe...
dino@apple.com [Sat, 9 Nov 2019 20:14:37 +0000 (20:14 +0000)]
Clicky Orbing support.apple.com categories shows a PNG instead of the web page preview, tapping loads image asset only instead of web page
https://bugs.webkit.org/show_bug.cgi?id=204037
<rdar://55614939>

Reviewed by Simon Fraser.

Source/WebKit:

When Safari adopted the ContextMenu API they began providing a PreviewViewController that
showed the image rather than the link, for the case of <a><img></a>.

This could be fixed in Safari, but I noticed that we actually tell the delegate that the
type of the activated element is an image, which is why they treat it as such. It's not
clear that because the image also has a link attached, a client should defer to the link.

Instead, I think it makes more sense to identify this as a link, because that is the more
important information in this API.

While here I also changed the logic to make sure we call the API if both the API and SPI
are available.

New ContextMenus and WKRequestActivatedElementInfo API tests.

* UIProcess/API/Cocoa/_WKActivatedElementInfo.mm: Identify as a link if you have a link.
(-[_WKActivatedElementInfo _initWithInteractionInformationAtPosition:userInfo:]):
* UIProcess/ios/WKContentViewInteraction.mm: Look for the API before the SPI.
(-[WKContentView continueContextMenuInteraction:]):

Tools:

New tests for a link wrapping an image, and the ordering of API and SPI.

Rename these tests so that they are much easier to filter on the command line.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/ContextMenus.mm:
(TEST):
(-[TestContextMenuAPIBeforeSPIUIDelegate webView:contextMenuConfigurationForElement:completionHandler:]):
(-[TestContextMenuAPIBeforeSPIUIDelegate _webView:contextMenuConfigurationForElement:completionHandler:]):
(-[TestContextMenuAPIBeforeSPIUIDelegate webView:contextMenuWillPresentForElement:]):
* TestWebKitAPI/Tests/WebKitCocoa/WKRequestActivatedElementInfo.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitCocoa/image.html: Added.
* TestWebKitAPI/Tests/WebKitCocoa/link-with-image.html: Added.

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

6 months agoMove style adjustment code out of StyleResolver and into a class of its own
antti@apple.com [Sat, 9 Nov 2019 17:09:02 +0000 (17:09 +0000)]
Move style adjustment code out of StyleResolver and into a class of its own
https://bugs.webkit.org/show_bug.cgi?id=204041

Reviewed by Zalan Bujtas.

Introduce Style::Adjuster.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/StyleResolver.cpp:
(WebCore::StyleResolver::styleForElement):
(WebCore::StyleResolver::styleForKeyframe):
(WebCore::StyleResolver::pseudoStyleForElement):
(WebCore::addIntrinsicMargins): Deleted.
(WebCore::equivalentBlockDisplay): Deleted.
(WebCore::doesNotInheritTextDecoration): Deleted.
(WebCore::isScrollableOverflow): Deleted.
(WebCore::hasEffectiveDisplayNoneForDisplayContents): Deleted.
(WebCore::adjustDisplayContentsStyle): Deleted.
(WebCore::StyleResolver::adjustSVGElementStyle): Deleted.
(WebCore::computeEffectiveTouchActions): Deleted.
(WebCore::hasTextChild): Deleted.
(WebCore::StyleResolver::adjustRenderStyleForTextAutosizing): Deleted.
(WebCore::StyleResolver::adjustRenderStyle): Deleted.
(WebCore::StyleResolver::adjustRenderStyleForSiteSpecificQuirks): Deleted.
* css/StyleResolver.h:
* page/Page.cpp:
(WebCore::Page::recomputeTextAutoSizingInAllFrames):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::adjustStyle):

None of this code uses the StyleResolver argument so remove it.

(WebCore::RenderTheme::adjustCheckboxStyle const):
(WebCore::RenderTheme::adjustRadioStyle const):
(WebCore::RenderTheme::adjustButtonStyle const):
(WebCore::RenderTheme::adjustInnerSpinButtonStyle const):
(WebCore::RenderTheme::adjustTextFieldStyle const):
(WebCore::RenderTheme::adjustTextAreaStyle const):
(WebCore::RenderTheme::adjustMenuListStyle const):
(WebCore::RenderTheme::adjustMeterStyle const):
(WebCore::RenderTheme::adjustCapsLockIndicatorStyle const):
(WebCore::RenderTheme::adjustAttachmentStyle const):
(WebCore::RenderTheme::adjustListButtonStyle const):
(WebCore::RenderTheme::adjustProgressBarStyle const):
(WebCore::RenderTheme::adjustMenuListButtonStyle const):
(WebCore::RenderTheme::adjustMediaControlStyle const):
(WebCore::RenderTheme::adjustSliderTrackStyle const):
(WebCore::RenderTheme::adjustSliderThumbStyle const):
(WebCore::RenderTheme::adjustSearchFieldStyle const):
(WebCore::RenderTheme::adjustSearchFieldCancelButtonStyle const):
(WebCore::RenderTheme::adjustSearchFieldDecorationPartStyle const):
(WebCore::RenderTheme::adjustSearchFieldResultsDecorationPartStyle const):
(WebCore::RenderTheme::adjustSearchFieldResultsButtonStyle const):
* rendering/RenderTheme.h:
(WebCore::RenderTheme::adjustApplePayButtonStyle const):
* rendering/RenderThemeCocoa.h:
* rendering/RenderThemeCocoa.mm:
(WebCore::RenderThemeCocoa::adjustApplePayButtonStyle const):
* rendering/RenderThemeGtk.cpp:
(WebCore::RenderThemeGtk::adjustButtonStyle const):
(WebCore::RenderThemeGtk::adjustMenuListStyle const):
(WebCore::RenderThemeGtk::adjustMenuListButtonStyle const):
(WebCore::RenderThemeGtk::adjustTextFieldStyle const):
(WebCore::RenderThemeGtk::adjustSearchFieldResultsButtonStyle const):
(WebCore::RenderThemeGtk::adjustSearchFieldResultsDecorationPartStyle const):
(WebCore::RenderThemeGtk::adjustSearchFieldCancelButtonStyle const):
(WebCore::RenderThemeGtk::adjustListButtonStyle const):
(WebCore::RenderThemeGtk::adjustSearchFieldStyle const):
(WebCore::RenderThemeGtk::adjustSliderTrackStyle const):
(WebCore::RenderThemeGtk::adjustSliderThumbStyle const):
(WebCore::RenderThemeGtk::adjustInnerSpinButtonStyle const):
(WebCore::RenderThemeGtk::adjustProgressBarStyle const):
* rendering/RenderThemeGtk.h:
* rendering/RenderThemeIOS.h:
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::adjustCheckboxStyle const):
(WebCore::RenderThemeIOS::adjustRadioStyle const):
(WebCore::RenderThemeIOS::adjustMenuListButtonStyle const):
(WebCore::RenderThemeIOS::adjustSliderTrackStyle const):
(WebCore::RenderThemeIOS::adjustSearchFieldStyle const):
(WebCore::RenderThemeIOS::adjustButtonStyle const):
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::setFontFromControlSize const):
(WebCore::RenderThemeMac::adjustListButtonStyle const):
(WebCore::RenderThemeMac::adjustTextFieldStyle const):
(WebCore::RenderThemeMac::adjustTextAreaStyle const):
(WebCore::RenderThemeMac::adjustProgressBarStyle const):
(WebCore::RenderThemeMac::adjustMenuListStyle const):
(WebCore::RenderThemeMac::adjustMenuListButtonStyle const):
(WebCore::RenderThemeMac::adjustSliderTrackStyle const):
(WebCore::RenderThemeMac::adjustSliderThumbStyle const):
(WebCore::RenderThemeMac::adjustSearchFieldStyle const):
(WebCore::RenderThemeMac::adjustSearchFieldCancelButtonStyle const):
(WebCore::RenderThemeMac::adjustSearchFieldDecorationPartStyle const):
(WebCore::RenderThemeMac::adjustSearchFieldResultsDecorationPartStyle const):
(WebCore::RenderThemeMac::adjustSearchFieldResultsButtonStyle const):
* style/StyleAdjuster.cpp: Added.
(WebCore::Style::Adjuster::Adjuster):
(WebCore::Style::addIntrinsicMargins):
(WebCore::Style::equivalentBlockDisplay):
(WebCore::Style::isAtShadowBoundary):
(WebCore::Style::doesNotInheritTextDecoration):
(WebCore::Style::isScrollableOverflow):
(WebCore::Style::computeEffectiveTouchActions):
(WebCore::Style::Adjuster::adjust const):
(WebCore::Style::hasEffectiveDisplayNoneForDisplayContents):
(WebCore::Style::Adjuster::adjustDisplayContentsStyle const):
(WebCore::Style::Adjuster::adjustSVGElementStyle):
(WebCore::Style::Adjuster::adjustForSiteSpecificQuirks const):
(WebCore::Style::hasTextChild):
(WebCore::Style::Adjuster::adjustForTextAutosizing):
* style/StyleAdjuster.h: Added.
* svg/SVGElement.cpp:
(WebCore::SVGElement::resolveCustomStyle):

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

6 months ago[Web Animations] Optimize animation resolution to not re-compute whether effects...
graouts@webkit.org [Sat, 9 Nov 2019 11:05:21 +0000 (11:05 +0000)]
[Web Animations] Optimize animation resolution to not re-compute whether effects only contain accelerated animation properties
https://bugs.webkit.org/show_bug.cgi?id=204009

Reviewed by Dean Jackson.

A KeyframeEffect already exposes whether it only affects CSS properties that can be accelerated, so use this information instead
of iterating over an effect's animated properties during resolution to get at the same information.

No tests or changes to existed test expectations as this should not yield any change in behavior.

* dom/Element.cpp:
(WebCore::Element::applyKeyframeEffects):

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

6 months ago[WebAssembly] LLIntGenerator should not retain VirtualRegisters used for constants
tzagallo@apple.com [Sat, 9 Nov 2019 07:05:16 +0000 (07:05 +0000)]
[WebAssembly] LLIntGenerator should not retain VirtualRegisters used for constants
https://bugs.webkit.org/show_bug.cgi?id=204028

Reviewed by Yusuke Suzuki.

The LLIntGenerator was keeping track of which RegisterIDs contained constants in order to materialize
the OSR entry data, since constants were not included in the OSR entry buffer. This was originally done
by adding the registers that contained constants to a vector and never reusing them. This is bad because
the bytecode generator reclaims registers by popping unused registers from the end of the vector and
stops as soon as it finds a used register. As it turns out, constants *should* be included in the buffer,
so we don't need to worry about whether registers contain constants and we can just stop retaining the
registers. An assertion was added to doOSREntry to ensure that the size of the scratch buffer matches the
size of the values to be written, which was not true before.
Additionally, add m_constantMap to LLIntGenerator to avoid adding duplicate constants to code blocks.

* bytecompiler/BytecodeGenerator.h:
* bytecompiler/BytecodeGeneratorBase.h:
* wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::addLoop):
* wasm/WasmLLIntGenerator.cpp:
(JSC::Wasm::LLIntGenerator::addConstant):
(JSC::Wasm::LLIntGenerator::addLoop):
* wasm/WasmOperations.cpp:
(JSC::Wasm::doOSREntry):

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

6 months agoNew test inspector-protocol/page/archive.html added in r154828 fails on EFL, Qt, GTK
yurys@chromium.org [Sat, 9 Nov 2019 06:27:57 +0000 (06:27 +0000)]
New test inspector-protocol/page/archive.html added in r154828 fails on EFL, Qt, GTK
https://bugs.webkit.org/show_bug.cgi?id=120682

Reviewed by Devin Rousso.

Generate custom expectations for inspector-protocol/page/archive.html on the platforms
where Page.archive is not supported yet.

* inspector/page/archive.html: 'Not supported' is a valid response on some platforms.
* platform/gtk/TestExpectations:
* platform/gtk/inspector/page/archive-expected.txt: Added.

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

6 months agoUnreviewed, fix debug JSC tests failures due to missing exception check
ysuzuki@apple.com [Sat, 9 Nov 2019 04:09:36 +0000 (04:09 +0000)]
Unreviewed, fix debug JSC tests failures due to missing exception check
https://bugs.webkit.org/show_bug.cgi?id=203936

* tools/JSDollarVM.cpp:
(JSC::functionCallWithStackSize):

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

6 months agoWKWebView Find-in-page API.
beidson@apple.com [Sat, 9 Nov 2019 04:06:58 +0000 (04:06 +0000)]
WKWebView Find-in-page API.
<rdar://problem/46971112> and https://bugs.webkit.org/show_bug.cgi?id=203872

Reviewed by Tim Horton.

Source/WebKit:

Covered by API tests.

- Promote _findString:
- Add a completion handler for it.

* SourcesCocoa.txt:

* UIProcess/API/Cocoa/WKFindConfiguration.h: Added.
* UIProcess/API/Cocoa/WKFindConfiguration.mm: Added.
(-[WKFindConfiguration init]):
(-[WKFindConfiguration copyWithZone:]):

* UIProcess/API/Cocoa/WKFindResult.h: Added.
* UIProcess/API/Cocoa/WKFindResult.mm: Added.
(-[WKFindResult init]):
(-[WKFindResult _initWithMatchFound:]):
(-[WKFindResult copyWithZone:]):
* UIProcess/API/Cocoa/WKFindResultInternal.h: Added.

* UIProcess/API/Cocoa/WKWebView.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(toFindOptions):
(-[WKWebView findString:withConfiguration:completionHandler:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:

* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:

* UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.h:
* UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.mm:

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::findString):
(WebKit::WebPageProxy::findStringCallback):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:

* WebKit.xcodeproj/project.pbxproj:

* WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::findString):
* WebProcess/WebPage/FindController.h:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::findString):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/FindInPageAPI.mm: Added.
(TEST):
* TestWebKitAPI/cocoa/TestWKWebView.h:
* TestWebKitAPI/cocoa/TestWKWebView.mm:
(-[TestWKWebView selectionRangeHasStartOffset:endOffset:]):

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

6 months ago[JSC] Rename LargeAllocation to PreciseAllocation
ysuzuki@apple.com [Sat, 9 Nov 2019 03:45:18 +0000 (03:45 +0000)]
[JSC] Rename LargeAllocation to PreciseAllocation
https://bugs.webkit.org/show_bug.cgi?id=204040

Reviewed by Keith Miller.

After r252298, LargeAllocation is also used for small allocations.
This patch renames from LargeAllocation to PreciseAllocation since it reflects the behavior.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Sources.txt:
* heap/CellContainer.cpp:
(JSC::CellContainer::isNewlyAllocated const):
* heap/CellContainer.h:
(JSC::CellContainer::CellContainer):
(JSC::CellContainer::isMarkedBlock const):
(JSC::CellContainer::isPreciseAllocation const):
(JSC::CellContainer::preciseAllocation const):
(JSC::CellContainer::isLargeAllocation const): Deleted.
(JSC::CellContainer::largeAllocation const): Deleted.
* heap/CellContainerInlines.h:
(JSC::CellContainer::vm const):
(JSC::CellContainer::isMarked const):
(JSC::CellContainer::noteMarked):
(JSC::CellContainer::assertValidCell const):
(JSC::CellContainer::cellSize const):
(JSC::CellContainer::weakSet const):
(JSC::CellContainer::aboutToMark):
(JSC::CellContainer::areMarksStale const):
* heap/CompleteSubspace.cpp:
(JSC::CompleteSubspace::tryAllocateSlow):
(JSC::CompleteSubspace::reallocatePreciseAllocationNonVirtual):
(JSC::CompleteSubspace::reallocateLargeAllocationNonVirtual): Deleted.
* heap/CompleteSubspace.h:
* heap/Heap.cpp:
(JSC::Heap::sweepInFinalize):
* heap/HeapCell.cpp:
(JSC::HeapCell::isLive):
* heap/HeapCell.h:
* heap/HeapCellInlines.h:
(JSC::HeapCell::isPreciseAllocation const):
(JSC::HeapCell::cellContainer const):
(JSC::HeapCell::preciseAllocation const):
(JSC::HeapCell::vm const):
(JSC::HeapCell::cellSize const):
(JSC::HeapCell::cellAttributes const):
(JSC::HeapCell::subspace const):
(JSC::HeapCell::isLargeAllocation const): Deleted.
(JSC::HeapCell::largeAllocation const): Deleted.
* heap/HeapInlines.h:
(JSC::Heap::isMarked):
(JSC::Heap::testAndSetMarked):
* heap/HeapUtil.h:
(JSC::HeapUtil::findGCObjectPointersForMarking):
(JSC::HeapUtil::isPointerGCObjectJSCell):
(JSC::HeapUtil::isValueGCObject):
* heap/IsoAlignedMemoryAllocator.cpp:
(JSC::IsoAlignedMemoryAllocator::tryReallocateMemory):
* heap/IsoCellSetInlines.h:
(JSC::IsoCellSet::add):
(JSC::IsoCellSet::remove):
(JSC::IsoCellSet::contains const):
(JSC::IsoCellSet::forEachMarkedCell):
(JSC::IsoCellSet::forEachMarkedCellInParallel):
(JSC::IsoCellSet::forEachLiveCell):
* heap/IsoSubspace.cpp:
(JSC::IsoSubspace::tryAllocateFromLowerTier):
(JSC::IsoSubspace::sweepLowerTierCell):
(JSC::IsoSubspace::destroyLowerTierFreeList):
* heap/IsoSubspace.h:
* heap/MarkedSpace.cpp:
(JSC::MarkedSpace::freeMemory):
(JSC::MarkedSpace::lastChanceToFinalize):
(JSC::MarkedSpace::sweepPreciseAllocations):
(JSC::MarkedSpace::prepareForAllocation):
(JSC::MarkedSpace::enablePreciseAllocationTracking):
(JSC::MarkedSpace::prepareForConservativeScan):
(JSC::MarkedSpace::prepareForMarking):
(JSC::MarkedSpace::resumeAllocating):
(JSC::MarkedSpace::isPagedOut):
(JSC::MarkedSpace::beginMarking):
(JSC::MarkedSpace::endMarking):
(JSC::MarkedSpace::objectCount):
(JSC::MarkedSpace::size):
(JSC::MarkedSpace::sweepLargeAllocations): Deleted.
(JSC::MarkedSpace::enableLargeAllocationTracking): Deleted.
* heap/MarkedSpace.h:
(JSC::MarkedSpace:: const):
(JSC::MarkedSpace::preciseAllocationsNurseryOffset const):
(JSC::MarkedSpace::preciseAllocationsOffsetForThisCollection const):
(JSC::MarkedSpace::preciseAllocationsForThisCollectionBegin const):
(JSC::MarkedSpace::preciseAllocationsForThisCollectionEnd const):
(JSC::MarkedSpace::preciseAllocationsForThisCollectionSize const):
(JSC::MarkedSpace::largeAllocationsNurseryOffset const): Deleted.
(JSC::MarkedSpace::largeAllocationsOffsetForThisCollection const): Deleted.
(JSC::MarkedSpace::largeAllocationsForThisCollectionBegin const): Deleted.
(JSC::MarkedSpace::largeAllocationsForThisCollectionEnd const): Deleted.
(JSC::MarkedSpace::largeAllocationsForThisCollectionSize const): Deleted.
* heap/MarkedSpaceInlines.h:
(JSC::MarkedSpace::forEachLiveCell):
(JSC::MarkedSpace::forEachDeadCell):
* heap/PreciseAllocation.cpp: Renamed from Source/JavaScriptCore/heap/LargeAllocation.cpp.
(JSC::isAlignedForPreciseAllocation):
(JSC::PreciseAllocation::tryCreate):
(JSC::PreciseAllocation::tryReallocate):
(JSC::PreciseAllocation::createForLowerTier):
(JSC::PreciseAllocation::reuseForLowerTier):
(JSC::PreciseAllocation::PreciseAllocation):
(JSC::PreciseAllocation::~PreciseAllocation):
(JSC::PreciseAllocation::lastChanceToFinalize):
(JSC::PreciseAllocation::shrink):
(JSC::PreciseAllocation::visitWeakSet):
(JSC::PreciseAllocation::reapWeakSet):
(JSC::PreciseAllocation::flip):
(JSC::PreciseAllocation::isEmpty):
(JSC::PreciseAllocation::sweep):
(JSC::PreciseAllocation::destroy):
(JSC::PreciseAllocation::dump const):
(JSC::PreciseAllocation::assertValidCell const):
* heap/PreciseAllocation.h: Renamed from Source/JavaScriptCore/heap/LargeAllocation.h.
(JSC::PreciseAllocation::fromCell):
(JSC::PreciseAllocation::isPreciseAllocation):
(JSC::PreciseAllocation::headerSize):
(JSC::PreciseAllocation::basePointer const):
* heap/SlotVisitor.cpp:
(JSC::SlotVisitor::appendHiddenSlowImpl):
(JSC::SlotVisitor::appendToMarkStack):
* heap/SlotVisitorInlines.h:
(JSC::SlotVisitor::appendUnbarriered):
(JSC::SlotVisitor::appendHiddenUnbarriered):
* heap/Subspace.h:
* heap/SubspaceInlines.h:
(JSC::Subspace::forEachPreciseAllocation):
(JSC::Subspace::forEachMarkedCell):
(JSC::Subspace::forEachMarkedCellInParallel):
(JSC::Subspace::forEachLiveCell):
(JSC::Subspace::forEachLargeAllocation): Deleted.
* heap/WeakBlock.cpp:
(JSC::WeakBlock::visit):
* heap/WeakSet.cpp:
(JSC::WeakSet::sweep):
* llint/LowLevelInterpreter.asm:
* runtime/ButterflyInlines.h:
(JSC::Butterfly::reallocArrayRightIfPossible):
* runtime/OptionsList.h:
* runtime/SamplingProfiler.cpp:
(JSC::SamplingProfiler::SamplingProfiler):
* tools/VMInspector.cpp:
(JSC::VMInspector::isInHeap):
* tools/VMInspectorInlines.h:
(JSC::VMInspector::verifyCell):

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

6 months agoAdd back/forward cache quirk for Vimeo.com
cdumez@apple.com [Sat, 9 Nov 2019 03:29:14 +0000 (03:29 +0000)]
Add back/forward cache quirk for Vimeo.com
https://bugs.webkit.org/show_bug.cgi?id=204025
<rdar://problem/56996057>

Reviewed by Antti Koivisto.

Vimeo.com used to bypass the back/forward cache by serving "Cache-Control: no-store" over HTTPS.
We started caching such content in r250437 but the vimeo.com content unfortunately is not currently compatible
because it changes the opacity of its body to 0 when navigating away and fails to restore the original opacity
when coming back from the back/forward cache (e.g. in 'pageshow' event handler).

To address the issue, this patch introduces a quirk to restore pre-r250437 on Vimeo.com, until they get
a chance to fix their content.

* history/BackForwardCache.cpp:
(WebCore::canCacheFrame):
* page/DiagnosticLoggingKeys.cpp:
(WebCore::DiagnosticLoggingKeys::siteSpecificQuirkKey):
* page/DiagnosticLoggingKeys.h:
* page/Quirks.cpp:
(WebCore::Quirks::shouldBypassBackForwardCache const):
* page/Quirks.h:

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

6 months agoSWServerWorker in redundant state do not need to process messages from the context...
youenn@apple.com [Sat, 9 Nov 2019 03:02:59 +0000 (03:02 +0000)]
SWServerWorker in redundant state do not need to process messages from the context process
https://bugs.webkit.org/show_bug.cgi?id=204019

Reviewed by Chris Dumez.

When a service worker is marked as redundant in network process, it might still receive some messages like didFinishActivation or didFinishInstall.
In that state, we do not need to process these messages.
Did some refactoring to directly pass the service worker to the job queue.
This makes it clear the registration and service worker are the correct ones.

* workers/service/server/SWServer.cpp:
(WebCore::SWServer::didFinishInstall):
Pass the worker instead of its identifier.
* workers/service/server/SWServerJobQueue.cpp:
(WebCore::SWServerJobQueue::didFinishInstall):
Now that we are given the service worker, get its registration directly.
* workers/service/server/SWServerJobQueue.h:
* workers/service/server/SWServerWorker.cpp:
(WebCore::SWServerWorker::didFinishInstall):
Exit early in redundant state.
(WebCore::SWServerWorker::didFinishActivation):
Exit early in redundant state.

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

6 months agoXMLHttpRequestUpload should be exposed in dedicated workers
youenn@apple.com [Sat, 9 Nov 2019 02:44:57 +0000 (02:44 +0000)]
XMLHttpRequestUpload should be exposed in dedicated workers
https://bugs.webkit.org/show_bug.cgi?id=203901

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

* web-platform-tests/workers/semantics/interface-objects/001.worker-expected.txt:
* web-platform-tests/xhr/idlharness.any.worker-expected.txt:

Source/WebCore:

Covered by rebased test.

* xml/XMLHttpRequestUpload.idl:

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

6 months ago[JSC] Make IsoSubspace scalable
ysuzuki@apple.com [Sat, 9 Nov 2019 01:37:55 +0000 (01:37 +0000)]
[JSC] Make IsoSubspace scalable
https://bugs.webkit.org/show_bug.cgi?id=201908

Reviewed by Keith Miller.

This patch introduces lower-tier into IsoSubspace so that we can avoid allocating MarkedBlock
if a certain type of object is not allocated so many. This optimization allows us apply IsoSubspace
more aggressively to various types of objects without introducing memory regression even if such a
type of object is allocated so frequently.

We use LargeAllocation for these lower-tier objects. Each IsoSubspace holds up to 8 lower-tier objects
allocated via LargeAllocation. We use this special LargeAllocation when we tend to allocate small # of cells
for this type. Specifically, what we are doing right now is, (1) first, try to allocate in an existing
MarkedBlock (there won't be one to start), and (2) then, try to allocate in LargeAllocation, and if we cannot
allocate lower-tier objects, (3) finally we allocate a new MarkedBlock. Once this LargeAllocation is allocated
to a certain type, we do not deallocate it until VM is destroyed, so that we can keep IsoSubspace's
characteristics: once an address is assigned to a certain type, we continue using this address only for this type.

To introduce this optimization, we need to remove an restriction that no callee cells can be a LargeAllocation.
This also turns out that SamplingProfiler's isValueGCObject is heavily relies on that all the callee is small-sized.
isValueGCObject relies on the thing that MarkedSpace::m_largeAllocations is sorted. But this is not true since
this vector is sorted only when conservative scan happens. And further, this vector is only partially sorted: we
sort only an eden part part of this vector. So we cannot use this vector to implement isValueGCObject in the sampling
profiler. Instead we register HeapCell address into a hash-set in MarkedSpace. Since we do not need to find a pointer
that is pointing at the middle of the JSCell in sampling profiler, just registering cell address is enough. And we
maintain this hash-set only when sampling profiler is enabled to save memory in major cases.

We also fix the code that is relying on that JSString is always allocated in MarkedBlock. And we also fix PackedCellPtr's
assumption that CodeBlock is always allocated in MarkedBlock.

We also make sizeof(LargeAllocation) small since it is now used for non-large allocations.

JetStream2 and Speedometer2 are neutral. RAMification shows 0.6% progression on iOS devices.

* heap/BlockDirectory.cpp:
(JSC::BlockDirectory::BlockDirectory):
* heap/BlockDirectory.h:
* heap/BlockDirectoryInlines.h:
(JSC::BlockDirectory::tryAllocateFromLowerTier):
* heap/CompleteSubspace.cpp:
(JSC::CompleteSubspace::allocatorForSlow):
(JSC::CompleteSubspace::tryAllocateSlow):
(JSC::CompleteSubspace::reallocateLargeAllocationNonVirtual):
* heap/Heap.cpp:
(JSC::Heap::dumpHeapStatisticsAtVMDestruction):
(JSC::Heap::addCoreConstraints):
* heap/HeapUtil.h:
(JSC::HeapUtil::isPointerGCObjectJSCell):
(JSC::HeapUtil::isValueGCObject):
* heap/IsoAlignedMemoryAllocator.cpp:
(JSC::IsoAlignedMemoryAllocator::tryAllocateMemory):
(JSC::IsoAlignedMemoryAllocator::freeMemory):
(JSC::IsoAlignedMemoryAllocator::tryReallocateMemory):
* heap/IsoCellSet.cpp:
(JSC::IsoCellSet::~IsoCellSet):
* heap/IsoCellSet.h:
* heap/IsoCellSetInlines.h:
(JSC::IsoCellSet::add):
(JSC::IsoCellSet::remove):
(JSC::IsoCellSet::contains const):
(JSC::IsoCellSet::forEachMarkedCell):
(JSC::IsoCellSet::forEachMarkedCellInParallel):
(JSC::IsoCellSet::forEachLiveCell):
(JSC::IsoCellSet::sweepLowerTierCell):
* heap/IsoSubspace.cpp:
(JSC::IsoSubspace::IsoSubspace):
(JSC::IsoSubspace::tryAllocateFromLowerTier):
(JSC::IsoSubspace::sweepLowerTierCell):
* heap/IsoSubspace.h:
* heap/LargeAllocation.cpp:
(JSC::LargeAllocation::tryReallocate):
(JSC::LargeAllocation::createForLowerTier):
(JSC::LargeAllocation::reuseForLowerTier):
(JSC::LargeAllocation::LargeAllocation):
* heap/LargeAllocation.h:
(JSC::LargeAllocation::lowerTierIndex const):
(JSC::LargeAllocation::isLowerTier const):
* heap/LocalAllocator.cpp:
(JSC::LocalAllocator::allocateSlowCase):
* heap/MarkedBlock.cpp:
(JSC::MarkedBlock::Handle::Handle):
(JSC::MarkedBlock::Handle::stopAllocating):
* heap/MarkedBlock.h:
(JSC::MarkedBlock::Handle::forEachCell):
* heap/MarkedSpace.cpp:
(JSC::MarkedSpace::freeMemory):
(JSC::MarkedSpace::lastChanceToFinalize):
(JSC::MarkedSpace::sweepLargeAllocations):
(JSC::MarkedSpace::enableLargeAllocationTracking):
* heap/MarkedSpace.h:
(JSC::MarkedSpace:: const):
* heap/PackedCellPtr.h:
(JSC::PackedCellPtr::PackedCellPtr):
* heap/Subspace.h:
* heap/WeakSet.cpp:
(JSC::WeakSet::~WeakSet):
(JSC::WeakSet::findAllocator):
(JSC::WeakSet::addAllocator):
* heap/WeakSet.h:
(JSC::WeakSet::WeakSet):
(JSC::WeakSet::resetAllocator):
(JSC::WeakSet::container const): Deleted.
(JSC::WeakSet::setContainer): Deleted.
* heap/WeakSetInlines.h:
(JSC::WeakSet::allocate):
* runtime/InternalFunction.cpp:
(JSC::InternalFunction::InternalFunction):
* runtime/JSCallee.cpp:
(JSC::JSCallee::JSCallee):
* runtime/JSString.h:
* runtime/SamplingProfiler.cpp:
(JSC::SamplingProfiler::SamplingProfiler):
(JSC::SamplingProfiler::processUnverifiedStackTraces):
(JSC::SamplingProfiler::releaseStackTraces):
(JSC::SamplingProfiler::stackTracesAsJSON):
(JSC::SamplingProfiler::reportTopFunctions):
(JSC::SamplingProfiler::reportTopBytecodes):
* runtime/SamplingProfiler.h:

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

6 months ago[WebAuthn] Add quirk needed to support legacy Google NFC Titan security keys
jiewen_tan@apple.com [Sat, 9 Nov 2019 01:09:19 +0000 (01:09 +0000)]
[WebAuthn] Add quirk needed to support legacy Google NFC Titan security keys
https://bugs.webkit.org/show_bug.cgi?id=204024
<rdar://problem/56962320>

Reviewed by Brent Fulgham.

Source/WebCore:

Covered by manual tests.

* Modules/webauthn/fido/FidoConstants.h:

Source/WebKit:

Some legacy U2F keys such as Google T1 Titan don't understand the FIDO applet command. Instead,
they are configured to only have the FIDO applet. Therefore, when the above command fails, we
use U2F_VERSION command to double check if the connected tag can actually speak U2F, indicating
we are interacting with one of these legacy keys.

* UIProcess/WebAuthentication/Cocoa/NfcConnection.mm:
(WebKit::fido::compareVersion):
(WebKit::fido::trySelectFidoApplet):
(WebKit::NfcConnection::transact const):
(WebKit::NfcConnection::didDetectTags):

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

6 months agoEntering/Exiting Picture-in-Picture mode through webkitSetPresentationMode() does...
commit-queue@webkit.org [Sat, 9 Nov 2019 00:39:29 +0000 (00:39 +0000)]
Entering/Exiting Picture-in-Picture mode through webkitSetPresentationMode() does not fire events (enterpictureinpicture and leavepictureinpicture) defined in the spec
https://bugs.webkit.org/show_bug.cgi?id=203989

Patch by Peng Liu <peng.liu6@apple.com> on 2019-11-08
Reviewed by Eric Carlson.

Source/WebCore:

Instantiate a HTMLVideoElementPictureInPicture object when we create a new video element
so that the events defined in the spec will be fired no matter which interface is used
to enter/exit the Picture-in-Picture mode.

Test: media/picture-in-picture/picture-in-picture-events.html

* Modules/pictureinpicture/HTMLVideoElementPictureInPicture.cpp:
(WebCore::HTMLVideoElementPictureInPicture::providePictureInPictureTo):
* Modules/pictureinpicture/HTMLVideoElementPictureInPicture.h:
* WebCore.xcodeproj/project.pbxproj:
* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::create):

LayoutTests:

Move all layout tests for Picture-in-Picture to folder media/picture-in-picture.
Add a layout test to verify the events defined in the spec are fired when we call the webkit prefixed API.
Update TestExpectations files since webkit.org/b/203614 has been fixed.

* TestExpectations:
* media/picture-in-picture/picture-in-picture-api-element-attributes-expected.txt: Renamed from LayoutTests/media/picture-in-picture-api-element-attributes-expected.txt.
* media/picture-in-picture/picture-in-picture-api-element-attributes.html: Renamed from LayoutTests/media/picture-in-picture-api-element-attributes.html.
* media/picture-in-picture/picture-in-picture-api-enter-pip-1-expected.txt: Renamed from LayoutTests/media/picture-in-picture-api-enter-pip-1-expected.txt.
* media/picture-in-picture/picture-in-picture-api-enter-pip-1.html: Renamed from LayoutTests/media/picture-in-picture-api-enter-pip-1.html.
* media/picture-in-picture/picture-in-picture-api-enter-pip-2-expected.txt: Renamed from LayoutTests/media/picture-in-picture-api-enter-pip-2-expected.txt.
* media/picture-in-picture/picture-in-picture-api-enter-pip-2.html: Renamed from LayoutTests/media/picture-in-picture-api-enter-pip-2.html.
* media/picture-in-picture/picture-in-picture-api-enter-pip-3-expected.txt: Renamed from LayoutTests/media/picture-in-picture-api-enter-pip-3-expected.txt.
* media/picture-in-picture/picture-in-picture-api-enter-pip-3.html: Renamed from LayoutTests/media/picture-in-picture-api-enter-pip-3.html.
* media/picture-in-picture/picture-in-picture-api-enter-pip-4-expected.txt: Renamed from LayoutTests/media/picture-in-picture-api-enter-pip-4-expected.txt.
* media/picture-in-picture/picture-in-picture-api-enter-pip-4.html: Renamed from LayoutTests/media/picture-in-picture-api-enter-pip-4.html.
* media/picture-in-picture/picture-in-picture-api-events-expected.txt: Renamed from LayoutTests/media/picture-in-picture-api-pip-events-expected.txt.
* media/picture-in-picture/picture-in-picture-api-events.html: Renamed from LayoutTests/media/picture-in-picture-api-pip-events.html.
* media/picture-in-picture/picture-in-picture-api-exit-pip-1-expected.txt: Renamed from LayoutTests/media/picture-in-picture-api-exit-pip-1-expected.txt.
* media/picture-in-picture/picture-in-picture-api-exit-pip-1.html: Renamed from LayoutTests/media/picture-in-picture-api-exit-pip-1.html.
* media/picture-in-picture/picture-in-picture-api-exit-pip-2-expected.txt: Renamed from LayoutTests/media/picture-in-picture-api-exit-pip-2-expected.txt.
* media/picture-in-picture/picture-in-picture-api-exit-pip-2.html: Renamed from LayoutTests/media/picture-in-picture-api-exit-pip-2.html.
* media/picture-in-picture/picture-in-picture-api-pip-window-expected.txt: Renamed from LayoutTests/media/picture-in-picture-api-pip-window-expected.txt.
* media/picture-in-picture/picture-in-picture-api-pip-window.html: Renamed from LayoutTests/media/picture-in-picture-api-pip-window.html.
* media/picture-in-picture/picture-in-picture-events-expected.txt: Added.
* media/picture-in-picture/picture-in-picture-events.html: Added.
* media/picture-in-picture/picture-in-picture-interruption-expected.txt: Renamed from LayoutTests/media/picture-in-picture-interruption-expected.txt.
* media/picture-in-picture/picture-in-picture-interruption.html: Renamed from LayoutTests/media/picture-in-picture-interruption.html.
* platform/gtk/TestExpectations:
* platform/ios/TestExpectations:
* platform/ipad/TestExpectations:
* platform/mac-wk2/TestExpectations:

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

6 months agoSimulators having trouble launching apps after booting
jbedard@apple.com [Sat, 9 Nov 2019 00:32:56 +0000 (00:32 +0000)]
Simulators having trouble launching apps after booting
<rdar://problem/57032042>

Unreviewed infrastructure fix.

* Scripts/webkitpy/port/simulator_process.py:
(SimulatorProcess._start): Temporarily increase timeout to help out bots.

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

6 months agoUnreviewed, rolling out r252260.
jbedard@apple.com [Sat, 9 Nov 2019 00:20:03 +0000 (00:20 +0000)]
Unreviewed, rolling out r252260.

Breaks half of API tests

Reverted changeset:

"Make DownloadID an ObjectIdentifier"
https://bugs.webkit.org/show_bug.cgi?id=203962
https://trac.webkit.org/changeset/252260

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

6 months agoUnreviewed, rolling out r252229.
jlewis3@apple.com [Sat, 9 Nov 2019 00:11:28 +0000 (00:11 +0000)]
Unreviewed, rolling out r252229.

This caused internal failures.

Reverted changeset:

"Split ArithProfile into a Unary and a Binary version"
https://bugs.webkit.org/show_bug.cgi?id=202832
https://trac.webkit.org/changeset/252229

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

6 months agoresults.webkit.org: List failing tests for criteria
jbedard@apple.com [Sat, 9 Nov 2019 00:03:56 +0000 (00:03 +0000)]
results.webkit.org: List failing tests for criteria
https://bugs.webkit.org/show_bug.cgi?id=203905

Rubber-stamped by Aakash Jain.

* resultsdbpy/resultsdbpy/controller/api_routes.py:
(APIRoutes.__init__): Add FailureController and /failures endpoint.
* resultsdbpy/resultsdbpy/controller/failure_controller.py: Added.
(FailureController): Added FailureController object to drive /failure endpoint.
(FailureController.__init__):
(FailureController.failures): Return a json list of failures for a range.
* resultsdbpy/resultsdbpy/controller/failure_controller_unittest.py: Added.
(FailureControllerTest): Test the /failure API.
(FailureControllerTest.setup_webserver):
(FailureControllerTest.test_failures_collapsed):
(FailureControllerTest.test_unexpected_failures_collapsed):
(FailureControllerTest.test_failures):
(FailureControllerTest.test_unexpected_failures):
(FailureControllerTest.test_failure_by_time):
* resultsdbpy/resultsdbpy/model/failure_context.py: Added.
(FailureContext): Database access to tables recording test failures.
(FailureContext.TestFailuresBase):
(FailureContext.TestFailuresBase.unpack):
(FailureContext.TestFailuresByCommit): Save test failures sorted by commit.
(FailureContext.TestFailuresByStartTime): Save test failures sorted by start time.
(FailureContext.UnexpectedTestFailuresByCommit): Save unexpected test failures
sorted by commit.
(FailureContext.UnexpectedTestFailuresByStartTime): Save unexpected test failures
sorted by commit.
(FailureContext.__init__):
(FailureContext.register): Register test failures to each of the 4 tables for an upload.
(FailureContext._failures): Return a list of test failures from a table.
(FailureContext.failures_by_commit): Return a list of test failures from a table sorted
by commit.
(FailureContext.failures_by_start_time): Return a list of test failures from a table
sorted by commit.
* resultsdbpy/resultsdbpy/model/failure_context_unittest.py: Added.
(FailureContextTest):
(FailureContextTest.init_database):
(FailureContextTest.test_failures_collapsed):
(FailureContextTest.test_unexpected_failures_collapsed):
(FailureContextTest.test_failures):
(FailureContextTest.test_unexpected_failures):
* resultsdbpy/resultsdbpy/model/model.py:
(Model.__init__):
* resultsdbpy/resultsdbpy/view/templates/documentation.html: Add documentation
for the /failure endpoint.

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

6 months agoUse separate cache directory for development WebKit on Mac
antti@apple.com [Fri, 8 Nov 2019 23:01:40 +0000 (23:01 +0000)]
Use separate cache directory for development WebKit on Mac
https://bugs.webkit.org/show_bug.cgi?id=204015

Reviewed by Youenn Fablet.

Replace the NetworkCache::lastStableVersion scheme with a completely separate directory.
This way potential bugs in development WebKit can't end up affecting system WebKit cache.
This also removes the need to keep lastStableVersion updated.

* NetworkProcess/cache/NetworkCacheStorage.cpp:
(WebKit::NetworkCache::makeCachePath):

Add '/Development' to cache path if this is not system WebKit.

(WebKit::NetworkCache::Storage::open):
(WebKit::NetworkCache::Storage::deleteOldVersions):

No need to avoid deleting lastStableVersion anymore.

* NetworkProcess/cache/NetworkCacheStorage.h:

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

6 months agoMake DeferredPromise behave nicely with regards to the back/forward cache
cdumez@apple.com [Fri, 8 Nov 2019 22:10:58 +0000 (22:10 +0000)]
Make DeferredPromise behave nicely with regards to the back/forward cache
https://bugs.webkit.org/show_bug.cgi?id=203976

Reviewed by Ryosuke Niwa.

Source/JavaScriptCore:

Add template parameter to JSC::Strong to indicate that the destructor should grab the JS lock.
Normally, the callers are in charge of grabbing the lock but this is not always feasible.
In particular, in this patch, I capture a JSC::Strong in a lambda. If the document gets destroyed
before the lambda has run, the lambda will get destroyed and it will destroy the captured JSC::Strong
as a result.

* heap/Handle.h:
* heap/Strong.h:
(JSC::Strong::clear):
* heap/StrongInlines.h:
(JSC::shouldStrongDestructorGrabLock>::Strong):
(JSC::shouldStrongDestructorGrabLock>::set):

Source/WebCore:

Previously, DeferredPromise would ignore requests to fulfill the promise if
reject/resolve/settle got called while the promise's script execution context
is suspended in the back/forward cache. This is really never the right thing to
do though because this means the promise will never be fulfilled if the user
ever goes back to this page.

To address the issue, DeferredPromise now schedules a task on the event loop if
it gets fulfilled while its script execution context is suspended. As a result,
the promise will properly get fulfilled if the document ever comes out of the
back/forward cache and developers using DeferredPromise do not have to worry
about suspension.

Now that DeferredPromise properly deals with suspended documents, this patch also
reverts changes I made recently in code using DeferredPromise. I had made them
queue a task on the event loop before fulfilling the promise, which did not match
their specification and is no longer needed.

Note that capturing the Strong<> in the lambda is correct here because we want
the resolution value to survive until either:
1. The task is processed by the event loop and the promise is resolved.
2. The back/forward cache entry containing this document is destroyed

Note that we do not leak here because when the back/forward cache's CachedFrame
gets destroyed, it will call Document::prepareForDestruction(), which will call
WindowEventLoop::stop() and destroys all pending tasks associated with this
document. This will therefore destroy the Strong captured in the task.

No new tests, covered by existing back/forward cache tests.

* Modules/cache/DOMCacheStorage.cpp:
(WebCore::DOMCacheStorage::doSequentialMatch):
(WebCore::DOMCacheStorage::match):
(WebCore::DOMCacheStorage::has):
(WebCore::DOMCacheStorage::open):
(WebCore::DOMCacheStorage::doOpen):
(WebCore::DOMCacheStorage::remove):
(WebCore::DOMCacheStorage::doRemove):
(WebCore::DOMCacheStorage::keys):
* Modules/cache/DOMCacheStorage.h:
* Modules/fetch/FetchBodyOwner.cpp:
(WebCore::FetchBodyOwner::blobLoadingSucceeded):
(WebCore::FetchBodyOwner::blobLoadingFailed):
(WebCore::FetchBodyOwner::blobChunk):
* Modules/fetch/FetchBodyOwner.h:
* Modules/mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::allow):
(WebCore::UserMediaRequest::deny):
* WebCore.xcodeproj/project.pbxproj:
* bindings/IDLTypes.h:
* bindings/js/JSDOMGuardedObject.h:
* bindings/js/JSDOMPromiseDeferred.cpp:
(WebCore::DeferredPromise::callFunction):
(WebCore::DeferredPromise::whenSettled):
(WebCore::DeferredPromise::reject):
* bindings/js/JSDOMPromiseDeferred.h:
(WebCore::DeferredPromise::resolve):
(WebCore::DeferredPromise::resolveWithNewlyCreated):
(WebCore::DeferredPromise::resolveCallbackValueWithNewlyCreated):
(WebCore::DeferredPromise::reject):
(WebCore::DeferredPromise::resolveWithCallback):
(WebCore::DeferredPromise::rejectWithCallback):
(WebCore::DeferredPromise::shouldIgnoreRequestToFulfill const):
* css/FontFaceSet.cpp:
(WebCore::FontFaceSet::didFirstLayout):
(WebCore::FontFaceSet::completedLoading):
(WebCore::FontFaceSet::faceFinished):
* dom/ActiveDOMCallback.cpp:
(WebCore::ActiveDOMCallback::activeDOMObjectsAreSuspended const):
(WebCore::ActiveDOMCallback::activeDOMObjectAreStopped const):
* dom/ActiveDOMCallback.h:
* dom/Element.h:
* dom/ScriptExecutionContext.h:
* page/DOMWindow.h:
* page/RemoteDOMWindow.h:

LayoutTests:

Rebaseline test where ordering has changed slightly due to not queueing a task anymore before
resolving the promise. This restores pre-r251746 behavior.

* fast/mediastream/MediaDevices-getUserMedia-expected.txt:

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

6 months agoUpdate expectations for 3 fast/events/ios/key-events-comprehensive tests
tsavell@apple.com [Fri, 8 Nov 2019 21:43:04 +0000 (21:43 +0000)]
Update expectations for 3 fast/events/ios/key-events-comprehensive tests
https://bugs.webkit.org/show_bug.cgi?id=204020

Unreviewed test gardening

* fast/events/ios/key-events-comprehensive/key-events-meta-control-expected.txt:
* fast/events/ios/key-events-comprehensive/key-events-meta-option-expected.txt:
* fast/events/ios/key-events-comprehensive/key-events-meta-shift-expected.txt:

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

6 months ago[macOS] [iOS] Add logging and telemetry to mach lookup rules
pvollan@apple.com [Fri, 8 Nov 2019 21:35:12 +0000 (21:35 +0000)]
[macOS] [iOS] Add logging and telemetry to mach lookup rules
https://bugs.webkit.org/show_bug.cgi?id=203999

Reviewed by Brent Fulgham.

Add logging and telemetry to help determine if mach lookups to a set of services can be denied in the WebContent process.

No new tests, since this only adds logging and telemetry.

* WebProcess/com.apple.WebProcess.sb.in:

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

6 months agoMake DownloadID an ObjectIdentifier
achristensen@apple.com [Fri, 8 Nov 2019 21:34:49 +0000 (21:34 +0000)]
Make DownloadID an ObjectIdentifier
https://bugs.webkit.org/show_bug.cgi?id=203962

Reviewed by Youenn Fablet.

Also deprecate the unused WKDownloadGetID because this identifier is internal.

* NetworkProcess/Downloads/Download.cpp:
(WebKit::Download::Download):
(WebKit::Download::didReceiveData):
(WebKit::Download::didFinish):
(WebKit::Download::didFail):
(WebKit::Download::didCancel):
(WebKit::Download::messageSenderDestinationID const):
* NetworkProcess/Downloads/DownloadID.h:
(WebKit::DownloadID::DownloadID): Deleted.
(WebKit::DownloadID::operator== const): Deleted.
(WebKit::DownloadID::operator!= const): Deleted.
(WebKit::DownloadID::downloadID const): Deleted.
(IPC::ArgumentCoder<WebKit::DownloadID>::encode): Deleted.
(IPC::ArgumentCoder<WebKit::DownloadID>::decode): Deleted.
(WTF::DownloadIDHash::hash): Deleted.
(WTF::DownloadIDHash::equal): Deleted.
(WTF::HashTraits<WebKit::DownloadID>::emptyValue): Deleted.
(WTF::HashTraits<WebKit::DownloadID>::constructDeletedValue): Deleted.
(WTF::HashTraits<WebKit::DownloadID>::isDeletedValue): Deleted.
* NetworkProcess/Downloads/DownloadMonitor.cpp:
(WebKit::DownloadMonitor::applicationWillEnterForeground):
(WebKit::DownloadMonitor::applicationDidEnterBackground):
(WebKit::DownloadMonitor::timerFired):
* NetworkProcess/Downloads/PendingDownload.cpp:
(WebKit::PendingDownload::messageSenderDestinationID const):
* NetworkProcess/Downloads/PendingDownload.h:
* NetworkProcess/NetworkDataTask.h:
(WebKit::NetworkDataTask::setPendingDownloadID):
(WebKit::NetworkDataTask::isDownload const):
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::pendingDownloadCanceled):
(WebKit::NetworkProcess::findPendingDownloadLocation):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::convertToDownload):
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
(-[WKNetworkSessionDelegate URLSession:downloadTask:didFinishDownloadingToURL:]):
(-[WKNetworkSessionDelegate URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:]):
(WebKit::NetworkSessionCocoa::continueDidReceiveChallenge):
* Scripts/webkit/messages.py:
* Shared/Authentication/AuthenticationManager.h:
* UIProcess/API/C/WKDownload.cpp:
(WKDownloadGetID):
* UIProcess/API/C/WKDownload.h:
* UIProcess/Downloads/DownloadProxy.cpp:
(WebKit::DownloadProxy::DownloadProxy):
(WebKit::generateDownloadID): Deleted.
* UIProcess/Downloads/DownloadProxy.h:
* UIProcess/Downloads/DownloadProxyMap.cpp:
(WebKit::DownloadProxyMap::createDownloadProxy):
(WebKit::DownloadProxyMap::downloadFinished):
(WebKit::DownloadProxyMap::invalidate):
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::startDownload):
(WebKit::WebFrame::convertMainResourceLoadToDownload):
* WebProcess/WebPage/WebFrame.h:
* WebProcess/WebPage/WebPage.h:

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

6 months agoFix flaky tests in http/tests/cache/disk-cache
achristensen@apple.com [Fri, 8 Nov 2019 21:26:15 +0000 (21:26 +0000)]
Fix flaky tests in http/tests/cache/disk-cache
https://bugs.webkit.org/show_bug.cgi?id=203822

Reviewed by Youenn Fablet.

Source/WebKit:

Right now tests that set the cache model do so using a race condition.  I think this will fix the flakyness we've observed.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::setCacheModelSynchronouslyForTesting):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreSetCacheModelSynchronouslyForTesting):
* UIProcess/API/C/WKWebsiteDataStoreRef.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::setCacheModelSynchronouslyForTesting):
* UIProcess/WebProcessPool.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::setCacheModelSynchronouslyForTesting):
* UIProcess/WebsiteData/WebsiteDataStore.h:

Tools:

* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::setCacheModel):
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):

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

6 months agoRevert some changes accidentally committed with r252257
achristensen@apple.com [Fri, 8 Nov 2019 21:16:35 +0000 (21:16 +0000)]
Revert some changes accidentally committed with r252257
https://bugs.webkit.org/show_bug.cgi?id=202178

* UIProcess/API/C/WKContextPrivate.h:

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

6 months agoMove schemes for SchemeRegistry from WebProcessPool to LegacyGlobalSettings
achristensen@apple.com [Fri, 8 Nov 2019 21:14:41 +0000 (21:14 +0000)]
Move schemes for SchemeRegistry from WebProcessPool to LegacyGlobalSettings
https://bugs.webkit.org/show_bug.cgi?id=202178

Reviewed by Youenn Fablet.

The current users of the SPI to set these only have one WebProcessPool, so they intend these settings to be global.
Moving them to LegacyGlobalSettings allows me to make a NetworkProcessProxy without a WebProcessPool and not regress existing functionality.
I move only the four sets of schemes needed to launch a NetworkProcess to remove the dependency the NetworkProcess has on the WebProcessPool.

* UIProcess/LegacyGlobalSettings.h:
(WebKit::LegacyGlobalSettings::schemesToRegisterAsSecure):
(WebKit::LegacyGlobalSettings::registerURLSchemeAsSecure):
(WebKit::LegacyGlobalSettings::schemesToRegisterAsBypassingContentSecurityPolicy):
(WebKit::LegacyGlobalSettings::registerURLSchemeAsBypassingContentSecurityPolicy):
(WebKit::LegacyGlobalSettings::schemesToRegisterAsLocal):
(WebKit::LegacyGlobalSettings::registerURLSchemeAsLocal):
(WebKit::LegacyGlobalSettings::schemesToRegisterAsNoAccess):
(WebKit::LegacyGlobalSettings::registerURLSchemeAsNoAccess):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::ensureNetworkProcess):
(WebKit::WebProcessPool::initializeNewWebProcess):
(WebKit::WebProcessPool::registerURLSchemeAsSecure):
(WebKit::WebProcessPool::registerURLSchemeAsBypassingContentSecurityPolicy):
(WebKit::WebProcessPool::registerURLSchemeAsLocal):
(WebKit::WebProcessPool::registerURLSchemeAsNoAccess):
* UIProcess/WebProcessPool.h:

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

6 months ago[JSC] Use LinkTimeConstants and make some properties lazy
ysuzuki@apple.com [Fri, 8 Nov 2019 21:11:25 +0000 (21:11 +0000)]
[JSC] Use LinkTimeConstants and make some properties lazy
https://bugs.webkit.org/show_bug.cgi?id=203795

Reviewed by Keith Miller.

This patch makes Map and Set lazily initialized in JSGlobalObject by leveraging link-time-constant. @Set was accessed from
builtin-JS. So we cannot make it lazily-allocated. But now we have link-time-constant mechanism that makes such accesses
lazily-initialized. We use this to make Set lazily-allocated.

And, instead of JSGlobalObject's last sequence of initialization, we initialize watchpoint in MapPrototype::finishCreation
and SetPrototype::finishCreation. This allows us to make Map and Set lazily-allocated. We also refactor NumberPrototype to
align to this model.

* runtime/ArrayPrototype.cpp:
(JSC::speciesWatchpointIsValid):
* runtime/JSGlobalObject.cpp:
(JSC::setupAdaptiveWatchpoint):
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::visitChildren):
(JSC::JSGlobalObject::tryInstallArraySpeciesWatchpoint):
(JSC::JSGlobalObject::installNumberPrototypeWatchpoint):
(JSC::JSGlobalObject::installMapPrototypeWatchpoint):
(JSC::JSGlobalObject::installSetPrototypeWatchpoint):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::numberProtoToStringFunction const):
(JSC::JSGlobalObject::mapPrototype const):
(JSC::JSGlobalObject::jsSetPrototype const):
(JSC::JSGlobalObject::numberObjectStructure const):
(JSC::JSGlobalObject::mapStructure const): Deleted.
* runtime/MapPrototype.cpp:
(JSC::MapPrototype::finishCreation):
* runtime/NumberPrototype.cpp:
(JSC::NumberPrototype::finishCreation):
* runtime/NumberPrototype.h:
* runtime/SetPrototype.cpp:
(JSC::SetPrototype::finishCreation):

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

6 months agoStyleResolver state should store user agent appearance style as RenderStyle
antti@apple.com [Fri, 8 Nov 2019 21:10:11 +0000 (21:10 +0000)]
StyleResolver state should store user agent appearance style as RenderStyle
https://bugs.webkit.org/show_bug.cgi?id=204008

Reviewed by Zalan Bujtas.

Generate and pass around user agent style as RenderStyle for apperance computation instead
of awkwardly passing around separate property values.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::styleForElement):
(WebCore::StyleResolver::styleForKeyframe):
(WebCore::StyleResolver::pseudoStyleForElement):
(WebCore::StyleResolver::adjustRenderStyle):
(WebCore::StyleResolver::applyMatchedProperties):
(WebCore::StyleResolver::State::cacheBorderAndBackground): Deleted.
* css/StyleResolver.h:
(WebCore::StyleResolver::element const):
(WebCore::StyleResolver::State::userAgentAppearanceStyle const):
(WebCore::StyleResolver::State::setUserAgentAppearanceStyle):
(WebCore::StyleResolver::element): Deleted.
(WebCore::StyleResolver::State::hasUAAppearance const): Deleted.
(WebCore::StyleResolver::State::borderData const): Deleted.
(WebCore::StyleResolver::State::backgroundData const): Deleted.
(WebCore::StyleResolver::State::backgroundColor const): Deleted.
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::adjustStyle):
(WebCore::RenderTheme::isControlStyled const):
* rendering/RenderTheme.h:
* rendering/RenderThemeIOS.h:
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::isControlStyled const):
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::isControlStyled const):
* style/StyleBuilder.cpp:
(WebCore::Style::Builder::Builder):

Allow providing style separately from StyleResolver state.

* style/StyleBuilder.h:

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

6 months agoAdd WebKit Legacy SPI to retrieve editable elements in rect
dbates@webkit.org [Fri, 8 Nov 2019 20:50:02 +0000 (20:50 +0000)]
Add WebKit Legacy SPI to retrieve editable elements in rect
https://bugs.webkit.org/show_bug.cgi?id=204006
<rdar://problem/57024093>

Reviewed by Wenson Hsieh.

Source/WebCore:

Extract code to retrieve the editable elements inside a specified rect from WebKit
to WebCore so that it can be shared by both Modern WebKit and Legacy WebKit.

* page/Page.cpp:
(WebCore::isEditableTextInputElement):
(WebCore::Page::editableElementsInRect const):
* page/Page.h:

Source/WebKit:

Write WebPage::textInputContextsInRect() in terms of Page::editableElementsInRect().
Also make use of Element::clientRect() instead of elementRectInRootViewCoordinates(),
which duplicates what the former does.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::textInputContextsInRect): Write in terms of Page::editableElementsInRect().
(WebKit::WebPage::contextForElement const): Use Element::clientRect() which does what
elementRectInRootViewCoordinates() does.
(WebKit::elementRectInRootViewCoordinates): Deleted.
(WebKit::isEditableTextInputElement): Deleted.

Source/WebKitLegacy/mac:

Add SPI to retrieve all the editable elements in a rect.

* WebView/WebView.mm:
(-[WebView _editableElementsInRect:]): Added.
* WebView/WebViewPrivate.h:

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

6 months ago[Web Animations] Use a keyframe effect stack to resolve animations on an element
graouts@webkit.org [Fri, 8 Nov 2019 20:40:57 +0000 (20:40 +0000)]
[Web Animations] Use a keyframe effect stack to resolve animations on an element
https://bugs.webkit.org/show_bug.cgi?id=204010

Reviewed by Dean Jackson.

Until now, when resolving animations for an element, we would call animationsForElement() during each resolution which
means doing several hash table lookups to locate the various classes of animations for that given element, sorting each
of those animations and inserting them into a new Vector.

We now use a KeyframeEffectStack which keeps a list of KeyframeEffect objects that apply to a given target, provided the
effect also has a valid animation and that animation has a valid timeline, all pre-conditions for that effect to produce
an animated value. Any time one of those pre-conditions change, we update the membership of that effect in the stack.
The KeyframeEffectStack is a new member of ElementRareData.

Now, each time we resolve an animation for an element, we iterate over the KeyframeEffect objects returned by calling
sortEffects() on the KeyframeEffectStack which will sort the stack's effects only if a new effect had been added since
the last iteration, which means that simple animations that are not mutated will require sorting of the stack just once,
and the addition of several animations in a single animation frame will require sorting just once as well.

It was also found while doing this work that Style::TreeResolver::createAnimatedElementUpdate would call RenderStyle::clonePtr()
for any element that was part of a document containing a timeline, regardless of whether that element had any animations. Now
we check whether that element's KeyframeEffectStack contains any effects prior to cloning the style.

No tests or changes to existed test expectations as this should not yield any change in behavior.

* Sources.txt: Add the new KeyframeEffectStack.
* WebCore.xcodeproj/project.pbxproj:
* animation/AnimationEffect.h:
(WebCore::AnimationEffect::setAnimation):
* animation/AnimationTimeline.cpp:
(WebCore::AnimationTimeline::removeAnimation):
(WebCore::AnimationTimeline::updateCSSAnimationsForElement): Since we need to know the order of CSS @keyframes rules listed in animation-name
when sorting effects, we must compile the ordered list of those @keyframe rules as we update CSS animations for an element and store it on its
KeyframeEffectStack.
* animation/DocumentTimeline.cpp:
(WebCore::DocumentTimeline::resolveAnimationsForElement): Deleted. Replaced by Element::applyKeyframeEffects().
* animation/DocumentTimeline.h:
* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::animationTimelineDidChange):
(WebCore::KeyframeEffect::setAnimation):
(WebCore::KeyframeEffect::setTarget):
* animation/KeyframeEffect.h:
* animation/KeyframeEffectStack.cpp: Added.
(WebCore::KeyframeEffectStack::KeyframeEffectStack):
(WebCore::KeyframeEffectStack::~KeyframeEffectStack):
(WebCore::KeyframeEffectStack::addEffect):
(WebCore::KeyframeEffectStack::removeEffect):
(WebCore::KeyframeEffectStack::sortedEffects):
(WebCore::KeyframeEffectStack::ensureEffectsAreSorted):
(WebCore::KeyframeEffectStack::setCSSAnimationNames):
* animation/KeyframeEffectStack.h: Added.
(WebCore::KeyframeEffectStack::hasEffects const):
* animation/WebAnimation.cpp:
(WebCore::WebAnimation::setTimelineInternal):
(WebCore::WebAnimation::persist):
* dom/Element.cpp:
(WebCore::Element::ensureKeyframeEffectStack):
(WebCore::Element::hasKeyframeEffects const):
(WebCore::Element::applyKeyframeEffects):
* dom/Element.h:
* dom/ElementRareData.cpp:
* dom/ElementRareData.h:
(WebCore::ElementRareData::keyframeEffectStack):
(WebCore::ElementRareData::setKeyframeEffectStack):
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::createAnimatedElementUpdate):

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

6 months agoAdd ANGLE backend for iOS device
dino@apple.com [Fri, 8 Nov 2019 19:55:56 +0000 (19:55 +0000)]
Add ANGLE backend for iOS device
https://bugs.webkit.org/show_bug.cgi?id=202159
<rdar://57000166>

Build fixes for Mac Catalyst, tvOS and watchOS.

* src/common/PackedEnums.cpp:
(egl_gl::EGLTextureTargetToTextureType):
* src/common/platform.h:
* src/gpu_info_util/SystemInfo_ios.cpp:
* src/gpu_info_util/SystemInfo_macos.cpp:
* src/libANGLE/Display.cpp:
* src/libANGLE/formatutils.cpp:
(gl::BuildInternalFormatInfoMap):
* src/libANGLE/renderer/gl/cgl/DeviceCGL.cpp:
* src/libANGLE/renderer/gl/cgl/DisplayCGL.mm:
* src/libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.cpp:
* src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.cpp:
* src/libANGLE/renderer/gl/cgl/RendererCGL.cpp:
* src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm:
* src/libANGLE/renderer/gl/eagl/DisplayEAGL.mm:
* src/libANGLE/renderer/gl/eagl/IOSurfaceSurfaceEAGL.mm:
* src/libANGLE/renderer/gl/eagl/PbufferSurfaceEAGL.cpp:
* src/libANGLE/renderer/gl/eagl/RendererEAGL.cpp:
* src/libANGLE/renderer/gl/eagl/WindowSurfaceEAGL.mm:
* src/libANGLE/renderer/gl/renderergl_utils.cpp:
(rx::nativegl_gl::GenerateCaps):
* src/libANGLE/validationES2.cpp:
(gl::ValidateFramebufferTexture2D):

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

6 months agoClicking on EWS status-bubble should open the results in new tab
aakash_jain@apple.com [Fri, 8 Nov 2019 19:54:49 +0000 (19:54 +0000)]
Clicking on EWS status-bubble should open the results in new tab
https://bugs.webkit.org/show_bug.cgi?id=204012

Reviewed by Alexey Proskuryakov.

* BuildSlaveSupport/ews-app/ews/templates/statusbubble.html:

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

6 months ago[WebAuthn] Return NotAllowedError immediately for UI cancellations
jiewen_tan@apple.com [Fri, 8 Nov 2019 19:44:34 +0000 (19:44 +0000)]
[WebAuthn] Return NotAllowedError immediately for UI cancellations
https://bugs.webkit.org/show_bug.cgi?id=203937
<rdar://problem/56962420>

Reviewed by Brent Fulgham.

Source/WebKit:

NotAllowedError representing UI cancellations should be returned to sites
immediately such that sites could show appropriate error page immediately.

Covered by existing tests.

* UIProcess/WebAuthentication/AuthenticatorManager.cpp:
(WebKit::AuthenticatorManager::cancelRequest):
(WebKit::AuthenticatorManager::clearState):
(WebKit::AuthenticatorManager::resetState): Deleted.
* UIProcess/WebAuthentication/AuthenticatorManager.h:

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:
(TestWebKitAPI::TEST):

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

6 months agoRemove invalid assertion in DFG's compileNewArray().
mark.lam@apple.com [Fri, 8 Nov 2019 19:37:54 +0000 (19:37 +0000)]
Remove invalid assertion in DFG's compileNewArray().
https://bugs.webkit.org/show_bug.cgi?id=204002
<rdar://problem/56973531>

Reviewed by Robin Morisset.

The assertion is in an if clause conditional on !globalObject->isHavingABadTime().
The assertion tests the IndexingType of a structure returned by
arrayStructureForIndexingTypeDuringAllocation().

However, the structures returned by arrayStructureForIndexingTypeDuringAllocation()
may have started transitioning to their SlowPut variant because the mutator will
be imminently firing the HavingABadTime watchpoint, but haven't done so yet.
In a race, the DFG may see the SlowPut variants of the structures before
isHavingABadTime() returns true.  Hence, the assertion is invalid.

Note that the FTL does not have this assertion.

This issue is already tested by stress/racy-slow-put-cloned-arguments-when-having-a-bad-time.js.

* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileNewArray):

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

6 months agoAdd ANGLE backend for iOS device
dino@apple.com [Fri, 8 Nov 2019 19:11:14 +0000 (19:11 +0000)]
Add ANGLE backend for iOS device
https://bugs.webkit.org/show_bug.cgi?id=202159
<rdar://57000166>

Build fix. Don't include IOSurface.h on iOS (public SDK doesn't have it).

* src/libANGLE/renderer/gl/eagl/IOSurfaceSurfaceEAGL.mm:

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

6 months agoAdd ANGLE backend for iOS device
dino@apple.com [Fri, 8 Nov 2019 18:58:06 +0000 (18:58 +0000)]
Add ANGLE backend for iOS device
https://bugs.webkit.org/show_bug.cgi?id=202159
<rdar://57000166>

Reviewed by Myles Maxfield.

Source/ThirdParty/ANGLE:

Add an OpenGLES backend over EAGL for iOS to ANGLE.

This is basically a copy of all the files in
libANGLE/renderer/gl/cgl into libANGLE/renderer/gl/eagl, then with
modifications to make it work on iOS's OpenGL ES. Most notably,
some format enums and the manner in which you bind an IOSurface to
a GL texture are different.

This introduces a few places where we have to do a compile time
switch for iOS, some of which might actually be applicable to
other OpenGL ES backends.

The biggest missing piece is support for the iOS simulator. At the moment
this backend relies on an IOSurface binding as a rendering target.
But the iOS Simulator does not have the required ability to have a
GL ES texture backed by an IOSurface.

The WindowSurfaceEAGL code is incomplete, but was not necessary
in order to get WebGL operational. And even if you are using ANGLE
directly, you can have the client code render into a CALayer without
going through the WindowSurface.

* ANGLE.xcodeproj/project.pbxproj:
* include/EGL/eglext_angle.h:
* src/common/PackedEnums.cpp:
(egl_gl::EGLTextureTargetToTextureType):
* src/common/platform.h:
* src/gpu_info_util/SystemInfo_ios.cpp: Added.
(angle::GetSystemInfo):
* src/gpu_info_util/SystemInfo_macos.cpp: Renamed from Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_mac.cpp.
(angle::GetSystemInfo):
* src/libANGLE/Caps.h:
* src/libANGLE/Display.cpp:
* src/libANGLE/formatutils.cpp:
(gl::BuildInternalFormatInfoMap):
* src/libANGLE/renderer/gl/cgl/DeviceCGL.cpp:
* src/libANGLE/renderer/gl/cgl/DisplayCGL.mm:
* src/libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.cpp:
(rx::IOSurfaceSurfaceCGL::bindTexImage):
* src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.cpp:
* src/libANGLE/renderer/gl/cgl/RendererCGL.cpp:
* src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm:
* src/libANGLE/renderer/gl/eagl/ContextEAGL.cpp: Added.
(rx::ContextEAGL::ContextEAGL):
* src/libANGLE/renderer/gl/eagl/ContextEAGL.h: Added.
* src/libANGLE/renderer/gl/eagl/DeviceEAGL.cpp: Added.
(rx::DeviceEAGL::DeviceEAGL):
(rx::DeviceEAGL::~DeviceEAGL):
(rx::DeviceEAGL::initialize):
(rx::DeviceEAGL::getAttribute):
(rx::DeviceEAGL::getType):
(rx::DeviceEAGL::generateExtensions const):
* src/libANGLE/renderer/gl/eagl/DeviceEAGL.h: Added.
* src/libANGLE/renderer/gl/eagl/DisplayEAGL.h: Added.
* src/libANGLE/renderer/gl/eagl/DisplayEAGL.mm: Added.
(rx::FunctionsGLEAGL::FunctionsGLEAGL):
(rx::DisplayEAGL::DisplayEAGL):
(rx::DisplayEAGL::~DisplayEAGL):
(rx::DisplayEAGL::initialize):
(rx::DisplayEAGL::terminate):
(rx::DisplayEAGL::createWindowSurface):
(rx::DisplayEAGL::createPbufferSurface):
(rx::DisplayEAGL::createPbufferFromClientBuffer):
(rx::DisplayEAGL::createPixmapSurface):
(rx::DisplayEAGL::createContext):
(rx::DisplayEAGL::createDevice):
(rx::DisplayEAGL::generateConfigs):
(rx::DisplayEAGL::testDeviceLost):
(rx::DisplayEAGL::restoreLostDevice):
(rx::DisplayEAGL::isValidNativeWindow const):
(rx::DisplayEAGL::validateClientBuffer const):
(rx::DisplayEAGL::getVendorString const):
(rx::DisplayEAGL::getEAGLContext const):
(rx::DisplayEAGL::getEAGLPixelFormat const):
(rx::DisplayEAGL::generateExtensions const):
(rx::DisplayEAGL::generateCaps const):
(rx::DisplayEAGL::waitClient):
(rx::DisplayEAGL::waitNative):
(rx::DisplayEAGL::getMaxSupportedESVersion const):
(rx::DisplayEAGL::makeCurrentSurfaceless):
(rx::WorkerContextEAGL::WorkerContextEAGL):
(rx::WorkerContextEAGL::~WorkerContextEAGL):
(rx::WorkerContextEAGL::makeCurrent):
(rx::WorkerContextEAGL::unmakeCurrent):
(rx::DisplayEAGL::createWorkerContext):
(rx::DisplayEAGL::initializeFrontendFeatures const):
(rx::DisplayEAGL::populateFeatureList):
* src/libANGLE/renderer/gl/eagl/IOSurfaceSurfaceEAGL.h: Added.
* src/libANGLE/renderer/gl/eagl/IOSurfaceSurfaceEAGL.mm: Copied from Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.cpp.
(rx::IOSurfaceSurfaceEAGL::IOSurfaceSurfaceEAGL):
(rx::IOSurfaceSurfaceEAGL::~IOSurfaceSurfaceEAGL):
(rx::IOSurfaceSurfaceEAGL::initialize):
(rx::IOSurfaceSurfaceEAGL::makeCurrent):
(rx::IOSurfaceSurfaceEAGL::unMakeCurrent):
(rx::IOSurfaceSurfaceEAGL::swap):
(rx::IOSurfaceSurfaceEAGL::postSubBuffer):
(rx::IOSurfaceSurfaceEAGL::querySurfacePointerANGLE):
(rx::IOSurfaceSurfaceEAGL::bindTexImage):
(rx::IOSurfaceSurfaceEAGL::releaseTexImage):
(rx::IOSurfaceSurfaceEAGL::setSwapInterval):
(rx::IOSurfaceSurfaceEAGL::getWidth const):
(rx::IOSurfaceSurfaceEAGL::getHeight const):
(rx::IOSurfaceSurfaceEAGL::isPostSubBufferSupported const):
(rx::IOSurfaceSurfaceEAGL::getSwapBehavior const):
(rx::IOSurfaceSurfaceEAGL::validateAttributes):
(rx::IOSurfaceFramebuffer::IOSurfaceFramebuffer):
(rx::IOSurfaceSurfaceEAGL::createDefaultFramebuffer):
(rx::IOSurfaceSurfaceEAGL::initializeAlphaChannel):
(rx::IOSurfaceSurfaceEAGL::hasEmulatedAlphaChannel const):
* src/libANGLE/renderer/gl/eagl/PbufferSurfaceEAGL.cpp: Copied from Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.cpp.
(rx::PbufferSurfaceEAGL::PbufferSurfaceEAGL):
(rx::PbufferSurfaceEAGL::~PbufferSurfaceEAGL):
(rx::PbufferSurfaceEAGL::initialize):
(rx::PbufferSurfaceEAGL::makeCurrent):
(rx::PbufferSurfaceEAGL::swap):
(rx::PbufferSurfaceEAGL::postSubBuffer):
(rx::PbufferSurfaceEAGL::querySurfacePointerANGLE):
(rx::PbufferSurfaceEAGL::bindTexImage):
(rx::PbufferSurfaceEAGL::releaseTexImage):
(rx::PbufferSurfaceEAGL::setSwapInterval):
(rx::PbufferSurfaceEAGL::getWidth const):
(rx::PbufferSurfaceEAGL::getHeight const):
(rx::PbufferSurfaceEAGL::isPostSubBufferSupported const):
(rx::PbufferSurfaceEAGL::getSwapBehavior const):
(rx::PbufferSurfaceEAGL::createDefaultFramebuffer):
* src/libANGLE/renderer/gl/eagl/PbufferSurfaceEAGL.h: Added.
* src/libANGLE/renderer/gl/eagl/RendererEAGL.cpp: Added.
(rx::RendererEAGL::RendererEAGL):
(rx::RendererEAGL::~RendererEAGL):
(rx::RendererEAGL::createWorkerContext):
* src/libANGLE/renderer/gl/eagl/RendererEAGL.h: Added.
* src/libANGLE/renderer/gl/eagl/WindowSurfaceEAGL.h: Added.
* src/libANGLE/renderer/gl/eagl/WindowSurfaceEAGL.mm: Copied from Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm.
(-[WebSwapLayer initWithSharedState:withContext:withFunctions:]):
(-[WebSwapLayer display]):
(rx::WindowSurfaceEAGL::WindowSurfaceEAGL):
(rx::WindowSurfaceEAGL::~WindowSurfaceEAGL):
(rx::WindowSurfaceEAGL::initialize):
(rx::WindowSurfaceEAGL::makeCurrent):
(rx::WindowSurfaceEAGL::swap):
(rx::WindowSurfaceEAGL::postSubBuffer):
(rx::WindowSurfaceEAGL::querySurfacePointerANGLE):
(rx::WindowSurfaceEAGL::bindTexImage):
(rx::WindowSurfaceEAGL::releaseTexImage):
(rx::WindowSurfaceEAGL::setSwapInterval):
(rx::WindowSurfaceEAGL::getWidth const):
(rx::WindowSurfaceEAGL::getHeight const):
(rx::WindowSurfaceEAGL::isPostSubBufferSupported const):
(rx::WindowSurfaceEAGL::getSwapBehavior const):
(rx::WindowSurfaceEAGL::createDefaultFramebuffer):
* src/libANGLE/renderer/gl/renderergl_utils.cpp:
(rx::nativegl_gl::GenerateCaps):
* src/libANGLE/validationES2.cpp:
(gl::ValidateFramebufferTexture2D):
* src/libGLESv2/entry_points_egl_ext.cpp:

Source/WebCore:

Use the ANGLE for iOS backend.

Mostly this was just moving some code around so that it would compile
on iOS when USE(ANGLE) is true. The actual code to render WebGL is
similar between macOS and iOS - both now using a CALayer with
a set of IOSurfaces that are used as swap textures.

The main difference is that macOS (OpenGL) binds to TEXTURE_RECTANGLE,
and iOS (OpenGL ES) binds to the regular TEXTURE_2D.

The remaining missing piece is getting video textures into ANGLE
efficiently (without leaving the GPU). We can ask CoreVideo
to give us raw GL textures, but with ANGLE we no longer have direct access
to the underlying OpenGL context.

This is not enabled in the builds yet, so no tests. However, when
enabled it will be tested against the official WebGL conformance suite.

* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::validateVertexAttributes):
* platform/cocoa/CoreVideoSoftLink.cpp:
* platform/cocoa/CoreVideoSoftLink.h:
* platform/graphics/GraphicsContext3D.h:
* platform/graphics/angle/GraphicsContext3DANGLE.cpp:
(WebCore::GraphicsContext3D::reshapeFBOs):
* platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
(WebCore::GraphicsContext3D::GraphicsContext3D):
(WebCore::GraphicsContext3D::allocateIOSurfaceBackingStore):
(WebCore::GraphicsContext3D::updateFramebufferTextureBackingStoreFromLayer):
* platform/graphics/cocoa/WebGLLayer.h:
* platform/graphics/cocoa/WebGLLayer.mm:
(-[WebGLLayer initWithGraphicsContext3D:]):
(-[WebGLLayer display]):
(-[WebGLLayer setEGLDisplay:config:]):
(-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]):
(-[WebGLLayer bindFramebufferToNextAvailableSurface]):
(-[WebGLLayer setEGLDisplay:andConfig:]): Deleted.
* platform/graphics/cv/TextureCacheCV.mm:
(WebCore::TextureCacheCV::textureFromImage):
* platform/graphics/cv/VideoTextureCopierCV.cpp:
(WebCore::VideoTextureCopierCV::copyVideoTextureToPlatformTexture):
* platform/graphics/opengl/TemporaryOpenGLSetting.cpp:
* platform/graphics/opengl/TemporaryOpenGLSetting.h:

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

6 months ago[ews] Prioritize builders over testers when a bot is shared over multiple queues
aakash_jain@apple.com [Fri, 8 Nov 2019 18:53:48 +0000 (18:53 +0000)]
[ews] Prioritize builders over testers when a bot is shared over multiple queues
https://bugs.webkit.org/show_bug.cgi?id=204007

Reviewed by Jonathan Bedard.

* BuildSlaveSupport/ews-build/loadConfig.py:
(loadBuilderConfig):
(prioritizeBuilders): Method to prioritize builder queues over tester queues.

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

6 months ago[PlayStation][JSC] Unreviewed build fix.
ross.kirsling@sony.com [Fri, 8 Nov 2019 18:37:53 +0000 (18:37 +0000)]
[PlayStation][JSC] Unreviewed build fix.

* shell/playstation/TestShell.cpp:

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

6 months agoRegression r252209: Layout Test fast/workers/worker-close-more.html is failing
cdumez@apple.com [Fri, 8 Nov 2019 18:24:23 +0000 (18:24 +0000)]
Regression r252209: Layout Test fast/workers/worker-close-more.html is failing
https://bugs.webkit.org/show_bug.cgi?id=203995
<rdar://problem/57020558>

Reviewed by Ryosuke Niwa.

We should not dispatch events on a MessagePort objects in a WorkerGlobalScope which is
closing (i.e. WorkerGlobalScope.close() has been called).

No new tests, covered by fast/workers/worker-close-more.html.

* dom/MessagePort.cpp:
(WebCore::MessagePort::dispatchEvent):

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

6 months agoTemporarily skip another broken test on MIPS due to OSR exit to LLInt
guijemont@igalia.com [Fri, 8 Nov 2019 18:08:33 +0000 (18:08 +0000)]
Temporarily skip another broken test on MIPS due to OSR exit to LLInt
https://bugs.webkit.org/show_bug.cgi?id=204003

Unreviewed gardening.

* stress/global-import-function-should-return-a-promise-when-clearing-exceptions.js:

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

6 months agoPicture-in-Picture events are not fired when enter/exit the Picture-in-Picture mode...
commit-queue@webkit.org [Fri, 8 Nov 2019 18:06:43 +0000 (18:06 +0000)]
Picture-in-Picture events are not fired when enter/exit the Picture-in-Picture mode through modern media controls
https://bugs.webkit.org/show_bug.cgi?id=203933

Patch by Peng Liu <peng.liu6@apple.com> on 2019-11-08
Reviewed by Eric Carlson.

Covered by existing layout test cases. No new test is required.

* Modules/modern-media-controls/media/pip-support.js:
(PiPSupport.prototype.buttonWasPressed):
* Modules/pictureinpicture/HTMLVideoElementPictureInPicture.cpp:
(WebCore::HTMLVideoElementPictureInPicture::didEnterPictureInPicture):
(WebCore::HTMLVideoElementPictureInPicture::didExitPictureInPicture):

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

6 months agoAdd a stack overflow check in Yarr::ByteCompiler::emitDisjunction().
mark.lam@apple.com [Fri, 8 Nov 2019 16:58:49 +0000 (16:58 +0000)]
Add a stack overflow check in Yarr::ByteCompiler::emitDisjunction().
https://bugs.webkit.org/show_bug.cgi?id=203936
<rdar://problem/56624724>

Reviewed by Saam Barati.

JSTests:

This issue originally manifested as incorrect-exception-assertion-in-operationRegExpExecNonGlobalOrSticky.js
failing on iOS devices due to its smaller stack.  We adapted the original test
here using $vm.callWithStackSize() to reproduce the issue on x86_64 though it
has a much larger physical stack to work with.  This new test will crash while
stepping on the guard page beyond the end of the stack if the fix is not applied.

* stress/stack-overflow-in-yarr-byteCompile.js: Added.

Source/JavaScriptCore:

Basically, any functions below Yarr::ByteCompiler::compile() that recurses need
to check if it's safe to recurse before doing so.  This patch adds the stack
checks in Yarr::ByteCompiler::compile() because it is the entry point to this
sub-system, and Yarr::ByteCompiler::emitDisjunction() because it is the only
function that recurses.  All other functions called below compile() are either
leaf functions or have shallow stack usage.  Hence, their stack needs are covered
by the DefaultReservedZone, and they do not need stack checks.

This patch also does the following:
1. Added $vm.callWithStackSize() which can be used to call a test function near
   the end of the physical stack.  This enables is to simulate the smaller stack
   size of more resource constrained devices.

   $vm.callWithStackSize() uses inline asm to adjust the stack pointer and
   does the callback via the JIT probe trampoline.

2. Added the --disableOptionsFreezingForTesting to the jsc shell to make it
   possible to disable freezing of JSC options.  $vm.callWithStackSize() relies
   on this to modify the VM's stack limits.

3. Removed the inline modifier on VM::updateStackLimits() so that we can call it
   from $vm.callWithStackSize() as well.  It is not a performance critical
   function and is rarely called.

4. Added a JSDollarVMHelper class that other parts of the system can declare as
   a friend.  This gives $vm a backdoor into the private functions and fields of
   classes for its debugging work.  In this patch, we're only using it to access
   VM::updateVMStackLimits().

* jsc.cpp:
(CommandLine::parseArguments):
* runtime/VM.cpp:
(JSC::VM::updateStackLimits):
* runtime/VM.h:
* tools/JSDollarVM.cpp:
(JSC::JSDollarVMHelper::JSDollarVMHelper):
(JSC::JSDollarVMHelper::vmStackStart):
(JSC::JSDollarVMHelper::vmStackLimit):
(JSC::JSDollarVMHelper::vmSoftStackLimit):
(JSC::JSDollarVMHelper::updateVMStackLimits):
(JSC::callWithStackSizeProbeFunction):
(JSC::functionCallWithStackSize):
(JSC::JSDollarVM::finishCreation):
(IGNORE_WARNINGS_BEGIN): Deleted.
* yarr/YarrInterpreter.cpp:
(JSC::Yarr::ByteCompiler::compile):
(JSC::Yarr::ByteCompiler::emitDisjunction):
(JSC::Yarr::ByteCompiler::isSafeToRecurse):

Source/WTF:

1. Add a StackCheck utility class so that we don't have to keep reinventing this
   every time we need to add stack checking somewhere.
2. Rename some arguments and constants in StackBounds to be more descriptive of
   what they actually are.

* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/StackBounds.h:
(WTF::StackBounds::recursionLimit const):
* wtf/StackCheck.h: Added.
(WTF::StackCheck::StackCheck):
(WTF::StackCheck::isSafeToRecurse):

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

6 months agoWebDriver: implement get page source command
carlosgc@webkit.org [Fri, 8 Nov 2019 15:09:00 +0000 (15:09 +0000)]
WebDriver: implement get page source command
https://bugs.webkit.org/show_bug.cgi?id=180399

Reviewed by Carlos Alberto Lopez Perez.

Source/WebDriver:

* Session.cpp:
(WebDriver::Session::getPageSource):
* Session.h:
* WebDriverService.cpp:
(WebDriver::WebDriverService::getPageSource):
* WebDriverService.h:

WebDriverTests:

Unskip tests that are now passing.

* TestExpectations.json:

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

6 months agoBuild fix for platforms without WebRTC's SSL after r252185
achristensen@apple.com [Fri, 8 Nov 2019 10:53:53 +0000 (10:53 +0000)]
Build fix for platforms without WebRTC's SSL after r252185
https://bugs.webkit.org/show_bug.cgi?id=203934

* TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadStatistics.mm:
The new test uses TLS with the HTTPS proxy.  Don't compile it if we can't compile it.

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

6 months ago[GTK] Add pointer lock permission request API
carlosgc@webkit.org [Fri, 8 Nov 2019 09:19:03 +0000 (09:19 +0000)]
[GTK] Add pointer lock permission request API
https://bugs.webkit.org/show_bug.cgi?id=203896

Reviewed by Adrian Perez de Castro.

Source/WebKit:

Add a WebKitPointerLockPermissionRequest class to handle pointer lock permissions.

* PlatformGTK.cmake:
* SourcesGTK.txt:
* UIProcess/API/glib/WebKitPointerLockPermissionRequest.cpp: Added.
(webkitPointerLockPermissionRequestAllow):
(webkitPointerLockPermissionRequestDeny):
(webkit_permission_request_interface_init):
(webkitPointerLockPermissionRequestDispose):
(webkit_pointer_lock_permission_request_class_init):
(webkitPointerLockPermissionRequestCreate):
(webkitPointerLockPermissionRequestDidLosePointerLock):
* UIProcess/API/glib/WebKitPointerLockPermissionRequestPrivate.h: Added.
* UIProcess/API/glib/WebKitUIClient.cpp:
(UIClient::~UIClient):
* UIProcess/API/glib/WebKitWebView.cpp:
(webkitWebViewPermissionRequest):
(webkitWebViewDenyPointerLockRequest):
* UIProcess/API/glib/WebKitWebViewPrivate.h:
* UIProcess/API/gtk/WebKitPointerLockPermissionRequest.h: Added.
* UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
* UIProcess/API/gtk/docs/webkit2gtk-4.0.types:
* UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
* UIProcess/API/gtk/webkit2.h:

Tools:

Handle pointer lock permission requests in MiniBrowser and add a new tests case to check the new API.

* MiniBrowser/gtk/BrowserTab.c:
(pointerLockMessageTimeoutCallback):
(decidePermissionRequest):
(browserTabFinalize):
(browserTabConstructed):
* TestWebKitAPI/Tests/WebKitGLib/TestUIClient.cpp:
(testWebViewPointerLockPermissionRequest):
(beforeAll):

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

6 months ago'Strikethrough' editing command reported as 'formatUnderline'
carlosgc@webkit.org [Fri, 8 Nov 2019 09:09:36 +0000 (09:09 +0000)]
'Strikethrough' editing command reported as 'formatUnderline'
https://bugs.webkit.org/show_bug.cgi?id=203944

Reviewed by Adrian Perez de Castro.

Source/WebCore:

Add an EditAction for strikeThrough command.

Test: fast/events/input-events-strikethrough-type.html

* editing/EditAction.cpp:
(WebCore::undoRedoLabel): Handle StrikeThrough action.
* editing/EditAction.h:
* editing/EditCommand.cpp:
(WebCore::inputTypeNameForEditingAction): Ditto.
* editing/EditorCommand.cpp:
(WebCore::executeStrikethrough): Use StrikeThrough action instead of Underline.

LayoutTests:

* fast/events/input-events-strikethrough-type-expected.txt: Added.
* fast/events/input-events-strikethrough-type.html: Added.

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

6 months agoUse fewer virtual registers in Wasm LLInt
tzagallo@apple.com [Fri, 8 Nov 2019 03:55:47 +0000 (03:55 +0000)]
Use fewer virtual registers in Wasm LLInt
https://bugs.webkit.org/show_bug.cgi?id=203861

Reviewed by Saam Barati.

Reduce the number of virtual registers in two ways:
- Re-use arguments for result values (e.g. the result of add lhs, rhs should go in lhs, not a new virtual register)
- Re-use the argument register space for return values that should be placed in registers

* bytecode/BytecodeList.rb:
* generator/Wasm.rb:
* llint/WebAssembly.asm:
* wasm/WasmLLIntGenerator.cpp:
(JSC::Wasm::LLIntGenerator::callInformationFor):
(JSC::Wasm::LLIntGenerator::addReturn):
(JSC::Wasm::LLIntGenerator::addRefIsNull):
(JSC::Wasm::LLIntGenerator::addTableGet):
(JSC::Wasm::LLIntGenerator::addTableGrow):
(JSC::Wasm::LLIntGenerator::addGrowMemory):
(JSC::Wasm::LLIntGenerator::addSelect):
(JSC::Wasm::LLIntGenerator::load):

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

6 months agoDefault NamepaceURI must be gotten from the topmost parent before the SVG <foreignObject>
commit-queue@webkit.org [Fri, 8 Nov 2019 02:52:40 +0000 (02:52 +0000)]
Default NamepaceURI must be gotten from the topmost parent before the SVG <foreignObject>
https://bugs.webkit.org/show_bug.cgi?id=203868

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-11-07
Reviewed by Ryosuke Niwa.

Source/WebCore:

Ensure that we don't cross boundaries from HTML to SVG when traversing
the tree of nodes upward. We need to stop at the foreignObject if it is
one of the ancestors of the contextElement.

Tests: svg/foreignObject/foreign-object-dynamic-parsing.svg

* html/HTMLTableCellElement.cpp:
(WebCore::HTMLTableCellElement::HTMLTableCellElement):
This assertion should not fire if the tag has a prefix like <h:th> or
<h:td> where 'h' is a defined namespace.

* xml/parser/XMLDocumentParser.cpp:
(WebCore::XMLDocumentParser::parseDocumentFragment):
Stop at the first SVG <foreignObject> ancestor when calculating the
defaultNamespaceURI.

* xml/parser/XMLDocumentParser.h:
* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::XMLDocumentParser::XMLDocumentParser):

(WebCore::XMLDocumentParser::startElementNs):
We need to special case setting the namespaceURI of the SVGElmenets. The
defaultNamespaceURI can be wrong for them if the context element is an
HTML element, <div> for example, and the innerHTML is set to something
like: '<svg><rect/></svg>'.

LayoutTests:

* svg/foreignObject/foreign-object-dynamic-parsing-expected.svg: Added.
* svg/foreignObject/foreign-object-dynamic-parsing.svg: Added.

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

6 months agoSplit ArithProfile into a Unary and a Binary version
rmorisset@apple.com [Fri, 8 Nov 2019 02:46:09 +0000 (02:46 +0000)]
Split ArithProfile into a Unary and a Binary version
https://bugs.webkit.org/show_bug.cgi?id=202832
<rdar://problem/56266847>

Reviewed by Keith Miller.

ArithProfile was for a long time only used for add/sub/mul/div, but recently it started being used for negate. And it will soon also have to be used for inc and dec due to BigInt.
So in this patch I make a separate version that only has the data for a single argument, and thus takes half as much memory.

After discussing this change with Phil I realized that the ResultType(s) that were taking space in ArithProfile are not needed: they never change and a copy is already in the bytecode instruction itself.
Removing them allowed shrinking both kinds of ArithProfile to fit in 16 bits (9 and 13 respectively).
I kept the two kinds separate because they may shrink or grow independently in the future.

This also required adding the "orh" instruction to the offline assembler, to set bits in the ArithProfile.
This in turn motivated the addition of "storeh", as on RISC platforms "orh" on a memory location is actually loadh -> orh -> storeh.

* bytecode/ArithProfile.cpp:
(JSC::ArithProfile<BitfieldType>::emitObserveResult):
(JSC::ArithProfile<BitfieldType>::shouldEmitSetDouble const):
(JSC::ArithProfile<BitfieldType>::emitSetDouble const):
(JSC::ArithProfile<BitfieldType>::shouldEmitSetNonNumeric const):
(JSC::ArithProfile<BitfieldType>::shouldEmitSetBigInt const):
(JSC::ArithProfile<BitfieldType>::emitSetNonNumeric const):
(JSC::ArithProfile<BitfieldType>::emitSetBigInt const):
(WTF::printInternal):
* bytecode/ArithProfile.h:
(JSC::ArithProfile::didObserveNonInt32 const):
(JSC::ArithProfile::didObserveDouble const):
(JSC::ArithProfile::didObserveNonNegZeroDouble const):
(JSC::ArithProfile::didObserveNegZeroDouble const):
(JSC::ArithProfile::didObserveNonNumeric const):
(JSC::ArithProfile::didObserveBigInt const):
(JSC::ArithProfile::didObserveInt32Overflow const):
(JSC::ArithProfile::didObserveInt52Overflow const):
(JSC::ArithProfile::setObservedNonNegZeroDouble):
(JSC::ArithProfile::setObservedNegZeroDouble):
(JSC::ArithProfile::setObservedNonNumeric):
(JSC::ArithProfile::setObservedBigInt):
(JSC::ArithProfile::setObservedInt32Overflow):
(JSC::ArithProfile::setObservedInt52Overflow):
(JSC::ArithProfile::observeResult):
(JSC::ArithProfile::addressOfBits const):
(JSC::ArithProfile::bits const):
(JSC::ArithProfile::ArithProfile):
(JSC::ArithProfile::hasBits const):
(JSC::ArithProfile::setBit):
(JSC::UnaryArithProfile::UnaryArithProfile):
(JSC::UnaryArithProfile::observedIntBits):
(JSC::UnaryArithProfile::observedNumberBits):
(JSC::UnaryArithProfile::argObservedType const):
(JSC::UnaryArithProfile::setArgObservedType):
(JSC::UnaryArithProfile::argSawInt32):
(JSC::UnaryArithProfile::argSawNumber):
(JSC::UnaryArithProfile::argSawNonNumber):
(JSC::UnaryArithProfile::observeArg):
(JSC::UnaryArithProfile::isObservedTypeEmpty):
(JSC::BinaryArithProfile::BinaryArithProfile):
(JSC::BinaryArithProfile::observedIntIntBits):
(JSC::BinaryArithProfile::observedNumberIntBits):
(JSC::BinaryArithProfile::observedIntNumberBits):
(JSC::BinaryArithProfile::observedNumberNumberBits):
(JSC::BinaryArithProfile::setLhsObservedType):
(JSC::BinaryArithProfile::setRhsObservedType):
(JSC::BinaryArithProfile::observeLHS):
(JSC::BinaryArithProfile::observeLHSAndRHS):
(JSC::BinaryArithProfile::isObservedTypeEmpty):
* bytecode/BytecodeList.rb:
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::addJITAddIC):
(JSC::CodeBlock::addJITMulIC):
(JSC::CodeBlock::addJITSubIC):
(JSC::CodeBlock::addJITNegIC):
(JSC::CodeBlock::binaryArithProfileForBytecodeOffset):
(JSC::CodeBlock::unaryArithProfileForBytecodeOffset):
(JSC::CodeBlock::binaryArithProfileForPC):
(JSC::CodeBlock::unaryArithProfileForPC):
(JSC::CodeBlock::couldTakeSpecialFastCase):
* bytecode/CodeBlock.h:
(JSC::CodeBlock::addMathIC):
* bytecode/Fits.h:
* bytecode/MethodOfGettingAValueProfile.cpp:
(JSC::MethodOfGettingAValueProfile::emitReportValue const):
(JSC::MethodOfGettingAValueProfile::reportValue):
* bytecode/MethodOfGettingAValueProfile.h:
(JSC::MethodOfGettingAValueProfile::MethodOfGettingAValueProfile):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitUnaryOp):
* bytecompiler/BytecodeGenerator.h:
* bytecompiler/NodesCodegen.cpp:
(JSC::UnaryOpNode::emitBytecode):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::makeSafe):
(JSC::DFG::ByteCodeParser::makeDivSafe):
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::methodOfGettingAValueProfileFor):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileValueAdd):
(JSC::DFG::SpeculativeJIT::compileValueSub):
(JSC::DFG::SpeculativeJIT::compileValueNegate):
(JSC::DFG::SpeculativeJIT::compileValueMul):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileValueAdd):
(JSC::FTL::DFG::LowerDFGToB3::compileValueSub):
(JSC::FTL::DFG::LowerDFGToB3::compileValueMul):
(JSC::FTL::DFG::LowerDFGToB3::compileUnaryMathIC):
(JSC::FTL::DFG::LowerDFGToB3::compileBinaryMathIC):
(JSC::FTL::DFG::LowerDFGToB3::compileArithAddOrSub):
(JSC::FTL::DFG::LowerDFGToB3::compileValueNegate):
* jit/JIT.h:
* jit/JITAddGenerator.cpp:
(JSC::JITAddGenerator::generateInline):
(JSC::JITAddGenerator::generateFastPath):
* jit/JITAddGenerator.h:
* jit/JITArithmetic.cpp:
(JSC::JIT::emit_op_negate):
(JSC::JIT::emit_op_add):
(JSC::JIT::emitMathICFast):
(JSC::JIT::emitMathICSlow):
(JSC::JIT::emit_op_div):
(JSC::JIT::emit_op_mul):
(JSC::JIT::emit_op_sub):
* jit/JITDivGenerator.cpp:
(JSC::JITDivGenerator::generateFastPath):
* jit/JITDivGenerator.h:
(JSC::JITDivGenerator::JITDivGenerator):
* jit/JITInlines.h:
(JSC::JIT::copiedArithProfile):
* jit/JITMathIC.h:
(JSC::JITMathIC::JITMathIC):
(JSC::JITMathIC::generateInline):
(JSC::JITMathIC::arithProfile const):
(JSC::isBinaryProfileEmpty):
(JSC::JITBinaryMathIC::JITBinaryMathIC):
(JSC::isUnaryProfileEmpty):
(JSC::JITUnaryMathIC::JITUnaryMathIC):
* jit/JITMulGenerator.cpp:
(JSC::JITMulGenerator::generateInline):
(JSC::JITMulGenerator::generateFastPath):
* jit/JITMulGenerator.h:
* jit/JITNegGenerator.cpp:
(JSC::JITNegGenerator::generateInline):
(JSC::JITNegGenerator::generateFastPath):
* jit/JITNegGenerator.h:
* jit/JITOperations.cpp:
* jit/JITOperations.h:
* jit/JITSubGenerator.cpp:
(JSC::JITSubGenerator::generateInline):
(JSC::JITSubGenerator::generateFastPath):
* jit/JITSubGenerator.h:
* llint/LLIntData.cpp:
(JSC::LLInt::Data::performAssertions):
* llint/LLIntOffsetsExtractor.cpp:
(JSC::LLIntOffsetsExtractor::dummy):
* llint/LowLevelInterpreter.asm:
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
* parser/ResultType.h:
(JSC::ResultType::ResultType):
* runtime/CommonSlowPaths.cpp:
(JSC::updateArithProfileForUnaryArithOp):
(JSC::updateArithProfileForBinaryArithOp):
(JSC::SLOW_PATH_DECL):

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

6 months agoTestController may reuse a view that used window.open(), which prevents process-swapp...
cdumez@apple.com [Fri, 8 Nov 2019 02:45:05 +0000 (02:45 +0000)]
TestController may reuse a view that used window.open(), which prevents process-swapping and causes flakiness
https://bugs.webkit.org/show_bug.cgi?id=203981

Reviewed by Ryosuke Niwa.

Tools:

Stop reusing WebViews that have created other WebViews (via window.open()) since this prevents process-swapping
and may therefore cause flakiness (see Bug 203965).

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::createOtherPage):
(WTR::TestController::ensureViewSupportsOptionsForTest):
* WebKitTestRunner/TestController.h:

LayoutTests:

Drop temporary flakiness workaround that was landed in r252214.

* http/tests/inspector/target/target-events-for-provisional-page.html:

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

6 months agoUse ActiveDOMObject::queueTaskKeepingObjectAlive() in DOMCache
cdumez@apple.com [Fri, 8 Nov 2019 02:35:32 +0000 (02:35 +0000)]
Use ActiveDOMObject::queueTaskKeepingObjectAlive() in DOMCache
https://bugs.webkit.org/show_bug.cgi?id=203985

Reviewed by Ryosuke Niwa.

Use ActiveDOMObject::queueTaskKeepingObjectAlive() in DOMCache and drop DOMCache::enqueueTask().

* Modules/cache/DOMCache.cpp:
(WebCore::DOMCache::match):
(WebCore::DOMCache::matchAll):
(WebCore::DOMCache::addAll):
(WebCore::DOMCache::putWithResponseData):
(WebCore::DOMCache::put):
(WebCore::DOMCache::remove):
(WebCore::DOMCache::keys):
(WebCore::DOMCache::enqueueTask): Deleted.
* Modules/cache/DOMCache.h:

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

6 months agoPlease support WEBGL_compressed_texture_etc1 extension (and possibly WEBGL_compressed...
commit-queue@webkit.org [Fri, 8 Nov 2019 01:38:26 +0000 (01:38 +0000)]
Please support WEBGL_compressed_texture_etc1 extension (and possibly WEBGL_compressed_texture_etc too)
https://bugs.webkit.org/show_bug.cgi?id=197900

Patch by Kenneth Russell <kbr@chromium.org> on 2019-11-07
Reviewed by Dean Jackson.

Support the ETC1 and ETC2 compressed texture formats in WebKit's WebGL
implementation.

Tested by changing the code to allocate an OpenGL ES 3.0 context for WebGL,
and running in the iOS Simulator. The WebGL conformance tests
webgl-compressed-texture-etc.html and webgl-compressed-texture-etc1.html all
pass with these changes.

When an ANGLE backend is supported on iOS, these extensions will
automatically be supported, and some of the new validation code can be
removed.

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDOMConvertWebGL.cpp:
(WebCore::convertToJSValue):
* html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::getExtension):
(WebCore::WebGL2RenderingContext::getSupportedExtensions):
* html/canvas/WebGLCompressedTextureETC.cpp: Added.
(WebCore::WebGLCompressedTextureETC::WebGLCompressedTextureETC):
(WebCore::WebGLCompressedTextureETC::getName const):
(WebCore::WebGLCompressedTextureETC::supported):
* html/canvas/WebGLCompressedTextureETC.h: Added.
* html/canvas/WebGLCompressedTextureETC.idl: Added.
* html/canvas/WebGLCompressedTextureETC1.cpp: Added.
(WebCore::WebGLCompressedTextureETC1::WebGLCompressedTextureETC1):
(WebCore::WebGLCompressedTextureETC1::getName const):
(WebCore::WebGLCompressedTextureETC1::supported):
* html/canvas/WebGLCompressedTextureETC1.h: Added.
* html/canvas/WebGLCompressedTextureETC1.idl: Added.
* html/canvas/WebGLExtension.h:
* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::getExtension):
(WebCore::WebGLRenderingContext::getSupportedExtensions):
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::extensionIsEnabled):
(WebCore::WebGLRenderingContextBase::validateCompressedTexFuncData):
(WebCore::WebGLRenderingContextBase::validateCompressedTexDimensions):
(WebCore::WebGLRenderingContextBase::validateCompressedTexSubDimensions):
* html/canvas/WebGLRenderingContextBase.h:
* platform/graphics/Extensions3D.h:
* platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
(WebCore::GraphicsContext3D::GraphicsContext3D):
* platform/graphics/opengl/Extensions3DOpenGL.cpp:
(WebCore::Extensions3DOpenGL::supportsExtension):

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

6 months ago[WebGL] Fixing WebGL tests: Add new baselines for iOS bots
justin_fan@apple.com [Fri, 8 Nov 2019 01:35:31 +0000 (01:35 +0000)]
[WebGL] Fixing WebGL tests: Add new baselines for iOS bots
https://bugs.webkit.org/show_bug.cgi?id=203938

Unreviewed test expectation gardening.

Follow-up to https://bugs.webkit.org/show_bug.cgi?id=203908.
New baselines for iOS tests generated from simulator.

* TestExpectations:
* platform/ios/TestExpectations:
* platform/ios/webgl/1.0.3/conformance/extensions/get-extension-expected.txt: Added.
* platform/ios/webgl/1.0.3/conformance/extensions/oes-texture-float-expected.txt: Added.
* platform/ios/webgl/1.0.3/conformance/extensions/webgl-compressed-texture-size-limit-expected.txt: Added.
* platform/ios/webgl/1.0.3/conformance/extensions/webgl-draw-buffers-expected.txt: Added.
* platform/ios/webgl/1.0.3/conformance/more/functions/readPixelsBadArgs-expected.txt: Added.
* platform/ios/webgl/1.0.3/conformance/more/functions/texImage2DHTML-expected.txt: Added.
* platform/ios/webgl/1.0.3/conformance/more/functions/texSubImage2DHTML-expected.txt: Added.
* platform/ios/webgl/1.0.3/conformance/renderbuffers/framebuffer-object-attachment-expected.txt: Added.
* platform/ios/webgl/1.0.3/conformance/textures/copy-tex-image-2d-formats-expected.txt: Added.
* platform/ios/webgl/1.0.3/conformance/textures/texture-npot-video-expected.txt: Added.
* platform/ios/webgl/2.0.0/conformance/extensions/angle-instanced-arrays-expected.txt: Added.
* platform/ios/webgl/2.0.0/conformance/extensions/oes-vertex-array-object-expected.txt: Added.

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

6 months ago[bmalloc] Bug fix for wait time when it's in mini mode.
ysuzuki@apple.com [Fri, 8 Nov 2019 01:29:07 +0000 (01:29 +0000)]
[bmalloc] Bug fix for wait time when it's in mini mode.
https://bugs.webkit.org/show_bug.cgi?id=203121

Reviewed by Saam Barati.

Basuke pointed out that we never changed m_waitTime in scavenger when we are in iOS and mini-mode.
So previously, we are always executing scavenger for each 10ms in mini-mode. After fixing it, we
found that this unintentional behavior was better policy for RAMification.
In this patch, we explicitly use the old behavior, "scavenge for each 10ms" in iOS mini-mode.
We should revisit scavenger's behavior in the future to explore further better behavior.

* bmalloc/Scavenger.cpp:
(bmalloc::Scavenger::threadRunLoop):

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

6 months agoRemove an unused icon resource
timothy_horton@apple.com [Fri, 8 Nov 2019 01:18:14 +0000 (01:18 +0000)]
Remove an unused icon resource
https://bugs.webkit.org/show_bug.cgi?id=203983

Reviewed by Wenson Hsieh.

* Resources/mac/mediaIcon.pdf: Removed.
* WebKit.xcodeproj/project.pbxproj:
This file has not been used in years.

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

6 months agowebgl/1.0.3/conformance/context/context-release-upon-reload.html is flaky
justin_fan@apple.com [Fri, 8 Nov 2019 01:15:24 +0000 (01:15 +0000)]
webgl/1.0.3/conformance/context/context-release-upon-reload.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=203984

Unreviewed test expectation addition.

Skip context-release-upon-reload.html on High Sierra WK1 debug bots.

* platform/mac-highsierra-wk1/TestExpectations: Added.

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

6 months agoWindowEventLoop should be shared among similar origin documents
rniwa@webkit.org [Fri, 8 Nov 2019 01:13:19 +0000 (01:13 +0000)]
WindowEventLoop should be shared among similar origin documents
https://bugs.webkit.org/show_bug.cgi?id=203882

Reviewed by Wenson Hsieh.

Source/WebCore:

Made WindowEventLoop shared across similar origin documents.

Also added internals.queueTask to directly test the event loop behavior
since implicitly testing it via other features has been very cumbersome.

This will help test other features that use the HTML5 event loop as well.

Tests: http/tests/eventloop/queue-task-across-cross-site-frames.html
       http/tests/eventloop/queue-task-across-frames.html

* dom/Document.cpp:
(WebCore::Document::eventLoop): Use WindowEventLoop::ensureForRegistrableDomain.
* dom/WindowEventLoop.cpp:
(WebCore::WindowEventLoop::ensureForRegistrableDomain): Added. Replaces create,
and returns an existing WindowEventLoop if the RegistrableDomain matches.
(WebCore::WindowEventLoop::WindowEventLoop): Added.
(WebCore::WindowEventLoop::~WindowEventLoop): Added. Removes itself from the map.
* dom/WindowEventLoop.h:
* testing/Internals.cpp:
(WebCore::Internals::queueTask): Added.
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

Added some tests to make sure the event loop is shared among similar origin documents.

* http/tests/eventloop: Added.
* http/tests/eventloop/queue-task-across-cross-site-frames-expected.txt: Added.
* http/tests/eventloop/queue-task-across-cross-site-frames.html: Added.
* http/tests/eventloop/queue-task-across-frames-expected.txt: Added.
* http/tests/eventloop/queue-task-across-frames.html: Added.
* http/tests/eventloop/resources: Added.
* http/tests/eventloop/resources/eventloop-helper.html: Added.

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

6 months agoDrop GenericEventQueue class now that it is unused
cdumez@apple.com [Fri, 8 Nov 2019 00:57:59 +0000 (00:57 +0000)]
Drop GenericEventQueue class now that it is unused
https://bugs.webkit.org/show_bug.cgi?id=203980

Reviewed by Ryosuke Niwa.

Drop GenericEventQueue class now that it is unused. All users have been ported to the HTML
event loop. MainThreadGenericEventQueue remains for now but will get dropped in a follow-up
patch, once it is no longer used.

* dom/GenericEventQueue.cpp:
(WebCore::MainThreadGenericEventQueue::MainThreadGenericEventQueue):
(WebCore::MainThreadGenericEventQueue::enqueueEvent):
(WebCore::MainThreadGenericEventQueue::dispatchOneEvent):
(WebCore::MainThreadGenericEventQueue::close):
(WebCore::MainThreadGenericEventQueue::cancelAllEvents):
(WebCore::MainThreadGenericEventQueue::hasPendingEvents const):
(WebCore::MainThreadGenericEventQueue::hasPendingEventsOfType const):
(WebCore::MainThreadGenericEventQueue::setPaused):
(WebCore::MainThreadGenericEventQueue::suspend):
(WebCore::MainThreadGenericEventQueue::resume):
(WebCore::MainThreadGenericEventQueue::rescheduleAllEventsIfNeeded):
(WebCore::MainThreadGenericEventQueue::stop):
(WebCore::MainThreadGenericEventQueue::activeDOMObjectName const):
(WebCore::TaskQueueConstructor::construct): Deleted.
(WebCore::TaskQueueConstructor<Timer>::construct): Deleted.
(WebCore::GenericEventQueueBase<T>::GenericEventQueueBase): Deleted.
(WebCore::GenericEventQueueBase<T>::enqueueEvent): Deleted.
(WebCore::GenericEventQueueBase<T>::dispatchOneEvent): Deleted.
(WebCore::GenericEventQueueBase<T>::close): Deleted.
(WebCore::GenericEventQueueBase<T>::cancelAllEvents): Deleted.
(WebCore::GenericEventQueueBase<T>::hasPendingEvents const): Deleted.
(WebCore::GenericEventQueueBase<T>::hasPendingEventsOfType const): Deleted.
(WebCore::GenericEventQueueBase<T>::setPaused): Deleted.
(WebCore::GenericEventQueueBase<T>::suspend): Deleted.
(WebCore::GenericEventQueueBase<T>::resume): Deleted.
(WebCore::GenericEventQueueBase<T>::rescheduleAllEventsIfNeeded): Deleted.
(WebCore::GenericEventQueueBase<T>::stop): Deleted.
(WebCore::GenericEventQueueBase<T>::activeDOMObjectName const): Deleted.
(WebCore::GenericEventQueue::create): Deleted.
* dom/GenericEventQueue.h:
(WebCore::GenericEventQueueBase::isSuspended const): Deleted.
(WebCore::GenericEventQueueBase::isSuspendedOrPausedByClient const): Deleted.
(WebCore::MainThreadGenericEventQueue::MainThreadGenericEventQueue): Deleted.
(WebCore::GenericEventQueue::GenericEventQueue): Deleted.

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

6 months agoLayout Test http/tests/appcache/remove-cache.html is a flaky failure
youenn@apple.com [Fri, 8 Nov 2019 00:52:28 +0000 (00:52 +0000)]
Layout Test http/tests/appcache/remove-cache.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=199124
<rdar://problem/52008712>

Reviewed by Chris Dumez.

The flakiness probably comes from the use of a setTimeout that might kick in while in most runs, it never kicks in.
When the timer kicks in, the test is reloaded, which triggers a new console log line.
The current console lines do not bring more values than what the test checks with appcache events.
Removing console log lines from the expected file will fix the flakiness.

* TestExpectations:
* http/tests/appcache/remove-cache-expected.txt:
* platform/mac/TestExpectations:

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

6 months ago[WebAssembly] Inspector's DebuggerCallFrame should be aware of Wasm frames
tzagallo@apple.com [Fri, 8 Nov 2019 00:37:52 +0000 (00:37 +0000)]
[WebAssembly] Inspector's DebuggerCallFrame should be aware of Wasm frames
https://bugs.webkit.org/show_bug.cgi?id=203925

Reviewed by Mark Lam.

The DebuggerCallFrame checks for CallFrame::codeBlock to determine if it the current frame is a
valid JS frame, but since the Wasm interpreter stores the Wasm::FunctionCodeBlock to this slot,
that check is not sufficient. Add an extra check for CalleeBits::isWasm.

* debugger/DebuggerCallFrame.cpp:
(JSC::DebuggerCallFrame::sourceIDForCallFrame):

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

6 months agoWeb Inspector: http/tests/inspector/target/target-events-for-provisional-page.html...
yurys@chromium.org [Thu, 7 Nov 2019 23:44:55 +0000 (23:44 +0000)]
Web Inspector: http/tests/inspector/target/target-events-for-provisional-page.html is flaky when running with other tests
https://bugs.webkit.org/show_bug.cgi?id=203965
<rdar://problem/56988642>

Reviewed by Devin Rousso.

Enforce enableProcessSwapOnWindowOpen=true for the test so that it PSON is enabled regardless of other tests
that may run before (the test may reuse Page instance from the previous test on which
Page::openedByDOMWithOpener==true).

* http/tests/inspector/target/target-events-for-provisional-page.html:

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

6 months agoWeb Inspector: REGRESSION(r251958): console prompt is automatically focused when...
drousso@apple.com [Thu, 7 Nov 2019 23:39:56 +0000 (23:39 +0000)]
Web Inspector: REGRESSION(r251958): console prompt is automatically focused when page is reloaded
https://bugs.webkit.org/show_bug.cgi?id=203932

Reviewed by Timothy Hatcher.

* UserInterface/Base/Main.js:
(WI._restoreCookieForOpenTabs):
Only attempt to autofocus when Web Inspector is first opened.

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

6 months agoPort Worker to the HTML5 event loop
cdumez@apple.com [Thu, 7 Nov 2019 23:24:35 +0000 (23:24 +0000)]
Port Worker to the HTML5 event loop
https://bugs.webkit.org/show_bug.cgi?id=203919

Reviewed by Ryosuke Niwa.

* dom/ActiveDOMObject.h:
* workers/Worker.cpp:
(WebCore::Worker::Worker):
(WebCore::Worker::terminate):
(WebCore::Worker::hasPendingActivity const):
(WebCore::Worker::notifyFinished):
(WebCore::Worker::dispatchEvent):
(WebCore::Worker::enqueueEvent): Deleted.
* workers/Worker.h:
* workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerMessagingProxy::postMessageToWorkerObject):
(WebCore::WorkerMessagingProxy::postExceptionToWorkerObject):

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

6 months ago[iOS] Add logging and telemetry to more mach lookup rules
pvollan@apple.com [Thu, 7 Nov 2019 23:20:01 +0000 (23:20 +0000)]
[iOS] Add logging and telemetry to more mach lookup rules
https://bugs.webkit.org/show_bug.cgi?id=203978

Reviewed by Brent Fulgham.

Add logging and telemetry to help determine if mach lookup of these services can be denied in the WebContent process.

* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:

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

6 months ago Many resourceLoadStatistics tests and storageAccess tests using the ITP
katherine_cheney@apple.com [Thu, 7 Nov 2019 23:16:39 +0000 (23:16 +0000)]
   Many resourceLoadStatistics tests and storageAccess tests using the ITP
       Database redirect to the corresponding memory store test after setting
       a cookie
       https://bugs.webkit.org/show_bug.cgi?id=203958
       <rdar://problem/56984114>

Reviewed by John Wilander.

This patch fixes incorrect redirects in some ITP database store tests.
They should redirect back to themselves as opposed to corresponding
memory store tests to be sure they are testing the correct
functionality.

* http/tests/resourceLoadStatistics/add-blocking-to-redirect-database.html:
* http/tests/resourceLoadStatistics/blocking-in-web-worker-script-import-database.html:
* http/tests/resourceLoadStatistics/cookie-deletion-database.html:
* http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction-database.html:
* http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations-database.html:
* http/tests/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource-database.html:
* http/tests/resourceLoadStatistics/grandfathering-database.html:
* http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context-database.html:
* http/tests/resourceLoadStatistics/ping-to-prevalent-resource-database.html:
* http/tests/storageAccess/deny-due-to-no-interaction-under-general-third-party-cookie-blocking-database.html:
* http/tests/storageAccess/grant-with-prompt-under-general-third-party-cookie-blocking-database.html:
* http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-database.html:
* http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral-database.html:
* http/tests/storageAccess/has-storage-access-under-general-third-party-cookie-blocking-with-cookie-database.html:
* http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access-database.html:
* http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access-database.html:
* http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access-database.html:

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

6 months agoPort MessagePort to the HTML5 event loop
cdumez@apple.com [Thu, 7 Nov 2019 23:16:07 +0000 (23:16 +0000)]
Port MessagePort to the HTML5 event loop
https://bugs.webkit.org/show_bug.cgi?id=203960

Reviewed by Ryosuke Niwa.

* dom/MessagePort.cpp:
(WebCore::MessagePort::MessagePort):
(WebCore::MessagePort::close):
(WebCore::MessagePort::dispatchMessages):
(WebCore::MessagePort::dispatchEvent):
* dom/MessagePort.h:
* dom/TaskSource.h:

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

6 months agoFactor matched declarations cache into a class
antti@apple.com [Thu, 7 Nov 2019 23:01:20 +0000 (23:01 +0000)]
Factor matched declarations cache into a class
https://bugs.webkit.org/show_bug.cgi?id=203972

Reviewed by Zalan Bujtas.

Move the code out from StyleResolver and rename "matched properties cache" -> "matched declarations cache"
to better describe it.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/ElementRuleCollector.cpp:
(WebCore::ElementRuleCollector::declarationsForOrigin):

Add a helper.

(WebCore::ElementRuleCollector::transferMatchedRules):

Reserve vector capacity before adding rules.

(WebCore::ElementRuleCollector::addMatchedProperties):
* css/ElementRuleCollector.h:
(WebCore::MatchResult::operator== const):
(WebCore::MatchResult::operator!= const):

Remove the unneeded inline capacity so we can just use MatchResult itself in the cache.

* css/RuleSet.cpp:
(WebCore::RuleSet::addChildRules):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::StyleResolver):
(WebCore::StyleResolver::invalidateMatchedDeclarationsCache):
(WebCore::StyleResolver::clearCachedDeclarationsAffectedByViewportUnits):
(WebCore::StyleResolver::applyMatchedProperties):
(WebCore::StyleResolver::sweepMatchedPropertiesCache): Deleted.
(WebCore::StyleResolver::computeMatchedPropertiesHash): Deleted.
(WebCore::StyleResolver::findFromMatchedPropertiesCache): Deleted.
(WebCore::StyleResolver::addToMatchedPropertiesCache): Deleted.
(WebCore::StyleResolver::invalidateMatchedPropertiesCache): Deleted.
(WebCore::StyleResolver::clearCachedPropertiesAffectedByViewportUnits): Deleted.
(WebCore::isCacheableInMatchedPropertiesCache): Deleted.
* css/StyleResolver.h:
(WebCore::StyleResolver::MatchedPropertiesCacheItem::MatchedPropertiesCacheItem): Deleted.
* dom/Document.cpp:
(WebCore::Document::invalidateMatchedPropertiesCacheAndForceStyleRecalc):
(WebCore::Document::updateViewportUnitsOnResize):
* page/Page.cpp:
(WebCore::Page::updateStyleAfterChangeInEnvironment):
* style/MatchedDeclarationsCache.cpp: Added.
(WebCore::Style::MatchedDeclarationsCache::MatchedDeclarationsCache):
(WebCore::Style::MatchedDeclarationsCache::isCacheable):
(WebCore::Style::MatchedDeclarationsCache::computeHash):
(WebCore::Style::MatchedDeclarationsCache::find):
(WebCore::Style::MatchedDeclarationsCache::add):
(WebCore::Style::MatchedDeclarationsCache::invalidate):
(WebCore::Style::MatchedDeclarationsCache::clearEntriesAffectedByViewportUnits):
(WebCore::Style::MatchedDeclarationsCache::sweep):
* style/MatchedDeclarationsCache.h: Added.
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::resolveElement):

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

6 months agoUserMediaController::from(document) can return nullptr
eric.carlson@apple.com [Thu, 7 Nov 2019 22:53:47 +0000 (22:53 +0000)]
UserMediaController::from(document) can return nullptr
https://bugs.webkit.org/show_bug.cgi?id=203977
<rdar://problem/56908013>

Reviewed by Jer Noble.

* Modules/mediastream/MediaDevices.cpp:
(WebCore::MediaDevices::stop): NULL-check the UserMediaController.

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

6 months agoPort ServiceWorkerContainer to the HTML5 event loop
cdumez@apple.com [Thu, 7 Nov 2019 22:36:45 +0000 (22:36 +0000)]
Port ServiceWorkerContainer to the HTML5 event loop
https://bugs.webkit.org/show_bug.cgi?id=203963

Reviewed by Ryosuke Niwa.

* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::ServiceWorkerContainer):
(WebCore::ServiceWorkerContainer::startMessages):
(WebCore::ServiceWorkerContainer::postMessage):
* workers/service/ServiceWorkerContainer.h:

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

6 months agoIntegrate scroll event into HTML5 event loop
rniwa@webkit.org [Thu, 7 Nov 2019 22:18:37 +0000 (22:18 +0000)]
Integrate scroll event into HTML5 event loop
https://bugs.webkit.org/show_bug.cgi?id=203839
<rdar://problem/56890922>

Reviewed by Simon Fraser.

Source/WebCore:

Dispatch scroll events on each pending scroll event targets inside the update-the-rendering step
of the event loop as specified in the HTML5 and CSSOM View Module specifications:
https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering
https://drafts.csswg.org/cssom-view/#run-the-scroll-steps

The new behavior also matches that of Chrome and Firefox.

Like resize event, the current visual viewport specification does not specify when scroll event
is dispatched on visualViewport interface: https://github.com/WICG/visual-viewport/issues/66
For now, we always dispatch upon it after dispatching on all pending scroll event targets.

Tests: fast/events/scroll-multiple-elements-in-rendering-update.html
       fast/events/scroll-subframe-in-rendering-update.html
       fast/visual-viewport/visual-viewport-scroll-after-resize-in-subframe.html

* dom/Document.cpp:
(WebCore::Document::addPendingScrollEventTarget): Added.
(WebCore::Document::setNeedsVisualViewportScrollEvent): Added.
(WebCore::Document::runScrollSteps): Added. This implements run the scroll steps in CSS OM View.
* dom/Document.h:
* dom/DocumentEventQueue.cpp:
(WebCore::DocumentEventQueue::enqueueOrDispatchScrollEvent): Deleted.
(WebCore::DocumentEventQueue::enqueueScrollEvent): Deleted.
* dom/DocumentEventQueue.h:
* page/EventHandler.cpp:
(WebCore::EventHandler::sendScrollEvent):
* page/Page.cpp:
(WebCore::Page::updateRendering): Invoke runScrollSteps on each document in the frame tree order.
* page/VisualViewport.cpp:
(WebCore::VisualViewport::update):
(WebCore::VisualViewport::enqueueScrollEvent): Deleted.
* page/VisualViewport.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollTo):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::scrollTo):

LayoutTests:

Added tests to test the timing at which scroll events are fired across multiple elements and documents,
and with visualViewport, and updated the existing tests to work with the new timing.

* editing/selection/overflow-scroll-while-selecting-text.html:
* fast/events/scroll-multiple-elements-in-rendering-update-expected.txt: Added.
* fast/events/scroll-multiple-elements-in-rendering-update.html: Added.
* fast/events/scroll-subframe-in-rendering-update-expected.txt: Added.
* fast/events/scroll-subframe-in-rendering-update.html: Added.
* fast/scrolling/programmatic-scroll-to-negative-offset.html:
* fast/shadow-dom/trusted-event-scoped-flags.html:
* fast/visual-viewport/visual-viewport-scroll-after-resize-in-subframe-expected.txt: Added.
* fast/visual-viewport/visual-viewport-scroll-after-resize-in-subframe.html: Added.
* tiled-drawing/scrolling/fast-scroll-div-latched-mainframe.html:

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

6 months agoREGRESSION: r252121 introduced timeout in webgl/1.0.3/conformance/glsl/misc/shader...
justin_fan@apple.com [Thu, 7 Nov 2019 21:34:15 +0000 (21:34 +0000)]
REGRESSION: r252121 introduced timeout in webgl/1.0.3/conformance/glsl/misc/shader-with-non-reserved-words.html
https://bugs.webkit.org/show_bug.cgi?id=203949

Unreviewed test expectation gardening.

shader-with-non-reserved-words takes dozens of minutes to pass. Skip everywhere.

* platform/gtk/TestExpectations:
* platform/ios-simulator-wk2/TestExpectations:
* platform/mac/TestExpectations:
* platform/wpe/TestExpectations:

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

6 months agoREGRESSION (r252161): 3 transitions/ tests time-out
simon.fraser@apple.com [Thu, 7 Nov 2019 21:07:42 +0000 (21:07 +0000)]
REGRESSION (r252161): 3 transitions/ tests time-out
https://bugs.webkit.org/show_bug.cgi?id=203966

Reviewed by Dean Jackson.

Fix the shadow parsing code to deal with non-integral values.

* legacy-animation-engine/transitions/resources/transition-test-helpers.js:
(isShadow):
* transitions/resources/transition-test-helpers.js:
(isShadow):

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

6 months agoWeb Inspector: REGRESSION(r250087): inspector/model/remote-object.html is timing out
drousso@apple.com [Thu, 7 Nov 2019 20:36:51 +0000 (20:36 +0000)]
Web Inspector: REGRESSION(r250087): inspector/model/remote-object.html is timing out
https://bugs.webkit.org/show_bug.cgi?id=202934
<rdar://problem/56270900>

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

In r250087, the inspector injected script was changed so that remote objects actually
iterate the keys of an array and generate a property descriptor for each. While this worked
fine (and was performant) for fetching remote objects, this was not efficient when creating
object previews, as that path wouldn't be limited by any sort of `fetchCount`, meaning that
a descriptor for every index would be created even though only the first 10 would be used.

Refactor the inspector injected script code so that both the fetch and preview paths only
examine exactly the number of properties desired instead of considering all of them and then
slicing to fit.

* inspector/InjectedScriptSource.js:
(InjectedScript.prototype._getProperties):
(InjectedScript.prototype._forEachPropertyDescriptor): Added.
(InjectedScript.prototype._forEachPropertyDescriptor.createFakeValueDescriptor): Added.
(InjectedScript.prototype._forEachPropertyDescriptor.processDescriptor): Added.
(InjectedScript.prototype._forEachPropertyDescriptor.processProperty): Added.
(RemoteObject.prototype._generatePreview):
(RemoteObject.prototype._appendPropertyPreview): Added.
(RemoteObject.prototype._appendPropertyPreview.appendPreview): Added.
(InjectedScript.prototype._propertyDescriptors): Deleted.
(InjectedScript.prototype._propertyDescriptors.processProperties): Deleted.
(InjectedScript.prototype._propertyDescriptors.arrayIndexPropertyNames): Deleted.
(RemoteObject.prototype._appendPropertyPreviews): Deleted.

Source/WebInspectorUI:

* UserInterface/Views/ObjectTreeView.js:
(WI.ObjectTreeView.addShowMoreIfNeeded):
Drive-by: ensure that the indeterminate progress spinner is added after the last button.
LayoutTests:

Split inspector/model/remote-object.html into separate tests for each type of object being
tested, as well as specialized tests for extremely large values. This allows us to better
know which specific expression can cause a timeout.

* inspector/model/remote-object.html: Removed.
* inspector/model/remote-object-expected.txt: Removed.
* platform/mac-wk1/inspector/model/remote-object-expected.txt: Removed.

* inspector/model/remote-object/array.html: Added.
* inspector/model/remote-object/array-expected.txt: Added.
* inspector/model/remote-object/array-large.html: Added.
* inspector/model/remote-object/array-large-expected.txt: Added.
* inspector/model/remote-object/boolean.html: Added.
* inspector/model/remote-object/boolean-expected.txt: Added.
* inspector/model/remote-object/class.html: Added.
* inspector/model/remote-object/class-expected.txt: Added.
* inspector/model/remote-object/date.html: Added.
* inspector/model/remote-object/date-expected.txt: Added.
* inspector/model/remote-object/error.html: Added.
* inspector/model/remote-object/error-expected.txt: Added.
* inspector/model/remote-object/function.html: Added.
* inspector/model/remote-object/function-expected.txt: Added.
* inspector/model/remote-object/immutable.html: Added.
* inspector/model/remote-object/immutable-expected.txt: Added.
* inspector/model/remote-object/iterator.html: Added.
* inspector/model/remote-object/iterator-expected.txt:  Added.
* inspector/model/remote-object/iterator-large.html: Added.
* inspector/model/remote-object/iterator-large-expected.txt: Added.
* inspector/model/remote-object/map.html: Added.
* inspector/model/remote-object/map-expected.txt: Added.
* inspector/model/remote-object/map-large.html: Added.
* inspector/model/remote-object/map-large-expected.txt: Added.
* inspector/model/remote-object/null.html: Added.
* inspector/model/remote-object/null-expected.txt: Added.
* inspector/model/remote-object/number.html: Added.
* inspector/model/remote-object/number-expected.txt: Added.
* platform/mac-wk1/inspector/number-expected.txt: Added.
* inspector/model/remote-object/object.html: Added.
* inspector/model/remote-object/object-expected.txt: Added.
* inspector/model/remote-object/object-large.html: Added.
* inspector/model/remote-object/object-large-expected.txt: Added.
* inspector/model/remote-object/promise.html: Added.
* inspector/model/remote-object/promise-expected.txt: Added.
* inspector/model/remote-object/regexp.html: Added.
* inspector/model/remote-object/regexp-expected.txt: Added.
* inspector/model/remote-object/set.html: Added.
* inspector/model/remote-object/set-expected.txt: Added.
* inspector/model/remote-object/set-large.html: Added.
* inspector/model/remote-object/set-large-expected.txt: Added.
* inspector/model/remote-object/string.html: Added.
* inspector/model/remote-object/string-expected.txt: Added.
* inspector/model/remote-object/string-large.html: Added.
* inspector/model/remote-object/string-large-expected.txt: Added.
* inspector/model/remote-object/undefined.html: Added.
* inspector/model/remote-object/undefined-expected.txt: Added.

* inspector/model/remote-object/dom.html: Renamed from LayoutTests/inspector/model/remote-object-dom.html.
* inspector/model/remote-object/dom-expected.txt: Renamed from LayoutTests/inspector/model/remote-object-dom-expected.txt.
* inspector/model/remote-object/iterators-mutated.html: Renamed from LayoutTests/inspector/model/remote-object-mutated-iterators.html.
* inspector/model/remote-object/iterators-mutated-expected.txt: Renamed from LayoutTests/inspector/model/remote-object-mutated-iterators-expected.txt.

* inspector/model/remote-object/resources/remote-object-utilities.js: Renamed from LayoutTests/inspector/model/resources/remote-object-utilities.js.

* inspector/runtime/getDisplayableProperties.html:
* inspector/runtime/getDisplayableProperties-expected.txt:
* inspector/runtime/getProperties.html:
* inspector/runtime/getProperties-expected.txt:
Drive-by: fix assertion for when the `__proto__` is included if `fetchStart` is 0.
* TestExpectations:

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

6 months agoWeb Inspector: REGRESSION(r249451): missing "Reveal in DOM Tree" on nodes logged...
drousso@apple.com [Thu, 7 Nov 2019 20:31:44 +0000 (20:31 +0000)]
Web Inspector: REGRESSION(r249451): missing "Reveal in DOM Tree" on nodes logged to the console
https://bugs.webkit.org/show_bug.cgi?id=203836

Reviewed by Timothy Hatcher.

* UserInterface/Views/ContextMenuUtilities.js:
(WI.appendContextMenuItemsForDOMNode):
* UserInterface/Views/DOMTreeOutline.js:
(WI.DOMTreeOutline.prototype.populateContextMenu):
DOM trees in the console are marked as being non-editable, which is intended to prevent
modifications (e.g. changing an attribute) from being made in the console as the DOM tree
there is not hooked up to the associated DOM agent. In r249451 however, this guard was over
expanded to include non-editing actions, like "Reveal in DOM Tree" and DOM breakpoints.

* UserInterface/Views/LogContentView.js:
(WI.LogContentView.prototype._handleContextMenuEvent):
Drive-by: add a separator before "Copy Selected" so it doesn't end up in the same group as
          any "Collapse All" from a `WI.TreeOutline`.

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

6 months agoWeb Inspector: Local Resource Overrides: automatically show a file picker when attemp...
drousso@apple.com [Thu, 7 Nov 2019 20:17:59 +0000 (20:17 +0000)]
Web Inspector: Local Resource Overrides: automatically show a file picker when attempting to create an override for non-text resources
https://bugs.webkit.org/show_bug.cgi?id=203917

Reviewed by Timothy Hatcher.

Since there's no way to edit non-text resources (e.g. images, fonts, etc.) in Web Inspector,
when creating a local override for non-text resources, default to showing a file picker and
creating a local override from the content and MIME type of whatever file is chosen.

Still provide a way (shift-click) to create a local override for non-text resources from the
resource's contents, as that can be useful if the user just wants to change some headers.

* UserInterface/Models/Resource.js:
(WI.Resource.prototype.async createLocalResourceOverride):

* UserInterface/Views/ResourceContentView.js:
(WI.ResourceContentView):
(WI.ResourceContentView.prototype.get createLocalResourceOverrideTooltip): Added.
(WI.ResourceContentView.prototype.requestLocalResourceOverrideInitialContent): Added.
(WI.ResourceContentView.prototype.async _getContentForLocalResourceOverrideFromFile): Added.
(WI.ResourceContentView.prototype._handleCreateLocalResourceOverride):
(WI.ResourceContentView.prototype._handleImportLocalResourceOverride):
(WI.ResourceContentView.prototype.localResourceOverrideInitialContent): Deleted.
(WI.ResourceContentView.prototype.async _handleCreateLocalResourceOverride): Deleted.

* UserInterface/Views/TextResourceContentView.js:
(WI.TextResourceContentView.prototype.get createLocalResourceOverrideTooltip): Added.
(WI.TextResourceContentView.prototype.requestLocalResourceOverrideInitialContent): Added.
(WI.TextResourceContentView.prototype.localResourceOverrideInitialContent): Deleted.

* Localizations/en.lproj/localizedStrings.js:

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

6 months agoWeb Inspector: Timelines: add a marker for when a stop was requested
drousso@apple.com [Thu, 7 Nov 2019 20:02:22 +0000 (20:02 +0000)]
Web Inspector: Timelines: add a marker for when a stop was requested
https://bugs.webkit.org/show_bug.cgi?id=203935

Reviewed by Timothy Hatcher.

After r244195, the Web Inspector frontend doesn't stop updating the current time marker
until after it receives all of the corresponding `*.trackingComplete` events. This means
that sometimes, the current time marker can move far past the time at which the stop was
requested, such as if there's a blocking script.

We should indicate where the stop was requested, as that is often right after a particular
issue is reproduced during a timeline recording, rather than have the user try to figure out
where they stopped.

Only keep a marker for the last stop request, and hide the marker once capturing resumes.

It's still useful to have the current time marker continue updating, as we should show all
the information we have about captured things, such as blocking scripts.

* UserInterface/Views/TimelineOverview.js:
(WI.TimelineOverview):
(WI.TimelineOverview.prototype._handleTimelineCapturingStateChanged):

* UserInterface/Models/TimelineMarker.js:
* UserInterface/Views/TimelineRuler.js:
(WI.TimelineRuler.prototype.addMarker):
* UserInterface/Views/TimelineRuler.css:
(.timeline-ruler > .markers > .marker.stopping-time): Added.
(.timeline-ruler > .markers > .marker.current-time):
(.timeline-ruler > .markers > .marker:matches(.stopping-time, .current-time)::after): Added.
(@media (prefers-color-scheme: dark) .timeline-ruler > .markers > .marker.stopping-time): Added.
(.timeline-ruler > .markers > .marker.current-time::after): Deleted.
Make the current time marker always on top (`z-index`).

* Localizations/en.lproj/localizedStrings.js:

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

6 months agoWeb Inspector: REGRESSION(r251958): automatic console prompt focusing prevents any...
drousso@apple.com [Thu, 7 Nov 2019 19:59:31 +0000 (19:59 +0000)]
Web Inspector: REGRESSION(r251958): automatic console prompt focusing prevents any "space" shortcuts from working
https://bugs.webkit.org/show_bug.cgi?id=203939

Reviewed by Timothy Hatcher.

* UserInterface/Base/Main.js:
(WI.isShowingTimelineTab): Added.
(WI.isShowingAuditTab): Added.
(WI._restoreCookieForOpenTabs):

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

6 months agoWeb Inspector: Uncaught Exception: Unable to get object details - GlobalObject
drousso@apple.com [Thu, 7 Nov 2019 19:46:41 +0000 (19:46 +0000)]
Web Inspector: Uncaught Exception: Unable to get object details - GlobalObject
https://bugs.webkit.org/show_bug.cgi?id=203930
<rdar://problem/56960937>

In r248286, calls to `Heap.snapshot`, `Heap.getPreview`, and `Heap.getRemoteObject` were
moved to the `WI.HeapManager` instead of being inside view code. During this move, extra
`WI.reportInternalError` calls were added, which wasn't entirely correct as it is fully
possible (and expected) that any of these commands are invoked with old heap snapshot nodes
that may no longer exist. As such, calling any error an "internal error" isn't strictly
correct, and instead should just be a log. Also, the frontend code that calls these commands
is able to handle errors, again because it is expected.

Reviewed by Brian Burg.

* UserInterface/Controllers/HeapManager.js:
(WI.HeapManager.prototype.snapshot):
(WI.HeapManager.prototype.getPreview):
(WI.HeapManager.prototype.getRemoteObject):

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

6 months agoJSTests:
commit-queue@webkit.org [Thu, 7 Nov 2019 19:42:10 +0000 (19:42 +0000)]
JSTests:
didPassSomeTestsSilenty is misspelled in standalone-pre.js
https://bugs.webkit.org/show_bug.cgi?id=203948

Patch by Tuomas Karkkainen <tuomas.webkit@apple.com> on 2019-11-07
Reviewed by Yusuke Suzuki.

* stress/resources/standalone-pre.js:

LayoutTests:
didPassSomeTestsSilenty and didFaileSomeTests are misspelled in standalone-pre.js
https://bugs.webkit.org/show_bug.cgi?id=203948

Patch by Tuomas Karkkainen <tuomas.webkit@apple.com> on 2019-11-07
Reviewed by Yusuke Suzuki.

* resources/standalone-pre.js:

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

6 months agoUnskip test262 tests for async-iteration
ross.kirsling@sony.com [Thu, 7 Nov 2019 19:24:54 +0000 (19:24 +0000)]
Unskip test262 tests for async-iteration
https://bugs.webkit.org/show_bug.cgi?id=203921

Reviewed by Keith Miller.

This should have been done two years ago, it seems.

* test262/config.yaml:
* test262/expectations.yaml:

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