WebKit-https.git
7 months agoUnreviewed, Non-GStreamer-GL build fix after r242701.
philn@webkit.org [Mon, 11 Mar 2019 15:26:04 +0000 (15:26 +0000)]
Unreviewed, Non-GStreamer-GL build fix after r242701.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):

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

7 months agoAdd utility function to allow easy reverse range-based iteration of a container
commit-queue@webkit.org [Mon, 11 Mar 2019 15:25:08 +0000 (15:25 +0000)]
Add utility function to allow easy reverse range-based iteration of a container
https://bugs.webkit.org/show_bug.cgi?id=195542

Patch by Sam Weinig <sam@webkit.org> on 2019-03-11
Reviewed by Antti Koivisto.

Source/WTF:

Add functions to create an IteratorRange<T> that will iterate a container backwards. It
works with any container that is compatible with std::rbegin() and std::rend(). It is
expected to be used in conjunction with range-based for-loops like so:

for (auto& value : WTF::makeReversedRange(myContainer))
    ...

* wtf/IteratorRange.h:
(WTF::makeReversedRange):

Tools:

* TestWebKitAPI/CMakeLists.txt:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/IteratorRange.cpp: Added.
(TestWebKitAPI::TEST):
Add test to ensure WTF::makeReversedRange() works correctly and uses the correct types.

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

7 months ago[GStreamer][v4l2] Synchronous video texture flushing support
philn@webkit.org [Mon, 11 Mar 2019 14:41:39 +0000 (14:41 +0000)]
[GStreamer][v4l2] Synchronous video texture flushing support
https://bugs.webkit.org/show_bug.cgi?id=195453

Reviewed by Xabier Rodriguez-Calvar.

The v4l2 video decoder currently requires that downstream users of
the graphics resources complete any pending draw call and release
resources before returning from the DRAIN query.

To accomplish this the player monitors the pipeline and whenever a
v4l2 decoder is added, synchronous video texture flushing support
is enabled. Additionally and for all decoder configurations, a
flush is performed before disposing of the player.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::playbinDeepElementAddedCallback):
Monitor elements added to the decodebin bin.
(WebCore::MediaPlayerPrivateGStreamer::decodebinElementAdded): Set
a flag if a v4l2 decoder was added in decodebin.
(WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Connect
to the deep-element-added signal so as to monitor pipeline
topology updates.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
Flush video texture before disposing of the player.
(WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer):
Synchronously flush if the pipeline contains a v4l2 decoder.
(WebCore::MediaPlayerPrivateGStreamerBase::createGLAppSink): Monitor push events only.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
* platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
(WebCore::TextureMapperPlatformLayerProxy::pushNextBuffer): New
boolean flag used mostly to trigger synchronous flush conditions.
(WebCore::TextureMapperPlatformLayerProxy::dropCurrentBufferWhilePreservingTexture):
Optionally drop the current buffer in a synchronous manner. By
default the method keeps operating asynchronously.
* platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:

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

7 months agoRename contentOffsetInCompostingLayer to contentOffsetInCompositingLayer
antti@apple.com [Mon, 11 Mar 2019 12:58:57 +0000 (12:58 +0000)]
Rename contentOffsetInCompostingLayer to contentOffsetInCompositingLayer
https://bugs.webkit.org/show_bug.cgi?id=195553

Reviewed by Simon Fraser.

Less composting, more compositing.

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateBackdropFiltersGeometry):
(WebCore::RenderLayerBacking::resetContentsRect):
(WebCore::RenderLayerBacking::updateChildClippingStrategy):
(WebCore::RenderLayerBacking::updateImageContents):
(WebCore::RenderLayerBacking::contentOffsetInCompositingLayer const):
(WebCore::RenderLayerBacking::contentsBox const):
(WebCore::RenderLayerBacking::backgroundBoxForSimpleContainerPainting const):
(WebCore::RenderLayerBacking::contentOffsetInCompostingLayer const): Deleted.
* rendering/RenderLayerBacking.h:

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

7 months agoInvalid flags in a RegExp literal should be an early SyntaxError
ross.kirsling@sony.com [Mon, 11 Mar 2019 06:20:53 +0000 (06:20 +0000)]
Invalid flags in a RegExp literal should be an early SyntaxError
https://bugs.webkit.org/show_bug.cgi?id=195514

Reviewed by Darin Adler.

JSTests:

* test262/expectations.yaml:
Mark 4 test cases as passing.

* stress/regexp-syntax-error-invalid-flags.js:
* stress/regress-161995.js: Removed.
Update existing test, merging in an older test for the same behavior.

Source/JavaScriptCore:

Currently we're throwing a *runtime* SyntaxError; this should occur at parse time.

  12.2.8.1 Static Semantics: Early Errors
    PrimaryExpression : RegularExpressionLiteral
      - It is a Syntax Error if BodyText of RegularExpressionLiteral cannot be recognized
        using the goal symbol Pattern of the ECMAScript RegExp grammar specified in 21.2.1.
      - It is a Syntax Error if FlagText of RegularExpressionLiteral contains any code points
        other than "g", "i", "m",  "s", "u", or "y", or if it contains the same code point more than once.

In fixing this, let's also move flag handling from runtime/ to yarr/.

* yarr/YarrSyntaxChecker.cpp:
(JSC::Yarr::checkSyntax):
Check flags before checking pattern.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Sources.txt:
* bytecompiler/NodesCodegen.cpp:
(JSC::RegExpNode::emitBytecode):
* inspector/ContentSearchUtilities.cpp:
(Inspector::ContentSearchUtilities::findMagicComment):
* runtime/CachedTypes.cpp:
* runtime/RegExp.cpp:
(JSC::RegExp::RegExp):
(JSC::RegExp::createWithoutCaching):
(JSC::RegExp::create):
(JSC::regExpFlags): Deleted.
* runtime/RegExp.h:
* runtime/RegExpCache.cpp:
(JSC::RegExpCache::lookupOrCreate):
(JSC::RegExpCache::ensureEmptyRegExpSlow):
* runtime/RegExpCache.h:
* runtime/RegExpConstructor.cpp:
(JSC::toFlags):
(JSC::regExpCreate):
(JSC::constructRegExp):
* runtime/RegExpKey.h:
(JSC::RegExpKey::RegExpKey):
(WTF::HashTraits<JSC::RegExpKey>::constructDeletedValue):
(WTF::HashTraits<JSC::RegExpKey>::isDeletedValue):
(): Deleted.
* runtime/RegExpPrototype.cpp:
(JSC::regExpProtoFuncCompile):
* testRegExp.cpp:
(parseRegExpLine):
* yarr/RegularExpression.cpp:
(JSC::Yarr::RegularExpression::Private::compile):
* yarr/YarrFlags.cpp: Added.
(JSC::Yarr::parseFlags):
* yarr/YarrFlags.h: Added.
* yarr/YarrInterpreter.h:
(JSC::Yarr::BytecodePattern::ignoreCase const):
(JSC::Yarr::BytecodePattern::multiline const):
(JSC::Yarr::BytecodePattern::sticky const):
(JSC::Yarr::BytecodePattern::unicode const):
(JSC::Yarr::BytecodePattern::dotAll const):
* yarr/YarrPattern.cpp:
(JSC::Yarr::YarrPattern::compile):
(JSC::Yarr::YarrPattern::YarrPattern):
(JSC::Yarr::YarrPattern::dumpPattern):
* yarr/YarrPattern.h:
(JSC::Yarr::YarrPattern::global const):
(JSC::Yarr::YarrPattern::ignoreCase const):
(JSC::Yarr::YarrPattern::multiline const):
(JSC::Yarr::YarrPattern::sticky const):
(JSC::Yarr::YarrPattern::unicode const):
(JSC::Yarr::YarrPattern::dotAll const):
Move flag handling to Yarr and modernize API.

Source/WebCore:

* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneDeserializer::readTerminal):
Consume YarrFlags.

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

7 months agoAdd a WKContentRuleList variant that uses copied memory instead of mmap'd shared...
commit-queue@webkit.org [Mon, 11 Mar 2019 06:04:00 +0000 (06:04 +0000)]
Add a WKContentRuleList variant that uses copied memory instead of mmap'd shared memory for class A containerized apps
https://bugs.webkit.org/show_bug.cgi?id=195511
<rdar://problem/44873269>

Patch by Alex Christensen <achristensen@webkit.org> on 2019-03-10
Reviewed by Darin Adler.

Source/WebKit:

* NetworkProcess/NetworkContentRuleListManager.cpp:
(WebKit::NetworkContentRuleListManager::addContentRuleLists):
* NetworkProcess/NetworkContentRuleListManager.h:
* NetworkProcess/cache/NetworkCacheFileSystem.cpp:
(WebKit::NetworkCache::pathRegisteredAsUnsafeToMemoryMapForTesting):
(WebKit::NetworkCache::registerPathAsUnsafeToMemoryMapForTesting):
(WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
* NetworkProcess/cache/NetworkCacheFileSystem.h:
* Shared/WebCompiledContentRuleList.cpp:
(WebKit::WebCompiledContentRuleList::usesCopiedMemory const):
(WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain const):
(WebKit::WebCompiledContentRuleList::filtersWithoutConditionsBytecode const):
(WebKit::WebCompiledContentRuleList::filtersWithConditionsBytecode const):
(WebKit::WebCompiledContentRuleList::topURLFiltersBytecode const):
(WebKit::WebCompiledContentRuleList::actions const):
* Shared/WebCompiledContentRuleList.h:
* Shared/WebCompiledContentRuleListData.cpp:
(WebKit::WebCompiledContentRuleListData::size const):
(WebKit::WebCompiledContentRuleListData::dataPointer const):
(WebKit::WebCompiledContentRuleListData::encode const):
(WebKit::WebCompiledContentRuleListData::decode):
* Shared/WebCompiledContentRuleListData.h:
(WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
* UIProcess/API/APIContentRuleList.cpp:
(API::ContentRuleList::usesCopiedMemory const):
* UIProcess/API/APIContentRuleList.h:
* UIProcess/API/APIContentRuleListStore.cpp:
(API::getData):
(API::decodeContentRuleListMetaData):
(API::ContentRuleListStore::readContentsOfFile):
(API::MappedOrCopiedData::dataPointer const):
(API::openAndMapOrCopyContentRuleList):
(API::compiledToFile):
(API::createExtension):
(API::ContentRuleListStore::lookupContentRuleList):
(API::ContentRuleListStore::compileContentRuleList):
(API::ContentRuleListStore::getContentRuleListSource):
(API::openAndMapContentRuleList): Deleted.
* UIProcess/API/APIContentRuleListStore.h:
* UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm:
(API::ContentRuleListStore::readContentsOfFile):
* UIProcess/API/Cocoa/WKContentRuleListStore.mm:
(+[WKContentRuleListStore _registerPathAsUnsafeToMemoryMapForTesting:]):
* UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h:
* UIProcess/API/Cocoa/_WKUserContentFilter.mm:
(-[_WKUserContentFilter usesCopiedMemory]):
* UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
* WebProcess/UserContent/WebUserContentController.cpp:
(WebKit::WebUserContentController::addContentRuleLists):
* WebProcess/UserContent/WebUserContentController.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_hostFileDescriptor):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/WKContentExtensionStore.mm:
(-[TestSchemeHandlerSubresourceShouldBeBlocked webView:startURLSchemeTask:]):
(-[TestSchemeHandlerSubresourceShouldBeBlocked webView:stopURLSchemeTask:]):
(TEST_F):

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

7 months agoOptimizing loads when creating new pages
jiewen_tan@apple.com [Mon, 11 Mar 2019 03:41:13 +0000 (03:41 +0000)]
Optimizing loads when creating new pages
https://bugs.webkit.org/show_bug.cgi?id=195516
<rdar://problem/48738086>

Reviewed by Darin Adler.

This patch adds hooks in WebPageProxy::createNewPage to optimize loads, and moves the creationParameters
of API::NavigationAction from UI clients to WebPageProxy::createNewPage. Also, we now pass the whole
API::NavigationAction to the load optimizer instead of the request within.

* UIProcess/API/APINavigationAction.h:
* UIProcess/API/APIUIClient.h:
(API::UIClient::createNewPage):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageUIClient):
* UIProcess/API/glib/WebKitUIClient.cpp:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::tryOptimizingLoad):
(WebKit::tryInterceptNavigation):
(WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::UIClient::createNewPage):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::tryOptimizingLoad):
(WebKit::WebPageProxy::createNewPage):
* UIProcess/WebPageProxy.h:

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

7 months agoAdd SPI to retrieve the set of text inputs in a given rect, and later focus one
timothy_horton@apple.com [Mon, 11 Mar 2019 03:32:50 +0000 (03:32 +0000)]
Add SPI to retrieve the set of text inputs in a given rect, and later focus one
https://bugs.webkit.org/show_bug.cgi?id=195499

Reviewed by Darin Adler.

Source/WebCore:

New API tests: WebKit.RequestTextInputContext and WebKit.FocusTextInputContext

* WebCore.xcodeproj/project.pbxproj:
* dom/Document.cpp:
(WebCore::Document::identifierForElement):
(WebCore::Document::elementWithIdentifier):
(WebCore::Document::identifiedElementWasRemovedFromDocument):
* dom/Document.h:
Add a mechanism where Document will vend an ObjectIdentifier for a given
element, and can (if possible) retrieve that element later.

* dom/Element.cpp:
(WebCore::Element::removedFromAncestor):
If an Element has an identifier created for it, inform Document to remove
it from the identifier map when the element is detached.

(WebCore::Element::createElementIdentifier):
* dom/Element.h:
* dom/ElementIdentifier.h: Added.
* dom/ElementRareData.cpp:
* dom/ElementRareData.h:
(WebCore::ElementRareData::hasElementIdentifier const):
(WebCore::ElementRareData::setHasElementIdentifier):
(WebCore::ElementRareData::ElementRareData):
Store a bit indicating if the Element has had a identifier created for it,
so that we can avoid a hash lookup on every Element removal.

* dom/Node.h:
* html/HTMLTextFormControlElement.h:

Source/WebKit:

* Scripts/webkit/messages.py:
* Shared/TextInputContext.cpp: Added.
(IPC::ArgumentCoder<WebKit::TextInputContext>::encode):
(IPC::ArgumentCoder<WebKit::TextInputContext>::decode):
* Shared/TextInputContext.h: Added.
(WebKit::TextInputContext::operator== const):
Add TextInputContext, which represents a minimal set of information
about a text field.

* Sources.txt:
* SourcesCocoa.txt:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _requestTextInputContextsInRect:completionHandler:]):
(-[WKWebView _focusTextInputContext:completionHandler:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
Add SPI that allows clients to asynchronously request text input
contexts for a given rect, and later focus a given context.

* UIProcess/API/Cocoa/_WKTextInputContext.h: Added.
* UIProcess/API/Cocoa/_WKTextInputContext.mm: Added.
(-[_WKTextInputContext _initWithTextInputContext:]):
(-[_WKTextInputContext boundingRect]):
(-[_WKTextInputContext _textInputContext]):
(-[_WKTextInputContext isEqual:]):
(-[_WKTextInputContext hash]):
(-[_WKTextInputContext copyWithZone:]):
* UIProcess/API/Cocoa/_WKTextInputContextInternal.h: Added.
Add an SPI object that exposes a read-only window on a TextInputContext to clients.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::textInputContextsInRect):
(WebKit::WebPageProxy::focusTextInputContext):
* UIProcess/WebPageProxy.h:
Plumbing from WKWebView<->WebPage.

* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::elementRectInWindowCoordinates):
(WebKit::isEditableTextInputElement):
(WebKit::WebPage::textInputContextsInRect):
Search the DOM for text input contexts: <input type='text'> (or other
form fields that fall back on text field behavior), <textarea>, and
contenteditable roots. Store the WebPage, Document, and Element identifiers
so that we can find the element again later.

(WebKit::WebPage::focusTextInputContext):
Find the element for a given (web page, document, element) triple and focus it,
if it's still available.

* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm: Added.
(-[WKWebView synchronouslyRequestTextInputContextsInRect:]):
(-[WKWebView synchronouslyFocusTextInputContext:]):
(applyStyle):
(applyIframe):
(TEST):
Add some tests for this SPI.

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

7 months agoiOS: Using ⌥ to scroll horizontally is no different than arrow key
timothy_horton@apple.com [Mon, 11 Mar 2019 02:54:55 +0000 (02:54 +0000)]
iOS: Using ⌥ to scroll horizontally is no different than arrow key
https://bugs.webkit.org/show_bug.cgi?id=195268
<rdar://problem/48326682>

