WebKit-https.git
18 months agoWeb Inspector: Fix typo "vritualized"
commit-queue@webkit.org [Tue, 11 Sep 2018 19:51:19 +0000 (19:51 +0000)]
Web Inspector: Fix typo "vritualized"
https://bugs.webkit.org/show_bug.cgi?id=189511

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2018-09-11
Reviewed by Devin Rousso.

* UserInterface/Views/TreeOutline.js:
(WI.TreeOutline):
(WI.TreeOutline.prototype.registerScrollVirtualizer):
(WI.TreeOutline.prototype.updateVirtualizedElements):

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

18 months agoShrink size of ResourseResponseBase
yusukesuzuki@slowstart.org [Tue, 11 Sep 2018 19:34:56 +0000 (19:34 +0000)]
Shrink size of ResourseResponseBase
https://bugs.webkit.org/show_bug.cgi?id=189501

Reviewed by Simon Fraser.

We reduce the size of ResourceResponseBase by the following two optimizations.

1. Use bitfields for bool flags and reorder them.

2. Use Markable<> in CacheControlDirectives, which is held by ResourceResponseBase.

This patch reduces the size of ResourceResponseBase from 416 to 392 bytes.

No behavior change.

* platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
(WebCore::WebCoreAVFResourceLoader::responseReceived):
(WebCore::WebCoreAVFResourceLoader::fulfillRequestWithResource):
* platform/network/CacheValidation.h:
(WebCore::CacheControlDirectives::CacheControlDirectives):
* platform/network/ResourceResponseBase.cpp:
(WebCore::ResourceResponseBase::ResourceResponseBase):
(WebCore::ResourceResponseBase::contentRange const):
* platform/network/ResourceResponseBase.h:
(WebCore::ResourceResponseBase::decode):

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

18 months agoCrash under PlatformPopupMenuData::encode when interacting with a select menu that...
mmaxfield@apple.com [Tue, 11 Sep 2018 19:30:46 +0000 (19:30 +0000)]
Crash under PlatformPopupMenuData::encode when interacting with a select menu that has variable fonts
https://bugs.webkit.org/show_bug.cgi?id=188008

Reviewed by Alex Christensen.

Source/WebKit:

This patch is a follow-up to https://bugs.webkit.org/show_bug.cgi?id=180307.
Variable fonts have CFDictionaries with non-string keys. We need to support that in our IPC code.

* Shared/cf/ArgumentCodersCF.cpp:
(IPC::encode):
(IPC::decode):

LayoutTests:

* fast/text/variations/ipc2-expected.txt: Added.
* fast/text/variations/ipc2.html: Added.

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

18 months ago[WPE][GTK] API documentation is unclear about how to modify requests before sending...
aperez@igalia.com [Tue, 11 Sep 2018 19:26:47 +0000 (19:26 +0000)]
[WPE][GTK] API documentation is unclear about how to modify requests before sending them
https://bugs.webkit.org/show_bug.cgi?id=189505

Reviewed by Michael Catanzaro.

Add notes to the API documentation to make explicit where modification
of WebKitURIRequest instances affects the request data sent over the
network.

* UIProcess/API/glib/WebKitNavigationAction.cpp: Clarify that
modifications to the associated WebKitURIRequest do not affect the
actual request. Point to WebKitPage::send-request instead.
* UIProcess/API/glib/WebKitResponsePolicyDecision.cpp: Ditto.
* UIProcess/API/glib/WebKitWebView.cpp:
(webkit_web_view_class_init): Ditto for the description of the
WebKitWebView::decide-policy signal. Also fix the syntax of example.
* WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
(webkit_web_page_class_init): Indicate that modifications to the
WebKitURIRequest will change the actual network request data.

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

18 months agoUnreviewed, attempt to fix Apple builds after r235903
mcatanzaro@igalia.com [Tue, 11 Sep 2018 19:19:52 +0000 (19:19 +0000)]
Unreviewed, attempt to fix Apple builds after r235903
https://bugs.webkit.org/show_bug.cgi?id=188872

If it really needs to be inlined, it will need to move to the header....

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::pageClient const):

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

18 months agoUnreviewed, fix build after r235903
mcatanzaro@igalia.com [Tue, 11 Sep 2018 18:56:09 +0000 (18:56 +0000)]
Unreviewed, fix build after r235903
https://bugs.webkit.org/show_bug.cgi?id=188872

This broke all ports except GTK. Need to add a missing header.

* UIProcess/PageClient.h:

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

18 months agoAdd missing #if ENABLE(VIDEO) WebProcess/FullScreen/WebFullScreenManager.cpp
commit-queue@webkit.org [Tue, 11 Sep 2018 18:38:28 +0000 (18:38 +0000)]
Add missing #if ENABLE(VIDEO) WebProcess/FullScreen/WebFullScreenManager.cpp
https://bugs.webkit.org/show_bug.cgi?id=189506

Patch by Pablo Saavedra <psaavedra@igalia.com> on 2018-09-11
Reviewed by Tim Horton.

m_pipStandbyElement is only defined in
WebKit/WebProcess/FullScreen/WebFullScreenManager.h
only when ENABLE(VIDEO) (see
https://bugs.webkit.org/show_bug.cgi?id=181338)

* WebProcess/FullScreen/WebFullScreenManager.cpp:
(WebKit::WebFullScreenManager::setPIPStandbyElement):

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

18 months agoTest for array initialization in arrayProtoFuncSplice.
mark.lam@apple.com [Tue, 11 Sep 2018 18:25:56 +0000 (18:25 +0000)]
Test for array initialization in arrayProtoFuncSplice.
https://bugs.webkit.org/show_bug.cgi?id=170253
<rdar://problem/31328773>

Rubber-stamped by Saam Barati.

* stress/regress-170253.js: Added.

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

18 months agoUnreviewed, fix some -Wreturn-type warnings
mcatanzaro@igalia.com [Tue, 11 Sep 2018 18:22:17 +0000 (18:22 +0000)]
Unreviewed, fix some -Wreturn-type warnings

* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::sourceFromNewReceiver):
* Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp:
(WebCore::toRTCRtpTransceiverDirection):
(WebCore::fromRTCRtpTransceiverDirection):

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

18 months agoWebPageProxy should hold a WeakPtr to its PageClient
mcatanzaro@igalia.com [Tue, 11 Sep 2018 18:16:58 +0000 (18:16 +0000)]
WebPageProxy should hold a WeakPtr to its PageClient
https://bugs.webkit.org/show_bug.cgi?id=188872

Reviewed by Ryosuke Niwa.

This ensures the PageClient reference is always valid when used.

* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::startDrag):
(WebKit::WebPageProxy::setDragCaretRect):
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::PageClientProtector::PageClientProtector):
(WebKit::PageClientProtector::~PageClientProtector):
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::m_resetRecentCrashCountTimer):
(WebKit::WebPageProxy::pageClient const):
(WebKit::WebPageProxy::reattachToWebProcess):
(WebKit::WebPageProxy::initializeWebPage):
(WebKit::WebPageProxy::close):
(WebKit::WebPageProxy::didChangeBackForwardList):
(WebKit::WebPageProxy::willGoToBackForwardListItem):
(WebKit::WebPageProxy::shouldKeepCurrentBackForwardListItemInList):
(WebKit::WebPageProxy::setViewNeedsDisplay):
(WebKit::WebPageProxy::requestScroll):
(WebKit::WebPageProxy::viewScrollPosition const):
(WebKit::WebPageProxy::updateActivityState):
(WebKit::WebPageProxy::activityStateDidChange):
(WebKit::WebPageProxy::viewDidEnterWindow):
(WebKit::WebPageProxy::dispatchActivityStateChange):
(WebKit::WebPageProxy::layerHostingModeDidChange):
(WebKit::WebPageProxy::viewSize const):
(WebKit::WebPageProxy::startDrag):
(WebKit::WebPageProxy::didPerformDragOperation):
(WebKit::WebPageProxy::processNextQueuedMouseEvent):
(WebKit::WebPageProxy::findPlugin):
(WebKit::WebPageProxy::handleTouchEventSynchronously):
(WebKit::WebPageProxy::handleTouchEvent):
(WebKit::WebPageProxy::preferencesDidChange):
(WebKit::WebPageProxy::didCreateMainFrame):
(WebKit::WebPageProxy::didCreateSubframe):
(WebKit::WebPageProxy::didStartProgress):
(WebKit::WebPageProxy::didChangeProgress):
(WebKit::WebPageProxy::didFinishProgress):
(WebKit::WebPageProxy::didDestroyNavigation):
(WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
(WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
(WebKit::WebPageProxy::willPerformClientRedirectForFrame):
(WebKit::WebPageProxy::didCancelClientRedirectForFrame):
(WebKit::WebPageProxy::didChangeProvisionalURLForFrame):
(WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
(WebKit::WebPageProxy::didCommitLoadForFrame):
(WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
(WebKit::WebPageProxy::didFinishLoadForFrame):
(WebKit::WebPageProxy::didFailLoadForFrame):
(WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
(WebKit::WebPageProxy::didReceiveTitleForFrame):
(WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
(WebKit::WebPageProxy::didReachLayoutMilestone):
(WebKit::WebPageProxy::didDisplayInsecureContentForFrame):
(WebKit::WebPageProxy::didRunInsecureContentForFrame):
(WebKit::WebPageProxy::frameDidBecomeFrameSet):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::decidePolicyForNewWindowAction):
(WebKit::WebPageProxy::decidePolicyForResponse):
(WebKit::WebPageProxy::unableToImplementPolicy):
(WebKit::WebPageProxy::didNavigateWithNavigationData):
(WebKit::WebPageProxy::didPerformClientRedirect):
(WebKit::WebPageProxy::didPerformServerRedirect):
(WebKit::WebPageProxy::didUpdateHistoryTitle):
(WebKit::WebPageProxy::closePage):
(WebKit::WebPageProxy::setWindowFrame):
(WebKit::WebPageProxy::getWindowFrame):
(WebKit::WebPageProxy::getWindowFrameWithCallback):
(WebKit::WebPageProxy::screenToRootView):
(WebKit::WebPageProxy::rootViewToScreen):
(WebKit::WebPageProxy::syncRootViewToScreen):
(WebKit::WebPageProxy::accessibilityScreenToRootView):
(WebKit::WebPageProxy::rootViewToAccessibilityScreen):
(WebKit::WebPageProxy::didChangeViewportProperties):
(WebKit::WebPageProxy::runOpenPanel):
(WebKit::WebPageProxy::showShareSheet):
(WebKit::WebPageProxy::handleDownloadRequest):
(WebKit::WebPageProxy::didChangeContentSize):
(WebKit::WebPageProxy::showColorPicker):
(WebKit::WebPageProxy::showDataListSuggestions):
(WebKit::WebPageProxy::compositionWasCanceled):
(WebKit::WebPageProxy::registerInsertionUndoGrouping):
(WebKit::WebPageProxy::canUndoRedo):
(WebKit::WebPageProxy::executeUndoRedo):
(WebKit::WebPageProxy::clearAllEditCommands):
(WebKit::WebPageProxy::setTextIndicator):
(WebKit::WebPageProxy::clearTextIndicator):
(WebKit::WebPageProxy::setTextIndicatorAnimationProgress):
(WebKit::WebPageProxy::showPopupMenu):
(WebKit::WebPageProxy::showContextMenu):
(WebKit::WebPageProxy::registerEditCommand):
(WebKit::WebPageProxy::canUndo):
(WebKit::WebPageProxy::canRedo):
(WebKit::WebPageProxy::setToolTip):
(WebKit::WebPageProxy::setCursor):
(WebKit::WebPageProxy::setCursorHiddenUntilMouseMoves):
(WebKit::WebPageProxy::didReceiveEvent):
(WebKit::WebPageProxy::resetState):
(WebKit::WebPageProxy::resetStateAfterProcessExited):
(WebKit::WebPageProxy::creationParameters):
(WebKit::WebPageProxy::enterAcceleratedCompositingMode):
(WebKit::WebPageProxy::exitAcceleratedCompositingMode):
(WebKit::WebPageProxy::updateAcceleratedCompositingMode):
(WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
(WebKit::WebPageProxy::recommendedScrollbarStyleDidChange):
(WebKit::WebPageProxy::didChangeScrollOffsetPinningForMainFrame):
(WebKit::WebPageProxy::didFinishLoadingDataForCustomContentProvider):
(WebKit::WebPageProxy::updateBackingStoreDiscardableState):
(WebKit::WebPageProxy::showCorrectionPanel):
(WebKit::WebPageProxy::dismissCorrectionPanel):
(WebKit::WebPageProxy::dismissCorrectionPanelSoon):
(WebKit::WebPageProxy::recordAutocorrectionResponse):
(WebKit::WebPageProxy::useDarkAppearance const):
(WebKit::WebPageProxy::showDictationAlternativeUI):
(WebKit::WebPageProxy::removeDictationAlternatives):
(WebKit::WebPageProxy::dictationAlternatives):
(WebKit::WebPageProxy::setEditableElementIsFocused):
(WebKit::WebPageProxy::takeViewSnapshot):
(WebKit::WebPageProxy::wrapCryptoKey):
(WebKit::WebPageProxy::unwrapCryptoKey):
(WebKit::WebPageProxy::signedPublicKeyAndChallengeString):
(WebKit::WebPageProxy::navigationGestureDidBegin):
(WebKit::WebPageProxy::navigationGestureWillEnd):
(WebKit::WebPageProxy::navigationGestureDidEnd):
(WebKit::WebPageProxy::willRecordNavigationSnapshot):
(WebKit::WebPageProxy::navigationGestureSnapshotWasRemoved):
(WebKit::WebPageProxy::isPlayingMediaDidChange):
(WebKit::WebPageProxy::videoControlsManagerDidChange):
(WebKit::WebPageProxy::handleControlledElementIDResponse const):
(WebKit::WebPageProxy::didPerformImmediateActionHitTest):
(WebKit::WebPageProxy::immediateActionAnimationControllerForHitTestResult):
(WebKit::WebPageProxy::didHandleAcceptedCandidate):
(WebKit::WebPageProxy::addPlaybackTargetPickerClient):
(WebKit::WebPageProxy::removePlaybackTargetPickerClient):
(WebKit::WebPageProxy::showPlaybackTargetPicker):
(WebKit::WebPageProxy::playbackTargetPickerClientStateDidChange):
(WebKit::WebPageProxy::setMockMediaPlaybackTargetPickerEnabled):
(WebKit::WebPageProxy::setMockMediaPlaybackTargetPickerState):
(WebKit::WebPageProxy::didChangeBackgroundColor):
(WebKit::WebPageProxy::didRestoreScrollPosition):
(WebKit::WebPageProxy::userInterfaceLayoutDirection):
(WebKit::WebPageProxy::didInsertAttachment):
(WebKit::WebPageProxy::didRemoveAttachment):
* UIProcess/WebPageProxy.h:
* UIProcess/gstreamer/WebPageProxyGStreamer.cpp:
(WebKit::WebPageProxy::requestInstallMissingMediaPlugins):
* UIProcess/gtk/WebPageProxyGtk.cpp:
(WebKit::WebPageProxy::viewWidget):
(WebKit::WebPageProxy::editorStateChanged):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::computeCustomFixedPositionRect const):
(WebKit::WebPageProxy::overflowScrollViewWillStartPanGesture):
(WebKit::WebPageProxy::overflowScrollViewDidScroll):
(WebKit::WebPageProxy::overflowScrollWillStartScroll):
(WebKit::WebPageProxy::overflowScrollDidEndScroll):
(WebKit::WebPageProxy::didCommitLayerTree):
(WebKit::WebPageProxy::layerTreeCommitComplete):
(WebKit::WebPageProxy::didReceivePositionInformation):
(WebKit::WebPageProxy::saveImageToLibrary):
(WebKit::WebPageProxy::interpretKeyEvent):
(WebKit::WebPageProxy::registerWebProcessAccessibilityToken):
(WebKit::WebPageProxy::couldNotRestorePageState):
(WebKit::WebPageProxy::restorePageState):
(WebKit::WebPageProxy::restorePageCenterAndScale):
(WebKit::WebPageProxy::didGetTapHighlightGeometries):
(WebKit::WebPageProxy::startAssistingNode):
(WebKit::WebPageProxy::stopAssistingNode):
(WebKit::WebPageProxy::showInspectorHighlight):
(WebKit::WebPageProxy::hideInspectorHighlight):
(WebKit::WebPageProxy::showInspectorIndication):
(WebKit::WebPageProxy::hideInspectorIndication):
(WebKit::WebPageProxy::enableInspectorNodeSearch):
(WebKit::WebPageProxy::disableInspectorNodeSearch):
(WebKit::WebPageProxy::setAcceleratedCompositingRootLayer):
(WebKit::WebPageProxy::showPlaybackTargetPicker):
(WebKit::WebPageProxy::commitPotentialTapFailed):
(WebKit::WebPageProxy::didNotHandleTapAsClick):
(WebKit::WebPageProxy::didCompleteSyntheticClick):
(WebKit::WebPageProxy::disableDoubleTapGesturesDuringTapIfNecessary):
(WebKit::WebPageProxy::editorStateChanged):
(WebKit::WebPageProxy::showValidationMessage):
(WebKit::WebPageProxy::didHandleStartDataInteractionRequest):
(WebKit::WebPageProxy::didHandleAdditionalDragItemsRequest):
(WebKit::WebPageProxy::didConcludeEditDataInteraction):
(WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame):
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::windowAndViewFramesChanged):
(WebKit::WebPageProxy::insertDictatedTextAsync):
(WebKit::WebPageProxy::setPromisedDataForImage):
(WebKit::WebPageProxy::didPerformDictionaryLookup):
(WebKit::WebPageProxy::registerWebProcessAccessibilityToken):
(WebKit::WebPageProxy::makeFirstResponder):
(WebKit::WebPageProxy::assistiveTechnologyMakeFirstResponder):
(WebKit::WebPageProxy::colorSpace):
(WebKit::WebPageProxy::pluginFocusOrWindowFocusChanged):
(WebKit::WebPageProxy::setPluginComplexTextInputState):
(WebKit::WebPageProxy::executeSavedCommandBySelector):
(WebKit::WebPageProxy::intrinsicContentSizeDidChange):
(WebKit::WebPageProxy::setAcceleratedCompositingRootLayer):
(WebKit::WebPageProxy::acceleratedCompositingRootLayer const):
(WebKit::WebPageProxy::showPDFContextMenu):
(WebKit::WebPageProxy::showTelephoneNumberMenu):
(WebKit::WebPageProxy::boundsOfLayerInLayerBackedWindowCoordinates const):
(WebKit::WebPageProxy::editorStateChanged):
(WebKit::WebPageProxy::startWindowDrag):
(WebKit::WebPageProxy::platformWindow):
(WebKit::WebPageProxy::rootViewToWindow):
(WebKit::WebPageProxy::showValidationMessage):
(WebKit::WebPageProxy::inspectorAttachmentView):
(WebKit::WebPageProxy::remoteObjectRegistry):
* UIProcess/win/WebPageProxyWin.cpp:
(WebKit::WebPageProxy::viewWidget):
* UIProcess/wpe/WebPageProxyWPE.cpp:
(WebKit::WebPageProxy::viewBackend):

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

18 months agoTest for IntlObject initialization.
mark.lam@apple.com [Tue, 11 Sep 2018 18:10:46 +0000 (18:10 +0000)]
Test for IntlObject initialization.
https://bugs.webkit.org/show_bug.cgi?id=170251
<rdar://problem/31328419>

Rubber-stamped by Saam Barati.

* stress/regress-170251.js: Added.

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

18 months agoTest for array memcpy'ing when JSGlobalObject::haveABadTime.
mark.lam@apple.com [Tue, 11 Sep 2018 17:59:37 +0000 (17:59 +0000)]
Test for array memcpy'ing when JSGlobalObject::haveABadTime.
https://bugs.webkit.org/show_bug.cgi?id=169889
<rdar://problem/31155607>

Reviewed by Saam Barati.

* stress/regress-169889-array-concat.js: Added.
* stress/regress-169889-array-concat1.js: Added.
* stress/regress-169889-array-slice.js: Added.

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

18 months agoUnreviewed, a speculative build fix for r235888.
jiewen_tan@apple.com [Tue, 11 Sep 2018 17:54:58 +0000 (17:54 +0000)]
Unreviewed, a speculative build fix for r235888.

* Modules/mediastream/MediaDevices.h:
Add class Document forward declaration.

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

18 months agoTest for incorrect check in emitPutDerivedConstructorToArrowFunctionContextScope.
mark.lam@apple.com [Tue, 11 Sep 2018 17:43:27 +0000 (17:43 +0000)]
Test for incorrect check in emitPutDerivedConstructorToArrowFunctionContextScope.
https://bugs.webkit.org/show_bug.cgi?id=169445
<rdar://problem/30957435>

Reviewed by Saam Barati.

* stress/regress-169445.js: Added.
(let.gun.eval.A):
(let.gun.eval.B.C):
(let.gun.eval.B.C.prototype.trigger):
(let.gun.eval.B.C.prototype.triggerWithRestParameters):
(let.gun.eval.B):
(let.gun.eval):

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

18 months agoRegression(PSON): "Swipe back" snapshot is missing when navigating back cross-process
cdumez@apple.com [Tue, 11 Sep 2018 17:42:28 +0000 (17:42 +0000)]
Regression(PSON): "Swipe back" snapshot is missing when navigating back cross-process
https://bugs.webkit.org/show_bug.cgi?id=189482
<rdar://problem/44317222>

Reviewed by Geoffrey Garen.

The issue was that when we swap process on navigation, we:
1. Call processDidTerminate() which calls resetState() and clears the displayed content
2. Reattach the WebPageProxy to a new WebProcess
3. Trigger the navigation
4. Take the navigation snapshot

When the navigation snapshot occurs at step 4, the view is already blank in the case of
process swap. To avoid the issue, we take the navigation snapshot earlier, before calling
processDidTerminate() and we suppress the next navigation snapshot as it would be blank.

At some point, we will likely want to display the previous' WebProcess content longer,
until the new WebProcess has something interesting to display. Once this is implemented,
we'll likely be able to drop the early snapshotting logic.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::recordAutomaticNavigationSnapshot):
(WebKit::WebPageProxy::continueNavigationInNewProcess):
(WebKit::WebPageProxy::restoreFromSessionState):
(WebKit::WebPageProxy::didCommitLoadForFrame):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::suppressNextAutomaticNavigationSnapshot):

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

18 months agoAdd Web API Statistics Collection
commit-queue@webkit.org [Tue, 11 Sep 2018 17:14:07 +0000 (17:14 +0000)]
Add Web API Statistics Collection
https://bugs.webkit.org/show_bug.cgi?id=187773
<rdar://problem/44155162>

Patch by Woodrow Wang <woodrow_wang@apple.com> on 2018-09-11
Reviewed by Brent Fulgham.

Source/WebCore:

Added data collection for web API statistics, specifically regarding the canvas, font loads,
screen functions, and navigator functions. The data collection code is placed under a runtime
enabled feature flag. The statistics are stored in a ResourceLoadStatistics object and written
to a plist on disk. Added a new file CanvasActivityRecord.h and CanvasActivityRecord.cpp which
includes a struct to keep track of HTML5 canvas element read and writes.

Tests: http/tests/webAPIStatistics/canvas-read-and-write-data-collection.html
       http/tests/webAPIStatistics/font-load-data-collection.html
       http/tests/webAPIStatistics/navigator-functions-accessed-data-collection.html
       http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSFontFaceSource.cpp:
(WebCore::CSSFontFaceSource::load):
* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::fontRangesForFamily):
(WebCore::CSSFontSelector::fallbackFontAt):

The following are the functions where we'd like to record a canvas read.

* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::toDataURL):
(WebCore::HTMLCanvasElement::toBlob):
(WebCore::HTMLCanvasElement::getImageData):
(WebCore::HTMLCanvasElement::toMediaSample):
(WebCore::HTMLCanvasElement::captureStream):

The following are the functions where we'd like to record a canvas write.

* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::measureText):
(WebCore::CanvasRenderingContext2D::drawTextInternal):