Reviewed by Brent Fulgham.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView keyboardScrollViewAnimator:distanceForIncrement:inDirection:]):
(-[WKContentView keyboardScrollViewAnimator:distanceForIncrement:]): Deleted.
* UIProcess/ios/WKKeyboardScrollingAnimator.h:
* UIProcess/ios/WKKeyboardScrollingAnimator.mm:
(-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
(-[WKKeyboardScrollViewAnimator setDelegate:]):
(-[WKKeyboardScrollViewAnimator distanceForIncrement:inDirection:]):
(-[WKKeyboardScrollViewAnimator distanceForIncrement:]): Deleted.
Add a direction parameter to -distanceForIncrement:, so the client
can return a different page/document size based on the scrolling axis.
Adopt it both in the default implementation and in WKContentViewInteraction.
Make the option key scroll by page when scrolling horizontally, like it
does when scrolling vertically.

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

7 months ago[WTF] Align assumption in RunLoopWin to the other platform's RunLoop
Hironori.Fujii@sony.com [Mon, 11 Mar 2019 02:36:23 +0000 (02:36 +0000)]
[WTF] Align assumption in RunLoopWin to the other platform's RunLoop
https://bugs.webkit.org/show_bug.cgi?id=181151

Source/WTF:

Reviewed by Don Olmstead.

This patch fixes RunLoop in Windows to align it to the implementations in the other platforms
to use RunLoop more aggressively.

* wtf/RunLoop.h:
(WTF::RunLoop::Timer::Timer):
* wtf/win/MainThreadWin.cpp:
(initializeMainThreadPlatform): Call RunLoop::registerRunLoopMessageWindowClass.
* wtf/win/RunLoopWin.cpp:
(WTF::RunLoop::wndProc):
(WTF::RunLoop::iterate):
(WTF::RunLoop::stop):
PostQuitMessage is only available in the RunLoop's thread. We should post a message and call
it inside this task.

(WTF::RunLoop::registerRunLoopMessageWindowClass):
Changed the return type from bool to void, and added RELEASE_ASSERT to check the return value of RegisterClass.

(WTF::RunLoop::~RunLoop):
When the RunLoop's thread is freed, its associated window is freed. We do not need to do here.

(WTF::RunLoop::TimerBase::timerFired):
(WTF::RunLoop::TimerBase::TimerBase):
(WTF::RunLoop::TimerBase::start):
(WTF::RunLoop::TimerBase::stop):
(WTF::RunLoop::TimerBase::isActive const):
(WTF::RunLoop::TimerBase::secondsUntilFire const):
(WTF::generateTimerID): Deleted.
We can use TimerBase's pointer as ID since it is uintptr_t.

Tools:

Patch by Yusuke Suzuki <utatane.tea@gmail.com> on 2019-03-10
Reviewed by Don Olmstead.

* TestWebKitAPI/CMakeLists.txt:
* TestWebKitAPI/PlatformWin.cmake:
Enable TestWTF RunLoop tests in all platforms.

* TestWebKitAPI/Tests/WTF/RunLoop.cpp:
(TestWebKitAPI::DerivedOneShotTimer::DerivedOneShotTimer):
(TestWebKitAPI::DerivedOneShotTimer::fired):
(TestWebKitAPI::TEST):
Only a few platforms support nested RunLoop.

(TestWebKitAPI::DerivedRepeatingTimer::DerivedRepeatingTimer):
(TestWebKitAPI::DerivedRepeatingTimer::fired):

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

7 months agoASSERT(m_downloads.isEmpty()) fails in DownloadProxyMap::~DownloadProxyMap()
david_quesada@apple.com [Mon, 11 Mar 2019 00:27:22 +0000 (00:27 +0000)]
ASSERT(m_downloads.isEmpty()) fails in DownloadProxyMap::~DownloadProxyMap()
https://bugs.webkit.org/show_bug.cgi?id=152480

Reviewed by Chris Dumez.

Source/WebKit:

* UIProcess/Downloads/DownloadProxyMap.cpp:
(WebKit::DownloadProxyMap::downloadFinished):
    If the DownloadProxy is holding the last reference to the process pool, then
    invalidating the proxy will cause the process pool, the network process proxy,
    and this DownloadProxyMap to deallocate. Ensure that doesn't happen until this
    method has done everything it wants to do to clean up.

Tools:

Add a unit test based on Daniel Bates's test case that starts a download, ensures
there are no additional references to the process pool besides the one held by
the download, waits for the download to finish (in the sense that the
DownloadProxyMap is done tracking the DownloadProxy), and doesn't crash. For good
measure, also check that the process pool has been deallocated at the end of the
test. The test wouldn't be meaningful if the process pool were still alive.

* TestWebKitAPI/Tests/WebKitCocoa/Download.mm:
(-[WaitUntilDownloadCanceledDelegate _downloadDidStart:]):
(-[WaitUntilDownloadCanceledDelegate _downloadDidCancel:]):
    The download will be canceled because the delegate does not implement the
    method to decide the download's destination, so this is where we know the
    DownloadProxyMap is done with the DownloadProxy.
(TEST):

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

7 months agoFix some misleading function and variable names in WKContentViewInteraction.mm
wenson_hsieh@apple.com [Sun, 10 Mar 2019 23:49:10 +0000 (23:49 +0000)]
Fix some misleading function and variable names in WKContentViewInteraction.mm
https://bugs.webkit.org/show_bug.cgi?id=195536

Reviewed by Tim Horton.

* UIProcess/ios/WKContentViewInteraction.mm:
(shouldDeferZoomingToSelectionWhenRevealingFocusedElement):

Rename shouldZoomToRevealSelectionRect to shouldDeferZoomingToSelectionWhenRevealingFocusedElement; this
function is used to determine whether we should zoom to the selection rect when revealing the focused element,
and therefore affects whether we need to defer zooming until we get selection information.

(rectToRevealWhenZoomingToFocusedElement):
(-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):

Rename shouldShowKeyboard to shouldShowInputView; this boolean indicates whether we should show not only the
keyboard, but other UI for user input such as date and select pickers.

(-[WKContentView _didReceiveEditorStateUpdateAfterFocus]):
(shouldZoomToRevealSelectionRect): Deleted.

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

7 months ago[ContentChangeObserver] Fix failing test cases
zalan@apple.com [Sun, 10 Mar 2019 20:08:54 +0000 (20:08 +0000)]
[ContentChangeObserver] Fix failing test cases
https://bugs.webkit.org/show_bug.cgi?id=195524
<rdar://problem/48745101>

Reviewed by Simon Fraser.

Source/WebCore:

1. Do not start DOM timer install observation when we already detected change at touchstart.
2. hasPendingActivity() should only care about ContentChangeObserver flags.
3. Do not try to notify the client when we are in the mouseMoved dispatch call (currently it could happen
when a timer gets intalled and removed right away).

* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::adjustObservedState):
(WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const): Deleted.
* page/ios/ContentChangeObserver.h:
(WebCore::ContentChangeObserver::hasPendingActivity const):
(WebCore::ContentChangeObserver::isObservationTimeWindowActive const):

LayoutTests:

They've been failing ever since the 32ms fixed time window was introduced.

* fast/events/touch/ios/content-observation/click-instead-of-hover-simple.html:
* fast/events/touch/ios/content-observation/stuck-with-hover-state.html:

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

7 months agoMark two tests as failing after r242624
simon.fraser@apple.com [Sun, 10 Mar 2019 18:10:43 +0000 (18:10 +0000)]
Mark two tests as failing after r242624
https://bugs.webkit.org/show_bug.cgi?id=195531

Unreviewed test gardening.

These tests are failing:
accessibility/mac/selection-notification-focus-change.html [ Failure ]
compositing/video/video-clip-change-src.html [ ImageOnlyFailure ]

* platform/mac-wk2/TestExpectations:

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

7 months agoScrollingTree should have the final say on where layers go
simon.fraser@apple.com [Sun, 10 Mar 2019 18:03:42 +0000 (18:03 +0000)]
ScrollingTree should have the final say on where layers go
https://bugs.webkit.org/show_bug.cgi?id=195507

Reviewed by Antti Koivisto.

Source/WebCore:

Main thread layer flushing can race with scrolling tree layer changes on macOS, causing
flashing as layers jump around sometimes. We go to some lengths to avoid this by trying
not to touch properties on layers that are being interacted with (scrollableArea->setIsUserScroll in
updateScrollPositionAfterAsyncScroll()), but that's fragile.

This patch adds ScrollingTree::applyScrollingTreeLayerPositions(), which enters
ScrollingTree::applyLayerPositions() on the main thread/UI process. This traverses
the tree allowing each node to run their layer positioning logic.

For macOS WK2, this is called from TiledCoreAnimationDrawingArea::flushLayers() after flushCompositingStateIncludingSubframes().
For macOS WK2 with UI-side compositing, RemoteLayerTreeDrawingAreaProxy::commitLayerTree()
calls m_webPageProxy.scrollingCoordinatorProxy()->applyScrollingTreeLayerPositions().
iOS WK2 is unchanged, using viewportChangedViaDelegatedScrolling() which does the same thing, allowing
for the dynamic viewport changes that happen when zooming on iOS.

Testing this requires infrastructure that we don't have yet.

* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::applyScrollingTreeLayerPositions):
* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::applyScrollingTreeLayerPositions):
* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::handleWheelEvent):
(WebCore::ScrollingTree::commitTreeState):
(WebCore::ScrollingTree::applyLayerPositions):
(WebCore::ScrollingTree::applyLayerPositionsRecursive):
* page/scrolling/ScrollingTree.h:
* page/scrolling/ScrollingTreeFrameHostingNode.cpp:
(WebCore::ScrollingTreeFrameHostingNode::applyLayerPositions):
* page/scrolling/ScrollingTreeFrameHostingNode.h:
* page/scrolling/ScrollingTreeNode.h:
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::applyLayerPositions):
* page/scrolling/ScrollingTreeScrollingNode.h:
* page/scrolling/cocoa/ScrollingTreeFixedNode.h:
* page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
(WebCore::ScrollingTreeFixedNode::relatedNodeScrollPositionDidChange):
* page/scrolling/cocoa/ScrollingTreeStickyNode.h:
* page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
(WebCore::ScrollingTreeStickyNode::applyLayerPositions):
(WebCore::ScrollingTreeStickyNode::relatedNodeScrollPositionDidChange):
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
(WebCore::ScrollingTreeFrameScrollingNodeMac::applyLayerPositions):

Source/WebKit:

* UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
(WebKit::RemoteScrollingCoordinatorProxy::applyScrollingTreeLayerPositions):
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::flushLayers):

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

7 months ago[Cocoa] Code signing fails because services are copied into XPCServices after the...
darin@apple.com [Sun, 10 Mar 2019 17:13:52 +0000 (17:13 +0000)]
[Cocoa] Code signing fails because services are copied into XPCServices after the framework is signed
https://bugs.webkit.org/show_bug.cgi?id=195523

Reviewed by Dan Bernstein.

* WebKit.xcodeproj/project.pbxproj: Make symbolic links while building the WebKit
framework instead of copying in the services after the framework is built.

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

7 months ago[iOS Simulator] LayoutTest/scrollingcoordinator/ios/nested-fixed-layer-positions...
simon.fraser@apple.com [Sun, 10 Mar 2019 05:52:26 +0000 (05:52 +0000)]
[iOS Simulator] LayoutTest/scrollingcoordinator/ios/nested-fixed-layer-positions.html is flaky fail
https://bugs.webkit.org/show_bug.cgi?id=171628

Unreviewed test gardening.

I can't reproduce flakiness for this test. Let's see if it's fixed.

* platform/ios-wk2/TestExpectations:

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

7 months ago[ios-simulator WK2] LayoutTest scrollingcoordinator/ios/non-stable-viewport-scroll...
simon.fraser@apple.com [Sun, 10 Mar 2019 05:52:24 +0000 (05:52 +0000)]
[ios-simulator WK2] LayoutTest scrollingcoordinator/ios/non-stable-viewport-scroll.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=168924

Unreviewed test gardening.

Let's try a new expectation for this test (it's non-flakey for me for 100 iterations).

* platform/ios-wk2/TestExpectations:
* scrollingcoordinator/ios/non-stable-viewport-scroll-expected.txt:

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

7 months agoAdd a test for scrolling tree adjustment of fixed layers (r242601)
simon.fraser@apple.com [Sun, 10 Mar 2019 05:52:21 +0000 (05:52 +0000)]
Add a test for scrolling tree adjustment of fixed layers (r242601)
https://bugs.webkit.org/show_bug.cgi?id=195521

Reviewed by Sam Weinig.

This test sets the "unstable" scrolling state (as if the user is actively scrolling) and scrolls,
then changes style to trigger a scrolling tree commit with a changed offset for a fixed layer.
The test shows the wrong fixed layer position before r242601.

Helpers are added to UIHelper to do the scroll, and to wrap setTimeout in an async function.
Sadly we have to wait about 120ms for the scrollbars to fade out.

* resources/ui-helper.js:
(window.UIHelper.async.delayFor):
(window.UIHelper.async.immediateScrollTo):
(window.UIHelper.async.immediateUnstableScrollTo):
* scrollingcoordinator/ios/ui-scroll-fixed-expected.html: Added.
* scrollingcoordinator/ios/ui-scroll-fixed.html: Added.

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

7 months agoREGRESSION (r242551): Sporadic hangs when tapping to change selection on iOS
wenson_hsieh@apple.com [Sun, 10 Mar 2019 05:43:36 +0000 (05:43 +0000)]
REGRESSION (r242551): Sporadic hangs when tapping to change selection on iOS
https://bugs.webkit.org/show_bug.cgi?id=195475
<rdar://problem/48721153>

Reviewed by Chris Dumez.

Source/WebKit:

r242551 refactored synchronous autocorrection context requests to send an async IPC message and then use
waitForAndDispatchImmediately, instead of calling sendSync. However, this exposes a couple of existing issues in
the implementation of waitForAndDispatchImmediately that causes sporadic IPC deadlocks when changing selection.

First, passing in InterruptWaitingIfSyncMessageArrives when synchronously waiting for an IPC message currently
does not fulfill its intended behavior of interrupting waiting when a sync message arrives. This is because sync
IPC messages, by default, may be dispatched while the receiver is waiting for a sync reply. This means that the
logic in Connection::SyncMessageState::processIncomingMessage to dispatch an incoming sync message on the main
thread will attempt to handle the incoming message by enqueueing it on the main thread, and then waking up the
client runloop (i.e. signaling m_waitForSyncReplySemaphore). This works in the case of sendSync since the sync
reply semaphore is used to block the main thread, but in the case of waitForAndDispatchImmediately, a different
m_waitForMessageCondition is used instead, so SyncMessageState::processIncomingMessage will only enqueue the
incoming sync message on the main thread, and not actually invoke it.

To fix this first issue, observe that there is pre-existing logic to enqueue the incoming message and signal
m_waitForMessageCondition in Connection::processIncomingMessage. This codepath is currently not taken because we
end up bailing early in the call to SyncMessageState::processIncomingMessage. Instead, we can move this early
return further down in the function, such that if there is an incoming sync message and we're waiting with the
InterruptWaitingIfSyncMessageArrives option, we will correctly enqueue the incoming message, wake the runloop,
and proceed to handle the incoming message.

The second issue is more subtle; consider the scenario in which we send a sync message A from the web process to
the UI process, and simultaneously, in the UI process, we schedule some work to be done on the main thread.
Let's additionally suppose that this scheduled work will send an IPC message B to the web process and
synchronously wait for a reply (in the case of this particular bug, this is the sync autocorrection context
request). What happens upon receiving sync message A is that the IPC thread in the UI process will schedule A on
the main thread; however, before the scheduled response to A is invoked, we will first invoke previously
scheduled work that attempts to block synchronously until a message B is received. In summary:

1. (Web process)    sends sync IPC message A to UI process.
2. (UI process)     schedules some main runloop task that will block synchronously on IPC message B.
3. (UI process)     receives sync IPC message A and schedules A on the main runloop.
4. (UI process)     carry out the task scheduled in (2) and block on B.

...and then, the UI process and web process are now deadlocked because the UI process is waiting for B to
arrive, but the web process can't send B because it's waiting for a reply for IPC message A! To fix this second
deadlock, we first make an important observation: when using sendSync, we don't run into this problem because
immediately before sending sync IPC, we will attempt to handle any incoming sync IPC messages that have been
queued up. However, when calling waitForAndDispatchImmediately, we don't have this extra step, so a deadlock may
occur in the manner described above. To fix this, we make waitForAndDispatchImmediately behave more like
sendSync, by handling all incoming sync messages prior to blocking on an IPC response.

Test: editing/selection/ios/change-selection-by-tapping.html

* Platform/IPC/Connection.cpp:
(IPC::Connection::waitForMessage):
(IPC::Connection::processIncomingMessage):

LayoutTests:

Add a new layout test that taps to change selection 20 times in a contenteditable area and additionally
disables IPC timeout, to ensure that any IPC deadlocks will result in the test failing due to timing out.

* editing/selection/ios/change-selection-by-tapping-expected.txt: Added.
* editing/selection/ios/change-selection-by-tapping.html: Added.

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

7 months ago[Apple Pay] CanMakePaymentsWithActiveCard and OpenPaymentSetup should be async messages
aestes@apple.com [Sun, 10 Mar 2019 05:29:42 +0000 (05:29 +0000)]
[Apple Pay] CanMakePaymentsWithActiveCard and OpenPaymentSetup should be async messages
https://bugs.webkit.org/show_bug.cgi?id=195526
<rdar://problem/48745636>

Reviewed by Chris Dumez.

Source/WebCore:

* Modules/applepay/PaymentCoordinatorClient.h:
* loader/EmptyClients.cpp:
* testing/MockPaymentCoordinator.cpp:
(WebCore::MockPaymentCoordinator::canMakePaymentsWithActiveCard):
(WebCore::MockPaymentCoordinator::openPaymentSetup):
* testing/MockPaymentCoordinator.h:

Source/WebKit:

* Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
(WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard):
(WebKit::WebPaymentCoordinatorProxy::openPaymentSetup):
* Shared/ApplePay/WebPaymentCoordinatorProxy.h:
* Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in:
* WebProcess/ApplePay/WebPaymentCoordinator.cpp:
(WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCard):
(WebKit::WebPaymentCoordinator::openPaymentSetup):
(WebKit::generateCanMakePaymentsWithActiveCardReplyID): Deleted.
(WebKit::generateOpenPaymentSetupReplyID): Deleted.
(WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCardReply): Deleted.
(WebKit::WebPaymentCoordinator::openPaymentSetupReply): Deleted.
* WebProcess/ApplePay/WebPaymentCoordinator.h:
* WebProcess/ApplePay/WebPaymentCoordinator.messages.in:

Source/WebKitLegacy/mac:

* WebCoreSupport/WebPaymentCoordinatorClient.h:
* WebCoreSupport/WebPaymentCoordinatorClient.mm:
(WebPaymentCoordinatorClient::canMakePaymentsWithActiveCard):
(WebPaymentCoordinatorClient::openPaymentSetup):

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

7 months ago[iOS] Remove unneeded entitlements and sandbox allowances from the Networking service
aestes@apple.com [Sun, 10 Mar 2019 05:28:48 +0000 (05:28 +0000)]
[iOS] Remove unneeded entitlements and sandbox allowances from the Networking service
https://bugs.webkit.org/show_bug.cgi?id=195527

Reviewed by Eric Carlson.

* Configurations/Network-iOS.entitlements:
* Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:

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

7 months ago[ContentChangeObserver] Click event fires immediately on hover menu at seriouseats.com
zalan@apple.com [Sun, 10 Mar 2019 04:48:34 +0000 (04:48 +0000)]
[ContentChangeObserver] Click event fires immediately on hover menu at seriouseats.com
https://bugs.webkit.org/show_bug.cgi?id=195520
<rdar://problem/48740098>

Reviewed by Simon Fraser.

Source/WebCore:

Unfortunately seriouseats has a 300ms hover intent delay to deal with accidental menupane pop-ups. This page also hides this
non-fixed width menupane using absolute positioning and negative left.

Test: fast/events/touch/ios/content-observation/move-content-from-offscreen.html

* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::didInstallDOMTimer):
(WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
(WebCore::ContentChangeObserver::StyleChangeScope::isConsideredHidden const): Content auhtors tend to use x - 1 values (where x = 10^y)

LayoutTests:

* fast/events/touch/ios/content-observation/move-content-from-offscreen-expected.txt: Added.
* fast/events/touch/ios/content-observation/move-content-from-offscreen.html: Added.

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

7 months agoUse modern async IPC with reply for device orientation permission
cdumez@apple.com [Sun, 10 Mar 2019 04:34:19 +0000 (04:34 +0000)]
Use modern async IPC with reply for device orientation permission
https://bugs.webkit.org/show_bug.cgi?id=195529

Reviewed by Ryosuke Niwa.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::requestDeviceOrientationAndMotionAccess):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
(WebKit::nextDeviceOrientationAndMotionPermissionCallbackID): Deleted.
(WebKit::WebPage::didReceiveDeviceOrientationAndMotionAccessDecision): Deleted.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

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

7 months agoAdd assertions to help debug crash under DOMWindowExtension::suspendForPageCache()
cdumez@apple.com [Sun, 10 Mar 2019 03:26:10 +0000 (03:26 +0000)]
Add assertions to help debug crash under DOMWindowExtension::suspendForPageCache()
https://bugs.webkit.org/show_bug.cgi?id=195488

Reviewed by Ryosuke Niwa.

Try and figure out how the document can be detached from its frame while we're suspending
DOMWindowExtensions.

* page/DOMWindow.cpp:
(WebCore::DOMWindow::willDetachDocumentFromFrame):
(WebCore::DOMWindow::suspendForPageCache):
* page/DOMWindow.h:

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

7 months agoSimplify DOMWindowProperty code / handling
cdumez@apple.com [Sun, 10 Mar 2019 02:25:42 +0000 (02:25 +0000)]
Simplify DOMWindowProperty code / handling
https://bugs.webkit.org/show_bug.cgi?id=195495

Reviewed by Ryosuke Niwa.

DOMWindowProperty code was unnecessarily complex because DOMWindowExtension inherited
from it and DOMWindowExtension needs a lot of information about the global object's
lifetime to communicate to the injected bbundle client. This subclassing is also
very confusing because a DOMWindowExtension is not a *property* on the Window object.

This patch updates DOMWindowExtension to stop subclassing DOMWindowProperty and
moves all the complexity from DOMWindowProperty to DOMWindowExtension.
DOMWindowProperty is now a very simple base class which merely has a WeakPtr to
the window and getters for the window and the frame.

* Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
(WebCore::DOMWindowIndexedDatabase::DOMWindowIndexedDatabase):
(WebCore::DOMWindowIndexedDatabase::indexedDB):
* Modules/indexeddb/DOMWindowIndexedDatabase.h:
There is no reason for DOMWindowIndexedDatabase to move its IDBFactory to a
separate data member which in PageCache. Script do not run while in PageCache.
Also, frames are nulled out while in the PageCache so the indexedDB() getter
would return null anyway while in PageCache.

* css/StyleMedia.idl:
* loader/appcache/ApplicationCacheHost.cpp:
(WebCore::ApplicationCacheHost::setDOMApplicationCache):
Store a WeakPtr to the DOMApplicationCache for safety.

(WebCore::ApplicationCacheHost::dispatchDOMEvent):
Do not fire events on the DOMApplicationCache if it is frameless to maintain
previous behavior. Previously, the DOMApplicationCache would have been nulled
out when detached from its frame so we would not have fired events.

* loader/appcache/ApplicationCacheHost.h:
* loader/appcache/DOMApplicationCache.cpp:
* loader/appcache/DOMApplicationCache.h:
Remove some unnecessary complexity. The ApplicationCacheHost is owned by the
DocumentLoader, which changes on navigation. There is therefore no reason to
null out the DOMApplicationCache on the ApplicationCacheHost when its gets
detached from its frame or enters PageCache.

* page/BarProp.idl:
* page/DOMSelection.idl:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::willDestroyCachedFrame):
(WebCore::DOMWindow::willDestroyDocumentInFrame):
(WebCore::DOMWindow::willDetachDocumentFromFrame):
(WebCore::DOMWindow::registerExtension):
(WebCore::DOMWindow::unregisterExtension):

(WebCore::DOMWindow::resetDOMWindowProperties): Removed.
Stop clearing some of the DOMWindow's properties when the document gets destroyed or when
the Window for the initial empty document gets reused on navigation. I think we used to
need this because DOMWindowProperty used to hold pointers to their frame. However, this
is no longer the case nowadays as DOMWindowProperty objects get their frame from their
Window.

(WebCore::DOMWindow::resetUnlessSuspendedForDocumentSuspension):
(WebCore::DOMWindow::suspendForPageCache):
(WebCore::DOMWindow::resumeFromPageCache):
* page/DOMWindow.h:
* page/DOMWindowExtension.cpp:
(WebCore::DOMWindowExtension::DOMWindowExtension):
(WebCore::DOMWindowExtension::~DOMWindowExtension):
(WebCore::DOMWindowExtension::frame const):
(WebCore::DOMWindowExtension::suspendForPageCache):
(WebCore::DOMWindowExtension::resumeFromPageCache):
(WebCore::DOMWindowExtension::willDestroyGlobalObjectInCachedFrame):
(WebCore::DOMWindowExtension::willDestroyGlobalObjectInFrame):
(WebCore::DOMWindowExtension::willDetachGlobalObjectFromFrame):
* page/DOMWindowExtension.h:
* page/DOMWindowProperty.cpp:
(WebCore::DOMWindowProperty::DOMWindowProperty):
* page/DOMWindowProperty.h:
(WebCore::DOMWindowProperty::window const):
* page/History.idl:
* page/Location.idl:
* page/Navigator.cpp:
(WebCore::Navigator::plugins):
(WebCore::Navigator::mimeTypes):
* page/PerformanceNavigation.idl:
* page/PerformanceTiming.idl:
* page/Screen.idl:
* page/VisualViewport.cpp:
(WebCore::VisualViewport::scriptExecutionContext const):
* plugins/DOMMimeTypeArray.idl:
* plugins/DOMPluginArray.idl:

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

7 months ago[ContentChangeObserver] Start observing for content change between touchEnd and mouse...
zalan@apple.com [Sun, 10 Mar 2019 00:09:05 +0000 (00:09 +0000)]
[ContentChangeObserver] Start observing for content change between touchEnd and mouseMoved start
https://bugs.webkit.org/show_bug.cgi?id=195510
<rdar://problem/48735695>

Reviewed by Simon Fraser.

Source/WebCore:

This patch covers the observation of async changes triggered by touchStart/touchEnd (animations, timers, style recalcs).

Test: fast/events/touch/ios/content-observation/visibility-change-after-touch-end.html

* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::didCancelTouchEvent):
(WebCore::ContentChangeObserver::adjustObservedState):
* page/ios/ContentChangeObserver.h:
(WebCore::ContentChangeObserver::setIsInBetweenTouchEndAndMouseMoved):
(WebCore::ContentChangeObserver::isInBetweenTouchEndAndMouseMoved const):
(WebCore::ContentChangeObserver::isObservingContentChanges const):

Source/WebKit:

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::cancelPotentialTapInFrame):

LayoutTests:

* fast/events/touch/ios/content-observation/visibility-change-after-touch-end-expected.txt: Added.
* fast/events/touch/ios/content-observation/visibility-change-after-touch-end.html: Added.

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

7 months agoCompilation can be shrunk by 8 bytes
rmorisset@apple.com [Sat, 9 Mar 2019 17:29:35 +0000 (17:29 +0000)]
Compilation can be shrunk by 8 bytes
https://bugs.webkit.org/show_bug.cgi?id=195500

Reviewed by Mark Lam.

* profiler/ProfilerCompilation.cpp:
(JSC::Profiler::Compilation::Compilation):
* profiler/ProfilerCompilation.h:

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

7 months agoBinarySwitch can be shrunk by 8 bytes
rmorisset@apple.com [Sat, 9 Mar 2019 17:25:11 +0000 (17:25 +0000)]
BinarySwitch can be shrunk by 8 bytes
https://bugs.webkit.org/show_bug.cgi?id=195493

Reviewed by Mark Lam.

* jit/BinarySwitch.cpp:
(JSC::BinarySwitch::BinarySwitch):
* jit/BinarySwitch.h:

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

7 months agoAsyncStackTrace can be shrunk by 8 bytes
rmorisset@apple.com [Sat, 9 Mar 2019 17:24:16 +0000 (17:24 +0000)]
AsyncStackTrace can be shrunk by 8 bytes
https://bugs.webkit.org/show_bug.cgi?id=195491

Reviewed by Mark Lam.

* inspector/AsyncStackTrace.h:

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

7 months agoMake it clearer which data is protected by the two locks in ScrollingTree
simon.fraser@apple.com [Sat, 9 Mar 2019 02:35:57 +0000 (02:35 +0000)]
Make it clearer which data is protected by the two locks in ScrollingTree
https://bugs.webkit.org/show_bug.cgi?id=195501

Reviewed by Tim Horton.

Gather ScrollingTree member variables into two structs, and name the struct
members and the locks to make it clear which data is protected by each lock.

We only need to protect data read by multiple threads; these are the scrolling
thread, the event handling thread (which runs ThreadedScrollingTree::tryToHandleWheelEvent()),
and the main thread, which pokes various bits of pin/rubber-banding state.
Ideally the main thread would always push data to the scrolling thread via a commit,
but that's not what happens now.

Suspiciously, ScrollingTree::shouldHandleWheelEventSynchronously() uses the root node,
so should probably hold a lock shared with the scrolling thread (webkit.org/b/195502).

* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::shouldHandleWheelEventSynchronously):
(WebCore::ScrollingTree::commitTreeState):
(WebCore::ScrollingTree::setAsyncFrameOrOverflowScrollingEnabled):
(WebCore::ScrollingTree::setMainFrameScrollPosition):
(WebCore::ScrollingTree::eventTrackingTypeForPoint):
(WebCore::ScrollingTree::isRubberBandInProgress):
(WebCore::ScrollingTree::setMainFrameIsRubberBanding):
(WebCore::ScrollingTree::isScrollSnapInProgress):
(WebCore::ScrollingTree::setMainFrameIsScrollSnapping):
(WebCore::ScrollingTree::setMainFramePinState):
(WebCore::ScrollingTree::setCanRubberBandState):
(WebCore::ScrollingTree::setScrollPinningBehavior):
(WebCore::ScrollingTree::scrollPinningBehavior):
(WebCore::ScrollingTree::willWheelEventStartSwipeGesture):
(WebCore::ScrollingTree::latchedNode):
(WebCore::ScrollingTree::setLatchedNode):
(WebCore::ScrollingTree::clearLatchedNode):
(WebCore::ScrollingTree::scrollingTreeAsText):
(WebCore::ScrollingTree::touchActionDataAtPoint const):
(WebCore::ScrollingTree::mainFrameScrollPosition): Deleted.
(WebCore::ScrollingTree::mainFrameLayoutViewport): Deleted.
(WebCore::ScrollingTree::rubberBandsAtLeft): Deleted.
(WebCore::ScrollingTree::rubberBandsAtRight): Deleted.
(WebCore::ScrollingTree::rubberBandsAtBottom): Deleted.
(WebCore::ScrollingTree::rubberBandsAtTop): Deleted.
* page/scrolling/ScrollingTree.h:
(WebCore::ScrollingTree::hasLatchedNode const):
* page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
(WebCore::ScrollingTreeScrollingNodeDelegateMac::stretchAmount):
* platform/graphics/FloatPoint.h:
(WebCore::FloatPoint::isZero const):

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

7 months agoShare some code that sets CALayer positions
simon.fraser@apple.com [Sat, 9 Mar 2019 02:35:54 +0000 (02:35 +0000)]
Share some code that sets CALayer positions
https://bugs.webkit.org/show_bug.cgi?id=195485

Reviewed by Zalan Bujtas.

Share some code between ScrollingTreeStickyNode and ScrollingTreeFixedNode that sets the position
of a CALayer given the top-left location.

* page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
(WebCore::ScrollingTreeFixedNode::relatedNodeScrollPositionDidChange):
(WebCore::ScrollingTreeFixedNodeInternal::operator*): Deleted.
* page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
(WebCore::ScrollingTreeStickyNode::relatedNodeScrollPositionDidChange):
(WebCore::ScrollingTreeStickyNodeInternal::operator*): Deleted.
* platform/graphics/cocoa/WebCoreCALayerExtras.h:
* platform/graphics/cocoa/WebCoreCALayerExtras.mm:
(-[CALayer _web_setLayerTopLeftPosition:]):

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

7 months agoStack overflow crash in JSC::JSObject::hasInstance.
mark.lam@apple.com [Sat, 9 Mar 2019 01:10:33 +0000 (01:10 +0000)]
Stack overflow crash in JSC::JSObject::hasInstance.
https://bugs.webkit.org/show_bug.cgi?id=195458
<rdar://problem/48710195>

Reviewed by Yusuke Suzuki.

JSTests:

* stress/stack-overflow-in-custom-hasInstance.js: Added.

Source/JavaScriptCore:

* runtime/JSObject.cpp:
(JSC::JSObject::hasInstance):

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

7 months agoEnable ProcessAssertions on iOS Simulator
cdumez@apple.com [Sat, 9 Mar 2019 00:59:40 +0000 (00:59 +0000)]
Enable ProcessAssertions on iOS Simulator
https://bugs.webkit.org/show_bug.cgi?id=195479

Reviewed by Alexey Proskuryakov.

Enable ProcessAssertions on iOS Simulator. We have some layout tests timing out in the
iOS Simulator due to the WebContent process suspending. Turning on ProcessAssertions in
the iOS Simulator seems to make those tests pass.

* UIProcess/ProcessAssertion.cpp:
* UIProcess/ProcessAssertion.h:
* UIProcess/ios/ProcessAssertionIOS.mm:

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