The following files and functions handle the CanvasActivityRecord struct and
its respective functions.

* loader/CanvasActivityRecord.cpp: Added.
(WebCore::CanvasActivityRecord::recordWrittenOrMeasuredText):
(WebCore::CanvasActivityRecord::mergeWith):
* loader/CanvasActivityRecord.h: Added.
(WebCore::CanvasActivityRecord::encode const):
(WebCore::CanvasActivityRecord::decode):

* loader/DocumentThreadableLoader.cpp:
* loader/FrameLoader.cpp:
* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::logFontLoad):
(WebCore::ResourceLoadObserver::logCanvasRead):
(WebCore::ResourceLoadObserver::logCanvasWriteOrMeasure):
(WebCore::ResourceLoadObserver::logNavigatorAPIAccessed):
(WebCore::ResourceLoadObserver::logScreenAPIAccessed):

Before, entries in the ResourceLoadStatistics involving HashSets used "origin" as the key.
Now the encodeHashSet function has been generalized to take any key to encode the entries
in the HashSet. Also added functionality to encode an OptionSet by converting it to its
raw bitmask state.

* loader/ResourceLoadObserver.h:
* loader/ResourceLoadStatistics.cpp:
(WebCore::encodeHashSet):
(WebCore::encodeOriginHashSet):
(WebCore::encodeOptionSet):
(WebCore::encodeFontHashSet):
(WebCore::encodeCanvasActivityRecord):
(WebCore::ResourceLoadStatistics::encode const):
(WebCore::decodeHashSet):
(WebCore::decodeOriginHashSet):
(WebCore::decodeOptionSet):
(WebCore::decodeFontHashSet):
(WebCore::decodeCanvasActivityRecord):
(WebCore::ResourceLoadStatistics::decode):
(WebCore::navigatorAPIEnumToString):
(WebCore::screenAPIEnumToString):
(WebCore::appendNavigatorAPIOptionSet):
(WebCore::appendScreenAPIOptionSet):
(WebCore::ResourceLoadStatistics::toString const):
(WebCore::ResourceLoadStatistics::merge):
* loader/ResourceLoadStatistics.h:
* loader/ResourceTiming.cpp:

The following are the navigator functions recorded for the web API statistics.

* page/Navigator.cpp:
(WebCore::Navigator::appVersion const):
(WebCore::Navigator::userAgent const):
(WebCore::Navigator::plugins):
(WebCore::Navigator::mimeTypes):
(WebCore::Navigator::cookieEnabled const):
(WebCore::Navigator::javaEnabled const):

The following are the screen functions recorded for the web API statistics.

* page/Screen.cpp:
(WebCore::Screen::height const):
(WebCore::Screen::width const):
(WebCore::Screen::colorDepth const):
(WebCore::Screen::pixelDepth const):
(WebCore::Screen::availLeft const):
(WebCore::Screen::availTop const):
(WebCore::Screen::availHeight const):
(WebCore::Screen::availWidth const):

Source/WebKit:

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
(IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
* UIProcess/ResourceLoadStatisticsMemoryStore.cpp:

LayoutTests:

Added new tests and expectations for the web API statistics data collection.

* TestExpectations:
* http/tests/webAPIStatistics/canvas-read-and-write-data-collection-expected.txt: Added.
* http/tests/webAPIStatistics/canvas-read-and-write-data-collection.html: Added.
* http/tests/webAPIStatistics/font-load-data-collection-expected.txt: Added.
* http/tests/webAPIStatistics/font-load-data-collection.html: Added.
* http/tests/webAPIStatistics/navigator-functions-accessed-data-collection-expected.txt: Added.
* http/tests/webAPIStatistics/navigator-functions-accessed-data-collection.html: Added.
* http/tests/webAPIStatistics/screen-functions-accessed-data-collection-expected.txt: Added.
* http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html: Added.
* platform/ios-wk2/TestExpectations:
* platform/mac-wk2/TestExpectations:

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

18 months agoUnreviewed, rebaseline imported/w3c/web-platform-tests/css/cssom/interfaces.html...
cdumez@apple.com [Tue, 11 Sep 2018 16:24:21 +0000 (16:24 +0000)]
Unreviewed, rebaseline imported/w3c/web-platform-tests/css/cssom/interfaces.html after r235889.

* web-platform-tests/css/cssom/interfaces-expected.txt:

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

18 months agoplaybackControlsManagerUpdateTimerFired and
commit-queue@webkit.org [Tue, 11 Sep 2018 16:07:45 +0000 (16:07 +0000)]
playbackControlsManagerUpdateTimerFired and
m_playbackControlsManagerUpdateTimer must be
guarded with ENABLE(VIDEO), otherwise the following
error occurs with the VIDEO feature turned off:

  error: 'MediaElementSession' has not been declared

Add missing #if ENABLE(VIDEO) Page.cpp and Page.h
https://bugs.webkit.org/show_bug.cgi?id=189500

Patch by Pablo Saavedra <psaavedra@igalia.com> on 2018-09-11
Reviewed by Anders Carlsson.

* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::schedulePlaybackControlsManagerUpdate):
* page/Page.h:

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

18 months agoRefactor filter list checking code
fred.wang@free.fr [Tue, 11 Sep 2018 12:48:33 +0000 (12:48 +0000)]
Refactor filter list checking code
https://bugs.webkit.org/show_bug.cgi?id=185087

Patch by Frederic Wang <fwang@igalia.com> on 2018-09-11
Reviewed by Antonio Gomes.

No new tests, behavior unchanged.

* page/animation/KeyframeAnimation.h: Add missing forward-declaration FilterOperations.

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

18 months agoModify more tests to use document.scrollingElement to access viewport scroll properties
commit-queue@webkit.org [Tue, 11 Sep 2018 12:47:54 +0000 (12:47 +0000)]
Modify more tests to use document.scrollingElement to access viewport scroll properties
https://bugs.webkit.org/show_bug.cgi?id=189495