7 months ago[ iOS Simulator ] REGRESSION (r237087) Layout Test fast/viewport/ios/*-width-viewport...
ryanhaddad@apple.com [Sat, 9 Mar 2019 00:53:46 +0000 (00:53 +0000)]
[ iOS Simulator ] REGRESSION (r237087) Layout Test fast/viewport/ios/*-width-viewport-after-changing-view-scale.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=195341

Unreviewed test gardening.

* platform/ios-wk2/TestExpectations:

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

7 months agoAdd support for Device Orientation / Motion permission API
cdumez@apple.com [Sat, 9 Mar 2019 00:30:45 +0000 (00:30 +0000)]
Add support for Device Orientation / Motion permission API
https://bugs.webkit.org/show_bug.cgi?id=195329
<rdar://problem/47645367>

Reviewed by Geoffrey Garen.

Source/WebCore:

Add support for Device Orientation / Motion permission API:
- https://github.com/w3c/deviceorientation/issues/57

Pages can add event listeners for 'deviceorientation' / 'devicemotion' events but
such events will not be fired until the page's JavaScript calls
DeviceOrientationEvent.requestPermission() / DeviceMotionEvent.requestPermission()
and the user grants the request.

The feature is currently behind an experimental feature flag, off by default.

Tests: fast/device-orientation/device-motion-request-permission-denied.html
       fast/device-orientation/device-motion-request-permission-granted.html
       fast/device-orientation/device-motion-request-permission-user-gesture.html
       fast/device-orientation/device-orientation-request-permission-denied.html
       fast/device-orientation/device-orientation-request-permission-granted.html
       fast/device-orientation/device-orientation-request-permission-user-gesture.html

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/DeviceMotionEvent.h:
* dom/DeviceMotionEvent.idl:
* dom/DeviceOrientationAndMotionAccessController.cpp: Added.
(WebCore::DeviceOrientationAndMotionAccessController::DeviceOrientationAndMotionAccessController):
(WebCore::DeviceOrientationAndMotionAccessController::shouldAllowAccess):
(WebCore::DeviceOrientationAndMotionAccessController::setAccessState):
* dom/DeviceOrientationAndMotionAccessController.h: Added.
(WebCore::DeviceOrientationAndMotionAccessController::accessState const):
* dom/DeviceOrientationEvent.h:
* dom/DeviceOrientationEvent.idl:
* dom/DeviceOrientationOrMotionEvent.cpp: Added.
(WebCore::DeviceOrientationOrMotionEvent::requestPermission):
* dom/DeviceOrientationOrMotionEvent.h: Added.
* dom/DeviceOrientationOrMotionEvent.idl: Added.
* dom/DeviceOrientationOrMotionPermissionState.h: Added.
* dom/DeviceOrientationOrMotionPermissionState.idl: Added.
* dom/Document.cpp:
(WebCore::Document::deviceOrientationAndMotionAccessController):
* dom/Document.h:
* dom/Event.cpp:
* dom/MessagePort.cpp:
* dom/Microtasks.cpp:
* page/ChromeClient.h:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::addEventListener):
(WebCore::DOMWindow::deviceOrientationController const):
(WebCore::DOMWindow::deviceMotionController const):
(WebCore::DOMWindow::isAllowedToUseDeviceMotionOrientation const):
(WebCore::DOMWindow::isAllowedToAddDeviceMotionOrientationListener const):
(WebCore::DOMWindow::startListeningForDeviceOrientationIfNecessary):
(WebCore::DOMWindow::stopListeningForDeviceOrientationIfNecessary):
(WebCore::DOMWindow::startListeningForDeviceMotionIfNecessary):
(WebCore::DOMWindow::stopListeningForDeviceMotionIfNecessary):
(WebCore::DOMWindow::removeEventListener):
(WebCore::DOMWindow::removeAllEventListeners):
* page/DOMWindow.h:
* page/DeviceController.cpp:
(WebCore::DeviceController::hasDeviceEventListener const):
* page/DeviceController.h:
* page/Settings.yaml:

Source/WebKit:

Add support for Device Orientation / Motion permission API:
- https://github.com/w3c/deviceorientation/issues/57

This adds new SPI to WKUIDelegatePrivate, until we can make this API.

* Shared/WebPreferences.yaml:
* UIProcess/API/APIUIClient.h:
(API::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageUIClient):
* UIProcess/API/C/WKPageUIClient.h:
* UIProcess/API/Cocoa/WKUIDelegate.h:
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate):
(WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::requestDeviceOrientationAndMotionAccess):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::shouldAllowDeviceOrientationAndMotionAccess):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::nextDeviceOrientationAndMotionPermissionCallbackID):
(WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
(WebKit::WebPage::didReceiveDeviceOrientationAndMotionAccessDecision):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

Tools:

Add test infrastructure to help test the Device Orientation / Motion permission API.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setShouldAllowDeviceOrientationAndMotionAccess):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::shouldAllowDeviceOrientationAndMotionAccess):
(WTR::TestController::createWebViewWithOptions):
(WTR::TestController::resetStateToConsistentValues):
(WTR::TestController::handleDeviceOrientationAndMotionAccessRequest):
* WebKitTestRunner/TestController.h:
(WTR::TestController::setShouldAllowDeviceOrientationAndMotionAccess):
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):

LayoutTests:

Add layout test coverage.

* TestExpectations:
* fast/device-orientation/device-motion-request-permission-denied-expected.txt: Added.
* fast/device-orientation/device-motion-request-permission-denied.html: Added.
* fast/device-orientation/device-motion-request-permission-granted-expected.txt: Added.
* fast/device-orientation/device-motion-request-permission-granted.html: Added.
* fast/device-orientation/device-motion-request-permission-user-gesture-expected.txt: Added.
* fast/device-orientation/device-motion-request-permission-user-gesture.html: Added.
* fast/device-orientation/device-orientation-request-permission-denied-expected.txt: Added.
* fast/device-orientation/device-orientation-request-permission-denied.html: Added.
* fast/device-orientation/device-orientation-request-permission-granted-expected.txt: Added.
* fast/device-orientation/device-orientation-request-permission-granted.html: Added.
* fast/device-orientation/device-orientation-request-permission-user-gesture-expected.txt: Added.
* fast/device-orientation/device-orientation-request-permission-user-gesture.html: Added.
* http/tests/events/device-orientation-motion-non-secure-context.html:
* http/tests/events/device-orientation-motion-secure-context-expected.txt:
* http/tests/events/device-orientation-motion-secure-context.html:
* platform/ios-wk2/TestExpectations:
* platform/ios/http/tests/events/device-orientation-motion-non-secure-context-expected.txt:
* platform/ios/http/tests/events/device-orientation-motion-secure-context-expected.txt:

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

7 months agoIntegerCheckCombiningPhase::Range can be shrunk by 8 bytes
rmorisset@apple.com [Sat, 9 Mar 2019 00:17:37 +0000 (00:17 +0000)]
IntegerCheckCombiningPhase::Range can be shrunk by 8 bytes
https://bugs.webkit.org/show_bug.cgi?id=195487

Reviewed by Saam Barati.

* dfg/DFGIntegerCheckCombiningPhase.cpp:

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

7 months agoHave the UIProcess take the UnboundedNetworking assertion when downloads are in progress.
beidson@apple.com [Fri, 8 Mar 2019 23:58:52 +0000 (23:58 +0000)]
Have the UIProcess take the UnboundedNetworking assertion when downloads are in progress.
https://bugs.webkit.org/show_bug.cgi?id=195468

Reviewed by Andy Estes.

* UIProcess/Downloads/DownloadProxyMap.cpp:
(WebKit::DownloadProxyMap::DownloadProxyMap):
(WebKit::DownloadProxyMap::createDownloadProxy): If this is the first download, and the process has the entitlement,
  take the assertion.
(WebKit::DownloadProxyMap::downloadFinished):
(WebKit::DownloadProxyMap::processDidClose):
* UIProcess/Downloads/DownloadProxyMap.h:

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

7 months ago[ContentChangeObserver] Expand "isConsideredClickable" to descendants
zalan@apple.com [Fri, 8 Mar 2019 23:51:05 +0000 (23:51 +0000)]
[ContentChangeObserver] Expand "isConsideredClickable" to descendants
https://bugs.webkit.org/show_bug.cgi?id=195478
<rdar://problem/48724935>

Reviewed by Simon Fraser.

Source/WebCore:

In StyleChangeScope we try to figure out whether newly visible content should stick (menu panes etc) by checking if it is clickable.
This works fine as long as all the visible elements are gaining new renderers through this style update processs.
However when an element becomes visible by a change other than display: (not)none, it's not sufficient to just check the element itself,
since it might not respond to click at all, while its descendants do.
A concrete example is a max-height value change on usps.com, where the max-height is on a container (menu pane).
This container itself is not clickable while most of its children are (menu items).

Test: fast/events/touch/ios/content-observation/clickable-content-is-inside-a-container.html

* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
(WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
(WebCore::ContentChangeObserver::StyleChangeScope::isConsideredHidden const):
(WebCore::ContentChangeObserver::StyleChangeScope::isConsideredClickable const):
(WebCore::isConsideredHidden): Deleted.
* page/ios/ContentChangeObserver.h:

LayoutTests:

* fast/events/touch/ios/content-observation/clickable-content-is-inside-a-container-expected.txt: Added.
* fast/events/touch/ios/content-observation/clickable-content-is-inside-a-container.html: Added.

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

7 months agoTypeLocation can be shrunk by 8 bytes
rmorisset@apple.com [Fri, 8 Mar 2019 23:31:38 +0000 (23:31 +0000)]
TypeLocation can be shrunk by 8 bytes
https://bugs.webkit.org/show_bug.cgi?id=195483

Reviewed by Mark Lam.

* bytecode/TypeLocation.h:
(JSC::TypeLocation::TypeLocation):

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

7 months agoGetByIdStatus can be shrunk by 16 bytes
rmorisset@apple.com [Fri, 8 Mar 2019 23:24:25 +0000 (23:24 +0000)]
GetByIdStatus can be shrunk by 16 bytes
https://bugs.webkit.org/show_bug.cgi?id=195480

Reviewed by Saam Barati.

8 bytes from reordering fields
8 more bytes by making the enum State only use 1 byte.

* bytecode/GetByIdStatus.cpp:
(JSC::GetByIdStatus::GetByIdStatus):
* bytecode/GetByIdStatus.h:

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

7 months agoAdd a compare-results script to compare benchmark results
sbarati@apple.com [Fri, 8 Mar 2019 23:20:15 +0000 (23:20 +0000)]
Add a compare-results script to compare benchmark results
https://bugs.webkit.org/show_bug.cgi?id=195486
<rdar://problem/48723397>

Reviewed by Geoffrey Garen.

This patch adds a script to compare benchmark results using Welch's two-tailed t test.
Initially, this patch only reasons about PLT5/JetStream2/Speedometer2. It will be easy
to extend it to learn about our other benchmarks.

* Scripts/compare-results: Added.
(readJSONFile):
(detectJetStream2):
(JetStream2Results):
(detectSpeedometer2):
(Speedometer2Results):
(detectPLT5):
(PLT5Results):
(detectBenchmark):
(biggerIsBetter):
(ttest):
(getOptions):
(main):

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

7 months agoPutByIdVariant can be shrunk by 8 bytes
rmorisset@apple.com [Fri, 8 Mar 2019 23:19:27 +0000 (23:19 +0000)]
PutByIdVariant can be shrunk by 8 bytes
https://bugs.webkit.org/show_bug.cgi?id=195482

Reviewed by Mark Lam.

* bytecode/PutByIdVariant.h:
(JSC::PutByIdVariant::PutByIdVariant):

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

7 months ago[ContentChangeObserver] Cleanup adjustObservedState
zalan@apple.com [Fri, 8 Mar 2019 22:12:46 +0000 (22:12 +0000)]
[ContentChangeObserver] Cleanup adjustObservedState
https://bugs.webkit.org/show_bug.cgi?id=195470
<rdar://problem/48717823>

Reviewed by Simon Fraser.

This is in preparation for introducing an observation window from touchStart -> mouseMoved.
1. Cancel pending activities (future timers, pending stylesheet recalcs) when visible content change is detected.
2. The fixed time window takes care of notifying the client -timers, style recalcs during the window should not signal themselves.
3. Reset m_isObservingPendingStyleRecalc at StartedStyleRecalc instead of EndedStyleRecalc.

* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
(WebCore::ContentChangeObserver::styleRecalcDidStart):
(WebCore::ContentChangeObserver::styleRecalcDidFinish):
(WebCore::ContentChangeObserver::adjustObservedState):
* page/ios/ContentChangeObserver.h:
(WebCore::ContentChangeObserver::hasPendingActivity const):
(WebCore::ContentChangeObserver::isObservationTimeWindowActive const):

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

7 months agoUnreviewed, follow-up after r242568
ysuzuki@apple.com [Fri, 8 Mar 2019 21:59:34 +0000 (21:59 +0000)]
Unreviewed, follow-up after r242568

Robin pointed that calculation of `numberOfChildren` and `nonEmptyIndex` is unnecessary.

* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):

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

7 months ago[ContentChangeObserver] Add StartedDOMTimerExecution and StartedStyleRecalc
zalan@apple.com [Fri, 8 Mar 2019 21:11:41 +0000 (21:11 +0000)]
[ContentChangeObserver] Add StartedDOMTimerExecution and StartedStyleRecalc
https://bugs.webkit.org/show_bug.cgi?id=195463
<rdar://problem/48714762>

Reviewed by Simon Fraser.

This is in preparation for introducing m_isObservingContentChanges flag to track observing state across events (touchStart -> mouseMoved).

* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::domTimerExecuteDidStart):
(WebCore::ContentChangeObserver::styleRecalcDidStart):
(WebCore::ContentChangeObserver::styleRecalcDidFinish):
(WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc):
(WebCore::ContentChangeObserver::adjustObservedState):
* page/ios/ContentChangeObserver.h:
(WebCore::ContentChangeObserver::isObservingPendingStyleRecalc const):
(WebCore::ContentChangeObserver::isObservingStyleRecalc const): Deleted.

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

7 months agoEnsure old tab state is cleared between iterations of run-benchmark
slewis@apple.com [Fri, 8 Mar 2019 20:52:56 +0000 (20:52 +0000)]
Ensure old tab state is cleared between iterations of run-benchmark
https://bugs.webkit.org/show_bug.cgi?id=195393
<rdar://problem/46885583>

Reviewed by Dewei Zhu.

a) ensure the default to restore state is not set
b) terminate Safari correctly
c) Set the system default to ignore Persistent State in Safari

* Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py:
(OSXBrowserDriver): fix terminate processes to call terminate before killing.
(OSXBrowserDriver.prepare_env):
(OSXBrowserDriver.restore_env):
(OSXBrowserDriver.close_browsers):
(OSXBrowserDriver._terminate_processes):
* Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py: add bundle id
(OSXChromeDriver):
(OSXChromeCanaryDriver):
* Scripts/webkitpy/benchmark_runner/browser_driver/osx_firefox_driver.py: ditto
(OSXFirefoxDriver):
(OSXFirefoxNightlyDriver):
* Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py: add preferences to not restore state, bundle id
(OSXSafariDriver):
(OSXSafariDriver.prepare_env):

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

7 months agoAdd assertions to help debug a WebProcessCache crash
cdumez@apple.com [Fri, 8 Mar 2019 19:54:02 +0000 (19:54 +0000)]
Add assertions to help debug a WebProcessCache crash
https://bugs.webkit.org/show_bug.cgi?id=195469

Reviewed by Brady Eidson.

I suspect the process's registrableDomain in null when evictProcess() gets
called, thus crashing when lookup it up in the HashMap. Confirm this and
how this could happen via assertions.

* UIProcess/WebProcessCache.cpp:
(WebKit::WebProcessCache::evictProcess):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame):

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

7 months agoAX: AOM accessibleclick does not work on iOS
cfleizach@apple.com [Fri, 8 Mar 2019 19:51:07 +0000 (19:51 +0000)]
AX: AOM accessibleclick does not work on iOS
https://bugs.webkit.org/show_bug.cgi?id=195423
<rdar://problem/48682110>

Reviewed by Joanmarie Diggs.

Return this value of this method so it can be surfaced to a higher level.

* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper _accessibilityActivate]):

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

7 months ago[JSC] We should have more WithoutTransition functions which are usable for JSGlobalOb...
ysuzuki@apple.com [Fri, 8 Mar 2019 19:33:51 +0000 (19:33 +0000)]
[JSC] We should have more WithoutTransition functions which are usable for JSGlobalObject initialization
https://bugs.webkit.org/show_bug.cgi?id=195447

Reviewed by Filip Pizlo.

This patch reduces # of unnecessary structure transitions in JSGlobalObject initialization to avoid unnecessary allocations
caused by Structure transition. One example is WeakBlock allocation for StructureTransitionTable.
To achieve this, we (1) add putDirectNonIndexAccessorWithoutTransition and putDirectNativeIntrinsicGetterWithoutTransition
to add accessor properties without transition, and (2) add NameAdditionMode::WithoutStructureTransition mode to InternalFunction::finishCreation
to use `putDirectWithoutTransition` instead of `putDirect`.

* inspector/JSInjectedScriptHostPrototype.cpp:
(Inspector::JSInjectedScriptHostPrototype::finishCreation):
* inspector/JSJavaScriptCallFramePrototype.cpp:
(Inspector::JSJavaScriptCallFramePrototype::finishCreation):
* runtime/ArrayConstructor.cpp:
(JSC::ArrayConstructor::finishCreation):
* runtime/AsyncFunctionConstructor.cpp:
(JSC::AsyncFunctionConstructor::finishCreation):
* runtime/AsyncGeneratorFunctionConstructor.cpp:
(JSC::AsyncGeneratorFunctionConstructor::finishCreation):
* runtime/BigIntConstructor.cpp:
(JSC::BigIntConstructor::finishCreation):
* runtime/BooleanConstructor.cpp:
(JSC::BooleanConstructor::finishCreation):
* runtime/DateConstructor.cpp:
(JSC::DateConstructor::finishCreation):
* runtime/ErrorConstructor.cpp:
(JSC::ErrorConstructor::finishCreation):
* runtime/FunctionConstructor.cpp:
(JSC::FunctionConstructor::finishCreation):
* runtime/FunctionPrototype.cpp:
(JSC::FunctionPrototype::finishCreation):
(JSC::FunctionPrototype::addFunctionProperties):
(JSC::FunctionPrototype::initRestrictedProperties):
* runtime/FunctionPrototype.h:
* runtime/GeneratorFunctionConstructor.cpp:
(JSC::GeneratorFunctionConstructor::finishCreation):
* runtime/InternalFunction.cpp:
(JSC::InternalFunction::finishCreation):
* runtime/InternalFunction.h:
* runtime/IntlCollatorConstructor.cpp:
(JSC::IntlCollatorConstructor::finishCreation):
* runtime/IntlDateTimeFormatConstructor.cpp:
(JSC::IntlDateTimeFormatConstructor::finishCreation):
* runtime/IntlNumberFormatConstructor.cpp:
(JSC::IntlNumberFormatConstructor::finishCreation):
* runtime/IntlPluralRulesConstructor.cpp:
(JSC::IntlPluralRulesConstructor::finishCreation):
* runtime/JSArrayBufferConstructor.cpp:
(JSC::JSGenericArrayBufferConstructor<sharingMode>::finishCreation):
* runtime/JSArrayBufferPrototype.cpp:
(JSC::JSArrayBufferPrototype::finishCreation):
* runtime/JSGenericTypedArrayViewConstructorInlines.h:
(JSC::JSGenericTypedArrayViewConstructor<ViewClass>::finishCreation):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
* runtime/JSObject.cpp:
(JSC::JSObject::putDirectNonIndexAccessorWithoutTransition):
(JSC::JSObject::putDirectNativeIntrinsicGetterWithoutTransition):
* runtime/JSObject.h:
* runtime/JSPromiseConstructor.cpp:
(JSC::JSPromiseConstructor::finishCreation):
* runtime/JSTypedArrayViewConstructor.cpp:
(JSC::JSTypedArrayViewConstructor::finishCreation):
* runtime/JSTypedArrayViewPrototype.cpp:
(JSC::JSTypedArrayViewPrototype::finishCreation):
* runtime/MapConstructor.cpp:
(JSC::MapConstructor::finishCreation):
* runtime/MapPrototype.cpp:
(JSC::MapPrototype::finishCreation):
* runtime/NativeErrorConstructor.cpp:
(JSC::NativeErrorConstructorBase::finishCreation):
* runtime/NullGetterFunction.h:
* runtime/NullSetterFunction.h:
* runtime/NumberConstructor.cpp:
(JSC::NumberConstructor::finishCreation):
* runtime/ObjectConstructor.cpp:
(JSC::ObjectConstructor::finishCreation):
* runtime/ProxyConstructor.cpp:
(JSC::ProxyConstructor::finishCreation):
* runtime/RegExpConstructor.cpp:
(JSC::RegExpConstructor::finishCreation):
* runtime/RegExpPrototype.cpp:
(JSC::RegExpPrototype::finishCreation):
* runtime/SetConstructor.cpp:
(JSC::SetConstructor::finishCreation):
* runtime/SetPrototype.cpp:
(JSC::SetPrototype::finishCreation):
* runtime/StringConstructor.cpp:
(JSC::StringConstructor::finishCreation):
* runtime/SymbolConstructor.cpp:
(JSC::SymbolConstructor::finishCreation):
* runtime/WeakMapConstructor.cpp:
(JSC::WeakMapConstructor::finishCreation):
* runtime/WeakSetConstructor.cpp:
(JSC::WeakSetConstructor::finishCreation):
* wasm/js/WebAssemblyCompileErrorConstructor.cpp:
(JSC::WebAssemblyCompileErrorConstructor::finishCreation):
* wasm/js/WebAssemblyInstanceConstructor.cpp:
(JSC::WebAssemblyInstanceConstructor::finishCreation):
* wasm/js/WebAssemblyLinkErrorConstructor.cpp:
(JSC::WebAssemblyLinkErrorConstructor::finishCreation):
* wasm/js/WebAssemblyMemoryConstructor.cpp:
(JSC::WebAssemblyMemoryConstructor::finishCreation):
* wasm/js/WebAssemblyModuleConstructor.cpp:
(JSC::WebAssemblyModuleConstructor::finishCreation):
* wasm/js/WebAssemblyRuntimeErrorConstructor.cpp:
(JSC::WebAssemblyRuntimeErrorConstructor::finishCreation):
* wasm/js/WebAssemblyTableConstructor.cpp:
(JSC::WebAssemblyTableConstructor::finishCreation):

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

7 months agoop_check_tdz does not def its argument
tzagallo@apple.com [Fri, 8 Mar 2019 19:18:18 +0000 (19:18 +0000)]
op_check_tdz does not def its argument
https://bugs.webkit.org/show_bug.cgi?id=192880
<rdar://problem/46221598>

Reviewed by Saam Barati.

JSTests:

* microbenchmarks/let-for-in.js: Added.
(foo):

Source/JavaScriptCore:

This prevented the for-in loop optimization in the bytecode generator, since
the analysis sees a redefinition of the loop variable.

* bytecode/BytecodeUseDef.h:
(JSC::computeDefsForBytecodeOffset):

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

7 months agoRename AssertionState::Download.
beidson@apple.com [Fri, 8 Mar 2019 19:01:31 +0000 (19:01 +0000)]
Rename AssertionState::Download.
https://bugs.webkit.org/show_bug.cgi?id=195465

Reviewed by Andy Estes.

It's (currently) about uploads and downloads.
Let's call it "UnboundedNetworking"

* NetworkProcess/Downloads/DownloadMap.cpp:
(WebKit::DownloadMap::add):

* UIProcess/ProcessAssertion.h:

* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didSetAssertionState):

* UIProcess/ios/ProcessAssertionIOS.mm:
(WebKit::flagsForState):
(WebKit::reasonForState):

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

7 months ago[macOS UI-side compositing] Mouse handling can trigger a crash before we have a scrol...
simon.fraser@apple.com [Fri, 8 Mar 2019 18:34:23 +0000 (18:34 +0000)]
[macOS UI-side compositing] Mouse handling can trigger a crash before we have a scrolling tree root
https://bugs.webkit.org/show_bug.cgi?id=195467

Reviewed by Antti Koivisto.

When launching MiniBrowser with UI-side compositing enabled in a state where the window
appears under the mouse, we can hit RemoteScrollingTree::handleMouseEvent() for a mouseEnter
event before we have a scrolling tree root node, so add a null check.

* UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
(WebKit::RemoteScrollingTree::handleMouseEvent):

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

7 months ago(r242595) Layout Tests in imported/w3c/web-platform-tests/html/semantics/embedded...
tsavell@apple.com [Fri, 8 Mar 2019 18:24:10 +0000 (18:24 +0000)]
(r242595) Layout Tests in imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/* are failing
https://bugs.webkit.org/show_bug.cgi?id=195466

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

7 months agoREGRESSION(r242624): [GTK] New rAF code path assumes AC mode
commit-queue@webkit.org [Fri, 8 Mar 2019 18:13:29 +0000 (18:13 +0000)]
REGRESSION(r242624): [GTK] New rAF code path assumes AC mode
https://bugs.webkit.org/show_bug.cgi?id=195459

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2019-03-08
Reviewed by Žan Doberšek.

* WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
(WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
The refresh monitor now calls scheduleLayerFlush() but when AC
mode is disabled this method does nothing, so setNeedsDisplay()
needs to be called instead.

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

7 months agoLayout Test http/tests/referrer-policy-iframe/no-referrer/cross-origin-http-http...
pvollan@apple.com [Fri, 8 Mar 2019 17:32:02 +0000 (17:32 +0000)]
Layout Test http/tests/referrer-policy-iframe/no-referrer/cross-origin-http-http.html is failing
https://bugs.webkit.org/show_bug.cgi?id=195461

Unreviewed test gardening.

* platform/win/TestExpectations:

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

7 months agoimported/w3c/web-platform-tests/FileAPI/reading-data-section/filereader_error.html...
cdumez@apple.com [Fri, 8 Mar 2019 17:02:16 +0000 (17:02 +0000)]
imported/w3c/web-platform-tests/FileAPI/reading-data-section/filereader_error.html is a flaky crash
https://bugs.webkit.org/show_bug.cgi?id=195441
<rdar://problem/43437394>

Reviewed by Alexey Proskuryakov.

FileReader is an ActiveDOMObject, which means that FileReader::stop() gets called when
its script execution context is about to get destroyed. FileReader::stop() sets m_state
to DONE. FileReader::abort() would schedule an asynchronous task and then ASSERT that
m_state is not DONE, which would hit if FileReader::stop() had been called in between
the task being scheduled and its execution. To address the issue, have the task abort
early if isContextStopped() returns true.

Also replace calls to setPendingActivity() / unsetPendingActivity() with a
PendingActivity data member as mismatched call to those can lead to leaks.

* fileapi/FileReader.cpp:
(WebCore::FileReader::canSuspendForDocumentSuspension const):
No reason not to suspend if there is no pending read.

(WebCore::FileReader::stop):
(WebCore::FileReader::readInternal):
(WebCore::FileReader::abort):
(WebCore::FileReader::didFinishLoading):
(WebCore::FileReader::didFail):
* fileapi/FileReader.h:

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

7 months agoGLContextEGL: desired EGL config should search for 8-bit components by default
zandobersek@gmail.com [Fri, 8 Mar 2019 11:57:54 +0000 (11:57 +0000)]
GLContextEGL: desired EGL config should search for 8-bit components by default
https://bugs.webkit.org/show_bug.cgi?id=195413

Reviewed by Carlos Garcia Campos.

The EGL config search in GLContextEGL should by default look for
RGBA8888 configurations while allowing RGB565 as an alternative.
This prevents from accidentally landing on an RGBA1010102
configuration that is available with some graphics stacks, and which is
not expected in e.g. window snapshotting that's done for layout test
output comparison.

* platform/graphics/egl/GLContextEGL.cpp:
(WebCore::GLContextEGL::getEGLConfig): EGL config search should by
default request 8-bit color channels.

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

7 months agoUse a thread safe refcounter for FilterOperation.
magomez@igalia.com [Fri, 8 Mar 2019 11:26:18 +0000 (11:26 +0000)]
Use a thread safe refcounter for FilterOperation.
https://bugs.webkit.org/show_bug.cgi?id=194149

Reviewed by Carlos Garcia Campos.

Use a thread safe refcounter for FilterOperation.

* platform/graphics/filters/FilterOperation.h:

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

7 months ago[GTK] Several InputMethodFilter tests are failing
dpino@igalia.com [Fri, 8 Mar 2019 10:18:28 +0000 (10:18 +0000)]
[GTK] Several InputMethodFilter tests are failing
https://bugs.webkit.org/show_bug.cgi?id=195408

Reviewed by Carlos Garcia Campos.

* TestWebKitAPI/Tests/WebKit/gtk/InputMethodFilter.cpp:
Regressed in r241751.
Hexadecimal values of keycodes are expressed now in upper letters.
Composited characters should be cast to UTF8 strings.

(TestWebKitAPI::TEST):

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

7 months ago[GTK] Make Tools/gtkdoc python3 compatible
tpopela@redhat.com [Fri, 8 Mar 2019 07:11:39 +0000 (07:11 +0000)]
[GTK] Make Tools/gtkdoc python3 compatible
https://bugs.webkit.org/show_bug.cgi?id=195359

Reviewed by Carlos Garcia Campos.

* gtkdoc/generate-gtkdoc:
ConfigParser was reworked in Python 3.2 so we have adapt the code to
work with Python 2 and 3.
(get_gtkdoc_module_paths):
The iteritems() was removed in Python 3, so let's use items() that's
available in Python 2 and 3.
(get_generator_for_config):
* gtkdoc/gtkdoc.py:
(GTKDoc._run_command):
The sys.stdout.write() is expecting str in Python 3 and not bytes
(that are coming from stdout.encode()). Use sys.stdout.buffer.write()
for passing the bytes there.

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

7 months ago[JSC] Make more fields lazy in JSGlobalObject
ysuzuki@apple.com [Fri, 8 Mar 2019 06:17:32 +0000 (06:17 +0000)]
[JSC] Make more fields lazy in JSGlobalObject
https://bugs.webkit.org/show_bug.cgi?id=195449

Reviewed by Mark Lam.

Source/JavaScriptCore:

This patch makes more fields lazy-allocated in JSGlobalObject to save memory.

1. Some minor structures like moduleRecordStructure.
2. Some functions like parseInt / parseFloat. While they are eagerly created in JIT mode anyway to materialize NumberConstructor, we can lazily allocate them in non JIT mode.
3. ArrayBuffer constructor. While it is eagerly allocated in WebCore, we can make lazily allocated in JSC.

* interpreter/Interpreter.cpp:
(JSC::Interpreter::execute):
* runtime/JSArrayBufferPrototype.h:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::visitChildren):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::parseIntFunction const):
(JSC::JSGlobalObject::parseFloatFunction const):
(JSC::JSGlobalObject::evalFunction const):
(JSC::JSGlobalObject::strictEvalActivationStructure const):
(JSC::JSGlobalObject::moduleRecordStructure const):
(JSC::JSGlobalObject::moduleNamespaceObjectStructure const):
(JSC::JSGlobalObject::proxyObjectStructure const):
(JSC::JSGlobalObject::callableProxyObjectStructure const):
(JSC::JSGlobalObject::proxyRevokeStructure const):
(JSC::JSGlobalObject::arrayBufferConstructor const):
(JSC::JSGlobalObject::arrayBufferPrototype const):
(JSC::JSGlobalObject::arrayBufferStructure const):
* runtime/ProxyObject.h:
* runtime/StrictEvalActivation.cpp:
(JSC::StrictEvalActivation::StrictEvalActivation):
* runtime/StrictEvalActivation.h:
* wasm/js/JSWebAssemblyMemory.cpp:
(JSC::JSWebAssemblyMemory::buffer):
* wasm/js/WebAssemblyModuleConstructor.cpp:
(JSC::webAssemblyModuleCustomSections):

Source/WebCore:

Use arrayBufferConstructor() since getDirect does not work with lazy property.

* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::addBuiltinGlobals):

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

7 months agoSource/WebCore:
zalan@apple.com [Fri, 8 Mar 2019 06:11:40 +0000 (06:11 +0000)]
Source/WebCore:
[ContentChangeObserver][REGRESSION] Check if visibility change happens while dispatching mouseMoved
https://bugs.webkit.org/show_bug.cgi?id=195421
<rdar://problem/48682004>

Reviewed by Simon Fraser.

Visibility change might be triggered synchronously while dispatching mouseMoved event.

Test: fast/events/touch/ios/content-observation/visibility-change-happens-while-in-mousemoved.html

* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::mouseMovedDidStart):
(WebCore::ContentChangeObserver::mouseMovedDidFinish):
(WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const):
* page/ios/ContentChangeObserver.h:
(WebCore::ContentChangeObserver::isObservingContentChanges const):

LayoutTests:
[ContentChangeObserver] Check if visibility change happens while dispatching mouseMoved
https://bugs.webkit.org/show_bug.cgi?id=195421
<rdar://problem/48682004>

Reviewed by Simon Fraser.

* fast/events/touch/ios/content-observation/visibility-change-happens-while-in-mousemoved-expected.txt: Added.
* fast/events/touch/ios/content-observation/visibility-change-happens-while-in-mousemoved.html: Added.

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

7 months ago[ContentChangeObserver] Check if max-height change triggers visible content change.
zalan@apple.com [Fri, 8 Mar 2019 06:08:59 +0000 (06:08 +0000)]
[ContentChangeObserver] Check if max-height change triggers visible content change.
https://bugs.webkit.org/show_bug.cgi?id=195417
<rdar://problem/48680631>

Reviewed by Simon Fraser.

Source/WebCore:

A fixed max-height non-zero value could indicate visible content change. usps.com uses this technique to show menu panes.

Test: fast/events/touch/ios/content-observation/visibility-change-is-max-height-change.html

* page/ios/ContentChangeObserver.cpp:
(WebCore::isConsideredHidden):
(WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
(WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
(WebCore::elementImplicitVisibility): Deleted.
* page/ios/ContentChangeObserver.h:

LayoutTests:

* fast/events/touch/ios/content-observation/visibility-change-is-max-height-change-expected.txt: Added.
* fast/events/touch/ios/content-observation/visibility-change-is-max-height-change.html: Added.

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

7 months agoUnreviewed, fix failing EWS build for ios-sim
ysuzuki@apple.com [Fri, 8 Mar 2019 04:51:12 +0000 (04:51 +0000)]
Unreviewed, fix failing EWS build for ios-sim

* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::touchEventDidStart):

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

7 months ago[Win] Remove -DUCHAR_TYPE=wchar_t stopgap and learn to live with char16_t.
Hironori.Fujii@sony.com [Fri, 8 Mar 2019 04:39:45 +0000 (04:39 +0000)]
[Win] Remove -DUCHAR_TYPE=wchar_t stopgap and learn to live with char16_t.
https://bugs.webkit.org/show_bug.cgi?id=195346
<rdar://problem/48667048>

Unreviewed build fix for clang-cl.

* DumpRenderTree/win/DumpRenderTree.cpp:
(setApplicationId): Replaced calling String::charactersWithNullTermination with String::wideCharacters to get wchar_t.

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

7 months ago[MSE] Adopt new AVSampleBufferDisplayLayer SPI
eric.carlson@apple.com [Fri, 8 Mar 2019 04:28:48 +0000 (04:28 +0000)]
[MSE] Adopt new AVSampleBufferDisplayLayer SPI
https://bugs.webkit.org/show_bug.cgi?id=195445
<rdar://problem/48480516>

Reviewed by Jer Noble.

No new tests, no functional change.

* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC): Only register for
kCMSampleBufferConsumerNotification_BufferConsumed notiication when
-[AVSampleBufferDisplayLayer prerollDecodeWithCompletionHandler:] isn't available.
(WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC): Ditto, for unregistering.
(WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Use
-[AVSampleBufferDisplayLayer prerollDecodeWithCompletionHandler:] when possible.

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

7 months ago[ContentChangeObserver] Click event fires immediately on hover menu at Ebbets.com
zalan@apple.com [Fri, 8 Mar 2019 04:24:40 +0000 (04:24 +0000)]
[ContentChangeObserver] Click event fires immediately on hover menu at Ebbets.com
https://bugs.webkit.org/show_bug.cgi?id=195397

Reviewed by Simon Fraser.

Source/WebCore:

This patch introduces TouchEventScope to track changes triggered by touch start.

Test: fast/events/touch/ios/content-observation/visibility-change-on-touch-start-simple.html

* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::touchEventDidStart):
(WebCore::ContentChangeObserver::touchEventDidFinish):
(WebCore::ContentChangeObserver::mouseMovedDidStart):
(WebCore::ContentChangeObserver::mouseMovedDidFinish):
(WebCore::ContentChangeObserver::adjustObservedState):
(WebCore::ContentChangeObserver::TouchEventScope::TouchEventScope):
(WebCore::ContentChangeObserver::TouchEventScope::~TouchEventScope):
* page/ios/ContentChangeObserver.h:
(WebCore::ContentChangeObserver::isObservingContentChanges const):

LayoutTests:

* fast/events/touch/ios/content-observation/visibility-change-on-touch-start-simple-expected.txt: Added.
* fast/events/touch/ios/content-observation/visibility-change-on-touch-start-simple.html: Added.

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

7 months agoCrash under RemoteLayerTreePropertyApplier::applyProperties
timothy_horton@apple.com [Fri, 8 Mar 2019 03:26:38 +0000 (03:26 +0000)]
Crash under RemoteLayerTreePropertyApplier::applyProperties
https://bugs.webkit.org/show_bug.cgi?id=195448
<rdar://problem/48588226>

Reviewed by Simon Fraser.

* UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::updateLayerTree):
Under some currently-unknown circumstances, the UI process is receiving
commits referring to layers that it does not know about.
One understood case of this was fixed in r241899, but there seem to be
cases remaining that are not understood.
Also, add a release log so that we can identify any downstream effects.

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

7 months ago[ContentChangeObserver] Introduce fixed duration content observation
zalan@apple.com [Fri, 8 Mar 2019 03:21:14 +0000 (03:21 +0000)]
[ContentChangeObserver] Introduce fixed duration content observation
https://bugs.webkit.org/show_bug.cgi?id=195295
<rdar://problem/48579913>

Reviewed by Simon Fraser.

Source/WebCore:

Some pages have a runloop-like scheduling setup where the content triggering change happens at a nested timer firing.
This patch helps finding cases like that using a 32ms long fixed window. Currently nested timers get dropped on the floor and
we stop observing for content changes before they even get fired.

Test: fast/events/touch/ios/content-observation/visibility-change-happens-on-timer-hops.html

* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::ContentChangeObserver):
(WebCore::ContentChangeObserver::startContentObservationForDuration):
(WebCore::ContentChangeObserver::completeDurationBasedContentObservation):
(WebCore::ContentChangeObserver::didInstallDOMTimer):
(WebCore::ContentChangeObserver::didRemoveDOMTimer):
(WebCore::ContentChangeObserver::domTimerExecuteDidStart):
(WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
(WebCore::ContentChangeObserver::styleRecalcDidStart):
(WebCore::ContentChangeObserver::styleRecalcDidFinish):
(WebCore::ContentChangeObserver::cancelPendingActivities):
(WebCore::ContentChangeObserver::didSuspendActiveDOMObjects):
(WebCore::ContentChangeObserver::willDetachPage):
(WebCore::ContentChangeObserver::contentVisibilityDidChange):
(WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc):
(WebCore::ContentChangeObserver::adjustObservedState):
(WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
(WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
(WebCore::ContentChangeObserver::clearTimersAndReportContentChange): Deleted.
* page/ios/ContentChangeObserver.h:
(WebCore::ContentChangeObserver::clearObservedDOMTimers):
(WebCore::ContentChangeObserver::isObservingContentChanges const):
(WebCore::ContentChangeObserver::hasPendingActivity const):

Source/WebKit:

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::handleSyntheticClick):
(WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):

LayoutTests:

* fast/events/touch/ios/content-observation/visibility-change-happens-on-timer-hops-expected.txt: Added.
* fast/events/touch/ios/content-observation/visibility-change-happens-on-timer-hops.html: Added.

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

7 months ago[JSC] Remove merging must handle values into proven types in CFA
ysuzuki@apple.com [Fri, 8 Mar 2019 02:54:17 +0000 (02:54 +0000)]
[JSC] Remove merging must handle values into proven types in CFA
https://bugs.webkit.org/show_bug.cgi?id=195444

Reviewed by Saam Barati.

Previously, we are merging must handle values as a proven constant in CFA. This is OK as long as this proven AbstractValue is blurred by merging the other legit AbstractValues
from the successors. But let's consider the following code, this is actually generated DFG graph from the attached test in r242626.

    Block #2 (loop header) succ #3, #4
    ...
    1: ForceOSRExit
    ...
    2: JSConstant(0)
    3: SetLocal(@2, loc6)
    ...
    4: Branch(#3, #4)

    Block #3 (This is OSR entry target) pred #2, #3, must handle value for loc6 => JSConstant(Int32, 31)
    ...
    5: GetLocal(loc6)
    6: StringFromCharCode(@5)
    ...

Block #3 is OSR entry target. So we have must handle value for loc6 and it is Int32 constant 31. Then we merge this constant as a proven value in #3's loc6 AbstractValue.
If the value from #2 blurs the value, it is OK. However, #2 has ForceOSRExit. So must handle value suddenly becomes the only source of loc6 in #3. Then we use this constant
as a proven value. But this is not expected behavior since must handle value is just a snapshot of the locals when we kick off the concurrent compilation. In the above example,
we assume that loop index is an constant 31, but it is wrong, and OSR entry fails. Because there is no strong assumption that the must handle value is the proven type or value,
we should not merge it in CFA.

Since (1) this is just an optimization, (2) type information is already propagated in prediction injection phase, and (3) the must handle value does not show the performance
progression in r211461 and we no longer see type misprediction in marsaglia-osr-entry.js, this patch simply removes must handle value type widening in CFA.

* dfg/DFGCFAPhase.cpp:
(JSC::DFG::CFAPhase::run):
(JSC::DFG::CFAPhase::performBlockCFA):
(JSC::DFG::CFAPhase::injectOSR): Deleted.

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

7 months ago[JSC] StringFromCharCode fast path should accept 0xff in DFG and FTL
ysuzuki@apple.com [Fri, 8 Mar 2019 01:53:35 +0000 (01:53 +0000)]
[JSC] StringFromCharCode fast path should accept 0xff in DFG and FTL
https://bugs.webkit.org/show_bug.cgi?id=195429

Reviewed by Saam Barati.

JSTests:

* stress/must-handled-values-should-not-be-used-as-proven-constants-in-cfa.js: Added.
(foo):
* stress/string-from-char-code-255.js: Added.

Source/JavaScriptCore:

We can create single characters without allocation up to 0xff character code. But currently, DFGSpeculativeJIT and FTLLowerDFGToB3 go to the slow path
for 0xff case. On the other hand, DFG DoesGC phase says GC won't happen if the child is int32 constant and it is <= 0xff. So, if you have `String.fromCharCode(0xff)`,
this breaks the assumption in DFG DoesGC. The correct fix is changing the check in DFGSpeculativeJIT and FTLLowerDFGToB3 from AboveOrEqual to Above.
Note that ThunkGenerators's StringFromCharCode thunk was correct.

* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileFromCharCode):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileStringFromCharCode):

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

7 months ago[WinCairo][WebKit] Nothing is drawn after Web process crashed
Hironori.Fujii@sony.com [Fri, 8 Mar 2019 01:35:23 +0000 (01:35 +0000)]
[WinCairo][WebKit] Nothing is drawn after Web process crashed
https://bugs.webkit.org/show_bug.cgi?id=195399

Reviewed by Alex Christensen.

PageClientImpl::viewSize returned 0x0 size after Web process
crashed. Restored the original implementation using GetClientRect
(Bug 52175).

* UIProcess/win/PageClientImpl.cpp:
(WebKit::PageClientImpl::viewSize):

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

7 months agorequestAnimationFrame should execute before the next frame
commit-queue@webkit.org [Fri, 8 Mar 2019 00:52:57 +0000 (00:52 +0000)]
requestAnimationFrame should execute before the next frame
https://bugs.webkit.org/show_bug.cgi?id=177484

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-03-07
Reviewed by Simon Fraser.

Source/WebCore:

This change fixes two issues with animation timing:

1. Calling the requestAnimationFrame callbacks would have happened when
   the DisplayLink fires. This may have happened even if the frame is
   missed and no display is committed.

2. Style changes and layout triggered by script could trigger painting
   at more than 60fps. CoreAnimation commits could happen at more than
   60fps, although WindowServer will throttle those, and only some will
   be shown on the screen.

This change introduces a new paint scheduling model where painting is
driven by a "RenderingUpdateScheduler", which only triggers paints once
per 16.7ms frame.

Code that previously scheduled a compositing layer flush now schedules a
"RenderingUpdate", and that update is driven by a DisplayRefreshMonitor
callback. When the render happens, we service requestAnimationFrame callbacks,
Web Animations and intersection observations per the "Update the rendering"
step of the HTML Event Loop specification
<https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering>.

In the future, more rendering steps will be added to this code.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* accessibility/mac/AXObjectCacheMac.mm:
Fix layout tests by adding null check.

* animation/DocumentAnimationScheduler.cpp: Removed.
* animation/DocumentAnimationScheduler.h: Removed.
* animation/DocumentTimeline.cpp:
(WebCore::DocumentTimeline::DocumentTimeline):
(WebCore::DocumentTimeline::updateThrottlingState):
(WebCore::DocumentTimeline::resumeAnimations):
(WebCore::DocumentTimeline::liveCurrentTime const):
(WebCore::DocumentTimeline::currentTime):
(WebCore::DocumentTimeline::animationTimingDidChange):
(WebCore::DocumentTimeline::scheduleAnimationResolution):
(WebCore::DocumentTimeline::unscheduleAnimationResolution):
(WebCore::DocumentTimeline::updateAnimationsAndSendEvents):
(WebCore::DocumentTimeline::internalUpdateAnimationsAndSendEvents):
(WebCore::DocumentTimeline::scheduleNextTick):
(WebCore::DocumentTimeline::updateListOfElementsWithRunningAcceleratedAnimationsForElement):
Simplify this function by handling the case of no-animations separately.

(WebCore::DocumentTimeline::resolveAnimationsForElement):
Simplify the loop and delete hasPendingAcceleratedAnimations because it
is initialized to true and is not changed inside the loop.

(WebCore::DocumentTimeline::scheduleAnimationResolutionIfNeeded): Deleted.
(WebCore::DocumentTimeline::animationResolutionTimerFired): Deleted.
* animation/DocumentTimeline.h:
* dom/Document.cpp:
(WebCore::Document::resolveStyle):
There is no need to force update in resolveStyle(). notifyFlushRequired()
will be called eventually which will scheduleRenderingUpdate().

(WebCore::Document::prepareForDestruction):
(WebCore::Document::updateAnimationsAndSendEvents):
(WebCore::Document::serviceRequestAnimationFrameCallbacks):
(WebCore::Document::windowScreenDidChange):
(WebCore::Document::updateIntersectionObservations):
(WebCore::Document::scheduleForcedIntersectionObservationUpdate): Deleted.
(WebCore::Document::animationScheduler): Deleted.
* dom/Document.h:
(WebCore::Document::numberOfIntersectionObservers const):
* dom/ScriptedAnimationController.cpp:
(WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks):
(WebCore::ScriptedAnimationController::scheduleAnimation):
(WebCore::ScriptedAnimationController::animationTimerFired):
(WebCore::ScriptedAnimationController::serviceScriptedAnimations): Deleted.
(WebCore::ScriptedAnimationController::documentAnimationSchedulerDidFire): Deleted.
* dom/ScriptedAnimationController.h:
* page/FrameView.cpp:
(WebCore::FrameView::viewportContentsChanged):
* page/IntersectionObserver.cpp:
(WebCore::IntersectionObserver::observe):
* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::layoutIfNeeded):
(WebCore::Page::renderingUpdate):
(WebCore::Page::renderingUpdateScheduler):
(WebCore::Page::willDisplayPage): Deleted.
(WebCore::Page::addDocumentNeedingIntersectionObservationUpdate): Deleted.
(WebCore::Page::updateIntersectionObservations): Deleted.
(WebCore::Page::scheduleForcedIntersectionObservationUpdate): Deleted.
* page/Page.h:
* page/PageOverlayController.cpp:
(WebCore::PageOverlayController::didChangeViewExposedRect):
(WebCore::PageOverlayController::notifyFlushRequired):
* page/ResourceUsageData.h:
Include header files that become missing because of adding
RenderingUpdateScheduler.cpp.

* page/RenderingUpdateScheduler.cpp: Added.
(WebCore::RenderingUpdateScheduler::RenderingUpdateScheduler):
(WebCore::RenderingUpdateScheduler::scheduleRenderingUpdate):
(WebCore::RenderingUpdateScheduler::startTimer):
(WebCore::RenderingUpdateScheduler::clearTimer):
(WebCore::RenderingUpdateScheduler::windowScreenDidChange):
(WebCore::RenderingUpdateScheduler::createDisplayRefreshMonitor const):
(WebCore::RenderingUpdateScheduler::displayRefreshFired):
* page/RenderingUpdateScheduler.h: Added.
(WebCore::RenderingUpdateScheduler::create):
* page/ios/ContentChangeObserver.h:
Include header files that become missing because of adding
RenderingUpdateScheduler.cpp.

* page/mac/ServicesOverlayController.mm:
(WebCore::ServicesOverlayController::Highlight::notifyFlushRequired):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::scheduleLayerFlushNow):

Source/WebKit:

Replace the calls to Page::layoutIfNeeded() and willDisplayPage() by
a single call to Page::renderingUpdate(). This new function implements
"Update the rendering" step of the HTML Event Loop specification
<https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering>.

* WebProcess/WebPage/AcceleratedDrawingArea.cpp:
(WebKit::AcceleratedDrawingArea::updateBackingStoreState):
* WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
(WebKit::LayerTreeHost::layerFlushTimerFired):
* WebProcess/WebPage/DrawingAreaImpl.cpp:
(WebKit::DrawingAreaImpl::display):
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::flushLayers):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::layoutIfNeeded):
(WebKit::WebPage::renderingUpdate):
(WebKit::WebPage::willDisplayPage): Deleted.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::flushLayers):

Source/WebKitLegacy/mac:

* WebView/WebView.mm:
(-[WebView _viewWillDrawInternal]):
Call Page::renderingUpdate() which implements  "Update the rendering"
step of the HTML Event Loop specification.

Source/WebKitLegacy/win:

* WebView.cpp:
(WebView::updateBackingStore):
(WebView::flushPendingGraphicsLayerChangesSoon):
(WebView::flushPendingGraphicsLayerChanges):
Call Page::renderingUpdate() which implements  "Update the rendering"
step of the HTML Event Loop specification.

Source/WTF:

Add trace points for the page RenderingUpdate.

* wtf/SystemTracing.h:

Tools:

Add trace points for the page RenderingUpdate.

* Tracing/SystemTracePoints.plist:

LayoutTests:

* TestExpectations:
There is a slight difference between the actual DRT and the expected DRT
due to animation timing change. But these two tests are not animating
correctly if they are opened in Safari with web animation turned on.

* animations/animation-multiple-callbacks-timestamp.html:
Fix variable names used by an error message.
* animations/no-style-recalc-during-accelerated-animation-expected.txt:
* animations/no-style-recalc-during-accelerated-animation.html:
One extra styleReclc was incurred due to the document styleRecalcTimer.
I think this timer is not needed anymore. I will look at removing it in
a separate patch.

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

7 months agoSkip compilation of unused audio device files for Mac and iOS
youenn@apple.com [Fri, 8 Mar 2019 00:44:30 +0000 (00:44 +0000)]
Skip compilation of unused audio device files for Mac and iOS
https://bugs.webkit.org/show_bug.cgi?id=195412

Reviewed by Eric Carlson.

Stop compiling audio_device_mac.cc, audio_mixer_manager_mac.cc and voice_processing_audio_unit.mm
as unused in WebKit.
* libwebrtc.xcodeproj/project.pbxproj:

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

7 months agoWeb Inspector: Styles: overridden CSS property should have go-to button to jump to...
nvasilyev@apple.com [Fri, 8 Mar 2019 00:40:02 +0000 (00:40 +0000)]
Web Inspector: Styles: overridden CSS property should have go-to button to jump to effective property
https://bugs.webkit.org/show_bug.cgi?id=185930
<rdar://problem/40506252>

Reviewed by Matt Baker.

Introduce a new experimental jump to effective property button. The button is a small arrow button
next to an overridden CSS property. Clicking the button scrolls to the effective CSS property and
selects it.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Base/Setting.js:
* UserInterface/Models/CSSProperty.js:
(WI.CSSProperty):
(WI.CSSProperty.prototype.update):
(WI.CSSProperty.prototype.get overridingProperty):
(WI.CSSProperty.prototype.set overridingProperty):
* UserInterface/Models/DOMNodeStyles.js:
(WI.DOMNodeStyles.prototype._markOverriddenProperties):
* UserInterface/Views/SettingsTabContentView.js:
(WI.SettingsTabContentView.prototype._createExperimentalSettingsView):
* UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.css:
(.spreadsheet-style-declaration-editor .property.overridden .select-effective-property):
(.spreadsheet-style-declaration-editor .property.overridden:hover .select-effective-property,):
(.spreadsheet-style-declaration-editor .property.overridden:hover .select-effective-property::after,):
(@media (prefers-color-scheme: dark)):
* UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js:
(WI.SpreadsheetCSSStyleDeclarationEditor.prototype.spreadsheetStylePropertySelectByProperty):
* UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:
(WI.SpreadsheetCSSStyleDeclarationSection.prototype.spreadsheetCSSStyleDeclarationEditorSelectProperty):
* UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js:
(WI.SpreadsheetRulesStyleDetailsPanel.prototype.spreadsheetCSSStyleDeclarationSectionSelectProperty):
* UserInterface/Views/SpreadsheetStyleProperty.js:
(WI.SpreadsheetStyleProperty.prototype.updateStatus):

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

7 months ago[ContentChangeObserver] Add a setting to be able to turn content change observation...
zalan@apple.com [Fri, 8 Mar 2019 00:36:42 +0000 (00:36 +0000)]
[ContentChangeObserver] Add a setting to be able to turn content change observation on/off
https://bugs.webkit.org/show_bug.cgi?id=195353
<rdar://problem/48626394>

Reviewed by Simon Fraser.

Source/WebCore:

Move content observation tests to a dedicated directory.

Tests: fast/events/touch/ios/content-observation/click-instead-of-hover-simple.html
       fast/events/touch/ios/content-observation/hover-when-style-change-is-async.html
       fast/events/touch/ios/content-observation/stuck-with-hover-state.html
       fast/events/touch/ios/content-observation/style-recalc-schedule-and-force-relalc.html
       fast/events/touch/ios/content-observation/visibility-change-happens-at-the-second-timer.html

* page/Settings.yaml:
* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::didInstallDOMTimer):
(WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const):
* page/ios/ContentChangeObserver.h:
(WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const): Deleted.
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::resetToConsistentState):

Source/WebKit:

* Shared/WebPreferences.yaml:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetContentChangeObserverEnabled):
(WKPreferencesGetContentChangeObserverEnabled):
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _contentChangeObserverEnabled]):
(-[WKPreferences _setContentChangeObserverEnabled:]):
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::handleSyntheticClick):

Source/WebKitLegacy/mac:

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences contentChangeObserverEnabled]):
(-[WebPreferences setContentChangeObserverEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Tools:

* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetPreferencesToConsistentValues):

LayoutTests:

* fast/events/touch/ios/content-observation/click-instead-of-hover-simple-expected.txt: Renamed from LayoutTests/fast/events/touch/ios/click-instead-of-hover-simple-expected.txt.
* fast/events/touch/ios/content-observation/click-instead-of-hover-simple.html: Renamed from LayoutTests/fast/events/touch/ios/click-instead-of-hover-simple.html.
* fast/events/touch/ios/content-observation/hover-when-style-change-is-async-expected.txt: Renamed from LayoutTests/fast/events/touch/ios/hover-when-style-change-is-async-expected.txt.
* fast/events/touch/ios/content-observation/hover-when-style-change-is-async.html: Renamed from LayoutTests/fast/events/touch/ios/hover-when-style-change-is-async.html.
* fast/events/touch/ios/content-observation/stuck-with-hover-state-expected.txt: Renamed from LayoutTests/fast/events/touch/ios/stuck-with-hover-state-expected.txt.
* fast/events/touch/ios/content-observation/stuck-with-hover-state.html: Renamed from LayoutTests/fast/events/touch/ios/stuck-with-hover-state.html.
* fast/events/touch/ios/content-observation/style-recalc-schedule-and-force-relalc-expected.txt: Renamed from LayoutTests/fast/events/touch/ios/style-recalc-schedule-and-force-relalc-expected.txt.
* fast/events/touch/ios/content-observation/style-recalc-schedule-and-force-relalc.html: Renamed from LayoutTests/fast/events/touch/ios/style-recalc-schedule-and-force-relalc.html.
* fast/events/touch/ios/content-observation/visibility-change-happens-at-the-second-timer-expected.txt: Renamed from LayoutTests/fast/events/touch/ios/visibility-change-happens-at-the-second-timer-expected.txt.
* fast/events/touch/ios/content-observation/visibility-change-happens-at-the-second-timer.html: Renamed from LayoutTests/fast/events/touch/ios/visibility-change-happens-at-the-second-timer.html.

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

7 months agoMake sure an empty host matches the internal representation "nullOrigin" in WebCore...
wilander@apple.com [Fri, 8 Mar 2019 00:23:51 +0000 (00:23 +0000)]
Make sure an empty host matches the internal representation "nullOrigin" in WebCore::RegistrableDomain::matches()
https://bugs.webkit.org/show_bug.cgi?id=195435

Reviewed by Brent Fulgham.

No new tests. Tests are currently failing and will pass again with
this patch.

WebCore::RegistrableDomain::matches() is a quick way to compare a
RegistrableDomain with a URL. Since RegistrableDomain represents the
empty host as "nullOrigin," a URL with an empty host needs to match
that representation in WebCore::RegistrableDomain::matches().
Failure to do so caused debug assertions in fast/ layout tests after
https://trac.webkit.org/changeset/242603/webkit.

* platform/RegistrableDomain.h:
(WebCore::RegistrableDomain::matches const):

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

7 months agoUnreviewed build fixes since MTLClampToBorderColor is only supported on macOS.
justin_fan@apple.com [Fri, 8 Mar 2019 00:18:59 +0000 (00:18 +0000)]
Unreviewed build fixes since MTLClampToBorderColor is only supported on macOS.

* Modules/webgpu/GPUSamplerDescriptor.idl:
* platform/graphics/gpu/GPUSamplerDescriptor.h:
* platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm: Forgot include.
* platform/graphics/gpu/cocoa/GPUSamplerMetal.mm:
(WebCore::mtlAddressModeForAddressMode):
(WebCore::tryCreateMtlSamplerState):
(WebCore::mtlBorderColorForBorderColor): Deleted.

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

7 months ago[WinCairo] Unreviewed test gardening.
ross.kirsling@sony.com [Thu, 7 Mar 2019 23:50:57 +0000 (23:50 +0000)]
[WinCairo] Unreviewed test gardening.

* platform/wincairo/TestExpectations:

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

7 months ago[Apple Pay] Untangle PKPaymentAuthorizationViewController from WebPaymentCoordinatorProxy
aestes@apple.com [Thu, 7 Mar 2019 23:30:42 +0000 (23:30 +0000)]
[Apple Pay] Untangle PKPaymentAuthorizationViewController from WebPaymentCoordinatorProxy
https://bugs.webkit.org/show_bug.cgi?id=195349
<rdar://problem/48625510>

Reviewed by Alex Christensen.

Source/WebCore/PAL:

Moved soft-linking of PKPaymentErrorDomain from WebPaymentCoordinatorProxy to here and used
a more descriptive platform macro.

* pal/cocoa/PassKitSoftLink.h:
* pal/cocoa/PassKitSoftLink.mm:

Source/WebKit:

Introduced PaymentAuthorizationPresenter and WKPaymentAuthorizationDelegate to encapsulate
PKPaymentAuthorizationViewController and its delegate. Taught WebPaymentCoordinatorProxy to
interact with PaymentAuthorizationPresenter rather than PKPAVC directly.

These changes will allow us to swap out PKPaymentAuthorizationViewController with PKPaymentAuthorizationController in a follow-on patch.

* Platform/cocoa/PaymentAuthorizationPresenter.h: Added. Defined the abstract interface for
payment authorization presenters that use PKPA(V)C.
* Platform/cocoa/PaymentAuthorizationPresenter.mm: Added.
(WebKit::toPKPaymentAuthorizationStatus): Moved from WebPaymentCoordinatorProxyCocoa.mm.
(WebKit::toPKPaymentErrorCode): Ditto.
(WebKit::toNSError): Ditto.
(WebKit::toNSErrors): Ditto.
(WebKit::toPKShippingMethods): Ditto.
(WebKit::PaymentAuthorizationPresenter::completeMerchantValidation): Added. Implements the
logic previously in WebPaymentCoordinatorProxy::platformCompleteMerchantValidation.
(WebKit::PaymentAuthorizationPresenter::completePaymentMethodSelection): Ditto for
WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection.
(WebKit::PaymentAuthorizationPresenter::completePaymentSession): Ditto for
(WebKit::PaymentAuthorizationPresenter::completeShippingContactSelection): Ditto for
WebPaymentCoordinatorProxy::platformCompletePaymentSession.
(WebKit::PaymentAuthorizationPresenter::completeShippingMethodSelection): Ditto for
WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection.
* Platform/cocoa/PaymentAuthorizationViewController.h: Added. Defined a subclass of PaymentAuthorizationPresenter for PKPaymentAuthorizationViewController.
* Platform/cocoa/PaymentAuthorizationViewController.mm: Added.
(-[WKPaymentAuthorizationViewControllerDelegate initWithPresenter:]): Added a PKPAVC
delegate that's a subclass of WKPaymentAuthorizationDelegate.
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewControllerDidFinish:]):
Called -[WKPaymentAuthorizationDelegate _didFinish].
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:handler:]): Called
-[WKPaymentAuthorizationDelegate _didAuthorizePayment:completion:].
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:handler:]): Called
-[WKPaymentAuthorizationDelegate _didSelectShippingMethod:completion:].
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:handler:]): Called
-[WKPaymentAuthorizationDelegate _didSelectShippingContact:completion:].
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:handler:]): Called
-[WKPaymentAuthorizationDelegate _didSelectPaymentMethod:completion:].
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:willFinishWithError:]):
Called -[WKPaymentAuthorizationDelegate _willFinishWithError:].
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didRequestMerchantSession:]): Called
-[WKPaymentAuthorizationDelegate _didRequestMerchantSession:].
* Platform/cocoa/WKPaymentAuthorizationDelegate.h: Added.
* Platform/cocoa/WKPaymentAuthorizationDelegate.mm: Added.
(-[WKPaymentAuthorizationDelegate summaryItems]): Added a summaryItems getter.
(-[WKPaymentAuthorizationDelegate shippingMethods]): Ditto for shippingMethods.
(-[WKPaymentAuthorizationDelegate completeMerchantValidation:error:]): Called
_didRequestMerchantSessionCompletion then set it to nil.
(-[WKPaymentAuthorizationDelegate completePaymentMethodSelection:]): Ditto for
_didSelectPaymentMethodCompletion.
(-[WKPaymentAuthorizationDelegate completePaymentSession:errors:didReachFinalState:]): Ditto
for _didAuthorizePaymentCompletion.
(-[WKPaymentAuthorizationDelegate completeShippingContactSelection:summaryItems:shippingMethods:errors:]):
Ditto for _didSelectShippingContactCompletion.
(-[WKPaymentAuthorizationDelegate completeShippingMethodSelection:]): Ditto for
_didSelectShippingMethodCompletion.
(-[WKPaymentAuthorizationDelegate invalidate]): If there's an outstanding authorization
callback, called -completePaymentSession:errors:didReachFinalState: with a state of
PKPaymentAuthorizationStatusFailure.
(-[WKPaymentAuthorizationDelegate _initWithPresenter:]):
(-[WKPaymentAuthorizationDelegate _didAuthorizePayment:completion:]): Added. Implements the
logic previously in WKPaymentAuthorizationViewControllerDelegate.
(-[WKPaymentAuthorizationDelegate _didFinish]): Ditto.
(-[WKPaymentAuthorizationDelegate _didRequestMerchantSession:]): Ditto.
(-[WKPaymentAuthorizationDelegate _didSelectPaymentMethod:completion:]): Ditto.
(-[WKPaymentAuthorizationDelegate _didSelectShippingContact:completion:]): Ditto.
(toShippingMethod): Moved from WebPaymentCoordinatorProxyCocoa.mm.
(-[WKPaymentAuthorizationDelegate _didSelectShippingMethod:completion:]): Added. Implements
the logic previously in WKPaymentAuthorizationViewControllerDelegate.
(-[WKPaymentAuthorizationDelegate _willFinishWithError:]): Ditto.
* Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
(WebKit::WebPaymentCoordinatorProxy::presenterWillValidateMerchant): To conform to
PaymentAuthorizationPresenter::Client, renamed from validateMerchant.
(WebKit::WebPaymentCoordinatorProxy::presenterDidAuthorizePayment): Renamed from
didAuthorizePayment.
(WebKit::WebPaymentCoordinatorProxy::presenterDidFinish): Moved logic here that previously
existed in WKPaymentAuthorizationViewControllerDelegate.
(WebKit::WebPaymentCoordinatorProxy::presenterDidSelectShippingMethod): Renamed from
didSelectShippingMethod.
(WebKit::WebPaymentCoordinatorProxy::presenterDidSelectShippingContact): Renamed from
didSelectShippingContact.
(WebKit::WebPaymentCoordinatorProxy::presenterDidSelectPaymentMethod): Renamed from
didSelectPaymentMethod.
(WebKit::WebPaymentCoordinatorProxy::validateMerchant): Renamed to
presenterWillValidateMerchant.
(WebKit::WebPaymentCoordinatorProxy::didAuthorizePayment): Renamed to
presenterDidAuthorizePayment.
(WebKit::WebPaymentCoordinatorProxy::didSelectShippingMethod): Renamed to
presenterDidSelectShippingMethod.
(WebKit::WebPaymentCoordinatorProxy::didSelectShippingContact): Renamed to
presenterDidSelectShippingContact.
(WebKit::WebPaymentCoordinatorProxy::didSelectPaymentMethod): Renamed to
didSelectPaymentMethod.
* Shared/ApplePay/WebPaymentCoordinatorProxy.h: Changed WebPaymentCoordinatorProxy to
subclass PaymentAuthorizationPresenter::Client.
* Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h: Removed WKPaymentAuthorizationViewControllerDelegate interface and declared some helper functions
needed by PaymentAuthorizationPresenter.
* Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
(WebKit::toPKPaymentSummaryItemType): Removed static keyword.
(WebKit::toDecimalNumber): Ditto.
(WebKit::toPKPaymentSummaryItem): Ditto.
(WebKit::toPKPaymentSummaryItems): Ditto.
(WebKit::toPKShippingMethod): Ditto.
(WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Changed to call
m_authorizationPresenter.
(WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession): Ditto.
(WebKit::WebPaymentCoordinatorProxy::platformCompleteMerchantValidation): Ditto.
(WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection): Ditto.
(WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection): Ditto.
(WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection): Ditto.
(-[WKPaymentAuthorizationViewControllerDelegate initWithPaymentCoordinatorProxy:]): Deleted.
(-[WKPaymentAuthorizationViewControllerDelegate invalidate]): Deleted.
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:willFinishWithError:]): Deleted.
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didRequestMerchantSession:]): Deleted.
(toShippingMethod): Deleted.
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:handler:]): Deleted.
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:handler:]): Deleted.
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:handler:]): Deleted.
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:handler:]): Deleted.
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:completion:]): Deleted.
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:completion:]): Deleted.
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:completion:]): Deleted.
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:completion:]): Deleted.
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewControllerDidFinish:]): Deleted.
(WebKit::toPKPaymentAuthorizationStatus): Moved to PaymentAuthorizationPresenter.mm.
(WebKit::toPKPaymentErrorCode): Ditto.
(WebKit::toNSError): Ditto.
(WebKit::toNSErrors): Ditto.
* Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
(WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Changed to present a
PaymentAuthorizationPresenter rather than a PKPAVC.
(WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Changed to dismiss a
PaymentAuthorizationPresenter rather than a PKPAVC.
* Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
(WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Ditto.
(WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Ditto.
* SourcesCocoa.txt:
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::paymentCoordinatorAuthorizationPresenter): Added. Returns a new
PaymentAuthorizationViewController.
* WebKit.xcodeproj/project.pbxproj:

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

7 months ago[Web GPU] GPUSampler implementation
justin_fan@apple.com [Thu, 7 Mar 2019 23:03:53 +0000 (23:03 +0000)]
[Web GPU] GPUSampler implementation
https://bugs.webkit.org/show_bug.cgi?id=195427
<rdar://problem/48686011>

Reviewed by Dean Jackson.

Source/WebCore:

Implement ability to create GPUSamplers and use them as pipeline resource bindings.

Test: texture-triangle-strip.html updated.

Add symbols to project:
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Sources.txt:
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:

GPUSampler creation:
* Modules/webgpu/GPUSamplerDescriptor.idl: Added.
* Modules/webgpu/WebGPUDevice.cpp:
(WebCore::WebGPUDevice::createSampler const): Added.
* Modules/webgpu/WebGPUDevice.h:
* Modules/webgpu/WebGPUDevice.idl:
* Modules/webgpu/WebGPUSampler.cpp: Added.
(WebCore::WebGPUSampler::create):
(WebCore::WebGPUSampler::WebGPUSampler):
* Modules/webgpu/WebGPUSampler.h: Added.
(WebCore::WebGPUSampler::sampler const):
* Modules/webgpu/WebGPUSampler.idl: Added.
* platform/graphics/gpu/GPUDevice.cpp:
(WebCore::GPUDevice::tryCreateSampler const): Added.
* platform/graphics/gpu/GPUDevice.h:
* platform/graphics/gpu/GPUSampler.h: Added.
(WebCore::GPUSampler::platformSampler const):
* platform/graphics/gpu/GPUSamplerDescriptor.h: Added.
* platform/graphics/gpu/cocoa/GPUSamplerMetal.mm: Added.
(WebCore::mtlAddressModeForAddressMode):
(WebCore::mtlBorderColorForBorderColor):
(WebCore::mtlMinMagFilterForFilterMode):
(WebCore::mtlMipFilterForFilterMode):
(WebCore::tryCreateMtlSamplerState):
(WebCore::GPUSampler::tryCreate):
(WebCore::GPUSampler::GPUSampler):

Move GPUCompareFunction to Utils for shared use.
* platform/graphics/gpu/GPUCompareFunction.h:
* platform/graphics/gpu/GPUUtils.h:
* platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
(WebCore::tryCreateMtlDepthStencilState):
(WebCore::validateAndConvertDepthCompareFunctionToMtl): Deleted.
* platform/graphics/gpu/cocoa/GPUUtilsMetal.mm:
(WebCore::platformTextureFormatForGPUTextureFormat):
(WebCore::platformCompareFunctionForGPUCompareFunction):

Expand bind groups to accept GPUSamplers:
* Modules/webgpu/WebGPUBindGroupBinding.h:
* Modules/webgpu/WebGPUBindGroupBinding.idl:
* Modules/webgpu/WebGPUBindGroupDescriptor.cpp:
(WebCore::WebGPUBindGroupDescriptor::asGPUBindGroupDescriptor const):
* platform/graphics/gpu/GPUBindGroupBinding.h:
* platform/graphics/gpu/GPUProgrammablePassEncoder.h:
* platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
(WebCore::GPUProgrammablePassEncoder::setBindGroup):
(WebCore::GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder):
(WebCore::GPUProgrammablePassEncoder::setResourceAsSamplerOnEncoder): Added.
(WebCore::GPUProgrammablePassEncoder::setResourceAsTextureOnEncoder):

Misc:
* Modules/webgpu/WebGPUTexture.cpp: Missing includes.
* Modules/webgpu/WebGPUTexture.h:
* Modules/webgpu/WebGPUSwapChain.cpp: Removed extra include.

LayoutTests:

Update texture-triangle-strip to use a GPUSampler provided through bindings instead of creating one in shader.

* webgpu/texture-triangle-strip.html:

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

7 months agoFollow up refactoring in try-finally code after r242591.
mark.lam@apple.com [Thu, 7 Mar 2019 23:01:18 +0000 (23:01 +0000)]
Follow up refactoring in try-finally code after r242591.
https://bugs.webkit.org/show_bug.cgi?id=195428

Reviewed by Saam Barati.

1. Added some comments in emitFinallyCompletion() to describe each completion case.
2. Converted CatchEntry into a struct.
3. Renamed variable hasBreaksOrContinuesNotCoveredByJumps to hasBreaksOrContinuesThatEscapeCurrentFinally
   to be more clear about its purpose.

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::generate):
(JSC::BytecodeGenerator::emitOutOfLineExceptionHandler):
(JSC::BytecodeGenerator::emitFinallyCompletion):
* bytecompiler/BytecodeGenerator.h:

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

7 months agoCompactVariableMap::Handle's copy operator= leaks the previous data
sbarati@apple.com [Thu, 7 Mar 2019 22:41:17 +0000 (22:41 +0000)]
CompactVariableMap::Handle's copy operator= leaks the previous data
https://bugs.webkit.org/show_bug.cgi?id=195398

Reviewed by Yusuke Suzuki.

The copy constructor was just assigning |this| to the new value,
forgetting to decrement the ref count of the thing pointed to by
the |this| handle. Based on Yusuke's suggestion, this patch refactors
the move constructor, move operator=, and copy operator= to use the
swap() primitive and the copy constructor primitive.

* parser/VariableEnvironment.cpp:
(JSC::CompactVariableMap::Handle::Handle):
(JSC::CompactVariableMap::Handle::swap):
(JSC::CompactVariableMap::Handle::operator=): Deleted.
* parser/VariableEnvironment.h:
(JSC::CompactVariableMap::Handle::Handle):
(JSC::CompactVariableMap::Handle::operator=):

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

7 months agoREGRESSION: ( r231040 ) Layout Test http/tests/security/xss-DENIED-xsl-external-entit...
youenn@apple.com [Thu, 7 Mar 2019 22:17:40 +0000 (22:17 +0000)]
REGRESSION: ( r231040 ) Layout Test http/tests/security/xss-DENIED-xsl-external-entity.xml is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=189724
<rdar://problem/48422520>

Reviewed by Geoffrey Garen.

Copy the flaky test into a new test for which we use DumpJSConsoleLogInStdErr.
This should make the new test no longer flaky in WK1.
Run this new test for WK1 only and run the original test for WK2 only.

* TestExpectations:
* http/tests/security/xss-DENIED-xsl-external-entity-no-logging-expected.txt: Added.
* http/tests/security/xss-DENIED-xsl-external-entity-no-logging.xml: Added.
* platform/ios-wk1/TestExpectations:
* platform/mac-wk1/TestExpectations:
* platform/wk2/TestExpectations:

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

7 months agoRegression(r242580) WebKit.NetworkProcessCrashWithPendingConnection API is crashing...
cdumez@apple.com [Thu, 7 Mar 2019 21:50:35 +0000 (21:50 +0000)]
Regression(r242580) WebKit.NetworkProcessCrashWithPendingConnection API is crashing on iOS debug
https://bugs.webkit.org/show_bug.cgi?id=195416

Reviewed by Antti Koivisto.

Drop ASSERT_NOT_REACHED() in WebPage::didCompletePageTransition() when the tree is still frozen due to
LayerTreeFreezeReason::ProcessSuspended. As demonstrated by this API test, nothing prevents a load from
completing and WebPage::didCompletePageTransition() to get called *after* WebProcess::prepareToSuspend()
has been called. From the logging during the test, I can tell that WebProcess::processDidResume() gets
called later on and the LayerTreeFreezeReason::ProcessSuspended freezing reason gets dropped, as expected.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didCompletePageTransition):

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

7 months agoClean up / simplify ProcessAssertion code
cdumez@apple.com [Thu, 7 Mar 2019 21:49:22 +0000 (21:49 +0000)]
Clean up / simplify ProcessAssertion code
https://bugs.webkit.org/show_bug.cgi?id=195394

Reviewed by Geoffrey Garen.

Clean up / simplify ProcessAssertion code to facilitate its maintenance and make it
less error-prone.

* Platform/IPC/mac/ConnectionMac.mm:
(IPC::ConnectionTerminationWatchdog::ConnectionTerminationWatchdog):
* UIProcess/ProcessAssertion.cpp:
(WebKit::ProcessAssertion::ProcessAssertion):
(WebKit::ProcessAssertion::setState):
* UIProcess/ProcessAssertion.h:
(WebKit::ProcessAssertion::Client::~Client):
(WebKit::ProcessAssertion::setClient):
(WebKit::ProcessAssertion::client):
* UIProcess/ProcessThrottler.cpp:
(WebKit::ProcessThrottler::didConnectToProcess):
* UIProcess/ProcessThrottler.h:
* UIProcess/ios/ProcessAssertionIOS.mm:
(-[WKProcessAssertionBackgroundTaskManager dealloc]):
(-[WKProcessAssertionBackgroundTaskManager addAssertionNeedingBackgroundTask:]):
(-[WKProcessAssertionBackgroundTaskManager removeAssertionNeedingBackgroundTask:]):
(-[WKProcessAssertionBackgroundTaskManager _notifyAssertionsOfImminentSuspension]):
(-[WKProcessAssertionBackgroundTaskManager _releaseBackgroundTask]):
(-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
(WebKit::ProcessAssertion::ProcessAssertion):
(WebKit::ProcessAssertion::processAssertionWasInvalidated):
(WebKit::ProcessAssertion::setState):
(WebKit::ProcessAndUIAssertion::updateRunInBackgroundCount):
(WebKit::ProcessAndUIAssertion::ProcessAndUIAssertion):
(WebKit::ProcessAndUIAssertion::~ProcessAndUIAssertion):
(WebKit::ProcessAndUIAssertion::processAssertionWasInvalidated):
(WebKit::ProcessAndUIAssertion::setState):
(WebKit::ProcessAndUIAssertion::uiAssertionWillExpireImminently):

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

7 months agoUnreviewed, rolling out r242297.
commit-queue@webkit.org [Thu, 7 Mar 2019 21:44:19 +0000 (21:44 +0000)]
Unreviewed, rolling out r242297.
https://bugs.webkit.org/show_bug.cgi?id=195430

Broke Microsoft Visio. (Requested by dydz on #webkit).

Reverted changeset:

"[iOS] Turn mouse event simulation on by default"
https://bugs.webkit.org/show_bug.cgi?id=195218
https://trac.webkit.org/changeset/242297

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

7 months agoCrash in com.apple.WebCore: WebCore::IDBTransaction::pendingOperationTimerFired + 72
sihui_liu@apple.com [Thu, 7 Mar 2019 21:43:10 +0000 (21:43 +0000)]
Crash in com.apple.WebCore: WebCore::IDBTransaction::pendingOperationTimerFired + 72
https://bugs.webkit.org/show_bug.cgi?id=195214
<rdar://problem/48461116>

Reviewed by Geoffrey Garen.

When IDBTransaction is ready to commit, a commit operation would be schedule to
m_pendingTransactionOperationQueue. If connection to IDBServer is lost, pending operations are moved to
m_transactionOperationsInProgressQueue and will be completed with TransactionOperation::doComplete. doComplete
executes complete function of the operation, clears the complete function, and then removes the operation from
m_transactionOperationsInProgressQueue. In doComplete, we do early return when complete function is null,
since the doComplete could be invoked twice due to the race conditions between receiving "operation complete"
message from server and client-side abort.

However, commit operation does not have a complete function because it should be the last operation of
transaction and it gets removed from queue in its perform function. A commit operation would not be removed from
m_transactionOperationsInProgressQueue because of the early return. It would be removed from
m_transactionOperationMap, which may hold the last ref to the commit operation, in
IDBTransaction::connectionClosedFromServer. In this case, when pendingOperationTimerFired is called later, the
commit operation left in m_transactionOperationsInProgressQueue would be used and found to be freed. We should
not use null check of complete function to decide whether an operation is completed.

* Modules/indexeddb/client/TransactionOperation.h:
(WebCore::IDBClient::TransactionOperation::doComplete):

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

7 months agoWeb Inspector: Protocol: add type checking when commands are called via invoke
drousso@apple.com [Thu, 7 Mar 2019 20:40:14 +0000 (20:40 +0000)]
Web Inspector: Protocol: add type checking when commands are called via invoke
https://bugs.webkit.org/show_bug.cgi?id=195310
<rdar://problem/48588679>

Reviewed by Joseph Pecoraro.

Source/WebInspectorUI:

* UserInterface/Protocol/InspectorBackend.js:
(InspectorBackend.Command.prototype.invoke.deliverFailure): Added.
(InspectorBackend.Command.prototype.invoke):
(InspectorBackend.Command.prototype._invokeWithArguments):

LayoutTests:

* inspector/protocol/inspector-backend-invocation-return-value.html:
* inspector/protocol/inspector-backend-invocation-return-value-expected.txt:

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

7 months agoLazily decode cached bytecode
tzagallo@apple.com [Thu, 7 Mar 2019 19:43:43 +0000 (19:43 +0000)]
Lazily decode cached bytecode
https://bugs.webkit.org/show_bug.cgi?id=194810

Reviewed by Saam Barati.

Like lazy parsing, we should pause at code block boundaries. Instead
of always eagerly decoding UnlinkedFunctionExecutable's UnlinkedCodeBlocks,
we store their offsets in the executable and lazily decode them on the next
call to `unlinkedCodeBlockFor`.

* bytecode/UnlinkedFunctionExecutable.cpp:
(JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):
(JSC::UnlinkedFunctionExecutable::~UnlinkedFunctionExecutable):
(JSC::UnlinkedFunctionExecutable::visitChildren):
(JSC::UnlinkedFunctionExecutable::unlinkedCodeBlockFor):
(JSC::UnlinkedFunctionExecutable::decodeCachedCodeBlocks):
* bytecode/UnlinkedFunctionExecutable.h:
* runtime/CachedTypes.cpp:
(JSC::Decoder::Decoder):
(JSC::Decoder::~Decoder):
(JSC::Decoder::create):
(JSC::Decoder::offsetOf):
(JSC::Decoder::cacheOffset):
(JSC::Decoder::ptrForOffsetFromBase):
(JSC::Decoder::handleForEnvironment const):
(JSC::Decoder::setHandleForEnvironment):
(JSC::Decoder::addFinalizer):
(JSC::VariableLengthObject::isEmpty const):
(JSC::CachedWriteBarrier::isEmpty const):
(JSC::CachedFunctionExecutable::unlinkedCodeBlockForCall const):
(JSC::CachedFunctionExecutable::unlinkedCodeBlockForConstruct const):
(JSC::CachedFunctionExecutable::decode const):
(JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):
(JSC::decodeCodeBlockImpl):
(JSC::isCachedBytecodeStillValid):
(JSC::decodeFunctionCodeBlock):
* runtime/CachedTypes.h:
(JSC::Decoder::vm):

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

7 months agoWeb Inspector: REGRESSION(r242118): WI.ScopeBar missing background
drousso@apple.com [Thu, 7 Mar 2019 19:24:23 +0000 (19:24 +0000)]
Web Inspector: REGRESSION(r242118): WI.ScopeBar missing background
https://bugs.webkit.org/show_bug.cgi?id=195299

Reviewed by Joseph Pecoraro.

Rework the way `color`, `background-color`, and `border-color` are set for `WI.ScopeBar` to
use CSS variables instead. Divides the variables into three categories:
 - default: these are the values that the `WI.ScopeBar` would use normally
 - override: these are values that take precidence over the default (e.g. set by other elements)
    - falls back to default when no value is set
 - actual: this is the resulting value that will be used when displaying
    - this way, other elements can "mirror" the styling of the `WI.ScopeBar`

* UserInterface/Views/ScopeBar.css:
(.scope-bar):
(.scope-bar > li):
(.scope-bar > li::before):
(.scope-bar > li:matches(.selected, :hover)):
(.scope-bar > li:not(.selected):hover::after):
(.scope-bar > li.selected:active::after):
(.scope-bar > li.multiple > select):
(body[dir=ltr] .scope-bar > li.multiple > select):
(body[dir=rtl] .scope-bar > li.multiple > select):
(.scope-bar > li.multiple:not(.selected) > select): Added.
(.scope-bar > li.multiple > .arrows):
(.scope-bar > li::before): Deleted.
(.scope-bar.default-item-selected > li.multiple.selected::before): Deleted.
(.scope-bar > li:matches(.selected, :hover)::before): Deleted.
(.scope-bar > li.selected:active::before): Deleted.
(.scope-bar > li.multiple.selected > select): Deleted.
(body[dir=ltr] .scope-bar > li.multiple > .arrows): Deleted.
(body[dir=rtl] .scope-bar > li.multiple > .arrows): Deleted.
(.scope-bar > li.multiple:matches(.selected, :hover, :active) > .arrows): Deleted.
(.scope-bar > li:matches(.selected, :active)): Deleted.
(@media (prefers-color-scheme: dark)): Deleted.
Switch to using `::after` since `::before` is more commonly used.

* UserInterface/Views/MultipleScopeBarItem.js:
(WI.MultipleScopeBarItem.prototype._handleMouseDown):
Drive-by: fix the <select> alignment by re-firing the "mousedown" event on it.
* UserInterface/Views/AuditTestGroupContentView.js:
(WI.AuditTestGroupContentView.prototype.layout):
* UserInterface/Views/AuditTestGroupContentView.css:
(.content-view.audit-test-group > header > nav > .scope-bar > li):
(.content-view.audit-test-group > header > nav > .scope-bar > li:not(:hover, .selected)):
(.content-view.audit-test-group > header > nav > .scope-bar > li > img): Added.
(.content-view.audit-test-group > header > nav > .scope-bar > li.pass > img): Added.
(.content-view.audit-test-group > header > nav > .scope-bar > li.warn > img): Added.
(.content-view.audit-test-group > header > nav > .scope-bar > li.fail > img): Added.
(.content-view.audit-test-group > header > nav > .scope-bar > li.error > img): Added.
(.content-view.audit-test-group > header > nav > .scope-bar > li.unsupported > img): Added.
(.content-view.audit-test-group > section > .audit-test-case:first-child, .content-view.audit-test-group > section > .audit-test-case.filtered ~ .audit-test-case:not(.filtered), .content-view.audit-test-group > section > .audit-test-group + .audit-test-case, .content-view.audit-test-group > section > .audit-test-case + .audit-test-group): Added.
(.content-view.audit-test-group > section > .audit-test-case:not(.filtered) ~ .audit-test-case:not(.filtered)): Added.
(.content-view.audit-test-group > header > nav > .scope-bar > li::before): Deleted.
(.content-view.audit-test-group > header > nav > .scope-bar > li.pass::before): Deleted.
(.content-view.audit-test-group > header > nav > .scope-bar > li.warn::before): Deleted.
(.content-view.audit-test-group > header > nav > .scope-bar > li.fail::before): Deleted.
(.content-view.audit-test-group > header > nav > .scope-bar > li.error::before): Deleted.
(.content-view.audit-test-group > header > nav > .scope-bar > li.unsupported::before): Deleted.
(.content-view.audit-test-group > section > .audit-test-case:first-child, .content-view.audit-test-group > section > .audit-test-group + .audit-test-case, .content-view.audit-test-group > section > .audit-test-case + .audit-test-group): Deleted.
Replace the `::before` image with an actual `<img>` now that the `WI.ScopeBar` itself uses
a pseudo-element for the background styling.

* UserInterface/Views/LogContentView.js:
(WI.LogContentView):
* UserInterface/Views/LogContentView.css:
(.log-scope-bar > li:not(.unread) > .indicator): Added.
(.log-scope-bar > li.unread > .indicator): Added.
(.log-scope-bar > li.unread:hover > .indicator): Added.
(.log-scope-bar > li.unread.errors > .indicator): Added.
(.log-scope-bar > li.unread.warnings > .indicator): Added.
(.log-scope-bar > li.unread.logs > .indicator): Added.
(.log-scope-bar > li.unread::before): Deleted.
(body[dir=ltr] .log-scope-bar > li.unread::before): Deleted.
(body[dir=rtl] .log-scope-bar > li.unread::before): Deleted.
(.log-scope-bar > li.unread:hover::before): Deleted.
(.log-scope-bar > li.unread.errors::before): Deleted.
(.log-scope-bar > li.unread.warnings::before): Deleted.
(.log-scope-bar > li.unread.logs::before): Deleted.
Replace the `::before` unread indicator with an actual `<div>` now that the `WI.ScopeBar`
itself uses a pseudo-element for the background styling.

* UserInterface/Views/TimelineRecordingContentView.css:
(.content-view.timeline-recording > .content-browser > .navigation-bar > .item.scope-bar.default-item-selected):
(.content-view.timeline-recording > .content-browser > .navigation-bar > .item.scope-bar.default-item-selected > .multiple): Deleted.
(.content-view.timeline-recording > .content-browser > .navigation-bar > .item.scope-bar.default-item-selected > .multiple .arrows): Deleted.

* UserInterface/Views/CanvasSidebarPanel.js:
(WI.CanvasSidebarPanel.prototype._updateRecordingScopeBar):
Drive-by: fix typo.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242604 268f45cc-cd09-0410-ab3c-d52691b4dbfc

7 months agoResource Load Statistics: Log first-party navigations with link decoration
wilander@apple.com [Thu, 7 Mar 2019 19:16:38 +0000 (19:16 +0000)]
Resource Load Statistics: Log first-party navigations with link decoration
https://bugs.webkit.org/show_bug.cgi?id=195301
<rdar://problem/48569971>

Reviewed by Brent Fulgham.

Source/WebCore:

Test: http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration.html

This patch adds two new members to WebCore::ResourceLoadStatistics:
- topFrameLinkDecorationsFrom, a set of domains
- gotLinkDecorationFromPrevalentResource, a boolean state

* loader/ResourceLoadStatistics.cpp:
(WebCore::ResourceLoadStatistics::encode const):
(WebCore::ResourceLoadStatistics::decode):
(WebCore::ResourceLoadStatistics::toString const):
(WebCore::ResourceLoadStatistics::merge):
* loader/ResourceLoadStatistics.h:

Source/WebKit:

This patch adds a call to the network process' resource load statistics to
log cross-site navigations with link decoration. The logging checks if the
source of the navigation is a prevalent resource and if so, sets the
appropriate flag for the destination.

* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
(WebKit::ResourceLoadStatisticsDatabaseStore::createSchema):
(WebKit::ResourceLoadStatisticsDatabaseStore::logSubresourceRedirect):
(WebKit::ResourceLoadStatisticsDatabaseStore::logCrossSiteLoadWithLinkDecoration):
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
(WebKit::ResourceLoadStatisticsMemoryStore::logCrossSiteLoadWithLinkDecoration):
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
* NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::logCrossSiteLoadWithLinkDecoration):
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::committedCrossSiteLoadWithLinkDecoration):
    This now receives a completion handler. This is in preparation for
    test cases where we need to log such an event and wait for it to
    finish before continuing.
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::committedCrossSiteLoadWithLinkDecoration):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didCommitLoadForFrame):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::committedCrossSiteLoadWithLinkDecoration):
* UIProcess/WebProcessPool.h:

LayoutTests:

* http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration-expected.txt: Added.
* http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration.html: Added.

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

7 months agoWeb Inspector: CSS: there should be a way to inline-replace a variable with it's...
drousso@apple.com [Thu, 7 Mar 2019 19:11:52 +0000 (19:11 +0000)]
Web Inspector: CSS: there should be a way to inline-replace a variable with it's value
https://bugs.webkit.org/show_bug.cgi?id=195335

Reviewed by Joseph Pecoraro.

* UserInterface/Views/InlineSwatch.js:
(WI.InlineSwatch):
(WI.InlineSwatch.prototype.didDismissPopover):
(WI.InlineSwatch.prototype._swatchElementClicked):
(WI.InlineSwatch.prototype._swatchElementClicked.optionsForType): Added.
Shift-clicking a variable swatch replaces the text with the variable's value.
Drive-by: try to create a readonly swatch for the variable's value (e.g. a color indicator).
* UserInterface/Views/SpreadsheetStyleProperty.js:
(WI.SpreadsheetStyleProperty.prototype._createInlineSwatch):
If the value of a variable swatch changes, re-render the value.

* UserInterface/Views/CodeMirrorTextMarkers.js:
(createCodeMirrorTextMarkers):
(createCodeMirrorColorTextMarkers):
(createCodeMirrorGradientTextMarkers):
(createCodeMirrorBezierTextMarkers):
(createCodeMirrorSpringTextMarkers):
Refactor function parameters for more flexibility.

* Localizations/en.lproj/localizedStrings.js:

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

7 months ago[iOS WK] REGRESSION (r242132): Fixed position banners flicker and move when scrolling...
simon.fraser@apple.com [Thu, 7 Mar 2019 18:03:41 +0000 (18:03 +0000)]
[iOS WK] REGRESSION (r242132): Fixed position banners flicker and move when scrolling (Apple, Tesla, YouTube, Reddit)
https://bugs.webkit.org/show_bug.cgi?id=195396
rdar://problem/48518959

Reviewed by Antti Koivisto.

r242132 introduced two issues that contributed to jumpiness of position:fixed layers when scrolling.

First, ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling() would early return if the scroll position
hadn't changed. It also needs to check the supplied layoutViewport (if any), but in some cases running the
notifyRelatedNodesAfterScrollPositionChange() code is necessary even without a scroll position change:
if the web process has committed new scrolling tree state (e.g. with new fixed constraints) since
the last call, we have to run the layer positioning code to have fixed layers re-adjust their position relative
to the root. This was the primary bug fix.

Secondly, a layer tree commit can give ScrollingTreeFrameScrollingNode a new layout viewport, but we need to
adjust this by the scrolling tree's current scroll position in case it gets used before the next scroll.

Currently no way to test this, as it's very timing-dependent.

* page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
(WebCore::ScrollingTreeFrameScrollingNode::commitStateBeforeChildren):
(WebCore::ScrollingTreeFrameScrollingNode::scrollPositionAndLayoutViewportMatch):
* page/scrolling/ScrollingTreeFrameScrollingNode.h:
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::scrollPositionAndLayoutViewportMatch):
(WebCore::ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling):
* page/scrolling/ScrollingTreeScrollingNode.h:

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

7 months ago[iOS] Disable permissive call logging in sandbox
pvollan@apple.com [Thu, 7 Mar 2019 17:46:12 +0000 (17:46 +0000)]
[iOS] Disable permissive call logging in sandbox
https://bugs.webkit.org/show_bug.cgi?id=195288
<rdar://problem/47683804>

Reviewed by Brent Fulgham.

As on macOS, we should enable strict call filtering in sandbox on iOS.

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

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

7 months agoIntroduce a quota manager for Cache API/Service Worker/IDB storage
youenn@apple.com [Thu, 7 Mar 2019 17:40:40 +0000 (17:40 +0000)]
Introduce a quota manager for Cache API/Service Worker/IDB storage
https://bugs.webkit.org/show_bug.cgi?id=195283

Reviewed by Chris Dumez.

Source/WebCore:

Introduce a generic quota manager and quota users to be used in Network Process.
Quota manager/users are scoped by client origin.
Quota manager is used to check for quota by an entity wanting to execute a storage task of a given taskSize.
Quota manager will check the current space used by all its quota users.
If the size + taskSize is above quota, it will call a function to try extend the quota.
In the meantime, the task (and all tasks that may be added) are queued.

Once the new quota is received, the quota manager will either allow or disallow the first task in the queue.
The quota manager will try to execute as many tasks as possible with the provided quota.
If some tasks are remaining and quota limit is hit, the quota manager will compute the space needed for all remaining requests
and do another quota extension request.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* page/ClientOrigin.h:
* storage/StorageQuotaManager.cpp: Added.
(WebCore::StorageQuotaManager::~StorageQuotaManager):
(WebCore::StorageQuotaManager::spaceUsage const):
(WebCore::StorageQuotaManager::requestSpace):
(WebCore::StorageQuotaManager::askForMoreSpace):
(WebCore::StorageQuotaManager::processPendingRequests):
* storage/StorageQuotaManager.h: Added.
(WebCore::StorageQuotaManager::StorageQuotaManager):
(WebCore::StorageQuotaManager::addUser):
(WebCore::StorageQuotaManager::removeUser):
* storage/StorageQuotaUser.h: Added.

Source/WebKit:

Remove quota handling from Cache API storage and use StorageQuotaManager/StorageQuotaUser.
CacheStorage::Caches becomes a quota user and has a StorageQuotaManager to check for space for any cache API write task.
NetworkProcess is responsible to manage the quota managers.
Quota managers will go through network process to ask UIProcess for quota extension.

Remove pending callback handling from CacheStorage since they are queued in QuotaManager now.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::~NetworkProcess):
(WebKit::NetworkProcess::destroySession):
(WebKit::NetworkProcess::cacheStorageRootPath):
(WebKit::NetworkProcess::setCacheStorageParameters):
(WebKit::NetworkProcess::storageQuotaManager):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::from):
(WebKit::CacheStorage::Engine::Engine):
(WebKit::CacheStorage::Engine::readCachesFromDisk):
* NetworkProcess/cache/CacheStorageEngine.h:
* NetworkProcess/cache/CacheStorageEngineCache.cpp:
(WebKit::CacheStorage::Cache::put):
* NetworkProcess/cache/CacheStorageEngineCache.h:
* NetworkProcess/cache/CacheStorageEngineCaches.cpp:
(WebKit::CacheStorage::Caches::Caches):
(WebKit::CacheStorage::Caches::~Caches):
(WebKit::CacheStorage::Caches::requestSpace):
(WebKit::CacheStorage::Caches::writeRecord):
* NetworkProcess/cache/CacheStorageEngineCaches.h:

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

7 months agoResource Load Statistics: Make it possible to purge only script-accessible cookies
wilander@apple.com [Thu, 7 Mar 2019 17:22:27 +0000 (17:22 +0000)]
Resource Load Statistics: Make it possible to purge only script-accessible cookies
https://bugs.webkit.org/show_bug.cgi?id=195383
<rdar://problem/48570136>

Reviewed by Brent Fulgham.

Source/WebCore:

Test: http/tests/resourceLoadStatistics/delete-script-accessible-cookies.html

This patch provides the ability to purge all script-accessible cookies while leaving
HttpOnly cookies in place.

* loader/CookieJar.h:
    Added boolean enum IncludeHttpOnlyCookies for use as function parameter.
* platform/network/NetworkStorageSession.h:
* platform/network/cocoa/NetworkStorageSessionCocoa.mm:
(WebCore::NetworkStorageSession::deleteCookiesForHostnames):
    Support for the new IncludeHttpOnlyCookies flag.
* platform/network/curl/NetworkStorageSessionCurl.cpp:
(WebCore::NetworkStorageSession::deleteCookiesForHostnames):
    Stubbed out the new function and added a FIXME comment.
* platform/network/soup/NetworkStorageSessionSoup.cpp:
(WebCore::NetworkStorageSession::deleteCookiesForHostnames):
    Stubbed out the new function and added a FIXME comment.

Source/WebKit:

This patch provides the ability to purge all script-accessible cookies while leaving
HttpOnly cookies in place.

* NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
(WebKit::ResourceLoadStatisticsStore::removeDataRecords):
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
    Support for a new boolean flag on whether or not to include HttpOnly Cookies.
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
    Support for a new boolean flag on whether or not to include HttpOnly Cookies.
(WebKit::NetworkProcess::deleteCookiesForTesting):
    Test infrastructure.
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
    Support for a new boolean flag on whether or not to include HttpOnly Cookies.
* NetworkProcess/NetworkSession.h:
* UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreStatisticsDeleteCookiesForTesting):
    Test infrastructure.
* UIProcess/API/C/WKWebsiteDataStoreRef.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::deleteCookiesForTesting):
    Test infrastructure.
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::deleteCookiesForTesting):
    Test infrastructure.
* UIProcess/WebsiteData/WebsiteDataStore.h:

Tools:

This patch adds test infrastructure to purge only script-accessible cookies,
including a new testRunner function called statisticsDeleteCookiesForHost().git a

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::statisticsDeleteCookiesForHost):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::statisticsDeleteCookiesForHost):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):

LayoutTests:

* http/tests/cookies/resources/set-http-only-cookie.php: Added.
* http/tests/resourceLoadStatistics/delete-script-accessible-cookies-expected.txt: Added.
* http/tests/resourceLoadStatistics/delete-script-accessible-cookies.html: Added.

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

7 months agoREGRESSION(r242364): [WPE] Do not stop the compositing run loop update timer on suspend
commit-queue@webkit.org [Thu, 7 Mar 2019 17:17:16 +0000 (17:17 +0000)]
REGRESSION(r242364): [WPE] Do not stop the compositing run loop update timer on suspend
https://bugs.webkit.org/show_bug.cgi?id=195410

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2019-03-07
Reviewed by Žan Doberšek.

Calling CompositingRunLoop::stopUpdates() on suspend is leaving the threaded compositor in an inconsistent
state, failing to resume and stopping the updates forever. This is causing timeouts in WPE layout tests. Instead
of calling stopUpdates(), a new suspend() is called, that stops the update timer, without changing the current
updae tha compositing state. A new method resume() is also added to schedule an update if needed.

* Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
(WebKit::CompositingRunLoop::suspend): Set state as suspended and stop the update timer.
(WebKit::CompositingRunLoop::resume): Set state as not suspended and start the update timer if it was scheduled
while suspended.
(WebKit::CompositingRunLoop::scheduleUpdate): Do not start the update timer when suspended.
(WebKit::CompositingRunLoop::compositionCompleted): Ditto.
(WebKit::CompositingRunLoop::updateCompleted): Ditto.
(WebKit::CompositingRunLoop::updateTimerFired): Add an assert to ensure the update timer is not fired while suspended.
* Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
(WebKit::ThreadedCompositor::suspend): Call CompositingRunLoop::suspend() instead of stopUpdates().
(WebKit::ThreadedCompositor::resume): Call CompositingRunLoop::resume().

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

7 months agoException is a JSCell, not a JSObject.
mark.lam@apple.com [Thu, 7 Mar 2019 10:16:58 +0000 (10:16 +0000)]
Exception is a JSCell, not a JSObject.
https://bugs.webkit.org/show_bug.cgi?id=195392

Reviewed by Saam Barati.

Source/JavaScriptCore:

Exception is a VM implementation construct to carry a stack trace for the point
where it is thrown from.  As a reminder, an Exception is needed because:
1. JS code can throw primitives as well that are non-cells.
2. Error objects capture the stack trace at the point where they are constructed,
   which is not always the same as the point where they are thrown (if they are
   thrown).

Hence, Exception should not be visible to JS code, and therefore should not be a
JSObject.  Hence, it should not inherit from JSDestructibleObject.

This patch changes the following:

1. Exception now inherits directly from JSCell instead.

2. Places where we return an Exception masquerading as a JSObject* are now
   updated to return a nullptr when we encounter an exception.

3. We still return Exception* as JSValue or EncodedJSValue when we encounter an
   exception in functions that return JSValue or EncodedJSValue.  This is because
   the number that implements the following pattern is too numerous:

        return throw<Some Error>(...)

   We'll leave these as is for now.

* bytecode/CodeBlock.h:
(JSC::ScriptExecutable::prepareForExecution):
* interpreter/Interpreter.cpp:
(JSC::Interpreter::executeProgram):
(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):
(JSC::Interpreter::prepareForRepeatCall):
(JSC::Interpreter::execute):
(JSC::Interpreter::executeModuleProgram):
* jit/JITOperations.cpp:
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::setUpCall):
* runtime/ConstructData.cpp:
(JSC::construct):
* runtime/Error.cpp:
(JSC::throwConstructorCannotBeCalledAsFunctionTypeError):
(JSC::throwTypeError):
(JSC::throwSyntaxError):
* runtime/Error.h:
(JSC::throwRangeError):
* runtime/Exception.cpp:
(JSC::Exception::createStructure):
* runtime/Exception.h:
* runtime/ExceptionHelpers.cpp:
(JSC::throwOutOfMemoryError):
(JSC::throwStackOverflowError):
(JSC::throwTerminatedExecutionException):
* runtime/ExceptionHelpers.h:
* runtime/FunctionConstructor.cpp:
(JSC::constructFunction):
(JSC::constructFunctionSkippingEvalEnabledCheck):
* runtime/IntlPluralRules.cpp:
(JSC::IntlPluralRules::resolvedOptions):
* runtime/JSGenericTypedArrayViewConstructorInlines.h:
(JSC::constructGenericTypedArrayViewWithArguments):
* runtime/JSObject.h:
* runtime/ObjectConstructor.cpp:
(JSC::objectConstructorSeal):
(JSC::objectConstructorFreeze):
* runtime/ProgramExecutable.cpp:
(JSC::ProgramExecutable::initializeGlobalProperties):
* runtime/RegExpConstructor.cpp:
(JSC::regExpCreate):
(JSC::constructRegExp):
* runtime/ScriptExecutable.cpp:
(JSC::ScriptExecutable::newCodeBlockFor):
(JSC::ScriptExecutable::prepareForExecutionImpl):
* runtime/ScriptExecutable.h:
* runtime/ThrowScope.cpp:
(JSC::ThrowScope::throwException):
* runtime/ThrowScope.h:
(JSC::ThrowScope::throwException):
(JSC::throwException):
* runtime/VM.cpp:
(JSC::VM::throwException):
* runtime/VM.h:

Source/WebCore:

* bridge/objc/objc_utility.h:
* bridge/objc/objc_utility.mm:
(JSC::Bindings::throwError):
* bridge/runtime_object.cpp:
(JSC::Bindings::RuntimeObject::throwInvalidAccessError):
* bridge/runtime_object.h:

Source/WebKit:

* WebProcess/Plugins/Netscape/JSNPObject.cpp:
(WebKit::JSNPObject::throwInvalidAccessError):
* WebProcess/Plugins/Netscape/JSNPObject.h:

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