After r235806, it is wrong to use document.body to access scroll properties of the viewport
in standard mode. New tests added since r227781 are modified to use
document.scrollingElement instead and avoid flaky behavior. For consistency, we do the same
for old tests in quirks mode. Note that WPT tests as well as the following tests using
document.body on purpose are not modified:
- fast/dom/Element/*
- events/scroll-in-scaled-page-with-overflow-hidden.html
- compositing/ios/overflow-scroll-update-overlap.html
- body-stuck-with-dirty-bit-with-columns.html

Patch by Frederic Wang <fwang@igalia.com> on 2018-09-11
Reviewed by Antonio Gomes.

* compositing/rtl/rtl-absolute-overflow-scrolled.html:
* compositing/rtl/rtl-fixed-overflow-scrolled.html:
* editing/caret/ios/absolute-caret-position-after-scroll.html:
* editing/caret/ios/fixed-caret-position-after-scroll.html:
* editing/execCommand/delete-no-scroll.html:
* editing/input/resources/reveal-utilities.js:
(performJumpAtTheEdgeTest):
* editing/pasteboard/copy-crash.html:
* editing/selection/ios/absolute-selection-after-scroll.html:
* editing/selection/ios/fixed-selection-after-scroll.html:
* fast/autoresize/autoresize-with-iframe-expected.txt:
* fast/autoresize/autoresize-with-iframe.html:
* fast/autoresize/basic-expected.txt:
* fast/autoresize/basic.html:
* fast/autoresize/turn-off-autoresize-expected.txt:
* fast/autoresize/turn-off-autoresize.html:
* fast/css/element-scrollByLines-scrollByPages-obsolete.html:
* fast/dom/non-numeric-values-numeric-parameters-expected.txt:
* fast/dom/non-numeric-values-numeric-parameters.html:
* fast/dom/resources/check-scroll-position-onload.html:
* fast/dom/scroll-position-for-new-loads.html:
* fast/events/attempt-scroll-with-no-scrollbars.html:
* fast/events/fire-scroll-event.html:
* fast/events/frame-scroll-fake-mouse-move.html:
* fast/events/ios/no-touch-events-when-stopping-momentum-scroll-in-mainframe-expected.txt:
* fast/events/ios/no-touch-events-when-stopping-momentum-scroll-in-mainframe.html:
* fast/events/ios/touch-events-during-scroll-deceleration-in-overflow.html:
* fast/events/mouse-cursor-image-set.html:
* fast/events/mouse-cursor-multiframecur.html:
* fast/events/mouse-cursor.html:
* fast/events/no-scroll-on-input-text-selection-expected.txt:
* fast/events/no-scroll-on-input-text-selection.html:
* fast/events/platform-wheelevent-paging-x-in-non-scrolling-page-expected.txt:
* fast/events/platform-wheelevent-paging-x-in-non-scrolling-page.html:
* fast/events/platform-wheelevent-paging-x-in-scrolling-page-expected.txt:
* fast/events/platform-wheelevent-paging-x-in-scrolling-page.html:
* fast/events/platform-wheelevent-paging-xy-in-scrolling-page-expected.txt:
* fast/events/platform-wheelevent-paging-xy-in-scrolling-page.html:
* fast/events/platform-wheelevent-paging-y-in-non-scrolling-page-expected.txt:
* fast/events/platform-wheelevent-paging-y-in-non-scrolling-page.html:
* fast/events/platform-wheelevent-paging-y-in-scrolling-page-expected.txt:
* fast/events/platform-wheelevent-paging-y-in-scrolling-page.html:
* fast/events/scale-and-scroll-body-expected.txt:
* fast/events/scale-and-scroll-body.html:
* fast/events/scale-and-scroll-window-expected.txt:
* fast/events/scale-and-scroll-window.html:
* fast/events/scroll-after-click-on-tab-index.html:
* fast/events/scroll-to-anchor-in-overflow-hidden.html:
* fast/events/touch/ios/touchmove-cancelable-after-touchstart-expected.txt:
* fast/events/touch/ios/touchmove-cancelable-after-touchstart.html:
* fast/forms/autofocus-opera-003.html:
* fast/forms/input-readonly-autoscroll.html:
* fast/forms/resources/common.js:
(getAbsoluteRect):
* fast/frames/iframe-scroll-page-up-down.html:
* fast/frames/transparent-scrollbar.html:
* fast/harness/results.html:
* fast/html/empty-fragment-id-goto-top-expected.txt:
* fast/html/empty-fragment-id-goto-top.html:
* fast/images/imagemap-scroll.html:
* fast/loader/scroll-position-restored-on-back-non-cached.html:
* fast/loader/scroll-position-restored-on-back.html:
* fast/multicol/body-stuck-with-dirty-bit-with-columns.html:
* fast/repaint/resources/iframe-scroll-repaint-iframe.html:
* fast/scrolling/ios/iframe-scroll-into-view.html:
* fast/scrolling/latching/scroll-div-latched-div.html:
* fast/scrolling/latching/scroll-div-latched-mainframe.html:
* fast/scrolling/latching/scroll-div-with-nested-nonscrollable-iframe.html:
* fast/scrolling/latching/scroll-iframe-fragment.html:
* fast/scrolling/latching/scroll-iframe-latched-iframe.html:
* fast/scrolling/latching/scroll-iframe-latched-mainframe.html:
* fast/scrolling/latching/scroll-iframe-webkit1-latching-bug.html:
* fast/scrolling/latching/scroll-select-bottom-test.html:
* fast/scrolling/latching/scroll-select-latched-mainframe.html:
* fast/scrolling/latching/scroll-select-latched-select.html:
* fast/scrolling/rtl-point-in-iframe.html:
* fast/spatial-navigation/snav-unit-overflow-and-scroll-in-direction.html:
* fast/table/assert-when-visual-overflow-is-cleared.html:
* fast/transforms/selection-bounds-in-transformed-view.html:
* http/tests/navigation/anchor-frames-cross-origin-expected.txt:
* http/tests/navigation/resources/frame-with-anchor-cross-origin.html:
* jquery/resources/test/unit/offset.js:
* legacy-animation-engine/fast/harness/results.html:
* media/video-controls-to-not-scroll-page-on-load.html:
* media/video-main-content-allow-then-scroll-expected.txt:
* media/video-main-content-allow-then-scroll.html:
* scrollbars/scrollbar-large-overflow-rectangle.html:
* tiled-drawing/scrolling/fast-scroll-div-latched-div-with-handler.html:
* tiled-drawing/scrolling/fast-scroll-div-latched-div.html:
* tiled-drawing/scrolling/fast-scroll-div-latched-mainframe-with-handler.html:
* tiled-drawing/scrolling/fast-scroll-iframe-latched-iframe-with-handler.html:
* tiled-drawing/scrolling/fast-scroll-iframe-latched-iframe.html:
* tiled-drawing/scrolling/fast-scroll-iframe-latched-mainframe-with-handler.html:
* tiled-drawing/scrolling/fast-scroll-iframe-latched-select.html:
* tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler.html:
* tiled-drawing/scrolling/fast-scroll-select-latched-mainframe.html:
* tiled-drawing/scrolling/fast-scroll-select-latched-select-with-handler.html:
* tiled-drawing/scrolling/fast-scroll-select-latched-select.html:
* tiled-drawing/scrolling/latched-to-deleted-node.html:
* tiled-drawing/scrolling/non-fast-region/top-content-inset-header.html:
* tiled-drawing/scrolling/non-fast-region/top-content-inset.html:
* tiled-drawing/scrolling/non-fast-region/wheel-event-plugin.html:
* tiled-drawing/scrolling/root-overflow-with-mousewheel.html:
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal.html:
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-slow-horizontal.html:
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-slow-vertical.html:
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-then-horizontal.html:
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical.html:
* tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-mainframe.html:

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

18 months agoUnreviewed follow-up to ChangeLog roll-over
philn@webkit.org [Tue, 11 Sep 2018 10:10:52 +0000 (10:10 +0000)]
Unreviewed follow-up to ChangeLog roll-over

Those 2 ChangeLogs are not meant to be here.

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

18 months ago== Rolled over to ChangeLog-2018-09-11 ==
philn@webkit.org [Tue, 11 Sep 2018 08:24:30 +0000 (08:24 +0000)]
== Rolled over to ChangeLog-2018-09-11 ==

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

18 months ago[GStreamer] use-after-free in MockVideoCaptureSource
philn@webkit.org [Tue, 11 Sep 2018 08:20:13 +0000 (08:20 +0000)]
[GStreamer] use-after-free in MockVideoCaptureSource
https://bugs.webkit.org/show_bug.cgi?id=189462

Reviewed by Xabier Rodriguez-Calvar.

* platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.cpp:
(WebCore::WrappedMockRealtimeVideoSource::updateSampleBuffer):
Copy the BGRA data before passing ownership to GStreamer. Also
include a few code style cosmetic changes.

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

18 months agoUpdate idlharness.js and webidl2.js.
Ms2ger@igalia.com [Tue, 11 Sep 2018 08:14:48 +0000 (08:14 +0000)]
Update idlharness.js and webidl2.js.
https://bugs.webkit.org/show_bug.cgi?id=189303

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Update idlharness.js and webidl2.js. Fix tests that are now broken
because of increased strictness in the harness. Fix tests that have
been broken for a while.

Update expectations. (The main change is the removal of "Unscopable
handled correctly for ..." subtests.)

* web-platform-tests/FileAPI/idlharness-expected.txt:
* web-platform-tests/FileAPI/idlharness.html: Update from upstream.
* web-platform-tests/FileAPI/idlharness.worker-expected.txt:
* web-platform-tests/FileAPI/idlharness.worker.js: Update from upstream.
* web-platform-tests/IndexedDB/interfaces.any-expected.txt:
* web-platform-tests/IndexedDB/interfaces.any.worker-expected.txt:
* web-platform-tests/WebCryptoAPI/idlharness.https-expected.txt:
* web-platform-tests/WebCryptoAPI/idlharness.https.worker-expected.txt:
* web-platform-tests/WebIDL/interfaces-expected.txt:
* web-platform-tests/credential-management/idl.https-expected.txt:
* web-platform-tests/css/cssom-view/interfaces-expected.txt:
* web-platform-tests/css/geometry/interfaces-expected.txt:
* web-platform-tests/css/geometry/interfaces.worker-expected.txt:
* web-platform-tests/dom/interfaces-expected.txt:
* web-platform-tests/dom/interfaces.html: Use the new method for dependency IDLs.
* web-platform-tests/encoding/idlharness-expected.txt:
* web-platform-tests/eventsource/interfaces-expected.txt:
* web-platform-tests/fetch/api/headers/headers-idl-expected.txt:
* web-platform-tests/fetch/api/request/request-idl-expected.txt:
* web-platform-tests/fetch/api/response/response-idl-expected.txt:
* web-platform-tests/hr-time/idlharness-expected.txt:
* web-platform-tests/hr-time/idlharness.html: Add missing dependency IDL.
* web-platform-tests/html/webappapis/animation-frames/idlharness-expected.txt:
* web-platform-tests/interfaces/IndexedDB.idl: Fix bug caught by stricter IDL parser.
* web-platform-tests/interfaces/intersection-observer.idl: Added from upstream.
* web-platform-tests/interfaces/web-audio-api.idl:
  Added to fix webaudio/the-audio-api/{the-gainnode-interface, the-delaynode-interface}/idl-test.html.
* web-platform-tests/intersection-observer/idlharness.window-expected.txt:
  Update for added intersection-observer.idl.
* web-platform-tests/media-source/interfaces-expected.txt: Update from macOS.
* web-platform-tests/mediacapture-streams/MediaDevices-IDL-all-expected.txt:
* web-platform-tests/mediacapture-streams/MediaDevices-IDL-all.html: Add missing dependency IDLs.
* web-platform-tests/mediacapture-streams/MediaDevices-IDL-enumerateDevices-expected.txt:
* web-platform-tests/mediacapture-streams/MediaDevices-IDL-enumerateDevices.html: Add missing dependency IDLs.
* web-platform-tests/notifications/interfaces-expected.txt:
* web-platform-tests/payment-request/idlharness.https.window-expected.txt:
* web-platform-tests/resource-timing/idlharness-expected.txt:
* web-platform-tests/resources/idlharness.js:
* web-platform-tests/resources/webidl2/CHANGELOG.md: Added.
* web-platform-tests/resources/webidl2/README.md:
* web-platform-tests/resources/webidl2/checker/index.html: Added.
* web-platform-tests/resources/webidl2/checker/w3c-import.log: Added.
* web-platform-tests/resources/webidl2/lib/w3c-import.log:
* web-platform-tests/resources/webidl2/lib/webidl2.js:
* web-platform-tests/resources/webidl2/lib/writer.js:
* web-platform-tests/resources/webidl2/package-lock.json: Added.
* web-platform-tests/resources/webidl2/package.json:
* web-platform-tests/resources/webidl2/test/invalid.js:
* web-platform-tests/resources/webidl2/test/invalid/idl/array.widl: Renamed from LayoutTests/imported/w3c/web-platform-tests/resources/webidl2/test/syntax/idl/array.widl.
* web-platform-tests/resources/webidl2/test/invalid/idl/caller.widl: Renamed from LayoutTests/imported/w3c/web-platform-tests/resources/webidl2/test/syntax/idl/caller.widl.
* web-platform-tests/resources/webidl2/test/invalid/idl/duplicate.widl: Added.
* web-platform-tests/resources/webidl2/test/invalid/idl/enum-empty.widl: Added.
* web-platform-tests/resources/webidl2/test/invalid/idl/enum-wo-comma.widl: Added.
* web-platform-tests/resources/webidl2/test/invalid/idl/exception.widl: Added.
* web-platform-tests/resources/webidl2/test/invalid/idl/extattr-empty-ids.widl: Added.
* web-platform-tests/resources/webidl2/test/invalid/idl/id-underscored-number.widl: Added.
* web-platform-tests/resources/webidl2/test/invalid/idl/implements_and_includes_ws.widl: Added.
* web-platform-tests/resources/webidl2/test/invalid/idl/iterator.widl: Renamed from LayoutTests/imported/w3c/web-platform-tests/resources/webidl2/test/syntax/idl/iterator.widl.
* web-platform-tests/resources/webidl2/test/invalid/idl/maplike-1type.widl:
* web-platform-tests/resources/webidl2/test/invalid/idl/namespace-readwrite.widl: Added.
* web-platform-tests/resources/webidl2/test/invalid/idl/no-semicolon-callback.widl: Added.
* web-platform-tests/resources/webidl2/test/invalid/idl/no-semicolon.widl: Added.
* web-platform-tests/resources/webidl2/test/invalid/idl/nonnullableobjects.widl:
* web-platform-tests/resources/webidl2/test/invalid/idl/promise-nullable.widl: Added.
* web-platform-tests/resources/webidl2/test/invalid/idl/promise-with-extended-attribute.widl: Added.
* web-platform-tests/resources/webidl2/test/invalid/idl/readonly-iterable.widl:
* web-platform-tests/resources/webidl2/test/invalid/idl/record-key-with-extended-attribute.widl: Added.
* web-platform-tests/resources/webidl2/test/invalid/idl/record-single.widl: Added.
* web-platform-tests/resources/webidl2/test/invalid/idl/setlike-2types.widl:
* web-platform-tests/resources/webidl2/test/invalid/idl/setter-creator.widl: Added.
* web-platform-tests/resources/webidl2/test/invalid/idl/spaced-negative-infinity.widl: Added.
* web-platform-tests/resources/webidl2/test/invalid/idl/spaced-variadic.widl: Added.
* web-platform-tests/resources/webidl2/test/invalid/idl/special-omittable.widl:
* web-platform-tests/resources/webidl2/test/invalid/idl/stray-slash.widl: Added.
* web-platform-tests/resources/webidl2/test/invalid/idl/stringconstants.widl: Renamed from LayoutTests/imported/w3c/web-platform-tests/resources/webidl2/test/invalid/idl/stringconstants.idl.
* web-platform-tests/resources/webidl2/test/invalid/idl/typedef-nested.widl:
* web-platform-tests/resources/webidl2/test/invalid/idl/union-dangling-or.widl: Added.
* web-platform-tests/resources/webidl2/test/invalid/idl/union-one.widl: Added.
* web-platform-tests/resources/webidl2/test/invalid/idl/union-zero.widl: Added.
* web-platform-tests/resources/webidl2/test/invalid/idl/unknown-generic.widl: Added.
* web-platform-tests/resources/webidl2/test/invalid/idl/w3c-import.log:
* web-platform-tests/resources/webidl2/test/invalid/json/array.json: Added.
* web-platform-tests/resources/webidl2/test/invalid/json/caller.json: Added.
* web-platform-tests/resources/webidl2/test/invalid/json/dict-required-default.json:
* web-platform-tests/resources/webidl2/test/invalid/json/duplicate.json: Added.
* web-platform-tests/resources/webidl2/test/invalid/json/enum-empty.json: Added.
* web-platform-tests/resources/webidl2/test/invalid/json/enum-wo-comma.json: Added.
* web-platform-tests/resources/webidl2/test/invalid/json/enum.json:
* web-platform-tests/resources/webidl2/test/invalid/json/exception.json: Added.
* web-platform-tests/resources/webidl2/test/invalid/json/extattr-empty-ids.json: Added.
* web-platform-tests/resources/webidl2/test/invalid/json/id-underscored-number.json: Added.
* web-platform-tests/resources/webidl2/test/invalid/json/implements_and_includes_ws.json: Added.
* web-platform-tests/resources/webidl2/test/invalid/json/iterator.json: Added.
* web-platform-tests/resources/webidl2/test/invalid/json/maplike-1type.json:
* web-platform-tests/resources/webidl2/test/invalid/json/module.json:
* web-platform-tests/resources/webidl2/test/invalid/json/namespace-readwrite.json: Added.
* web-platform-tests/resources/webidl2/test/invalid/json/no-semicolon-callback.json: Added.
* web-platform-tests/resources/webidl2/test/invalid/json/no-semicolon.json: Added.
* web-platform-tests/resources/webidl2/test/invalid/json/nonnullableany.json:
* web-platform-tests/resources/webidl2/test/invalid/json/nonnullableobjects.json:
* web-platform-tests/resources/webidl2/test/invalid/json/promise-nullable.json: Added.
* web-platform-tests/resources/webidl2/test/invalid/json/promise-with-extended-attribute.json: Added.
* web-platform-tests/resources/webidl2/test/invalid/json/raises.json:
* web-platform-tests/resources/webidl2/test/invalid/json/readonly-iterable.json:
* web-platform-tests/resources/webidl2/test/invalid/json/record-key-with-extended-attribute.json: Added.
* web-platform-tests/resources/webidl2/test/invalid/json/record-key.json:
* web-platform-tests/resources/webidl2/test/invalid/json/record-single.json: Added.
* web-platform-tests/resources/webidl2/test/invalid/json/scopedname.json:
* web-platform-tests/resources/webidl2/test/invalid/json/sequenceAsAttribute.json:
* web-platform-tests/resources/webidl2/test/invalid/json/setlike-2types.json:
* web-platform-tests/resources/webidl2/test/invalid/json/setter-creator.json: Added.
* web-platform-tests/resources/webidl2/test/invalid/json/spaced-negative-infinity.json: Added.
* web-platform-tests/resources/webidl2/test/invalid/json/spaced-variadic.json: Added.
* web-platform-tests/resources/webidl2/test/invalid/json/special-omittable.json:
* web-platform-tests/resources/webidl2/test/invalid/json/stray-slash.json: Added.
* web-platform-tests/resources/webidl2/test/invalid/json/stringconstants.json:
* web-platform-tests/resources/webidl2/test/invalid/json/typedef-nested.json:
* web-platform-tests/resources/webidl2/test/invalid/json/union-dangling-or.json: Added.
* web-platform-tests/resources/webidl2/test/invalid/json/union-one.json: Added.
* web-platform-tests/resources/webidl2/test/invalid/json/union-zero.json: Added.
* web-platform-tests/resources/webidl2/test/invalid/json/unknown-generic.json: Added.
* web-platform-tests/resources/webidl2/test/invalid/json/w3c-import.log:
* web-platform-tests/resources/webidl2/test/syntax.js:
* web-platform-tests/resources/webidl2/test/syntax/idl/attributes.widl:
* web-platform-tests/resources/webidl2/test/syntax/idl/constants.widl:
* web-platform-tests/resources/webidl2/test/syntax/idl/equivalent-decl.widl:
* web-platform-tests/resources/webidl2/test/syntax/idl/exception-inheritance.widl: Removed.
* web-platform-tests/resources/webidl2/test/syntax/idl/exception.widl: Removed.
* web-platform-tests/resources/webidl2/test/syntax/idl/extended-attributes.widl:
* web-platform-tests/resources/webidl2/test/syntax/idl/generic.widl:
* web-platform-tests/resources/webidl2/test/syntax/idl/identifier-qualified-names.widl:
* web-platform-tests/resources/webidl2/test/syntax/idl/indexed-properties.widl:
* web-platform-tests/resources/webidl2/test/syntax/idl/inherits-getter.widl:
* web-platform-tests/resources/webidl2/test/syntax/idl/iterable.widl:
* web-platform-tests/resources/webidl2/test/syntax/idl/legacyiterable.widl:
* web-platform-tests/resources/webidl2/test/syntax/idl/maplike.widl:
* web-platform-tests/resources/webidl2/test/syntax/idl/mixin.widl: Added.
* web-platform-tests/resources/webidl2/test/syntax/idl/overloading.widl:
* web-platform-tests/resources/webidl2/test/syntax/idl/primitives.widl:
* web-platform-tests/resources/webidl2/test/syntax/idl/promise-void.widl: Added.
* web-platform-tests/resources/webidl2/test/syntax/idl/record.widl:
* web-platform-tests/resources/webidl2/test/syntax/idl/reg-operations.widl:
* web-platform-tests/resources/webidl2/test/syntax/idl/sequence.widl:
* web-platform-tests/resources/webidl2/test/syntax/idl/serializer.widl: Removed.
* web-platform-tests/resources/webidl2/test/syntax/idl/setlike.widl:
* web-platform-tests/resources/webidl2/test/syntax/idl/stringifier.widl:
* web-platform-tests/resources/webidl2/test/syntax/idl/typedef-union.widl: Renamed from LayoutTests/imported/w3c/web-platform-tests/resources/webidl2/test/syntax/idl/typedef-union.idl.
* web-platform-tests/resources/webidl2/test/syntax/idl/typesuffixes.widl:
* web-platform-tests/resources/webidl2/test/syntax/idl/w3c-import.log:
* web-platform-tests/resources/webidl2/test/syntax/json/allowany.json:
* web-platform-tests/resources/webidl2/test/syntax/json/array.json: Removed.
* web-platform-tests/resources/webidl2/test/syntax/json/attributes.json:
* web-platform-tests/resources/webidl2/test/syntax/json/callback.json:
* web-platform-tests/resources/webidl2/test/syntax/json/caller.json: Removed.
* web-platform-tests/resources/webidl2/test/syntax/json/constants.json:
* web-platform-tests/resources/webidl2/test/syntax/json/constructor.json:
* web-platform-tests/resources/webidl2/test/syntax/json/dictionary-inherits.json:
* web-platform-tests/resources/webidl2/test/syntax/json/dictionary.json:
* web-platform-tests/resources/webidl2/test/syntax/json/documentation-dos.json:
* web-platform-tests/resources/webidl2/test/syntax/json/documentation.json:
* web-platform-tests/resources/webidl2/test/syntax/json/enum.json:
* web-platform-tests/resources/webidl2/test/syntax/json/equivalent-decl.json:
* web-platform-tests/resources/webidl2/test/syntax/json/exception-inheritance.json:
* web-platform-tests/resources/webidl2/test/syntax/json/exception.json: Removed.
* web-platform-tests/resources/webidl2/test/syntax/json/extended-attributes.json:
* web-platform-tests/resources/webidl2/test/syntax/json/generic.json:
* web-platform-tests/resources/webidl2/test/syntax/json/getter-setter.json:
* web-platform-tests/resources/webidl2/test/syntax/json/identifier-qualified-names.json:
* web-platform-tests/resources/webidl2/test/syntax/json/implements.json:
* web-platform-tests/resources/webidl2/test/syntax/json/indexed-properties.json:
* web-platform-tests/resources/webidl2/test/syntax/json/inherits-getter.json:
* web-platform-tests/resources/webidl2/test/syntax/json/interface-inherits.json:
* web-platform-tests/resources/webidl2/test/syntax/json/iterable.json:
* web-platform-tests/resources/webidl2/test/syntax/json/iterator.json:
* web-platform-tests/resources/webidl2/test/syntax/json/legacyiterable.json:
* web-platform-tests/resources/webidl2/test/syntax/json/maplike.json:
* web-platform-tests/resources/webidl2/test/syntax/json/mixin.json: Added.
* web-platform-tests/resources/webidl2/test/syntax/json/namedconstructor.json:
* web-platform-tests/resources/webidl2/test/syntax/json/namespace.json:
* web-platform-tests/resources/webidl2/test/syntax/json/nointerfaceobject.json:
* web-platform-tests/resources/webidl2/test/syntax/json/nullable.json:
* web-platform-tests/resources/webidl2/test/syntax/json/nullableobjects.json:
* web-platform-tests/resources/webidl2/test/syntax/json/operation-optional-arg.json:
* web-platform-tests/resources/webidl2/test/syntax/json/overloading.json:
* web-platform-tests/resources/webidl2/test/syntax/json/overridebuiltins.json:
* web-platform-tests/resources/webidl2/test/syntax/json/partial-interface.json:
* web-platform-tests/resources/webidl2/test/syntax/json/primitives.json:
* web-platform-tests/resources/webidl2/test/syntax/json/promise-void.json: Added.
* web-platform-tests/resources/webidl2/test/syntax/json/prototyperoot.json:
* web-platform-tests/resources/webidl2/test/syntax/json/putforwards.json:
* web-platform-tests/resources/webidl2/test/syntax/json/record.json:
* web-platform-tests/resources/webidl2/test/syntax/json/reg-operations.json:
* web-platform-tests/resources/webidl2/test/syntax/json/replaceable.json:
* web-platform-tests/resources/webidl2/test/syntax/json/sequence.json:
* web-platform-tests/resources/webidl2/test/syntax/json/serializer.json: Removed.
* web-platform-tests/resources/webidl2/test/syntax/json/setlike.json:
* web-platform-tests/resources/webidl2/test/syntax/json/static.json:
* web-platform-tests/resources/webidl2/test/syntax/json/stringifier-attribute.json:
* web-platform-tests/resources/webidl2/test/syntax/json/stringifier-custom.json:
* web-platform-tests/resources/webidl2/test/syntax/json/stringifier.json:
* web-platform-tests/resources/webidl2/test/syntax/json/treatasnull.json:
* web-platform-tests/resources/webidl2/test/syntax/json/treatasundefined.json:
* web-platform-tests/resources/webidl2/test/syntax/json/typedef-union.json:
* web-platform-tests/resources/webidl2/test/syntax/json/typedef.json:
* web-platform-tests/resources/webidl2/test/syntax/json/typesuffixes.json:
* web-platform-tests/resources/webidl2/test/syntax/json/uniontype.json:
* web-platform-tests/resources/webidl2/test/syntax/json/variadic-operations.json:
* web-platform-tests/resources/webidl2/test/syntax/json/w3c-import.log:
* web-platform-tests/resources/webidl2/test/util/acquire.js: Added.
* web-platform-tests/resources/webidl2/test/util/collect.js: Added.
* web-platform-tests/resources/webidl2/test/util/w3c-import.log: Added.
* web-platform-tests/resources/webidl2/test/w3c-import.log:
* web-platform-tests/resources/webidl2/test/web/w3c-import.log:
* web-platform-tests/resources/webidl2/test/writer.js: Added.
* web-platform-tests/resources/webidl2/w3c-import.log:
* web-platform-tests/service-workers/service-worker/interfaces-sw.https-expected.txt:
* web-platform-tests/service-workers/service-worker/interfaces-window.https-expected.txt:
* web-platform-tests/url/interfaces.any-expected.txt:
* web-platform-tests/url/interfaces.any.worker-expected.txt:
* web-platform-tests/user-timing/idlharness-expected.txt:
* web-platform-tests/web-animations/interfaces/Animation/idlharness-expected.txt:
* web-platform-tests/web-animations/interfaces/AnimationEffectTiming/idlharness-expected.txt:
* web-platform-tests/web-animations/interfaces/AnimationPlaybackEvent/idlharness-expected.txt:
* web-platform-tests/web-animations/interfaces/DocumentTimeline/idlharness-expected.txt:
* web-platform-tests/web-animations/interfaces/KeyframeEffect/idlharness-expected.txt:
* web-platform-tests/web-share/idlharness.https-expected.txt:
* web-platform-tests/webaudio/the-audio-api/the-audiobuffer-interface/idl-test-expected.txt:
* web-platform-tests/webaudio/the-audio-api/the-audiobuffer-interface/idl-test.html: Escape less-than signs.
* web-platform-tests/webaudio/the-audio-api/the-audiodestinationnode-interface/idl-test-expected.txt:
* web-platform-tests/webaudio/the-audio-api/the-audiodestinationnode-interface/idl-test.html: Escape less-than signs.
* web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/idl-test-expected.txt:
* web-platform-tests/webaudio/the-audio-api/the-delaynode-interface/idl-test-expected.txt:
* web-platform-tests/webaudio/the-audio-api/the-delaynode-interface/idl-test.html: Escape less-than signs.
* web-platform-tests/webaudio/the-audio-api/the-gainnode-interface/idl-test-expected.txt:
* web-platform-tests/webaudio/the-audio-api/the-gainnode-interface/idl-test.html: Escape less-than signs.
* web-platform-tests/workers/interfaces.worker-expected.txt:
* web-platform-tests/xhr/idlharness.any-expected.txt:
* web-platform-tests/xhr/idlharness.any.worker-expected.txt:
* web-platform-tests/xhr/interfaces-expected.txt:

LayoutTests:

Updated expectations.

* http/wpt/credential-management/idl.https-expected.txt:
* http/wpt/entries-api/interfaces-expected.txt:
* http/wpt/webauthn/idl.https-expected.txt:
* http/wpt/webauthn/idl.https.html: Fix confusion in untested IDLs.
* platform/ios-wk2/imported/w3c/web-platform-tests/web-share/idlharness.https-expected.txt:
* platform/mac/imported/w3c/web-platform-tests/media-source/interfaces-expected.txt: Removed; the platform-neutral file was updated.

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

18 months ago[WebAuthN] Polish AuthenticatorManager and rename it to AuthenticatorCoordinator
jiewen_tan@apple.com [Tue, 11 Sep 2018 07:59:20 +0000 (07:59 +0000)]
[WebAuthN] Polish AuthenticatorManager and rename it to AuthenticatorCoordinator
https://bugs.webkit.org/show_bug.cgi?id=189277
<rdar://problem/44115936>

Reviewed by Chris Dumez.

Source/WebCore:

This patch aims to polish AuthenticatorManager such that:
1) It is no longer a singleton. Instead, it will live with Page. It was a singleton simply because static
PublicKeyCredential::isUserVerifyingPlatformAuthenticatorAvailable() have to access it. However, this request
can be fulfilled by adding an attribute [CallWith=Document] to the IDL defination. Therefore, there is no
such need. Also, the singleton is illy implemented as it owns a single IPC proxy to UI Process which means
different web pages will talk to the same web page proxy. Anyway, making it live with Page should fix everything.
2) Since we are now planning to support external authenticators, the manager of all authenticators will then
have to live in UI Process which makes this AuthenticatorManager obsolete. Instead, rename it to AuthenticatorCoordinator.
3) Rename CredentialsMessenger to AuthenticatorCoordinatorClient to tight it to WebAuthN. Also, simplify the
message reply model as PublicKeyCredentialCreationOptions/PublicKeyCredentialRequestOptions =>
ExceptionData/PublicKeyCredentialData for makeCredential/getAssertion operations.
4) Restrict one request per time, i.e. makeCredential/getAssertion for a single page.
5) Unifying makeCredentialReply/getAssertionReply/exceptionReply into requestReply for IPC. Correspondingly,
unify callback and exceptionCallback into callback as well for LocalAuthenticator.
6) Enhance PublicKeyCredentialCreationOptions encoding/decoding with encoder.encodeFixedLengthData/decoder.decodeFixedLengthData.

Covered by existing tests.

* DerivedSources.make:
* Modules/credentialmanagement/CredentialsContainer.cpp:
(WebCore::CredentialsContainer::get):
(WebCore::CredentialsContainer::isCreate):
* Modules/credentialmanagement/CredentialsContainer.h:
* Modules/credentialmanagement/CredentialsMessenger.cpp: Removed.
* Modules/credentialmanagement/CredentialsMessenger.h: Removed.
* Modules/webauthn/AuthenticatorAssertionResponse.cpp: Removed.
* Modules/webauthn/AuthenticatorAssertionResponse.h:
(WebCore::AuthenticatorAssertionResponse::create):
(WebCore::AuthenticatorAssertionResponse::authenticatorData const):
(WebCore::AuthenticatorAssertionResponse::signature const):
(WebCore::AuthenticatorAssertionResponse::userHandle const):
(WebCore::AuthenticatorAssertionResponse::AuthenticatorAssertionResponse):
* Modules/webauthn/AuthenticatorAttestationResponse.cpp: Removed.
* Modules/webauthn/AuthenticatorAttestationResponse.h:
(WebCore::AuthenticatorAttestationResponse::create):
(WebCore::AuthenticatorAttestationResponse::attestationObject const):
(WebCore::AuthenticatorAttestationResponse::AuthenticatorAttestationResponse):
* Modules/webauthn/AuthenticatorCoordinator.cpp: Renamed from Source/WebCore/Modules/webauthn/AuthenticatorManager.cpp.
(WebCore::AuthenticatorCoordinatorInternal::produceClientDataJson):
(WebCore::AuthenticatorCoordinatorInternal::produceClientDataJsonHash):
(WebCore::AuthenticatorCoordinatorInternal::initTimeoutTimer):
(WebCore::AuthenticatorCoordinatorInternal::didTimeoutTimerFire):
(WebCore::AuthenticatorCoordinator::AuthenticatorCoordinator):
(WebCore::AuthenticatorCoordinator::setClient):
(WebCore::AuthenticatorCoordinator::create const):
(WebCore::AuthenticatorCoordinator::discoverFromExternalSource const):
(WebCore::AuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable const):
* Modules/webauthn/AuthenticatorCoordinator.h: Renamed from Source/WebCore/Modules/webauthn/AuthenticatorManager.h.
* Modules/webauthn/AuthenticatorCoordinatorClient.cpp: Added.
(WebCore::AuthenticatorCoordinatorClient::~AuthenticatorCoordinatorClient):
(WebCore::AuthenticatorCoordinatorClient::requestReply):
(WebCore::AuthenticatorCoordinatorClient::isUserVerifyingPlatformAuthenticatorAvailableReply):
(WebCore::AuthenticatorCoordinatorClient::setRequestCompletionHandler):
(WebCore::AuthenticatorCoordinatorClient::addQueryCompletionHandler):
* Modules/webauthn/AuthenticatorCoordinatorClient.h: Copied from Source/WebKit/UIProcess/CredentialManagement/WebCredentialsMessengerProxy.h.
* Modules/webauthn/AuthenticatorResponse.cpp: Removed.
* Modules/webauthn/AuthenticatorResponse.h:
(WebCore::AuthenticatorResponse::AuthenticatorResponse):
(WebCore::AuthenticatorResponse::clientDataJSON const):
* Modules/webauthn/PublicKeyCredential.cpp:
(WebCore::PublicKeyCredential::create):
(WebCore::PublicKeyCredential::tryCreate):
(WebCore::PublicKeyCredential::PublicKeyCredential):
(WebCore::PublicKeyCredential::isUserVerifyingPlatformAuthenticatorAvailable):
* Modules/webauthn/PublicKeyCredential.h:
* Modules/webauthn/PublicKeyCredential.idl:
* Modules/webauthn/PublicKeyCredentialCreationOptions.h:
(WebCore::PublicKeyCredentialCreationOptions::encode const):
(WebCore::PublicKeyCredentialCreationOptions::decode):
* Modules/webauthn/PublicKeyCredentialData.h: Added.
(WebCore::PublicKeyCredentialData::encode const):
(WebCore::PublicKeyCredentialData::decode):
* Modules/webauthn/cocoa/LocalAuthenticator.h:
* Modules/webauthn/cocoa/LocalAuthenticator.mm:
(WebCore::LocalAuthenticator::makeCredential):
(WebCore::LocalAuthenticator::getAssertion):
* Modules/webvr/VRStageParameters.cpp:
Add a header file to prevent linkage error.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* page/Page.cpp:
* page/Page.h:
(WebCore::Page::authenticatorCoordinator const):
* page/PageConfiguration.cpp:
* page/PageConfiguration.h:
* testing/Internals.cpp:
(WebCore::Internals::Internals):
(WebCore::Internals::mockAuthenticatorCoordinator const):
(WebCore::Internals::mockCredentialsMessenger const): Deleted.
* testing/Internals.h:
* testing/Internals.idl:
* testing/MockAuthenticatorCoordinator.cpp: Added.
(WebCore::MockAuthenticatorCoordinator::setCreationReturnBundle):
(WebCore::MockAuthenticatorCoordinator::setAssertionReturnBundle):
(WebCore::MockAuthenticatorCoordinator::makeCredential):
(WebCore::MockAuthenticatorCoordinator::getAssertion):
(WebCore::MockAuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable):
* testing/MockAuthenticatorCoordinator.h: Renamed from Source/WebCore/testing/MockCredentialsMessenger.h.
* testing/MockAuthenticatorCoordinator.idl: Renamed from Source/WebCore/testing/MockCredentialsMessenger.idl.
* testing/MockCredentialsMessenger.cpp: Removed.

Source/WebKit:

* DerivedSources.make:
* SourcesCocoa.txt:
* UIProcess/CredentialManagement/WebCredentialsMessengerProxy.cpp: Removed.
* UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp: Added.
(WebKit::WebAuthenticatorCoordinatorProxy::WebAuthenticatorCoordinatorProxy):
(WebKit::WebAuthenticatorCoordinatorProxy::~WebAuthenticatorCoordinatorProxy):
(WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
(WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
(WebKit::WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailable):
(WebKit::WebAuthenticatorCoordinatorProxy::requestReply):
(WebKit::WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailableReply):
* UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h: Renamed from Source/WebKit/UIProcess/CredentialManagement/WebCredentialsMessengerProxy.h.
* UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.messages.in: Renamed from Source/WebKit/UIProcess/CredentialManagement/WebCredentialsMessengerProxy.messages.in.
* UIProcess/WebPageProxy.cpp:
(WebKit::m_resetRecentCrashCountTimer):
(WebKit::WebPageProxy::reattachToWebProcess):
* UIProcess/WebPageProxy.h:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/CredentialManagement/WebCredentialsMessenger.cpp: Removed.
* WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp: Added.
(WebKit::WebAuthenticatorCoordinator::WebAuthenticatorCoordinator):
(WebKit::WebAuthenticatorCoordinator::~WebAuthenticatorCoordinator):
(WebKit::WebAuthenticatorCoordinator::makeCredential):
(WebKit::WebAuthenticatorCoordinator::getAssertion):
(WebKit::WebAuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable):
* WebProcess/WebAuthentication/WebAuthenticatorCoordinator.h: Renamed from Source/WebKit/WebProcess/CredentialManagement/WebCredentialsMessenger.h.
* WebProcess/WebAuthentication/WebAuthenticatorCoordinator.messages.in: Renamed from Source/WebKit/WebProcess/CredentialManagement/WebCredentialsMessenger.messages.in.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_cpuLimit):
(WebKit::m_credentialsMessenger): Deleted.
* WebProcess/WebPage/WebPage.h:

Tools:

* TestWebKitAPI/Tests/ios/LocalAuthenticator.mm:
(TestWebKitAPI::TEST):

LayoutTests:

* http/wpt/credential-management/credentialscontainer-store-basics.https.html:
* http/wpt/webauthn/idl.https.html:
* http/wpt/webauthn/public-key-credential-create-failure.https.html:
* http/wpt/webauthn/public-key-credential-create-success.https.html:
* http/wpt/webauthn/public-key-credential-get-failure.https.html:
* http/wpt/webauthn/public-key-credential-get-success.https.html:
* http/wpt/webauthn/public-key-is-user-verifying-platform-authenticator-available.html:

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

18 months agoUnreviewed, add yet another email address to the collection.
rwlbuis@webkit.org [Tue, 11 Sep 2018 07:10:35 +0000 (07:10 +0000)]
Unreviewed, add yet another email address to the collection.

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

18 months agoRemove unused needsDestruction class variables from HashTraits
Hironori.Fujii@sony.com [Tue, 11 Sep 2018 05:18:31 +0000 (05:18 +0000)]
Remove unused needsDestruction class variables from HashTraits
https://bugs.webkit.org/show_bug.cgi?id=189490

Reviewed by Daniel Bates.

Source/WebCore:

needsDestruction has been obsoleted in Bug 121983.

No new tests (No behavior change).

* css/makeprop.pl: Removed needsDestruction.
* platform/graphics/FloatSizeHash.h: Ditto.
* platform/graphics/IntPointHash.h: Ditto.
* platform/graphics/IntRectHash.h: Ditto.
* platform/graphics/IntSizeHash.h: Ditto.
* platform/graphics/WidthCache.h: Ditto.

Source/WebKitLegacy/mac:

* History/BinaryPropertyList.cpp: Removed needsDestruction.

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

18 months agoTest262 failure with Named Capture Groups - using a reference before the group is...
msaboff@apple.com [Tue, 11 Sep 2018 04:53:56 +0000 (04:53 +0000)]
Test262 failure with Named Capture Groups - using a reference before the group is defined
https://bugs.webkit.org/show_bug.cgi?id=189407

Reviewed by Alex Christensen.

JSTests:

Re-enabled previously failing test.

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

Source/JavaScriptCore:

Added code to save the named forward references we see during parsing and validating that
they are all present when parsing the RegExp is complete.  If there are unnamed references,
we reparse with some variation of behavior.  Just like for numeric references, the
behavior is different depending on whether or not the unicode (u flag) is present.
For non-unicode patterns, we treat the \k<...> as a literal pattern.  For a unicode
pattern we throw an exception.

Did some refactoring, renaming YarrPattern::reset() and YarrPatternConstructor::reset()
resetForReparsing() as that is the only use for those methods.  Also changed
all the delegate methods that take a String to take a const String& to eliminate
copy churn.

* yarr/YarrParser.h:
(JSC::Yarr::Parser::CharacterClassParserDelegate::atomNamedBackReference):
(JSC::Yarr::Parser::CharacterClassParserDelegate::isValidNamedForwardReference):
(JSC::Yarr::Parser::CharacterClassParserDelegate::atomNamedForwardReference):
(JSC::Yarr::Parser::parseEscape):
* yarr/YarrPattern.cpp:
(JSC::Yarr::YarrPatternConstructor::resetForReparsing):
(JSC::Yarr::YarrPatternConstructor::saveUnmatchedNamedForwardReferences):
(JSC::Yarr::YarrPatternConstructor::atomNamedBackReference):
(JSC::Yarr::YarrPatternConstructor::isValidNamedForwardReference):
(JSC::Yarr::YarrPatternConstructor::atomNamedForwardReference):
(JSC::Yarr::YarrPattern::compile):
(JSC::Yarr::YarrPatternConstructor::reset): Deleted.
* yarr/YarrPattern.h:
(JSC::Yarr::YarrPattern::resetForReparsing):
(JSC::Yarr::YarrPattern::containsIllegalNamedForwardReferences):
(JSC::Yarr::YarrPattern::reset): Deleted.
* yarr/YarrSyntaxChecker.cpp:
(JSC::Yarr::SyntaxChecker::atomNamedBackReference):
(JSC::Yarr::SyntaxChecker::isValidNamedForwardReference):
(JSC::Yarr::SyntaxChecker::atomNamedForwardReference):

Source/WebCore:

Created new delegate stubs for RegExp parsing.  These are not needed for the URL filtering
use cases.  Also changed all the delegate methods that take a String to take
const String& to eliminate copy churn.

Updated TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp.

* contentextensions/URLFilterParser.cpp:
(WebCore::ContentExtensions::PatternParser::atomNamedBackReference):
(WebCore::ContentExtensions::PatternParser::isValidNamedForwardReference):
(WebCore::ContentExtensions::PatternParser::atomNamedForwardReference):
(WebCore::ContentExtensions::URLFilterParser::statusString):
* contentextensions/URLFilterParser.h:

Tools:

Updated test.

* TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp:
(TestWebKitAPI::TEST_F):

LayoutTests:

Updated tests.

* js/regexp-named-capture-groups-expected.txt:
* js/script-tests/regexp-named-capture-groups.js:

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

18 months agoUpdate shadow DOM and custom elements tests
rniwa@webkit.org [Tue, 11 Sep 2018 03:59:41 +0000 (03:59 +0000)]
Update shadow DOM and custom elements tests
https://bugs.webkit.org/show_bug.cgi?id=189494

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Re-imported WPT tests for shadow DOM and custom elements.

* resources/import-expectations.json:
* web-platform-tests/custom-elements/range-and-constructors-expected.txt: Added.
* web-platform-tests/custom-elements/range-and-constructors.html: Added.
* web-platform-tests/custom-elements/w3c-import.log:
* web-platform-tests/shadow-dom/Document-prototype-currentScript-expected.txt:
* web-platform-tests/shadow-dom/Document-prototype-currentScript.html:
* web-platform-tests/shadow-dom/DocumentOrShadowRoot-prototype-elementFromPoint-expected.txt: Added.
* web-platform-tests/shadow-dom/DocumentOrShadowRoot-prototype-elementFromPoint.html: Added.
* web-platform-tests/shadow-dom/Element-interface-attachShadow-custom-element-expected.txt: Added.
* web-platform-tests/shadow-dom/Element-interface-attachShadow-custom-element.html: Added.
* web-platform-tests/shadow-dom/Element-interface-attachShadow-expected.txt:
* web-platform-tests/shadow-dom/Element-interface-attachShadow.html:
* web-platform-tests/shadow-dom/Extensions-to-Event-Interface-expected.txt:
* web-platform-tests/shadow-dom/Extensions-to-Event-Interface.html:
* web-platform-tests/shadow-dom/OWNERS: Removed.
* web-platform-tests/shadow-dom/directionality-001.tentative-expected.html: Added.
* web-platform-tests/shadow-dom/directionality-001.tentative.html: Added.
* web-platform-tests/shadow-dom/event-composed-path-after-dom-mutation-expected.txt: Added.
* web-platform-tests/shadow-dom/event-composed-path-after-dom-mutation.html: Added.
* web-platform-tests/shadow-dom/form-control-form-attribute-expected.txt: Added.
* web-platform-tests/shadow-dom/form-control-form-attribute.html: Added.
* web-platform-tests/shadow-dom/getElementById-dynamic-001-expected.txt: Added.
* web-platform-tests/shadow-dom/getElementById-dynamic-001.html: Added.
* web-platform-tests/shadow-dom/input-element-list-expected.txt: Added.
* web-platform-tests/shadow-dom/input-element-list.html: Added.
* web-platform-tests/shadow-dom/layout-slot-no-longer-assigned-expected.html: Added.
* web-platform-tests/shadow-dom/layout-slot-no-longer-assigned.html: Added.
* web-platform-tests/shadow-dom/layout-slot-no-longer-fallback-expected.html: Added.
* web-platform-tests/shadow-dom/layout-slot-no-longer-fallback.html: Added.
* web-platform-tests/shadow-dom/leaktests/get-elements-expected.txt:
* web-platform-tests/shadow-dom/leaktests/get-elements.html:
* web-platform-tests/shadow-dom/leaktests/w3c-import.log:
* web-platform-tests/shadow-dom/resources/event-path-test-helpers.js:
(dispatchEventWithEventLog):
* web-platform-tests/shadow-dom/resources/shadow-dom-utils.js:
* web-platform-tests/shadow-dom/resources/w3c-import.log:
* web-platform-tests/shadow-dom/w3c-import.log:

LayoutTests:

Skip the test hitting a debug assertion until the bug 189493 is fixed.

* TestExpectations:

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

18 months agoUnreviewed, fix ProcessSwap API tests after r235867.
cdumez@apple.com [Tue, 11 Sep 2018 01:35:44 +0000 (01:35 +0000)]
Unreviewed, fix ProcessSwap API tests after r235867.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::exitAcceleratedCompositingMode):
Add null-check for drawing area.

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

18 months ago[WHLSL] Inlining should be optional
commit-queue@webkit.org [Tue, 11 Sep 2018 01:25:13 +0000 (01:25 +0000)]
[WHLSL] Inlining should be optional
https://bugs.webkit.org/show_bug.cgi?id=188641

Patch by Thomas Denney <tdenney@apple.com> on 2018-09-10
Reviewed by Myles C. Maxfield.

Inlining functions is now optional, and disabled by default. This patch
additionally resolves https://bugs.webkit.org/show_bug.cgi?id=189326 as
the code for calling functions was completely rewritten.

* WebGPUShadingLanguageRI/All.js: Add LateCheckAndLayoutBuffers.js
* WebGPUShadingLanguageRI/CallFunction.js:
(callFunction): Remove dependency on inlining.
* WebGPUShadingLanguageRI/Evaluator.js:
(Evaluator.prototype._snapshot): Allow null srcPtr in the case of void
returns from functions.
(Evaluator.prototype._evaluateArguments): Abstract out argument
evaluation, ensuring that the order is right-to-left for
FunctionLikeBlocks (i.e. inlined functions) and regular calls.
(Evaluator.prototype._evaluateFunction): Abstracted out function body
evaluation for inlined and non-inlined functions.
(Evaluator.prototype.visitFunctionLikeBlock): Ditto.
(Evaluator.prototype.visitCallExpression): Ditto.
* WebGPUShadingLanguageRI/Inline.js:
(_inlineFunction): Moved logic that is needed regardless of inlining
into LateCheckAndLayoutBuffers.js
(resolveInlinedFunction): Deleted.
* WebGPUShadingLanguageRI/LateCheckAndLayoutBuffers.js: Moved logic for
late checking.
* WebGPUShadingLanguageRI/Prepare.js: Make inlining optional and off by
default.
* WebGPUShadingLanguageRI/SPIRV.html: Update include.
* WebGPUShadingLanguageRI/Test.html: Ditto.
* WebGPUShadingLanguageRI/Test.js: Right-to-left argument evaluation,
and inlining tests.
* WebGPUShadingLanguageRI/index.html: Update include.

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

18 months ago[iOS] Unable to change the value of select elements while preserving focus state
wenson_hsieh@apple.com [Tue, 11 Sep 2018 01:18:05 +0000 (01:18 +0000)]
[iOS] Unable to change the value of select elements while preserving focus state
https://bugs.webkit.org/show_bug.cgi?id=189475
<rdar://problem/41125764>

Reviewed by Tim Horton.

Source/WebKit:

With UITextInputMultiDocument support in WebKit (r226911), WKContentView may enter a state where the user is
able to interact with web content, but focus state is being preserved on WKWebView. This prevents keyboard and
input view dismissal from blurring the focused element (which, in turn, means that the value of certain form
controls, such as select elements, cannot be changed). This can happen in the following scenario:

1. Suppose we have a web view embedded inside of a view controller (let's call it `A`).
2. Another view controller (let's call this one `B`) is modally presented over `A`.
3. The web view is removed from `A`'s view hierarchy and reparented under `B`'s view.
4. The user taps a form control in the web view, interacts with the keyboard, and taps the Done button.

After step 2, WKContentView gets a call to `-_preserveFocusWithToken:destructively:`, which increments its focus
retain count to 1. Thus, in step 3, resigning first responder using the Done button fails to blur the element.
To fix this, we split the existing `_activeFocusedStateRetainCount` into two values: `_focusPreservationCount`,
which is safe to reset and resets to 0 when changing the focused element, and `_activeFocusedStateRetainCount`,
which always increments and decrements, and only does so when using `-_retainActiveFocusedState`.

This also fixes a bug wherein `-_restoreFocusWithToken:` is implemented as returning `void` in WebKit, even
though its declaration in UIKit returns a `BOOL`. UIKit currently calls this selector on WKContentView and
stores the result within a `BOOL`; this results in the return value of `-_restoreFocusWithToken:` effectively
becoming the last byte of the most recent value stored in `$rax` when exiting `-_restoreFocusWithToken:`. From
debugging a release build of WebKit, this turns out to just be 0x0, becoming NO, which is correct given that
WKContentView does not attempt to become first responder within `_restoreFocusWithToken:`.

Tests:  FocusPreservationTests.PreserveAndRestoreFocus
        FocusPreservationTests.ChangingFocusedNodeResetsFocusPreservationState

* Platform/spi/ios/UIKitSPI.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _incrementFocusPreservationCount]):
(-[WKWebView _decrementFocusPreservationCount]):
(-[WKWebView _resetFocusPreservationCount]):
(-[WKWebView _isRetainingActiveFocusedState]):

Active focus state is retained if either the focus preservation count or active focus state count is non-zero.
Splitting this into two variables ensures that SPI clients of `-_retainActiveFocusedState` won't have active
focus state reset from underneath them, and additionally prevents WKContentView from retaining active focus due
to UITextInputMultiDocument protocol methods while the user is still interacting with it.

* UIProcess/API/Cocoa/WKWebViewInternal.h:

Move _activeFocusedStateRetainCount to the implementation of WKContentView; instead of directly manipulating the
variable, add helper methods to increment, decrement, or reset the focus preservation count.

* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::isViewWindowActive):
(WebKit::PageClientImpl::isViewFocused):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView resignFirstResponderForWebView]):
(-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):

Reset the focus preservation count.

(-[WKContentView addFocusedFormControlOverlay]):
(-[WKContentView removeFocusedFormControlOverlay]):

Use `-_retainActiveFocusedState` instead of incrementing and decrementing the counter directly.

(-[WKContentView _restoreFocusWithToken:]):
(-[WKContentView _preserveFocusWithToken:destructively:]):

Use `_incrementFocusPreservationCount` and `_decrementFocusPreservationCount` instead of manipulating counter
variables directly.

Tools:

Adds a pair of new API tests to verify that (1) resigning first responder while preserving focus does not blur
the focused element, and (2) if another element is focused and presents an input view while preserving focus,
then we reset preservation state and allow first responder resignation to blur the focused element.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/ios/FocusPreservationTests.mm: Added.
(webViewForTestingFocusPreservation):
(TestWebKitAPI::TEST):
* TestWebKitAPI/cocoa/TestWKWebView.h:
* TestWebKitAPI/cocoa/TestWKWebView.mm:
(-[TestWKWebView textInputContentView]):
* TestWebKitAPI/ios/UIKitSPI.h:

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

18 months agoCorrectly interpret from angle for conic gradients
megan_gardner@apple.com [Tue, 11 Sep 2018 00:51:42 +0000 (00:51 +0000)]
Correctly interpret from angle for conic gradients
https://bugs.webkit.org/show_bug.cgi?id=189445

Reviewed by Simon Fraser

No new tests, no functionality is changing.

Just renaming angle to angleRadians to make the type more clear,
and hopefully avoid bugs in the future. Update patch to original bug
fix.

* css/CSSGradientValue.cpp:
(WebCore::CSSConicGradientValue::createGradient):
* inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::buildArrayForCanvasGradient):
* platform/graphics/Gradient.cpp:
(WebCore::Gradient::hash const):
* platform/graphics/Gradient.h:
* platform/graphics/cg/GradientCG.cpp:
(WebCore::Gradient::paint):

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

18 months agoRevert the errornous change to the test in r235864.
rniwa@webkit.org [Tue, 11 Sep 2018 00:44:15 +0000 (00:44 +0000)]
Revert the errornous change to the test in r235864.

* web-platform-tests/shadow-dom/Extensions-to-Event-Interface.html: Replaced with LayoutTests/imported/w3c/web-platform-tests/shadow-dom/Extensions-to-Event-Interface.html.

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

18 months ago[WHLSL] Add the test shader type
commit-queue@webkit.org [Tue, 11 Sep 2018 00:31:23 +0000 (00:31 +0000)]
[WHLSL] Add the test shader type
https://bugs.webkit.org/show_bug.cgi?id=189484

Patch by Thomas Denney <tdenney@apple.com> on 2018-09-10
Reviewed by Myles C. Maxfield.

Tests are now precedeed by the 'test' keyword so that they are treated
as entry points, in the same way as vertex and fragment shaders.

* WebGPUShadingLanguageRI/LateChecker.js:
(LateChecker.prototype._checkShaderType): Allow tests to return any
type, as some currently return void/pointer types.
* WebGPUShadingLanguageRI/Parse.js:
(parseFuncDecl): Add the test keyword.
* WebGPUShadingLanguageRI/Test.js: Prepend 'test' to every single test.

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

18 months agoRebaseline test after https://trac.webkit.org/changeset/235866/webkit.
tsavell@apple.com [Mon, 10 Sep 2018 23:54:51 +0000 (23:54 +0000)]
Rebaseline test after https://trac.webkit.org/changeset/235866/webkit.
https://bugs.webkit.org/show_bug.cgi?id=189178.

Unreviewed Test Gardening.

* platform/mac-highsierra/fast/css/apple-system-control-colors-expected.txt:

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

18 months agoWeb Inspector: Address some ESLint warnings
joepeck@webkit.org [Mon, 10 Sep 2018 23:47:05 +0000 (23:47 +0000)]
Web Inspector: Address some ESLint warnings
https://bugs.webkit.org/show_bug.cgi?id=188824

Reviewed by Matt Baker.

* .eslintrc:
* UserInterface/Base/Platform.js:
* UserInterface/Controllers/AuditManager.js:
* UserInterface/Controllers/BasicBlockAnnotator.js:
* UserInterface/Controllers/CallFrameTreeController.js:
* UserInterface/Controllers/HARBuilder.js:
* UserInterface/Models/AuditReport.js:
* UserInterface/Models/AuditResult.js:
* UserInterface/Models/AuditTestCase.js:
* UserInterface/Models/AuditTestSuite.js:
* UserInterface/Models/Cookie.js:
* UserInterface/Models/SourceCodePosition.js:
* UserInterface/Test/FrontendTestHarness.js:
* UserInterface/Test/TestSuite.js:
* UserInterface/Views/CanvasContentView.js:
* UserInterface/Views/CollectionContentView.js:
* UserInterface/Views/ContentBrowser.js:
* UserInterface/Views/CookieStorageContentView.js:
* UserInterface/Views/DataGrid.js:
* UserInterface/Views/DatabaseTableContentView.js:
* UserInterface/Views/FindBanner.js:
* UserInterface/Views/JSONResourceContentView.js:
* UserInterface/Views/LogContentView.js:
* UserInterface/Views/ResourceSidebarPanel.js:
* UserInterface/Views/SourceCodeTextEditor.js:
* UserInterface/Views/SpreadsheetTextField.js:
* UserInterface/Workers/Formatter/FormatterUtilities.js:

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

18 months agoMake it easier to build for SDK_VARIANT=iosmac
timothy_horton@apple.com [Mon, 10 Sep 2018 23:24:45 +0000 (23:24 +0000)]
Make it easier to build for SDK_VARIANT=iosmac
https://bugs.webkit.org/show_bug.cgi?id=189488
<rdar://problem/38254840>

Reviewed by Wenson Hsieh.

* Makefile:
* Makefile.shared:
* Source/Makefile:
Set a variety of build flags (disable libwebrtc, tools, and set
SDK_VARIANT and WK_ALTERNATE_FRAMEWORKS_DIR).

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

18 months agoUnreviewed test gardening, rebaseline fast/events/ios/keyup.html after r235818.
ryanhaddad@apple.com [Mon, 10 Sep 2018 23:15:32 +0000 (23:15 +0000)]
Unreviewed test gardening, rebaseline fast/events/ios/keyup.html after r235818.

* fast/events/ios/keyup-expected.txt:

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

18 months agoLong press on picture/link show menu obscured by keyboard.
commit-queue@webkit.org [Mon, 10 Sep 2018 22:59:16 +0000 (22:59 +0000)]
Long press on picture/link show menu obscured by keyboard.
https://bugs.webkit.org/show_bug.cgi?id=189114.

Patch by James Savage <james.savage@apple.com> on 2018-09-10
Reviewed by Megan Gardner.

Use the visible bounds of the window, not the full bounds, when deciding if
an element's rect takes up too much screen space to present from. This factors
in occlusion of the window by the keyboard, bars, and other overlapping content.

If possible, it would be nice to only account for overlapping geometry which a
popover would avoid, but that information is not available. This approach will
produce some false positives in favor of the "from touch" style, but those are
still better than getting an unusably small action sheet.

* UIProcess/ios/WKActionSheetAssistant.h:
* UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant showImageSheet]): Use new helper method for style.
(-[WKActionSheetAssistant showLinkSheet]): Ditto.
(-[WKActionSheetAssistant _presentationStyleForPositionInfo:elementInfo:]):
Query new delegate method to figure out the unobscured rect of the window. This
information only exists on WKScrollView, so we have to ask for it. If this method
is not implemented, fall back to the current approach of assuming the full window
bounds are available.
(presentationStyleForView): Deleted. Replaced by instance method.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView unoccludedWindowBoundsForActionSheetAssistant:]):
Calculate the unoccluded rect using -[UIScrollView adjustedContentInset], which
factors in client specified insets and system insets (such as the keyboard).

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

18 months agoontrack events should be fired even if an existing transceiver exists
youenn@apple.com [Mon, 10 Sep 2018 22:47:09 +0000 (22:47 +0000)]
ontrack events should be fired even if an existing transceiver exists
https://bugs.webkit.org/show_bug.cgi?id=189477

Reviewed by Eric Carlson.

Source/WebCore:

In case of an OnTrack callback from libwebrtc, make sure the ontrack event is called even if a transceiver already exists for that track.

Covered by updated video-addTransceiver.html
New test video-addLegacyTransceiver.html keeps testing the old transceiver behavior.
Test: webrtc/video-addLegacyTransceiver.html

* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::newTransceiver):

LayoutTests:

* webrtc/video-addLegacyTransceiver-expected.txt: Added.
* webrtc/video-addLegacyTransceiver.html: Copied from LayoutTests/webrtc/video-addTransceiver.html.
* webrtc/video-addTransceiver.html:

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

18 months agoCorrectly interpret from angle for conic gradients
megan_gardner@apple.com [Mon, 10 Sep 2018 22:23:05 +0000 (22:23 +0000)]
Correctly interpret from angle for conic gradients
https://bugs.webkit.org/show_bug.cgi?id=189445
<rdar://problem/44158271>

Reviewed by Tim Horton.

Source/WebCore:

Test: fast/gradients/conic-from-angle.html

We were pulling the angle as degrees when we really need radians.

* css/CSSGradientValue.cpp:
(WebCore::CSSConicGradientValue::createGradient):

LayoutTests:

Adding a test for a conic gradient that starts at an angle.
Cover the edges because triangles and conic gradients aren't rendered
exactly the same.

* TestExpectations:
* fast/gradients/conic-from-angle-expected.html: Added.
* fast/gradients/conic-from-angle.html: Added.
* platform/ios-12/TestExpectations:
* platform/mac/TestExpectations:

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

18 months agoRegression(PSON): WebView is blank when navigating back cross-process on iOS
cdumez@apple.com [Mon, 10 Sep 2018 22:17:58 +0000 (22:17 +0000)]
Regression(PSON): WebView is blank when navigating back cross-process on iOS
https://bugs.webkit.org/show_bug.cgi?id=189481
<rdar://problem/44315010>

Reviewed by Tim Horton.

When process swapping on navigation, the WebPageProxy would detach from the old WebProcess and destroy
its RemoteLayerTreeDrawingAreaProxy. It would then create a new process and a new RemoteLayerTreeDrawingAreaProxy
to listen for IPC from this new process. When navigating back to the original process, we would do the
same in the opposite direction. However, the issue was that the old WebProcess's WebPage would not destroy its
drawing area and some state would persist and cause issues. For example, the DrawingArea would send a
CommitLayerTree IPC to the UIProcess and set m_waitingForBackingStoreSwap to true. It normally resets
m_waitingForBackingStoreSwap to false when getting the DidUpdate IPC from the UIProcess. However, when the
WebPage is detached from its WebPageProxy (i.e. suspended due to PSON), the UIProcess would not respond to
IPC from the old WebProcess and m_waitingForBackingStoreSwap would never get reset.

* UIProcess/SuspendedPageProxy.cpp:
(WebKit::SuspendedPageProxy::~SuspendedPageProxy):
Make sure we send the SetIsSuspended IPC to the WebProcess with false value when
the SuspendedPageProxy gets destroyed, so that the WebProcess can update its
m_isSuspended flag. Previous, it was set to true when constructing the
SuspendedPageProxy but never reset to false.

* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::invalidateContentsAndRootView):
(WebKit::WebChromeClient::invalidateContentsForSlowScroll):
Add null checks for the drawing area now that it can be null while suspended.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::reinitializeWebPage):
When a WebPage gets reattached to a WebPageProxy, this method is called. Since we now
destroy the drawing area upon suspension (WebPage gets detached from WebPageProxy), we
need to make sure we recreate the drawing area when reattaching.

(WebKit::WebPage::setIsSuspended):
Destroy the drawing area when the WebPage is suspended, meaning that this WebPage
is no longer associated with a WebPageProxy.

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

18 months agoExpose -apple-system-container-border color to internal web views.
commit-queue@webkit.org [Mon, 10 Sep 2018 22:16:35 +0000 (22:16 +0000)]
Expose -apple-system-container-border color to internal web views.
https://bugs.webkit.org/show_bug.cgi?id=189178.

Patch by James Savage <james.savage@apple.com> on 2018-09-10
Reviewed by Timothy Hatcher.

Source/WebCore:

Tests: LayoutTests/fast/css/apple-system-colors.html

* css/CSSValueKeywords.in: Add new semantic color name.
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::systemColor const): Use system color on supported
systems, and fall back to approximation for older systems.

Source/WebCore/PAL:

* pal/spi/cocoa/NSColorSPI.h: Declare SPI.

LayoutTests:

* fast/css/apple-system-control-colors-expected.txt:
* fast/css/apple-system-control-colors.html:
* platform/mac-highsierra/fast/css/apple-system-control-colors-expected.txt:
* platform/mac-sierra/fast/css/apple-system-control-colors-expected.txt:
* platform/mac/fast/css/apple-system-control-colors-expected.txt:

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

18 months agomouseenter and mouseleave events don't get dispatched even when there is a capturing...
rniwa@webkit.org [Mon, 10 Sep 2018 21:54:14 +0000 (21:54 +0000)]
mouseenter and mouseleave events don't get dispatched even when there is a capturing event listener for a slot ancestor
https://bugs.webkit.org/show_bug.cgi?id=188561

Reviewed by Darin Adler.

Source/WebCore:

This patch makes mouseenter and mouseleave events to work with shadow trees and slots therein, and makes them uncomposed
as discussed in https://github.com/w3c/uievents/issues/208.

This patch also makes these events dispatched on DOM tree ancestors of the currently hovered element instead of
render tree's hover ancestors to be consistent with the check in hierarchyHasCapturingEventListeners and other browsers.
In particular, using hover ancestors is problematic when there is an element with display: contents such as slot elements,
which do not have a render object.

Tests: fast/shadow-dom/mouseenter-mouseleave-across-shadow-boundary.html
       fast/shadow-dom/mouseenter-mouseleave-inside-shadow-tree.html
       fast/shadow-dom/mouseenter-mouseleave-on-slot-parent.html

* dom/MouseEvent.cpp:
(WebCore::MouseEvent::create):
* page/EventHandler.cpp:
(WebCore::nearestCommonHoverAncestor): Deleted.
(WebCore::hierarchyHasCapturingEventListeners): Use parentInComposedTree. Else we would miss capturing event listeners
on inclusive ancestors of slots.
(WebCore::EventHandler::updateMouseEventTargetNode): Use the composed tree's ancestor chain to fire mouseenter and
mouseleave events. This is needed to dispatch mouseenter / mouseleave events on slot elements. Also removed comments
which just state what is self-evident from the code beneath them.

LayoutTests:

Added tests for listening to mouseenter and mouseleave events using capturing and bubbling event listeners
across shadow boundaries.

* fast/shadow-dom/mouseenter-mouseleave-across-shadow-boundary-expected.txt: Added.
* fast/shadow-dom/mouseenter-mouseleave-across-shadow-boundary.html: Added.
* fast/shadow-dom/mouseenter-mouseleave-inside-shadow-tree-expected.txt: Added.
* fast/shadow-dom/mouseenter-mouseleave-inside-shadow-tree.html: Added.
* fast/shadow-dom/mouseenter-mouseleave-on-slot-parent-expected.txt: Added.
* fast/shadow-dom/mouseenter-mouseleave-on-slot-parent.html: Added.
* platform/ios/TestExpectations: Skip the new tests since mouse events aren't supported on iOS.

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

18 months agoRemove isOrphan check in ShadowRoot::setInnerHTML
rniwa@webkit.org [Mon, 10 Sep 2018 21:48:55 +0000 (21:48 +0000)]
Remove isOrphan check in ShadowRoot::setInnerHTML
https://bugs.webkit.org/show_bug.cgi?id=189449

Reviewed by Darin Adler.

Removed isOrphan() check in ShadowRoot::setInnerHTML needed for webkit.org/b/88834.

The only reason this check was kept in the code was because the fix for V8 couldn't be landed
due to a perf regression but V8 binding isn't even a thing in WebKit anymore.

* dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::setInnerHTML):
* dom/ShadowRoot.h:

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

18 months agoMany textarea tests leak documents because Document::removeFocusNavigationNodeOfSubtr...
simon.fraser@apple.com [Mon, 10 Sep 2018 21:42:45 +0000 (21:42 +0000)]
Many textarea tests leak documents because Document::removeFocusNavigationNodeOfSubtree() can trigger a Document retain cycle
https://bugs.webkit.org/show_bug.cgi?id=188722

Reviewed by Ryosuke Niwa.

Fix a retain cycle created when Document::adjustFocusNavigationNodeOnNodeRemoval() sets
m_focusNavigationStartingNode to itself. m_focusNavigationStartingNode is a Node* (not sure why it's not an Element*),
making it possible to assign the Document to it, which creates a reference to the document which prevents
Document::removedLastRef() ever running and doing the necessary cleanup.

Fix by setting m_focusNavigationStartingNode to null if code tries to set it to the Document. This can happen
when an element is focused and the page calls document.write(), which removes all children.

Will be tested by future leak testing. Fixes the document leak in at least the following tests:
  fast/forms/append-children-during-form-submission.html
  fast/forms/empty-textarea-toggle-disabled.html
  fast/forms/textarea-paste-newline.html
  fast/forms/textarea-trailing-newline.html

* dom/Document.cpp:
(WebCore::Document::setFocusNavigationStartingNode):
(WebCore::Document::adjustFocusNavigationNodeOnNodeRemoval):

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

18 months agosvg/W3C-SVG-1.1/render-groups-03-t.svg and some other SVG tests leak documents
simon.fraser@apple.com [Mon, 10 Sep 2018 21:19:49 +0000 (21:19 +0000)]
svg/W3C-SVG-1.1/render-groups-03-t.svg and some other SVG tests leak documents
https://bugs.webkit.org/show_bug.cgi?id=189147

Reviewed by Dean Jackson.

Document::removedLastRef() needs to clean up m_fontSelector, because it can reference
CSSFontFaceSources that keep SVGFontFaceElements alive, and they in turn will keep
the Document alive.

Also add the beginnings of a Fonts log channel.

This will be tested by world leak testing (webkit.org/b/189332).

* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::CSSFontSelector):
(WebCore::CSSFontSelector::~CSSFontSelector):
* dom/Document.cpp:
(WebCore::Document::removedLastRef):
* platform/Logging.h:
* platform/graphics/FontCache.cpp:
(WebCore::FontCache::purgeInactiveFontDataIfNeeded):
(WebCore::FontCache::purgeInactiveFontData):
* svg/SVGFontFaceElement.cpp:
(WebCore::SVGFontFaceElement::SVGFontFaceElement):
(WebCore::SVGFontFaceElement::~SVGFontFaceElement):
* svg/SVGFontFaceElement.h:

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

18 months agoCBOR coders should only be compiled if WebAuthN is enabled
don.olmstead@sony.com [Mon, 10 Sep 2018 21:11:23 +0000 (21:11 +0000)]
CBOR coders should only be compiled if WebAuthN is enabled
https://bugs.webkit.org/show_bug.cgi?id=189425

Reviewed by Jiewen Tan.

Source/WebCore:

No new tests. No change in behavior.

Just places ENABLE(WEB_AUTHN) guards around all CBOR files.

* Modules/webauthn/cbor/CBORBinary.h:
* Modules/webauthn/cbor/CBORReader.cpp:
* Modules/webauthn/cbor/CBORReader.h:
* Modules/webauthn/cbor/CBORValue.cpp:
* Modules/webauthn/cbor/CBORValue.h:
* Modules/webauthn/cbor/CBORWriter.cpp:
* Modules/webauthn/cbor/CBORWriter.h:

Tools:

Just places ENABLE(WEB_AUTHN) guards around CBOR test files.

* TestWebKitAPI/Tests/WebCore/CBORReaderTest.cpp:
* TestWebKitAPI/Tests/WebCore/CBORValueTest.cpp:
* TestWebKitAPI/Tests/WebCore/CBORWriterTest.cpp:

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

18 months ago[iOS] Arrow keys do not dispatch DOM events to non-editable elements
dbates@webkit.org [Mon, 10 Sep 2018 21:02:50 +0000 (21:02 +0000)]
[iOS] Arrow keys do not dispatch DOM events to non-editable elements
https://bugs.webkit.org/show_bug.cgi?id=189389

Reviewed by Simon Fraser.

Source/WebCore:

On iOS the arrow keys are identified by special multi character key strings: UIKeyInput{Up,
Down, Left, Right}Arrow as opposed to special key codes as on Mac. When converting the iOS-
specific WebEvent we need to take care to recognize when the key string for the event is
one of these special key strings when computing key code, character code, and key identifier
properties for the WebCore platform-specific event. These details will be included in
the corresponding DOM keyboard events that are dispatched when the arrow keys are pressed.

* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
Mark file PlatformEventFactoryIOS as @no-unify as it is not compatible with the unified sources
build strategy given its use of wtf/cocoa/SoftLinking.h macros.

* platform/ios/PlatformEventFactoryIOS.h:
* platform/ios/PlatformEventFactoryIOS.mm:
(WebCore::convertSpecialKeyToCharCode): Manufacture the appropriate character code for an
event that represents an arrow key. Otherwise, return std::nullopt to indicate that the
event is not for an arrow key.
(WebCore::keyCodeForEvent): Manufacture the appropriate Windows virtual key code for an
event that represents an arrow key. Otherwise, do what we do now and return the key code
associated with the WebEvent.
(WebCore::keyIdentifierForKeyEvent): Modified to test if the event is for an arrow key
and return the appropriate key identifier.
(WebCore::keyForKeyEvent): Modified to test if the event is for an arrow key
and return the appropriate character code.
(WebCore::codeForKeyEvent): Modified to call keyCodeForEvent(), which knows how to account
for events that represent arrow keys.
(WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):

Source/WebKit:

Use WebCore::keyCodeForEvent() to retrieve the key code for a WebEvent instead of querying
the key code from the WebEvent directly. The function WebCore::keyCodeForEvent() knows how
to compute the key code for an event that represents an arrow key.

* Shared/ios/WebIOSEventFactory.mm:
(WebIOSEventFactory::createWebKeyboardEvent):

LayoutTests:

Update expected result now that we compute the correct keyIdentifier, keycode, and which properties
for DOM keyboard events dispatched when the arrow keys are pressed.

* fast/events/ios/keydown-keyup-in-non-editable-content-expected.txt:

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

18 months agoTry to fix the iOSMac build
timothy_horton@apple.com [Mon, 10 Sep 2018 20:57:00 +0000 (20:57 +0000)]
Try to fix the iOSMac build
https://bugs.webkit.org/show_bug.cgi?id=189469

* UIProcess/API/C/mac/WKContextPrivateMac.mm:
(WKContextSetPluginLoadClientPolicy):
(WKContextClearPluginClientPolicies):
(WKContextCopyPlugInInfoForBundleIdentifier):
(WKContextGetInfoForInstalledPlugIns):
(WKContextResetHSTSHosts):
(WKContextResetHSTSHostsAddedAfterDate):
(WKContextRegisterSchemeForCustomProtocol):
(WKContextUnregisterSchemeForCustomProtocol):
* UIProcess/API/C/mac/WKPagePrivateMac.mm:
(-[WKObservablePageState initWithPage:]):
(WKPageCreateObservableState):
(WKPageGetObjectRegistry):
(WKPageIsURLKnownHSTSHost):
(WKPageLoadURLRequestReturningNavigation):
(WKPageLoadFileReturningNavigation):
(WKPageIsPlayingVideoInEnhancedFullscreen):
(WKPageSetFullscreenDelegate):
(WKPageGetFullscreenDelegate):
* UIProcess/API/C/mac/WKProtectionSpaceNS.mm:
(WKProtectionSpaceCopyNSURLProtectionSpace):

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

18 months ago[iOS] Make WKWebView become the first responder to support testing key presses to...
dbates@webkit.org [Mon, 10 Sep 2018 20:55:23 +0000 (20:55 +0000)]
[iOS] Make WKWebView become the first responder to support testing key presses to non-editable elements
https://bugs.webkit.org/show_bug.cgi?id=189432

Reviewed by Simon Fraser.

Tools:

Make the WKWebView become the first responder immediately without the need to focus an editable
element. This allows us to test that DOM keyboard events are dispatched to non-editable elements.

* WebKitTestRunner/ios/PlatformWebViewIOS.mm:
(WTR::PlatformWebView::PlatformWebView):

LayoutTests:

Add a test that DOM keyboard events are dispatched to a non-editable <body> when simulating key
presses using a hardware keyboard.

* fast/events/ios/keydown-keyup-in-non-editable-content-expected.txt: Added.
* fast/events/ios/keydown-keyup-in-non-editable-content.html: Added.

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

18 months ago[macOS] Editor::readSelectionFromPasteboard’s MailBlockquoteHandling argument is...
mitz@apple.com [Mon, 10 Sep 2018 20:39:57 +0000 (20:39 +0000)]
[macOS] Editor::readSelectionFromPasteboard’s MailBlockquoteHandling argument is effectively unused
https://bugs.webkit.org/show_bug.cgi?id=189480

Reviewed by Anders Carlsson.

No new tests, because this doesn’t change behavior.

* editing/Editor.h: Removed the MailBlockquoteHandling argument from
  readSelectionFromPasteboard.
* editing/mac/EditorMac.mm:
(WebCore::Editor::readSelectionFromPasteboard): Don’t pass mailBlockquoteHandling to
  pasteWithPasteboard. It was always set to RespectBlockquote, which is the latter’s
  default.

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

18 months ago[Payment Request] Use JSValueInWrappedObject for PaymentResponse's details attribute
aestes@apple.com [Mon, 10 Sep 2018 20:08:00 +0000 (20:08 +0000)]
[Payment Request] Use JSValueInWrappedObject for PaymentResponse's details attribute
https://bugs.webkit.org/show_bug.cgi?id=189458

Reviewed by Youenn Fablet.

Source/WebCore:

Test: http/tests/paymentrequest/payment-response-reference-cycle-leak.https.html

* Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
(WebCore::ApplePayPaymentHandler::didAuthorizePayment):

Created a PaymentResponse::DetailsFunction that converts the ApplePayPayment into a JSValue.

* Modules/paymentrequest/PaymentRequest.cpp:
(WebCore::PaymentRequest::accept):

Passed detailsFunction into PaymentResponse::create().

* Modules/paymentrequest/PaymentRequest.h:
* Modules/paymentrequest/PaymentResponse.cpp:
(WebCore::PaymentResponse::PaymentResponse):
* Modules/paymentrequest/PaymentResponse.h:
* Modules/paymentrequest/PaymentResponse.idl:

Removed m_details and replaced it with a DetailsFunction and a cached JSValueInWrappedObject.
JSPaymentResponseCustom.cpp uses these values to implement the details attribute getter.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSPaymentResponseCustom.cpp: Added.
(WebCore::JSPaymentResponse::details const):

Called PaymentResponse::detailsFunction() to cache a JSValue for the details attribute.

(WebCore::JSPaymentResponse::visitAdditionalChildren):

Visited PaymentResponse::cachedDetails().

* bindings/js/JSServiceWorkerClientCustom.cpp:

Fixed a missing include issue that cropped up due to unified source shuffling.

LayoutTests:

* fast/dom/reference-cycle-leaks.html:
* http/tests/paymentrequest/payment-response-reference-cycle-leak.https-expected.txt: Added.
* http/tests/paymentrequest/payment-response-reference-cycle-leak.https.html: Added.

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

18 months ago[CSSOM View] Handle the scrollingElement in Element::scroll(Left/Top/Width/Height/To)
fred.wang@free.fr [Mon, 10 Sep 2018 19:39:10 +0000 (19:39 +0000)]
[CSSOM View] Handle the scrollingElement in Element::scroll(Left/Top/Width/Height/To)
https://bugs.webkit.org/show_bug.cgi?id=182230

Follow-up patch replacing document.body with document.scrollingElement in
fast-scroll-iframe-latched-mainframe.html. This fixes flaky behavior.

Patch by Frederic Wang <fwang@igalia.com> on 2018-09-10
Reviewed by Antonio Gomes.

* tiled-drawing/scrolling/fast-scroll-iframe-latched-mainframe.html: Replace document.body
with document.scrollingElement since this document is in standard mode.

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

18 months ago[Web Animations] Positive delays of accelerated animations are not respected
graouts@webkit.org [Mon, 10 Sep 2018 19:05:31 +0000 (19:05 +0000)]
[Web Animations] Positive delays of accelerated animations are not respected
https://bugs.webkit.org/show_bug.cgi?id=189411
<rdar://problem/44151416>

Reviewed by Dean Jackson.

Source/WebCore:

Test: webanimations/accelerated-animation-with-delay-and-seek.html

We were only accounting for negative delays for accelerated actions. We also were misbehaving
when seeking an animation with a delay (positive or negative) since we wouldn't reset the animation
begin time to be the current time when adjusting its time offset, while the begin time set when
first creating the animation would be set accounting for the time offset.

* animation/KeyframeEffectReadOnly.cpp:
(WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::seekCAAnimationOnLayer):

LayoutTests:

Add a test that checks that positive delays are accounted for during accelerated actions, including a seek.

* webanimations/accelerated-animation-with-delay-and-seek-expected.html: Added.
* webanimations/accelerated-animation-with-delay-and-seek.html: Added.

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

18 months agoTry to fix the build after r235850
timothy_horton@apple.com [Mon, 10 Sep 2018 18:30:28 +0000 (18:30 +0000)]
Try to fix the build after r235850

* UIProcess/ios/fullscreen/WKFullScreenViewController.mm:

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

18 months ago[WTF] Add Markable<T, Traits>
yusukesuzuki@slowstart.org [Mon, 10 Sep 2018 18:19:09 +0000 (18:19 +0000)]
[WTF] Add Markable<T, Traits>
https://bugs.webkit.org/show_bug.cgi?id=189231

Reviewed by Sam Weinig.

Source/WebCore:

Use Markable<Seconds> and Markable<WallTime> in ResourceResponseBase.
Since these fields are parsed results from http header fields, Seconds::nan() and WallTime::nan()
can be used as an empty value for these fields. Thus we can use Markable because it uses
these nan values as an empty values (they are configured by Seconds::MarkableTraits and WallTime::MarkableTraits).
This reduces the size of ResourceResponseBase from 448 to 416.

* platform/network/ResourceResponseBase.h:

Source/WTF:

We can represent a value with nullopt by using std::optional<T>. However, std::optional<T> has storage efficiency
problem. It always has a bool indicating that the value is nullopt or not. If we have a following class,

    class A {
        std::optional<WallTime> m_timeA;
        std::optional<WallTime> m_timeB;
        std::optional<WallTime> m_timeC;
    };

This class has significant amount of padding between m_timeA / m_timeB, m_timeB / m_timeC due to the above bool.

If we know that WallTime has a value that represents invalid, we can use it instead and save the storage.
This is very similar problem to our HashTable implementation. In our HashTable implementation, we need Deleted
and Empty value, which can represent Deleted and Empty values without sacrificing storage efficiency.

We should have similar mechanism here. In this patch, we have WTF::Markable<T, Traits>. Traits offers
`Traits::isEmptyValue(value)` and `Traits::emptyValue()`. Then, we use this empty value instead of having bool
flag. This way, we can make `sizeof(WTF::Markable<T>) == sizeof(T)`.

This idea is inspired from https://github.com/akrzemi1/markable. But we would like to have WTF::Markable<T>
here instead of importing it since we would like to have (1) integrated interfaces with std::optional<T> and (2)
aligned function names to HashTraits' `isEmptyValue` and `emptyValue`.

* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/Markable.h: Added.
(WTF::std::underlying_type<EnumType>::type>::max): EnumMarkableTraits can be used as an MarkableTraits for enum
values. We can specify a constant value as an empty value.
(WTF::IntegralMarkableTraits::isEmptyValue):
(WTF::IntegralMarkableTraits::emptyValue): IntegralMarkableTraits can be used as an MarkableTraits for integral
types including int etc.
(WTF::Markable::Markable):
(WTF::Markable::operator bool const):
(WTF::Markable::reset):
(WTF::Markable::value const):
(WTF::Markable::value):
(WTF::Markable::operator-> const):
(WTF::Markable::operator->):
(WTF::Markable::operator* const):
(WTF::Markable::operator*):
(WTF::Markable::operator std::optional<T>):
(WTF::Markable::operator std::optional<T> const): This operator allows us to cast Markable<T> to
std::optional<T>.
* wtf/MonotonicTime.h:
(WTF::MonotonicTime::MarkableTraits::isEmptyValue):
(WTF::MonotonicTime::MarkableTraits::emptyValue): MarkableTraits for MonotonicTime. MonotonicTime::nan() is used
as an empty value.
* wtf/Seconds.h:
(WTF::Seconds::MarkableTraits::isEmptyValue):
(WTF::Seconds::MarkableTraits::emptyValue): MarkableTraits for Seconds. Seconds::nan() is used as an empty value.
* wtf/WallTime.h:
(WTF::WallTime::nan):
(WTF::WallTime::MarkableTraits::isEmptyValue):
(WTF::WallTime::MarkableTraits::emptyValue): MarkableTraits for WallTime. WallTime::nan() is used as an empty value.

Tools:

Add tests for Markable.

* TestWebKitAPI/CMakeLists.txt:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/Markable.cpp: Added.
(TestWebKitAPI::TEST):

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

18 months agoBefore tracking Document leaks, clear all caches
simon.fraser@apple.com [Mon, 10 Sep 2018 18:16:37 +0000 (18:16 +0000)]
Before tracking Document leaks, clear all caches
https://bugs.webkit.org/show_bug.cgi?id=189459

Reviewed by Sam Weinig.
Source/WebKit:

It's not enough to clear the page and memory caches; font caches can reference Documents (for SVG fonts),
so just call WebCore::releaseMemory(), which empties caches including the page and memory caches, and
does the GC that we need to happen.

* WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleReleaseMemory):
(WKBundleClearPageCache): Deleted.
(WKBundleClearMemoryCache): Deleted.
* WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:

Tools:

It's not enough to clear the page and memory caches; font caches can reference Documents (for SVG fonts),
so just call WebCore::releaseMemory(), which empties caches including the page and memory caches, and
does the GC that we need to happen.

* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::didReceiveMessageToPage):

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

18 months agoSource/WebCore:
mrajca@apple.com [Mon, 10 Sep 2018 17:20:26 +0000 (17:20 +0000)]
Source/WebCore:
Touch Bar displays an active PIP button for audio elements (and it doesn't do anything)
https://bugs.webkit.org/show_bug.cgi?id=189433
<rdar://problem/44186498> Touch Bar displays an active PIP button for audio elements (and it doesn't do anything)

Reviewed by Eric Carlson.

When playing an audio element, the media Touch Bar displays an active PIP button even though only
videos are PIP-able. Pressing it does not do anything. The issue is canTogglePictureInPicture is set
to YES unconditionally on the WebPlaybackControlsManager. It is then only updated based on whether or
not external playback is enabled.

This patch extends that logic such that the picture-in-picture Touch Bar button will be disabled for
audio elements. Since PlaybackSessionModelMediaElement today does not know whether we're dealing
with an audio or video element, a new isPictureInPictureSupported flag has been added (as well as
the plumbing necessary to get the state over from the web process).

An API test has been added that checks the value of the canTogglePictureInPicture and ensures it
is NO when audio elements are playing. To expose it to tests, a _canTogglePictureInPictureForTesting
property has been added to the WKTesting category.

* platform/cocoa/PlaybackSessionModel.h:
(WebCore::PlaybackSessionModelClient::isPictureInPictureSupportedChanged):
* platform/cocoa/PlaybackSessionModelMediaElement.h:
* platform/cocoa/PlaybackSessionModelMediaElement.mm:
(WebCore::PlaybackSessionModelMediaElement::setMediaElement):
(WebCore::PlaybackSessionModelMediaElement::isPictureInPictureSupported const):
* platform/mac/PlaybackSessionInterfaceMac.h:
* platform/mac/PlaybackSessionInterfaceMac.mm:
(WebCore::PlaybackSessionInterfaceMac::isPictureInPictureSupportedChanged):
(WebCore::PlaybackSessionInterfaceMac::externalPlaybackChanged):
(WebCore::PlaybackSessionInterfaceMac::updatePlaybackControlsManagerCanTogglePictureInPicture):

Source/WebKit:
Touch Bar displays an active PIP button for audio elements (and it doesn't do anything)
https://bugs.webkit.org/show_bug.cgi?id=189433
<rdar://problem/44186498> Touch Bar displays an active PIP button for audio elements (and it doesn't do anything)

Reviewed by Eric Carlson.

When playing an audio element, the media Touch Bar displays an active PIP button even though only
videos are PIP-able. Pressing it does not do anything. The issue is canTogglePictureInPicture is set
to YES unconditionally on the WebPlaybackControlsManager. It is then only updated based on whether or
not external playback is enabled.

This patch extends that logic such that the picture-in-picture Touch Bar button will be disabled for
audio elements. Since PlaybackSessionModelMediaElement today does not know whether we're dealing
with an audio or video element, a new isPictureInPictureSupported flag has been added (as well as
the plumbing necessary to get the state over from the web process).

An API test has been added that checks the value of the canTogglePictureInPicture and ensures it
is NO when audio elements are playing. To expose it to tests, a _canTogglePictureInPictureForTesting
property has been added to the WKTesting category.

Source/WebKit:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _canTogglePictureInPictureForTesting]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
* UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in:
* UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
(WebKit::PlaybackSessionModelContext::pictureInPictureSupportedChanged):
(WebKit::PlaybackSessionManagerProxy::pictureInPictureSupportedChanged):
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::updateMediaTouchBar):
(WebKit::WebViewImpl::canTogglePictureInPictureForTesting):
* UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
* WebProcess/cocoa/PlaybackSessionManager.h:
* WebProcess/cocoa/PlaybackSessionManager.mm:
(WebKit::PlaybackSessionInterfaceContext::isPictureInPictureSupportedChanged):
(WebKit::PlaybackSessionManager::isPictureInPictureSupportedChanged):

Tools:
https://bugs.webkit.org/show_bug.cgi?id=189433
<rdar://problem/44186498> Touch Bar displays an active PIP button for audio elements (and it doesn't do anything)

Reviewed by Eric Carlson.

An API test has been added that checks the value of the canTogglePictureInPicture and ensures it
is NO when audio elements are playing.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/PictureInPictureDelegate.html:
* TestWebKitAPI/Tests/WebKitCocoa/PictureInPictureDelegate.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitCocoa/audio-with-controls.html: Added.

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

18 months ago[Windows] Layout Test webanimations/accelerated-transition-interrupted-on-composited...
pvollan@apple.com [Mon, 10 Sep 2018 14:35:16 +0000 (14:35 +0000)]
[Windows] Layout Test webanimations/accelerated-transition-interrupted-on-composited-element.html is failing
https://bugs.webkit.org/show_bug.cgi?id=189468

Unreviewed test gardening.

The test is timing out. Skip it on Windows.

* platform/win/TestExpectations:

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

18 months ago[GStreamer] Fix overflow in buffered ranges
aboya@igalia.com [Mon, 10 Sep 2018 14:04:32 +0000 (14:04 +0000)]
[GStreamer] Fix overflow in buffered ranges
https://bugs.webkit.org/show_bug.cgi?id=189419

Reviewed by Philippe Normand.

Scale operations on big numbers (like media timestamps or durations)
should be made with GStreamer utility functions to avoid overflows.

This fixes an assertion when a 24 hour long fragmented MP4 file is
played.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::buffered const):

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

18 months agoRefactor filter list checking code
fred.wang@free.fr [Mon, 10 Sep 2018 12:00:59 +0000 (12:00 +0000)]
Refactor filter list checking code
https://bugs.webkit.org/show_bug.cgi?id=185087

Patch by Frederic Wang <fwang@igalia.com> on 2018-09-07
Reviewed by Yusuke Suzuki.

No new tests, behavior unchanged.

* animation/KeyframeEffectReadOnly.h: Add missing forward-declaration FilterOperations.

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

18 months ago[GStreamer] Several media related tests timing out around the same revision
philn@webkit.org [Mon, 10 Sep 2018 09:10:27 +0000 (09:10 +0000)]
[GStreamer] Several media related tests timing out around the same revision
https://bugs.webkit.org/show_bug.cgi?id=189349

Reviewed by Carlos Garcia Campos.

Source/WebCore:

The timeouts were happening because the `ended` event was no
longer properly emitted. The change in playbackPosition also
ensures `timeupdate` event remains emitted in a... timely manner.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::playbackPosition const):
Reduce the position cache threshold to 200ms, which is a value
slightly lower than the 250ms defined in HTMLMediaElement.
(WebCore::MediaPlayerPrivateGStreamer::didEnd): Reset the cached
position value to ensure the following query will most likely
return the same value as reported by the duration query.

LayoutTests:

* platform/gtk/TestExpectations: Unflag Timeout from now-unaffected tests.

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

18 months ago[MSVC] X86Assembler.h(108): error C2666: 'WebCore::operator -': 7 overloads have...
Hironori.Fujii@sony.com [Mon, 10 Sep 2018 08:57:41 +0000 (08:57 +0000)]
[MSVC] X86Assembler.h(108): error C2666: 'WebCore::operator -': 7 overloads have similar conversions
https://bugs.webkit.org/show_bug.cgi?id=189467

Unreviewed build fix for WinCairo port.

MSVC reports compilation errors if certain JSC header files are
included after "using namespace" statements.

* Sources.txt: Added @no-unify to InjectedBundleNodeHandle.cpp and InjectedBundleRangeHandle.cpp temporarily.
* WebKit.xcodeproj/project.pbxproj: Compile InjectedBundleNodeHandle.cpp and InjectedBundleRangeHandle.cpp.

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

18 months agoXMLHttpRequest: overrideMimeType should not update the response's "Content-Type"...
commit-queue@webkit.org [Mon, 10 Sep 2018 08:28:02 +0000 (08:28 +0000)]
XMLHttpRequest: overrideMimeType should not update the response's "Content-Type" header
https://bugs.webkit.org/show_bug.cgi?id=189465

Patch by Rob Buis <rbuis@igalia.com> on 2018-09-10
Reviewed by Frédéric Wang.

LayoutTests/imported/w3c:

* web-platform-tests/xhr/overridemimetype-invalid-mime-type-expected.txt:

Source/WebCore:

The xhr spec changed [1, 2] so that overrideMimeType should not update the
response's "Content-Type" header anymore.

Behavior matches Firefox and Chrome.

[1] https://xhr.spec.whatwg.org/#dom-xmlhttprequest-overridemimetype
[2] https://github.com/whatwg/xhr/issues/157

Tests: http/tests/xmlhttprequest/xmlhttprequest-overridemimetype-content-type-header.html
       web-platform-tests/xhr/overridemimetype-invalid-mime-type.htm

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::didReceiveResponse):

LayoutTests:

Change existing test to reflect new behavior.

* http/tests/xmlhttprequest/xmlhttprequest-overridemimetype-content-type-header-expected.txt:
* http/tests/xmlhttprequest/xmlhttprequest-overridemimetype-content-type-header.html:

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

18 months ago[Web Animations] Interrupting an accelerated CSS transition on a composited element...
graouts@webkit.org [Mon, 10 Sep 2018 07:13:19 +0000 (07:13 +0000)]
[Web Animations] Interrupting an accelerated CSS transition on a composited element in flight fails
https://bugs.webkit.org/show_bug.cgi?id=189405
<rdar://problem/43342639>

Reviewed by Simon Fraser.

Source/WebCore:

Test: webanimations/accelerated-transition-interrupted-on-composited-element.html

If we interrupt an animation on an element that is composited also outside of the duration of the animation,
the "stop" accelerated action would fail to be performed because we no longer had a resolved current time and
the accelerated animation applied to the layer would never be removed.

However, having a resolved current time is not necessary to stop an animation, only for the other types of
actions (play, pause and seek). So we now simply default to a 0s time for an unresolved current time for a
simple fix to this issue.

* animation/KeyframeEffectReadOnly.cpp:
(WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):

LayoutTests:

Add a new test that checks that interrupting a CSS transition targeting an accelerated property for an element
that is composited outside the duration of the transition correctly interrupts the animation and jumps straight
to the target value.

* platform/win/TestExpectations:
* webanimations/accelerated-transition-interrupted-on-composited-element-expected.html: Added.
* webanimations/accelerated-transition-interrupted-on-composited-element.html: Added.

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

18 months agoUnreviewed, rolling out r235839.
Hironori.Fujii@sony.com [Mon, 10 Sep 2018 05:37:06 +0000 (05:37 +0000)]
Unreviewed, rolling out r235839.

Which breaks all Xcode based ports

Reverted changeset:

"[MSVC] X86Assembler.h(108): error C2666: 'WebCore::operator
-': 7 overloads have similar conversions"
https://bugs.webkit.org/show_bug.cgi?id=189467
https://trac.webkit.org/changeset/235839

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

18 months agoAdd specialized template declarations of HashTraits and DefaultHash to detect misuse
Hironori.Fujii@sony.com [Mon, 10 Sep 2018 05:20:52 +0000 (05:20 +0000)]
Add specialized template declarations of HashTraits and DefaultHash to detect misuse
https://bugs.webkit.org/show_bug.cgi?id=189044

Reviewed by Yusuke Suzuki.

Source/WebCore:

Some classes have a separate header for specializations of
WTF::HashTraits and WTF::DefaultHash to reduce the number of
header files included. For example, ColorHash.h and Color.h.

If someone is mistakenly using HashSet or HashMap without
including the specialization header, unexpected template
instantiation can cause subtle bugs. For example, MSVC linker
would silently produce an broken executable (Bug 188893).

By applying this change, I found three misuse cases in
DebugPageOverlays.cpp, AVVideoCaptureSource.h and WebPage.h. As
far as I analyzed, I concluded that these misuses don't introduce
any bugs at the moment, and they are not testable (Bug 189044 Comment 9),
except the MSVC issue (Bug 188893).

No new tests (Covered by existing tests).

* Modules/webdatabase/SQLResultSetRowList.h: Removed unused #include <wtf/HashTraits.h>.
* bindings/js/SerializedScriptValue.cpp: Ditto.
* page/DebugPageOverlays.cpp: Added #include "ColorHash.h" to instantiate HashMap<String, Color>.
* platform/URLHash.h: Added DefaultHash<URL> specialization definition.
* platform/URL.h: Added specialized template declarations.
* platform/graphics/Color.h: Ditto.
* platform/graphics/FloatSize.h: Ditto.
* platform/graphics/IntPoint.h: Ditto.
* platform/graphics/IntSize.h: Ditto.
* platform/network/ProtectionSpace.h: Ditto.
* platform/network/ProtectionSpaceHash.h: Removed unnecessary DefaultHash declaration.
* platform/mediastream/mac/AVVideoCaptureSource.h:
Added #include "IntSizeHash.h" to instantiate HashMap<String, IntSize>.

Source/WebKit:

* WebProcess/WebPage/WebPage.h: Added #include <WebCore/IntPointHash.h> to instantiate HashMap<std::pair<IntSize, double>, IntPoint>.

Source/WTF:

* wtf/BitVector.h: Removed unnecessary HashTraits declaration.
* wtf/MetaAllocatorPtr.h: Ditto.
* wtf/IndexSparseSet.h: Removed unused #include <wtf/HashTraits.h>.
* wtf/LoggingHashMap.h: Removed unused #include <wtf/LoggingHashTraits.h>.
* wtf/StackShot.h: Added #include <wtf/HashTraits.h> because this header uses SimpleClassHashTraits.
Removed unnecessary HashTraits declaration.

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

18 months ago[Win][Clang] Add FloatRect(const RECT&) constructor
Hironori.Fujii@sony.com [Mon, 10 Sep 2018 05:12:44 +0000 (05:12 +0000)]
[Win][Clang] Add FloatRect(const RECT&) constructor
https://bugs.webkit.org/show_bug.cgi?id=189398

Reviewed by Alex Christensen.

While trying to build WebKit WinCairo port with the latest Clang
(Bug 171618), the following compilation errors were reported.

  error: no viable conversion from returned value of type 'RECT' (aka 'tagRECT') to function return type 'WebCore::FloatRect'

No new tests (No behavior change).

* platform/graphics/FloatRect.h:
* platform/graphics/win/FloatRectDirect2D.cpp:
(WebCore::FloatRect::FloatRect): Added a new constructor taking a RECT as the argument.

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

18 months ago[MSVC] X86Assembler.h(108): error C2666: 'WebCore::operator -': 7 overloads have...
Hironori.Fujii@sony.com [Mon, 10 Sep 2018 04:54:58 +0000 (04:54 +0000)]
[MSVC] X86Assembler.h(108): error C2666: 'WebCore::operator -': 7 overloads have similar conversions
https://bugs.webkit.org/show_bug.cgi?id=189467

Unreviewed build fix for WinCairo port.

MSVC reports compilation errors if certain JSC header files are
included after "using namespace" statements.

* Sources.txt: Added @no-unify to InjectedBundleNodeHandle.cpp and InjectedBundleRangeHandle.cpp temporarily.

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

18 months agoUnreviewed, rolling out r235832.
commit-queue@webkit.org [Sun, 9 Sep 2018 17:55:00 +0000 (17:55 +0000)]
Unreviewed, rolling out r235832.
https://bugs.webkit.org/show_bug.cgi?id=189464

Broke WebKit2 tests (Requested by ap on #webkit).

Reverted changeset:

"[Cocoa] Turn on ARC for WebKitTestRunner"
https://bugs.webkit.org/show_bug.cgi?id=189228
https://trac.webkit.org/changeset/235832

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

18 months agoaccessibility/notification-listeners.html abandons a document
simon.fraser@apple.com [Sun, 9 Sep 2018 05:02:34 +0000 (05:02 +0000)]
accessibility/notification-listeners.html abandons a document
https://bugs.webkit.org/show_bug.cgi?id=188724

Reviewed by Darin Adler.

AccessibilityControllerMac leaked m_globalNotificationHandler, which leaks a JSValueProtect'd function,
which leaks a Document. Fix by using adoptNS().

* WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm:
(WTR::AccessibilityController::addNotificationListener):

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

18 months ago[Cocoa] Use more bridging casts in TestWebKitAPI
wenson_hsieh@apple.com [Sun, 9 Sep 2018 04:24:33 +0000 (04:24 +0000)]
[Cocoa] Use more bridging casts in TestWebKitAPI
https://bugs.webkit.org/show_bug.cgi?id=189457

Reviewed by Darin Adler.

Adds some bridging casts to TestWebKitAPI, when converting betweeen several common types of objects, including:
CFStringRef <=> NSString
CFURLRef <=> NSURL
WKPreferences <=> WKPreferencesRef
CFDataRef <=> NSData

* TestWebKitAPI/Tests/WebCore/cocoa/SharedBuffer.mm:
(TestWebKitAPI::TEST_F):
* TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm:
(readHTMLFromPasteboard):
(createWebViewWithCustomPasteboardDataEnabled):
* TestWebKitAPI/Tests/WebKitCocoa/CopyURL.mm:
(createWebViewWithCustomPasteboardDataEnabled):
* TestWebKitAPI/Tests/WebKitCocoa/DragAndDropTests.mm:
(TEST):
* TestWebKitAPI/Tests/WebKitCocoa/PasteHTML.mm:
(writeHTMLToPasteboard):
(createWebViewWithCustomPasteboardDataSetting):
* TestWebKitAPI/Tests/WebKitCocoa/PasteImage.mm:
(TEST):
* TestWebKitAPI/Tests/WebKitCocoa/PasteMixedContent.mm:
(TestWebKitAPI::setUpWebView):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitCocoa/PasteRTFD.mm:
(writeRTFToPasteboard):
(writeRTFDToPasteboard):
(createWebViewWithCustomPasteboardDataEnabled):
(TEST):
* TestWebKitAPI/Tests/WebKitCocoa/PasteWebArchive.mm:
(createWebViewWithCustomPasteboardDataEnabled):
* TestWebKitAPI/Tests/WebKitCocoa/RestoreSessionStateWithoutNavigation.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:
(webViewForTestingAttachments):
* TestWebKitAPI/Tests/WebKitLegacy/mac/AccessingPastedImage.mm:
(writeRTFDToPasteboard):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/ios/ActionSheetTests.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:
(checkRichTextTypePrecedesPlainTextType):
(TestWebKitAPI::TEST):
(TestWebKitAPI::setUpTestWebViewForDataTransferItems):
* TestWebKitAPI/Tests/ios/UIPasteboardTests.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/mac/PlatformUtilitiesMac.mm:
(TestWebKitAPI::Util::createInjectedBundlePath):
(TestWebKitAPI::Util::createURLForResource):
(TestWebKitAPI::Util::URLForNonExistentResource):
(TestWebKitAPI::Util::MIMETypeForWKURLResponse):
* TestWebKitAPI/mac/WebKitAgnosticTest.mm:
(TestWebKitAPI::WebKitAgnosticTest::loadURL):

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

18 months agoREGRESSION (r235153): [iOS] Can't move selection start grabber when selecting text...
wenson_hsieh@apple.com [Sun, 9 Sep 2018 03:25:05 +0000 (03:25 +0000)]
REGRESSION (r235153): [iOS] Can't move selection start grabber when selecting text in a subframe
https://bugs.webkit.org/show_bug.cgi?id=189454
<rdar://problem/44265956>

Reviewed by Darin Adler.

Source/WebKit:

rangeForPointInRootViewCoordinates is responsible for taking a user gesture location representing the location
of the selection start or end handle (given in root view coordinates) and computing a Range representing an
updated selection. r235153 introduced a mechanism here to clamp the y offset of this user gesture location to
a max or min value determined by computing the bounds of the other selection handle, which more closely matches
platform behavior elsewhere in iOS.

However, this clamping logic would cause the user gesture location in root view coordinates to incorrectly clamp
in cases where the user selects text within an iframe that is offset from the top of the main document, since it
compares content coordinates (i.e. the caret bounds) against root view coordinates (i.e. the gesture location).
This makes it impossible to use selection handles to select text in some iframes.

We fix this by first converting the gesture location to document coordinates, and then clamping.

Test: editing/selection/ios/selection-handle-clamping-in-iframe.html

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

Also reuse `selectionStart` and `selectionEnd` when computing absolute caret bounds, instead of creating new
VisiblePositions.

LayoutTests:

Adds a test that selects a word inside an iframe, moves the selection start handle down past the selection end,
and then moves the selection end handle up above the selection start. The test verifies that the entire word
remains selected.

* editing/selection/ios/selection-handle-clamping-in-iframe-expected.txt: Added.
* editing/selection/ios/selection-handle-clamping-in-iframe.html: Added.

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

18 months ago[Apple Pay] Dispatch a paymentmethodchange event when the payment method changes
aestes@apple.com [Sun, 9 Sep 2018 02:03:52 +0000 (02:03 +0000)]
[Apple Pay] Dispatch a paymentmethodchange event when the payment method changes
https://bugs.webkit.org/show_bug.cgi?id=189386

Reviewed by Darin Adler.

Source/WebCore:

Implemented the "payment method changed" algorithm as defined in the Payment Request API W3C
Editor's Draft of 05 September 2018.

Payment Request says that the user agent MAY run this algorithm when the payment method
changes. In our case, we only wish to dispatch this event when a listener is registered for
it. Since PassKit requires merchants to respond to this event by calling updateWith() within
30 seconds, firing the event unconditionally would break compatibility with existing
clients.

For merchants that do not listen for this event, they can continue to use modifiers to
update details based on the selected payment method type.

Also made PaymentMethodChangeEvent.methodDetails a cached attribute in a way that avoids
potential reference cycles from holding a JSC::Strong in the wrapped object.

Test: http/tests/ssl/applepay/ApplePayPaymentMethodChangeEvent.https.html

* CMakeLists.txt:
* DerivedSources.make:
* Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
(WebCore::toJSDictionary):
(WebCore::ApplePayPaymentHandler::didAuthorizePayment):
(WebCore::ApplePayPaymentHandler::didSelectPaymentMethod):
* Modules/paymentrequest/PaymentMethodChangeEvent.cpp:
(WebCore::PaymentMethodChangeEvent::PaymentMethodChangeEvent):
* Modules/paymentrequest/PaymentMethodChangeEvent.h:
* Modules/paymentrequest/PaymentMethodChangeEvent.idl:
* Modules/paymentrequest/PaymentMethodChangeEventInit.idl: Removed.
* Modules/paymentrequest/PaymentRequest.cpp:
(WebCore::PaymentRequest::paymentMethodChanged):
* Modules/paymentrequest/PaymentRequest.h:
* Modules/paymentrequest/PaymentRequestUpdateEvent.cpp:
(WebCore::PaymentRequestUpdateEvent::updateWith):
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSPaymentMethodChangeEventCustom.cpp: Added.
(WebCore::JSPaymentMethodChangeEvent::methodDetails const):
(WebCore::JSPaymentMethodChangeEvent::visitAdditionalChildren):

LayoutTests:

* fast/dom/reference-cycle-leaks-expected.txt:
* fast/dom/reference-cycle-leaks.html:
* http/tests/ssl/applepay/ApplePayPaymentMethodChangeEvent.https-expected.txt: Added.
* http/tests/ssl/applepay/ApplePayPaymentMethodChangeEvent.https.html: Added.
* platform/ios-wk2/fast/dom/reference-cycle-leaks-expected.txt: Added.
* platform/mac-wk2/fast/dom/reference-cycle-leaks-expected.txt: Added.

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

18 months ago[Cocoa] Turn on ARC for WebKitTestRunner
darin@apple.com [Sat, 8 Sep 2018 21:29:49 +0000 (21:29 +0000)]
[Cocoa] Turn on ARC for WebKitTestRunner
https://bugs.webkit.org/show_bug.cgi?id=189228

Reviewed by Sam Weinig.

* TestRunnerShared/EventSerialization/mac/EventSerializerMac.mm:
(+[EventSerializer dictionaryForEvent:relativeToTime:]): Removed autorelease.

* TestRunnerShared/cocoa/LayoutTestSpellChecker.mm:
(-[LayoutTestSpellChecker setResultsFromJSObject:inContext:]): Removed autorelease.

* WebKitTestRunner/Configurations/Base.xcconfig: Added CLANG_ENABLE_OBJC_ARC.

* WebKitTestRunner/InjectedBundle/ios/AccessibilityControllerIOS.mm:
(WTR::AccessibilityController::accessibleElementById): Use a __bridge cast.
* WebKitTestRunner/InjectedBundle/ios/AccessibilityTextMarkerIOS.mm:
(WTR::AccessibilityTextMarker::isEqual): Ditto.

* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::AccessibilityUIElement): Removed retain.
(WTR::AccessibilityUIElement::~AccessibilityUIElement): Removed release.
(WTR::AccessibilityUIElement::removeNotificationListener): Removed release.
(WTR::AccessibilityUIElement::lineTextMarkerRangeForTextMarker): Use a __bridge cast.
(WTR::AccessibilityUIElement::textMarkerRangeForElement): Ditto.
(WTR::AccessibilityUIElement::textMarkerRangeLength): Ditto.
(WTR::AccessibilityUIElement::previousTextMarker): Ditto.
(WTR::AccessibilityUIElement::nextTextMarker): Ditto.
(WTR::AccessibilityUIElement::stringForTextMarkerRange): Ditto.
(WTR::AccessibilityUIElement::textMarkerRangeForMarkers): Ditto.
(WTR::AccessibilityUIElement::startTextMarkerForTextMarkerRange): Ditto.
(WTR::AccessibilityUIElement::endTextMarkerForTextMarkerRange): Ditto.
(WTR::AccessibilityUIElement::accessibilityElementForTextMarker): Ditto.
(WTR::AccessibilityUIElement::textMarkerRangeMatchesTextNearMarkers): Ditto.
(WTR::_CGPathEnumerationIteration): Ditto.
(WTR::AccessibilityUIElement::pathDescription const): Ditto.

* WebKitTestRunner/InjectedBundle/mac/AccessibilityNotificationHandler.mm:
(-[AccessibilityNotificationHandler dealloc]): Removed [super dealloc].

* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::AccessibilityUIElement): Removed retain.
(WTR::AccessibilityUIElement::~AccessibilityUIElement): Removed release.
(WTR::AccessibilityUIElement::removeNotificationListener): Removed release.
(WTR::createJSStringRef): Removed autorelease.

* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::initializeWebViewConfiguration): Removed release.
(WTR::TestController::cocoaPlatformInitialize): Removed release.
(WTR::TestController::platformCreateOtherPage): Removed autorelease.

* WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
(-[TestRunnerWKWebView dealloc]): Removed [super dealloc] and also many
cases of setting properties to nil that were only present for memory
management reasons.

* WebKitTestRunner/ios/GeneratedTouchesDebugWindow.mm:
(-[GeneratedTouchesDebugWindow dealloc]): Removed release and [super dealloc].

* WebKitTestRunner/ios/HIDEventGenerator.mm:
(-[HIDEventGenerator dealloc]): Deleted.
(-[HIDEventGenerator _sendMarkerHIDEventWithCompletionBlock:]): Removed
Block_copy.
(-[HIDEventGenerator markerEventReceived:]): Removed Block_release.
(-[HIDEventGenerator interpolatedEvents:]): Removed release.
(-[HIDEventGenerator sendEventStream:completionBlock:]): Removed autorelease.

* WebKitTestRunner/ios/PlatformWebViewIOS.mm:
(-[WebKitTestRunnerWindow dealloc]): Removed [super dealloc].
(WTR::PlatformWebView::PlatformWebView): Removed release.
(WTR::PlatformWebView::~PlatformWebView): Removed release.
(WTR::PlatformWebView::addChromeInputField): Removed release.
(WTR::PlatformWebView::removeChromeInputField): Removed release.

* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::initializeInjectedBundlePath): Use __bridge cast.
(WTR::TestController::initializeTestPluginDirectory): Ditto.

* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::accessibilitySpeakSelectionContent const):
Use __bridge cast.
(WTR::UIScriptController::enterText): Ditto.
(WTR::UIScriptController::selectFormPopoverTitle const): Ditto.
(WTR::UIScriptController::textContentType const): Ditto.
(WTR::UIScriptController::formInputLabel const): Ditto.
(WTR::UIScriptController::scrollingTreeAsText const): Ditto.

* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::~PlatformWebView): Removed release.
(WTR::PlatformWebView::addChromeInputField): Removed release.

* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::allowedFontFamilySet): Removed retain.
(WTR::systemHiddenFontFamilySet): Removed retain.

* WebKitTestRunner/mac/WebKitTestRunnerDraggingInfo.mm:
(-[WebKitTestRunnerDraggingInfo draggingDestinationWindow]): Removed retain.
(-[WebKitTestRunnerDraggingInfo dealloc]): Deleted.

* WebKitTestRunner/mac/WebKitTestRunnerPasteboard.mm:
(+[WebKitTestRunnerPasteboard _pasteboardWithName:]): Removed release.
(+[WebKitTestRunnerPasteboard releaseLocalPasteboards]): Removed release.
Method name is still OK because setting localPasteboards to nil will
still release them.
(+[NSPasteboard superAlloc]): Added. Helper so that LocalPasteboard can
bypass +[NSPasteboard alloc].
(+[NSPasteboard superAllocWithZone:]): Ditto.
(+[LocalPasteboard alloc]): Call superAlloc instead of class_createInstance.
This is a different way to achieve the "bypass NSPasteboard" behavior we need.
(+[LocalPasteboard allocWithZone:]): Added. Calls superAllocWithZone: for the
same reason as above. Needed because, at least at this time, +[NSObject alloc]
calls +allocWithZone: so we have to override both.
(-[LocalPasteboard dealloc]): Deleted.
(-[LocalPasteboard addTypes:owner:]): Removed release.

* WebKitTestRunner/mac/WebKitTestRunnerWindow.mm:
(-[WebKitTestRunnerWindow dealloc]): Removed [super dealloc].

* WebKitTestRunner/mac/main.mm:
(disableAppNapInUIProcess): Removed retain.

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

18 months ago[JSC] Remove loadModule function in jsc.cpp
yusukesuzuki@slowstart.org [Sat, 8 Sep 2018 20:51:22 +0000 (20:51 +0000)]
[JSC] Remove loadModule function in jsc.cpp
https://bugs.webkit.org/show_bug.cgi?id=184808

Patch by Yusuke Suzuki <utatane.tea@gmail.com> on 2018-09-08
Reviewed by Darin Adler.

JSTests:

Use `import` expression instead.

* modules/different-view.js:
(from.string_appeared_here.shouldThrow): Deleted.
* modules/fallback-ambiguous.js:
(from.string_appeared_here.shouldThrow): Deleted.
* modules/import-error.js:
(from.string_appeared_here.shouldThrow): Deleted.
(shouldThrow): Deleted.
* modules/indirect-export-error.js:
(from.string_appeared_here.shouldThrow): Deleted.
(shouldThrow): Deleted.
* modules/namespace-error.js:
(from.string_appeared_here.shouldThrow): Deleted.

Source/JavaScriptCore:

Since we have `import`, we do not need to have `loadModule` function for testing purpose.

* jsc.cpp:
(GlobalObject::finishCreation):
(functionLoadModule): Deleted.

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

18 months agoClean up code related to Document node removal
simon.fraser@apple.com [Sat, 8 Sep 2018 20:19:22 +0000 (20:19 +0000)]
Clean up code related to Document node removal
https://bugs.webkit.org/show_bug.cgi?id=189452

Reviewed by Wenson Hsieh.

Replace the "amongChildrenOnly" boolean argument with an enum for clarity.

Rename the remove*OfSubtree functions, because that naming is very unclear.
Instead, use adjust*OnNodeRemoval which better describes what the code does.

* dom/Document.cpp:
(WebCore::isNodeInSubtree):
(WebCore::Document::adjustFocusedNodeOnNodeRemoval):
(WebCore::Document::nodeChildrenWillBeRemoved):
(WebCore::Document::nodeWillBeRemoved):
(WebCore::Document::adjustFocusNavigationNodeOnNodeRemoval):
(WebCore::Document::adjustFullScreenElementOnNodeRemoval):
(WebCore::Document::removeFocusedNodeOfSubtree): Deleted.
(WebCore::Document::removeFocusNavigationNodeOfSubtree): Deleted.
(WebCore::Document::removeFullScreenElementOfSubtree): Deleted.
* dom/Document.h:
* dom/Element.cpp:
(WebCore::Element::removeShadowRoot):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::clear):

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

18 months ago[CSSJIT] Use lshiftPtr instead of mul32
yusukesuzuki@slowstart.org [Sat, 8 Sep 2018 19:25:10 +0000 (19:25 +0000)]
[CSSJIT] Use lshiftPtr instead of mul32
https://bugs.webkit.org/show_bug.cgi?id=189451

Reviewed by Sam Weinig.

Use `value << 4` instead of `value * 16`. In 64bit environment, sizeof(Style::Relation) is 16,
so that we can use `value << 4` in CSS JIT.

No behavior change.

* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateAddStyleRelation):

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

18 months agoUnify most of the WebKit Objective-C API sources
timothy_horton@apple.com [Sat, 8 Sep 2018 17:59:43 +0000 (17:59 +0000)]
Unify most of the WebKit Objective-C API sources
https://bugs.webkit.org/show_bug.cgi?id=189447

Reviewed by Andy Estes.

Unify and fix errors.

* Shared/API/Cocoa/_WKFrameHandle.mm:
* Shared/API/Cocoa/_WKRemoteObjectRegistry.mm:
* SourcesCocoa.txt:
* UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm:
* UIProcess/API/Cocoa/WKBackForwardList.mm:
* UIProcess/API/Cocoa/WKBackForwardListItem.mm:
* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
* UIProcess/API/Cocoa/WKBrowsingContextGroup.mm:
* UIProcess/API/Cocoa/WKConnection.mm:
* UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm:
* UIProcess/API/Cocoa/WKNavigationData.mm:
* UIProcess/API/Cocoa/WKProcessGroup.mm:
* UIProcess/API/Cocoa/WKURLSchemeTask.mm:
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
* UIProcess/API/Cocoa/_WKAttachment.mm:
* UIProcess/API/Cocoa/_WKGeolocationPosition.mm:
* UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm:
* UIProcess/API/Cocoa/_WKThumbnailView.mm:
* UIProcess/API/mac/WKView.mm:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResult.mm:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInPageGroup.mm:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.mm:
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm:
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:

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

18 months agoEnsure that handleIntrinsicCall() is only applied on op_call shaped instructions.
mark.lam@apple.com [Sat, 8 Sep 2018 06:29:41 +0000 (06:29 +0000)]
Ensure that handleIntrinsicCall() is only applied on op_call shaped instructions.
https://bugs.webkit.org/show_bug.cgi?id=189317
<rdar://problem/44152198>

Reviewed by Filip Pizlo.

JSTests:

* stress/regress-189317.js: Added.
(testGetter):
(testSetter):

Source/JavaScriptCore:

handleIntrinsicCall() is normally used for checking if an op_call is a call to
an intrinsic function, and inlining it if it's a match.

However, getter and setter functions also does calls, and uses handleCall()
to implement the call.  handleCall() eventually calls handleIntrinsicCall() to
check for intrinsics.  This results in a bug because handleIntrinsicCall()
sometimes relies on the ArrayProfile* of the instruction, and is always assuming
that the instruction is op_call shaped.  This turns out to be not true: getters
and setters can get there with op_get_by_val and op_put_by_val instead.

Since the intrinsic functions handled by handleIntrinsicCall() are never
intended to be used as getter / setter functions anyway, we can prevent this
whole class of bugs by having handleIntrinsicCall() fail early if the
instruction is not op_call shaped.

To implement this fix, we did the following:

1. Introduced the OpcodeShape enum.
2. Introduced isOpcodeShape<OpcodeShape>() for testing if a instruction of the
   shape of the specified OpcodeShape.
3. Introduced arrayProfileFor<OpcodeShape>() for fetching the ArrayProfile* from
   the instruction given the OpcodeShape.

   Using this arrayProfileFor template has the following benefits:
   1. Centralizes the definition of which instructions has an ArrayProfile* operand.
   2. Centralizes the definition of which operand is the ArrayProfile*.
   3. Asserts that the instruction is of the expected shape when retrieving the
      ArrayProfile*.

4. Added ArrayProfile::m_typeName and ArrayProfile::s_typeName which are used
   in ArrayProfile::isValid() as a sanity check that a retrieved ArrayProfile*
   indeed does point to an ArrayProfile.

* JavaScriptCore.xcodeproj/project.pbxproj:
* bytecode/ArrayProfile.cpp:
* bytecode/ArrayProfile.h:
(JSC::ArrayProfile::isValid const):
* bytecode/OpcodeInlines.h: Added.
(JSC::isOpcodeShape):
(JSC::arrayProfileFor):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleIntrinsicCall):
(JSC::DFG::ByteCodeParser::parseBlock):
* jit/JITCall.cpp:
(JSC::JIT::compileOpCall):
* jit/JITCall32_64.cpp:
(JSC::JIT::compileOpCall):
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_has_indexed_property):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::emit_op_has_indexed_property):
* jit/JITPropertyAccess.cpp:
(JSC::JIT::emit_op_get_by_val):
(JSC::JIT::emit_op_put_by_val):
(JSC::JIT::emitGenericContiguousPutByVal):
(JSC::JIT::emitArrayStoragePutByVal):
(JSC::JIT::emitIntTypedArrayPutByVal):
(JSC::JIT::emitFloatTypedArrayPutByVal):
* jit/JITPropertyAccess32_64.cpp:
(JSC::JIT::emit_op_get_by_val):
(JSC::JIT::emit_op_put_by_val):
(JSC::JIT::emitGenericContiguousPutByVal):
(JSC::JIT::emitArrayStoragePutByVal):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
(JSC::LLInt::getByVal):
* runtime/CommonSlowPaths.cpp:
(JSC::SLOW_PATH_DECL):

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

18 months agoTry to fix the build
timothy_horton@apple.com [Sat, 8 Sep 2018 02:17:49 +0000 (02:17 +0000)]
Try to fix the build

* Shared/mac/SandboxExtensionMac.mm:

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

18 months ago[Win][Clang] exceptionShouldTerminateProgram of StructuredExceptionHandlerSuppressor...
Hironori.Fujii@sony.com [Sat, 8 Sep 2018 00:41:14 +0000 (00:41 +0000)]
[Win][Clang] exceptionShouldTerminateProgram of StructuredExceptionHandlerSuppressor.cpp should take DWORD
https://bugs.webkit.org/show_bug.cgi?id=189402

Reviewed by Alex Christensen.

Clang reports compilation errors like following:

> StructuredExceptionHandlerSuppressor.cpp(38,10):  error: case value evaluates to 2147483650, which cannot be narrowed to type 'int' [-Wc++11-narrowing]
>     case EXCEPTION_DATATYPE_MISALIGNMENT:
>          ^

No new tests (no behavioral change).

* platform/win/StructuredExceptionHandlerSuppressor.cpp:
(exceptionShouldTerminateProgram): Changed the type of argument from int to DWORD.

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

18 months ago[WinCairo][MiniBrowser][WebKit] REGRESSION(r235398): ASSERTION FAILED: !m_client...
Hironori.Fujii@sony.com [Sat, 8 Sep 2018 00:37:16 +0000 (00:37 +0000)]
[WinCairo][MiniBrowser][WebKit] REGRESSION(r235398): ASSERTION FAILED: !m_client.didReceiveTitleForFrame
https://bugs.webkit.org/show_bug.cgi?id=189336

Reviewed by Alex Christensen.

WKPageSetPageLoaderClient is deprecated. Replaced it with
WKPageSetPageNavigationClient.

* MiniBrowser/win/WebKitBrowserWindow.cpp:
(WebKitBrowserWindow::WebKitBrowserWindow):
Call WKPageSetPageNavigationClient instead of WKPageSetPageLoaderClient.
(WebKitBrowserWindow::didFinishNavigation):
Copied from didReceiveTitleForFrame. Use WKPageCopyTitle to get the title.
(WebKitBrowserWindow::didCommitNavigation):
Copied from didCommitLoadForFrame. Use WKPageCopyCommittedURL to get the URL.
(WebKitBrowserWindow::didReceiveTitleForFrame): Deleted.
(WebKitBrowserWindow::didCommitLoadForFrame): Deleted.
* MiniBrowser/win/WebKitBrowserWindow.h: Renamed the class methods.

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

18 months agoUnify most of the WebKit C API sources
timothy_horton@apple.com [Sat, 8 Sep 2018 00:36:09 +0000 (00:36 +0000)]
Unify most of the WebKit C API sources
https://bugs.webkit.org/show_bug.cgi?id=189400

Reviewed by Alex Christensen.

Unify and fix errors (mostly API:String vs. WTF::String mismatches).

* Shared/APIWebArchiveResource.h:
* Sources.txt:
* SourcesCocoa.txt:
* UIProcess/API/APIContentRuleListStore.cpp:
(API::constructedPathPrefix):
(API::constructedPathFilter):
(API::constructedPath):
(API::encodeContentRuleListMetaData):
(API::decodeContentRuleListMetaData):
(API::openAndMapContentRuleList):
(API::writeDataToFile):
(API::compiledToFile):
(API::createExtension):
(API::ContentRuleListStore::lookupContentRuleList):
(API::ContentRuleListStore::getAvailableContentRuleListIdentifiers):
(API::ContentRuleListStore::compileContentRuleList):
(API::ContentRuleListStore::getContentRuleListSource):
* UIProcess/API/APINavigation.cpp:
(API::Navigation::loggingString const):
* UIProcess/API/APIWebsiteDataStore.cpp:
(API::WebsiteDataStore::defaultMediaCacheDirectory):
(API::WebsiteDataStore::defaultJavaScriptConfigurationDirectory):
* UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
(API::WebsiteDataStore::defaultApplicationCacheDirectory):
(API::WebsiteDataStore::defaultCacheStorageDirectory):
(API::WebsiteDataStore::defaultNetworkCacheDirectory):
(API::WebsiteDataStore::defaultMediaCacheDirectory):
(API::WebsiteDataStore::defaultIndexedDBDatabaseDirectory):
(API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):
(API::WebsiteDataStore::defaultLocalStorageDirectory):
(API::WebsiteDataStore::defaultMediaKeysStorageDirectory):
(API::WebsiteDataStore::defaultWebSQLDatabaseDirectory):
(API::WebsiteDataStore::defaultResourceLoadStatisticsDirectory):
(API::WebsiteDataStore::defaultJavaScriptConfigurationDirectory):
(API::WebsiteDataStore::legacyDefaultApplicationCacheDirectory):
(API::WebsiteDataStore::legacyDefaultNetworkCacheDirectory):
(API::WebsiteDataStore::legacyDefaultWebSQLDatabaseDirectory):
(API::WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory):
(API::WebsiteDataStore::legacyDefaultLocalStorageDirectory):
(API::WebsiteDataStore::legacyDefaultMediaCacheDirectory):
(API::WebsiteDataStore::legacyDefaultMediaKeysStorageDirectory):
(API::WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory):
(API::WebsiteDataStore::tempDirectoryFileSystemRepresentation):
(API::WebsiteDataStore::cacheDirectoryFileSystemRepresentation):
(API::WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation):
* UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
(API::WebsiteDataStore::defaultApplicationCacheDirectory):
(API::WebsiteDataStore::defaultNetworkCacheDirectory):
(API::WebsiteDataStore::defaultCacheStorageDirectory):
(API::WebsiteDataStore::defaultIndexedDBDatabaseDirectory):
(API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):
(API::WebsiteDataStore::defaultLocalStorageDirectory):
(API::WebsiteDataStore::defaultMediaKeysStorageDirectory):
(API::WebsiteDataStore::defaultWebSQLDatabaseDirectory):
(API::WebsiteDataStore::defaultResourceLoadStatisticsDirectory):
(API::WebsiteDataStore::cacheDirectoryFileSystemRepresentation):
(API::WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation):
(API::WebsiteDataStore::legacyDefaultApplicationCacheDirectory):
(API::WebsiteDataStore::legacyDefaultNetworkCacheDirectory):
(API::WebsiteDataStore::legacyDefaultWebSQLDatabaseDirectory):
(API::WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory):
(API::WebsiteDataStore::legacyDefaultLocalStorageDirectory):
(API::WebsiteDataStore::legacyDefaultMediaCacheDirectory):
(API::WebsiteDataStore::legacyDefaultMediaKeysStorageDirectory):
(API::WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory):
* WebKit.xcodeproj/project.pbxproj:

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

18 months ago[LayoutTests] Add digest access authentication test.
Basuke.Suzuki@sony.com [Sat, 8 Sep 2018 00:36:07 +0000 (00:36 +0000)]
[LayoutTests] Add digest access authentication test.
https://bugs.webkit.org/show_bug.cgi?id=189286

Reviewed by Alex Christensen.

Add digest auth tests

* http/tests/resources/digest-auth/authorize.php: Added.
* http/tests/resources/digest-auth/digest.php: Added.
* http/tests/xmlhttprequest/digest-auth-expected.txt: Added.
* http/tests/xmlhttprequest/digest-auth.html: Added.

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

18 months ago[Curl] Stop sending request with credential if no authorization requested.
Basuke.Suzuki@sony.com [Sat, 8 Sep 2018 00:32:11 +0000 (00:32 +0000)]
[Curl] Stop sending request with credential if no authorization requested.
https://bugs.webkit.org/show_bug.cgi?id=189057

Reviewed by Alex Christensen.

Source/WebCore:

When 401 response returns without 'www-authenticate' header, suppress another request with credential.

Test: http/tests/xmlhttprequest/unauthorized-without-authenticate-header.html

* platform/network/curl/CurlResourceHandleDelegate.cpp:
(WebCore::CurlResourceHandleDelegate::curlDidReceiveResponse):

Source/WebKit:

When 401 response returns without 'www-authenticate' header, suppress another request with credential.
Same fix for proxy authentication.

* NetworkProcess/curl/NetworkDataTaskCurl.cpp:
(WebKit::NetworkDataTaskCurl::curlDidReceiveResponse):

LayoutTests:

* http/tests/xmlhttprequest/resources/no-authenticate-header-401.php: Added.
* http/tests/xmlhttprequest/unauthorized-without-authenticate-header-expected.txt: Added.
* http/tests/xmlhttprequest/unauthorized-without-authenticate-header.html: Added.

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

18 months ago[Win][Clang] duplicated variable name `advance` in UniscribeController::shapeAndPlaceItem
Hironori.Fujii@sony.com [Fri, 7 Sep 2018 23:47:20 +0000 (23:47 +0000)]
[Win][Clang] duplicated variable name `advance` in UniscribeController::shapeAndPlaceItem
https://bugs.webkit.org/show_bug.cgi?id=189399

Reviewed by Myles C. Maxfield.

Clang reports the following compilation error:

UniscribeController.cpp(372,56):  error: invalid operands to binary expression ('float' and 'WebCore::GlyphBufferAdvance' (aka 'WebCore::FloatSize'))
     GlyphBufferAdvance advance(-origin.width() + advance, -origin.height());
                                ~~~~~~~~~~~~~~~ ^ ~~~~~~~
No new tests (No behavior change).

* platform/graphics/win/UniscribeController.cpp:
(WebCore::UniscribeController::shapeAndPlaceItem): Replaced the second variable named `advance` with `glyphAdvance`.

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

18 months agoTests checking document GC in case of ActiveDOMObjects are flaky
youenn@apple.com [Fri, 7 Sep 2018 23:13:32 +0000 (23:13 +0000)]
Tests checking document GC in case of ActiveDOMObjects are flaky
https://bugs.webkit.org/show_bug.cgi?id=189413

Reviewed by Eric Carlson.

Instead of calling parent.done() use postMessage.
The assumption is that GC might not always collect 'parent' as it is in the call stack.
With postMessage, no flakiness is observed locally.
Added a related MediaDevices test that was missing from r235438.

* http/tests/IndexedDB/collect-IDB-objects.https.html:
* http/tests/IndexedDB/resources/myidbframe.htm:
* http/tests/media/clearkey/collect-webkit-media-session.html:
* http/tests/media/clearkey/resources/mywebkitmediasessionframe.htm:
* http/tests/media/media-stream/collect-media-devices.https-expected.txt: Added.
* http/tests/media/media-stream/collect-media-devices.https.html: Added.
* http/tests/media/media-stream/resources/mymediadevicesframe.htm: Added.

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

18 months ago[iOS] uiController.typeCharacterUsingHardwareKeyboard("`", ...) dispatches DOM key...
dbates@webkit.org [Fri, 7 Sep 2018 23:08:34 +0000 (23:08 +0000)]
[iOS] uiController.typeCharacterUsingHardwareKeyboard("`", ...) dispatches DOM key events for ~
https://bugs.webkit.org/show_bug.cgi?id=189325

Reviewed by Wenson Hsieh.

Tools:

Fixes an issue where the test infrastructure would incorrectly synthesized a shift key press followed
by a ` key press (i.e. type '~') when instructed to simulate typing a grave accent (`). Typing a
grave accent does not require holding the shift key.

* WebKitTestRunner/ios/HIDEventGenerator.mm:
(shouldWrapWithShiftKeyEventForCharacter):

LayoutTests:

Add a test to ensure that we dispatch the correct DOM key events when using uiController.typeCharacterUsingHardwareKeyboard("`")
(by way of UIHelper.typeCharacter()).

* fast/events/ios/keypress-grave-accent-expected.txt: Added.
* fast/events/ios/keypress-grave-accent.html: Added.

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

18 months agoRTCRtpReceiver::track should return a MediaStreamTrack reference
youenn@apple.com [Fri, 7 Sep 2018 23:07:53 +0000 (23:07 +0000)]
RTCRtpReceiver::track should return a MediaStreamTrack reference
https://bugs.webkit.org/show_bug.cgi?id=189420

Reviewed by Eric Carlson.

As per spec, a receiver always has a track.
Remove unneeded RTCRtpSenderReceiverBase and make RTCRtpReceiver have a Ref<MediaStreamTrack>.
RTCRtpSender keeps having a RefPtr<MediaStreamTrack>.
Update call sites accordingly.
No change of behavior.

* Modules/mediastream/RTCRtpReceiver.cpp:
(WebCore::RTCRtpReceiver::RTCRtpReceiver):
(WebCore::RTCRtpReceiver::stop):
* Modules/mediastream/RTCRtpReceiver.h:
(WebCore::RTCRtpReceiver::track):
* Modules/mediastream/RTCRtpReceiver.idl:
* Modules/mediastream/RTCRtpSender.cpp:
(WebCore::RTCRtpSender::RTCRtpSender):
* Modules/mediastream/RTCRtpSender.h:
(WebCore::RTCRtpSender::track):
* Modules/mediastream/RTCRtpSender.idl:
* Modules/mediastream/RTCRtpSenderReceiverBase.h: Removed.
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::addRemoteTrack):
* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
(WebCore::LibWebRTCPeerConnectionBackend::videoReceiver):
(WebCore::LibWebRTCPeerConnectionBackend::audioReceiver):
* WebCore.xcodeproj/project.pbxproj:

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

18 months agoCleanup: Remove extraneous "using namespace" and scope WebCore::LogThreading
dbates@webkit.org [Fri, 7 Sep 2018 23:00:09 +0000 (23:00 +0000)]
Cleanup: Remove extraneous "using namespace" and scope WebCore::LogThreading
https://bugs.webkit.org/show_bug.cgi?id=189381

Reviewed by Simon Fraser.

* platform/ios/wak/WKGraphics.mm:
* platform/ios/wak/WebCoreThread.mm:
(WebThreadEnable):

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

18 months agoClean up FontAttributeChanges.cpp after r235748
wenson_hsieh@apple.com [Fri, 7 Sep 2018 22:53:50 +0000 (22:53 +0000)]
Clean up FontAttributeChanges.cpp after r235748
https://bugs.webkit.org/show_bug.cgi?id=189394

Reviewed by Tim Horton.

* Sources.txt: Move FontAttributeChanges.cpp into unified sources.
* WebCore.xcodeproj/project.pbxproj:
* editing/FontAttributeChanges.cpp: Replace `#import`s with `#include`s.

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

18 months ago[Curl][WebKitLegacy] Stop sending credential embedded in the url via XHR.
Basuke.Suzuki@sony.com [Fri, 7 Sep 2018 22:50:30 +0000 (22:50 +0000)]
[Curl][WebKitLegacy] Stop sending credential embedded in the url via XHR.
https://bugs.webkit.org/show_bug.cgi?id=189198

Reviewed by Alexey Proskuryakov.

Source/WebCore:

Because sync XHR of Curl port uses passed request directly, the credential information in
url is not removed. Use ResourceHandleInternal's firstRequest because those are
already takne out.

Test: http/tests/xmlhttprequest/url-with-credentials.html

* platform/network/curl/ResourceHandleCurl.cpp:
(WebCore::ResourceHandle::platformLoadResourceSynchronously):

LayoutTests:

* http/tests/xmlhttprequest/resources/url-with-credentials/authenticate.php: Added.
* http/tests/xmlhttprequest/resources/url-with-credentials/authorize.php: Added.
* http/tests/xmlhttprequest/url-with-credentials-expected.txt: Added.
* http/tests/xmlhttprequest/url-with-credentials.html: Added.

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

18 months agoRealtimeOutgoingVideoSourceCocoa should use VTImageRotationSession to rotate CVPixelB...
youenn@apple.com [Fri, 7 Sep 2018 22:28:18 +0000 (22:28 +0000)]
RealtimeOutgoingVideoSourceCocoa should use VTImageRotationSession to rotate CVPixelBuffers
https://bugs.webkit.org/show_bug.cgi?id=189427

Reviewed by Eric Carlson.

Previously, we were relying on libwebrtc utils to do the rotation.
This is inefficient compared to VTImageRotateSession and also induces additional memory cost
since libwebrtc is rotating using its own buffers and the encoder will convert this buffer back to a CVPixelBuffer.

Instead use VTImageRotationSession when rotation must be done at sending side.
Covered by webrtc/video-rotation.html.

* platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
(WebCore::RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated):
* platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.h:
* platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm:
(WebCore::computeRotatedWidthAndHeight):
(WebCore::RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer):

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

18 months agoAdd support for unified plan transceivers
youenn@apple.com [Fri, 7 Sep 2018 21:57:47 +0000 (21:57 +0000)]
Add support for unified plan transceivers
https://bugs.webkit.org/show_bug.cgi?id=189390

Reviewed by Eric Carlson.

LayoutTests/imported/w3c:

* web-platform-tests/webrtc/RTCDTMFSender-insertDTMF.https-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-addTrack.https-expected.txt:
Regression comes from the fact that the sender was never used but transceiver direction is sendrecv.
This might need further clarification in the spec or implementation of libwebrtc.
* web-platform-tests/webrtc/RTCPeerConnection-addTransceiver-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-removeTrack.https-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-setDescription-transceiver-expected.txt:
* web-platform-tests/webrtc/RTCRtpTransceiver-setDirection-expected.txt:

Source/ThirdParty/libwebrtc:

Expose more symbols.
* Configurations/libwebrtc.iOS.exp:
* Configurations/libwebrtc.iOSsim.exp:
* Configurations/libwebrtc.mac.exp:

Source/WebCore:

Keep previous transceiver behavior when unified plan flag is off.
Otherwise, use the libwebrtc transceiver API to create and use unified plan transceivers.
Fuel the implementation of transceivers through a dedicated backend.

Update transceiver IDL and make some smaller fixes at the same time:
- Make sure remote sources have a proper name as per https://w3c.github.io/webrtc-pc/#dfn-create-an-rtcrtpreceiver.
- Add support for transceiver.currentDirection.

Our mock peer connections are only supporting plan B APIs at the moment.
We therefore mandate plan B when using such mocks until we can upgrade mocks to support unified plan APIs.

Covered by modified and rebased tests.

* Modules/mediastream/PeerConnectionBackend.cpp:
(WebCore::PeerConnectionBackend::addTrack):
* Modules/mediastream/PeerConnectionBackend.h:
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::addTrack):
(WebCore::RTCPeerConnection::addTransceiver):
* Modules/mediastream/RTCRtpSender.cpp:
(WebCore::RTCRtpSender::RTCRtpSender):
* Modules/mediastream/RTCRtpTransceiver.cpp:
(WebCore::RTCRtpTransceiver::mid const):
(WebCore::RTCRtpTransceiver::currentDirection const):
* Modules/mediastream/RTCRtpTransceiver.h:
(WebCore::RTCRtpTransceiver::backend):
* Modules/mediastream/RTCRtpTransceiver.idl:
* Modules/mediastream/RTCRtpTransceiverBackend.h:
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::addTrack):
(WebCore::LibWebRTCMediaEndpoint::newTransceiver):
(WebCore::LibWebRTCMediaEndpoint::addTransceiver):
(WebCore::LibWebRTCMediaEndpoint::transceiverBackendFromSender):
(WebCore::LibWebRTCMediaEndpoint::OnAddTrack):
(WebCore::LibWebRTCMediaEndpoint::OnTrack):
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
(WebCore::createReceiverForSource):
(WebCore::LibWebRTCPeerConnectionBackend::createReceiver):
(WebCore::LibWebRTCPeerConnectionBackend::videoReceiver):
(WebCore::LibWebRTCPeerConnectionBackend::audioReceiver):
(WebCore::LibWebRTCPeerConnectionBackend::addTrack):
(WebCore::LibWebRTCPeerConnectionBackend::addTransceiver):
(WebCore::backendFromRTPTransceiver):
(WebCore::LibWebRTCPeerConnectionBackend::existingTransceiver):
(WebCore::LibWebRTCPeerConnectionBackend::newTransceiver):
* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
* Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
(WebCore::LibWebRTCRtpSenderBackend::replaceTrack):
* Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
* Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.cpp: Added.
(WebCore::LibWebRTCRtpTransceiverBackend::createReceiverBackend):
(WebCore::LibWebRTCRtpTransceiverBackend::createSenderBackend):
(WebCore::LibWebRTCRtpTransceiverBackend::direction const):
(WebCore::LibWebRTCRtpTransceiverBackend::currentDirection const):
(WebCore::LibWebRTCRtpTransceiverBackend::setDirection):
(WebCore::LibWebRTCRtpTransceiverBackend::mid):
(WebCore::LibWebRTCRtpTransceiverBackend::stop):
* Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.h: Added.
* Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp:
(WebCore::toRTCRtpTransceiverDirection):
(WebCore::fromRTCRtpTransceiverDirection):
(WebCore::fromRtpTransceiverInit):
* Modules/mediastream/libwebrtc/LibWebRTCUtils.h:
* WebCore.xcodeproj/project.pbxproj:
* platform/mediastream/RealtimeIncomingAudioSource.cpp:
(WebCore::RealtimeIncomingAudioSource::RealtimeIncomingAudioSource):
* platform/mediastream/RealtimeIncomingVideoSource.cpp:
(WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource):
* platform/mediastream/RealtimeMediaSource.h:
* testing/Internals.cpp:
(WebCore::Internals::useMockRTCPeerConnectionFactory):

LayoutTests:

Update tests using mock to enforce plan B for now until unified plan mocks are supported.

* fast/mediastream/RTCPeerConnection-addIceCandidate-expected.txt:
* fast/mediastream/RTCPeerConnection-icecandidate-event.html:
* fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html:
* fast/mediastream/RTCPeerConnection-inspect-answer.html:
* fast/mediastream/RTCPeerConnection-inspect-offer.html:
* fast/mediastream/RTCPeerConnection-media-setup-single-dialog.html:
* fast/mediastream/RTCPeerConnection-media-setup-two-dialogs.html:
* fast/mediastream/RTCPeerConnection-remotely-assigned-transceiver-mid.html:
* fast/mediastream/RTCPeerConnection-setLocalDescription-offer.html:
* fast/mediastream/RTCPeerConnection-setRemoteDescription-offer.html:
* webrtc/calling-peerconnection-once-closed.html:
Once closed, addTransceiver is expected to throw.
* webrtc/libwebrtc/release-while-creating-offer.html:
* webrtc/libwebrtc/release-while-getting-stats.html:
* webrtc/libwebrtc/release-while-setting-local-description.html:
* webrtc/video-getParameters.html: sender and receiver parameters are no longer the same.
Testing them individually.
* webrtc/video-with-receiver.html:
Test is working only with legacy mode.

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

18 months agoXMLHttpRequest: open() does not throw a SYNTAX_ERR exception if method is empty or...
commit-queue@webkit.org [Fri, 7 Sep 2018 21:43:35 +0000 (21:43 +0000)]
XMLHttpRequest: open() does not throw a SYNTAX_ERR exception if method is empty or url cannot be resolved
https://bugs.webkit.org/show_bug.cgi?id=46008

Patch by Rob Buis <rbuis@igalia.com> on 2018-09-07
Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

* web-platform-tests/xhr/open-url-bogus-expected.txt:
* web-platform-tests/xhr/open-url-multi-window-6-expected.txt:

Source/WebCore:

Check if passed URL is valid as specified here [1].

Test: web-platform-tests/xhr/open-url-bogus.htm

[1] https://xhr.spec.whatwg.org/#the-open()-method Step 7

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::open):

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

18 months agoAllow WebContent access to AVCSupported IOKit property in sandbox
bfulgham@apple.com [Fri, 7 Sep 2018 21:29:35 +0000 (21:29 +0000)]
Allow WebContent access to AVCSupported IOKit property in sandbox
https://bugs.webkit.org/show_bug.cgi?id=189429
<rdar://problem/43612229>

Reviewed by Eric Carlson.

Allow access to the IOKit properties AVCSupported and HEVCSupported to allow the WebContent process
to check for efficient video codecs.

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

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

18 months ago[CSSOM View] Handle the scrollingElement in Element::scroll(Left/Top/Width/Height/To)
commit-queue@webkit.org [Fri, 7 Sep 2018 21:12:41 +0000 (21:12 +0000)]
[CSSOM View] Handle the scrollingElement in Element::scroll(Left/Top/Width/Height/To)
https://bugs.webkit.org/show_bug.cgi?id=182230

Patch by Frederic Wang <fwang@igalia.com> on 2018-09-07
Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

This commit updates expectations for some WPT tests so that they have only PASS results.
Note that css/cssom-view/scrollingElement-quirks-dynamic-*.html still fail for now (bug 182292).

* web-platform-tests/css/cssom-view/HTMLBody-ScrollArea_quirksmode-expected.txt:
* web-platform-tests/css/cssom-view/scrolling-quirks-vs-nonquirks-expected.txt:
* web-platform-tests/css/cssom-view/scrollingElement-expected.txt: Added.

Source/WebCore:

This commit moves the special logic for "scrolling element" body from the
HtmlBodyElement::scroll(Left/Top/Width/Height/To) functions to the Element class. The code
is executed when the element is the scrolling element which includes the case of body
in Quirks mode and of documentElement in standard mode. This makes the behavior closer to
the CSSOM View spec (bug 5991) while not deviating too much from the current implementation.
Finally, CSSOMViewScrollingAPI is now enabled for running tests and some adjustments are made
to existing tests. Further improvements will be performed in dependencies of bug 5991.

No new tests, already covered by existing tests.

* dom/Document.cpp: Split scrollingElement into two functions so that one can be called
internally without updating the layout.
(WebCore::Document::scrollingElement):
(WebCore::Document::scrollingElementForAPI):
* dom/Document.h: Ditto.
* dom/Document.idl: Use the version updating the layout for API calls.
* dom/Element.cpp: Add include to call DOMWindow::ScrollTo
(WebCore::Element::scrollTo): Moved some logic from HtmlBodyElement to handle the case of
the scrolling element. Also skip special handling of documentElement() when
CSSOMViewScrollingAPI is disabled.
(WebCore::adjustContentsScrollPositionOrSizeForZoom): Moved some logic from HtmlBodyElement
to handle the case of the scrolling element. Also add a FIXME for improving these kinds of
helper functions. Renamed to make more explicit the semantic of the value argument.
(WebCore::Element::scrollLeft): Moved some logic from HtmlBodyElement to handle the case of
the scrolling element. Use the new documentFrameWithNonNullView() helper function.
(WebCore::Element::scrollTop): Ditto.
(WebCore::Element::setScrollLeft): Ditto
(WebCore::Element::setScrollTop): Ditto.
(WebCore::Element::scrollWidth): Ditto.
(WebCore::Element::scrollHeight): Ditto.
* dom/Element.h:
(WebCore::Document::documentFrameWithNonNullView): New helper function to retrieve the
frame and ensure a view is available.
* html/HTMLBodyElement.cpp: Remove code that is now in Element.
* html/HTMLBodyElement.h: Ditto.

Source/WebKit:

* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp:
(webkit_dom_document_get_scrolling_element): Use the new name.

Source/WebKitLegacy/mac:

* DOM/DOMDocument.mm:
(-[DOMDocument scrollingElement]): Use the new name.

Tools:

This patch enables CSSOMViewScrollingAPI during test execution.

* DumpRenderTree/mac/DumpRenderTree.mm:
(enableExperimentalFeatures):
(resetWebPreferencesToConsistentValues):
* DumpRenderTree/win/DumpRenderTree.cpp:
(enableExperimentalFeatures):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetPreferencesToConsistentValues):

LayoutTests:

This commit updates some tests to work when CSSOMViewScrollingAPI is enabled.

* TestExpectations: Enable web-platform-tests/cssom-view/scrollingElement.html.
* fast/dom/Document/scrollingElement-quirks-mode.html: Do not enable explictly enable
CSSOMViewScrollingAPI.
* fast/dom/Document/scrollingElement-standards-mode.html: Ditto.
* fast/dom/Element/body-scrollLeft-expected.txt: Updated to follow the CSSOMView spec.
* fast/dom/Element/body-scrollLeft.html: Ditto.
* fast/dom/Element/body-scrollTop-expected.txt: Ditto.
* fast/dom/Element/body-scrollTop.html: Ditto.
* fast/dom/Element/documentElement-scrollLeft-expected.txt: Ditto.
* fast/dom/Element/documentElement-scrollLeft.html: Ditto.
* fast/dom/Element/documentElement-scrollTop-expected.txt: Ditto.
* fast/dom/Element/documentElement-scrollTop.html: Ditto.
* fast/dom/Element/scrollLeft-expected.txt: Ditto.
* fast/dom/Element/scrollLeft.html: Ditto.
* fast/dom/Element/scrollTop-expected.txt: Ditto.
* fast/dom/Element/scrollTop.html: Ditto.
* fast/dom/Element/scrolling-funtions-on-body-expected.txt: Ditto.
* fast/dom/Element/scrolling-funtions-on-body.html: Ditto.
* platform/ios/TestExpectations: Add expectation for one WPT test that was already failing
on iOS.
* platform/ios/ios/fast/coordinates/page-offsets-expected.txt: Use documentElement instead
of body for this test when running in standard mode.
* platform/ios/ios/fast/coordinates/resources/helpers.js: Ditto.
(verifyScrollOffsets):
* tiled-drawing/scrolling/fast-scroll-div-latched-mainframe.html: Use
document.scrollingElement instead of document.body to access viewport scroll offset.

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