WebKit-https.git
10 months agoAdd support for reporting "display composited video frames" through the VideoPlayback...
jer.noble@apple.com [Fri, 5 Oct 2018 01:11:22 +0000 (01:11 +0000)]
Add support for reporting "display composited video frames" through the VideoPlaybackQuality object.
https://bugs.webkit.org/show_bug.cgi?id=190266

Reviewed by Eric Carlson.

Source/WebCore:

Test: TestWebKitAPI.VideoQualityDisplayCompositing

Modify VideoPlaybackQuality to take a VideoPlaybackQualityMetrics object in its
constructor (rather than individual fields). Add a new setting to control visibility
of the displayCompositedVideoFrames attribute on VideoPlaybackQuality. Add support
for VideoPlaybackQualityMetrics to MediaPlayerPrivateAVFoundationObjC.

* Modules/mediasource/VideoPlaybackQuality.cpp:
(WebCore::VideoPlaybackQuality::create):
(WebCore::VideoPlaybackQuality::VideoPlaybackQuality):
* Modules/mediasource/VideoPlaybackQuality.h:
(WebCore::VideoPlaybackQuality::displayCompositedVideoFrames const):
* Modules/mediasource/VideoPlaybackQuality.idl:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::getVideoPlaybackQuality):
* html/HTMLMediaElement.h:
* html/HTMLMediaElement.idl:
* page/Settings.yaml:
* platform/graphics/MediaPlayer.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::videoPlaybackQualityMetrics):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::videoPlaybackQualityMetrics):
* platform/mock/mediasource/MockMediaSourcePrivate.cpp:
(WebCore::MockMediaSourcePrivate::videoPlaybackQualityMetrics):

Source/WebCore/PAL:

* pal/spi/mac/AVFoundationSPI.h:

Source/WebKit:

Add a new preference to control the visibility of displayCompositedVideoFrames in the VideoPlaybackQualityObject.

* Shared/WebPreferences.yaml:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _setVideoQualityIncludesDisplayCompositingEnabled:]):
(-[WKPreferences _videoQualityIncludesDisplayCompositingEnabled]):
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/VideoQualityDisplayCompositing.mm: Added.
(TestWebKitAPI::TEST):

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

10 months ago[Cocoa] Add SPI to expose typing attributes at the current selection on WKWebView
wenson_hsieh@apple.com [Fri, 5 Oct 2018 00:47:05 +0000 (00:47 +0000)]
[Cocoa] Add SPI to expose typing attributes at the current selection on WKWebView
https://bugs.webkit.org/show_bug.cgi?id=190119
<rdar://problem/44767062>

Reviewed by Tim Horton.

Source/WebKit:

Add support for new WebKit2 SPI to notify the UI delegate about font attributes when the editor state changes
(e.g. due to selection changes, or executing an edit command). See below for more detail.

Test: FontAttributes.FontAttributesAfterChangingSelection

* Shared/EditorState.cpp:
(WebKit::EditorState::PostLayoutData::encode const):
(WebKit::EditorState::PostLayoutData::decode):
* Shared/EditorState.h:

Add a new optional `FontAttributes` member to EditorState's post-layout data. FontAttributes are computed and
sent over IPC only if the UI delegate implements the new delegate hook which requires information about font
attributes.

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:

Add a new flag for the UI process to let a new web page know whether it should additionally compute font
attributes when computing editor state.

* UIProcess/API/APIUIClient.h:
(API::UIClient::needsFontAttributes const):
(API::UIClient::didChangeFontAttributes):
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _didChangeEditorState]):
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate):
(WebKit::UIDelegate::UIClient::didChangeFontAttributes):

Call out to the UI delegate with a font attribute dictionary, created via FontAttributes on EditorState's
post-layout data.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setUIClient):

Update whether or not the UI process needs to know about font attributes. The UI process only requires font
attribute information if the UI delegate implements `-_webView:didChangeFontAttributes:`.

(WebKit::WebPageProxy::setNeedsFontAttributes):
(WebKit::WebPageProxy::creationParameters):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::editorStateChanged):
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::editorStateChanged):

Update the cached font attributes in the UI process when receiving a new editor state update.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_cpuLimit):
(WebKit::WebPage::editorState const):
(WebKit::WebPage::setNeedsFontAttributes):

Add a new IPC hook to update whether or not the page should additionally compute font attributes. In the case
where the UI delegate changes from something that does not require font attributes to one that does, we
additionally schedule an editor state update.

(WebKit::WebPage::updateFontAttributesAfterEditorStateChange):

Private helper function to plumb FontAttributes to the UI client after an editor state change.

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

Tools:

Add a new API test that loads a document containing various rich text styles. This test moves the selection
around the document and checks the last set of font attributes received via the new UI delegate hook.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/FontAttributes.mm: Added.
(-[FontAttributesListener _webView:didChangeFontAttributes:]):
(-[FontAttributesListener lastFontAttributes]):
(-[TestWKWebView selectElementWithIdentifier:]):
(-[TestWKWebView fontAttributesAfterNextPresentationUpdate]):
(ColorExpectation::ColorExpectation):
(ShadowExpectation::ShadowExpectation):
(checkColor):
(checkShadow):
(checkFont):
(webViewForTestingFontAttributes):
* TestWebKitAPI/Tests/WebKitCocoa/rich-text-attributes.html: Added.

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

10 months agoMove start/EndOfFixedExecutableMemoryPool pointers into the FixedVMPoolExecutableAllo...
mark.lam@apple.com [Fri, 5 Oct 2018 00:35:25 +0000 (00:35 +0000)]
Move start/EndOfFixedExecutableMemoryPool pointers into the FixedVMPoolExecutableAllocator object.
https://bugs.webkit.org/show_bug.cgi?id=190295
<rdar://problem/19197193>

Reviewed by Saam Barati.

This allows us to use the tagging logic already baked into MacroAssemblerCodePtr
instead of needing to use our own custom version here.

* jit/ExecutableAllocator.cpp:
(JSC::FixedVMPoolExecutableAllocator::FixedVMPoolExecutableAllocator):
(JSC::FixedVMPoolExecutableAllocator::memoryStart):
(JSC::FixedVMPoolExecutableAllocator::memoryEnd):
(JSC::FixedVMPoolExecutableAllocator::isJITPC):
(JSC::ExecutableAllocator::allocate):
(JSC::startOfFixedExecutableMemoryPoolImpl):
(JSC::endOfFixedExecutableMemoryPoolImpl):
(JSC::isJITPC):
* jit/ExecutableAllocator.h:

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

10 months agoA Document / Window should lose its browsing context as soon as its iframe is removed...
cdumez@apple.com [Fri, 5 Oct 2018 00:19:46 +0000 (00:19 +0000)]
A Document / Window should lose its browsing context as soon as its iframe is removed from the document
https://bugs.webkit.org/show_bug.cgi?id=190282

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline several WPT tests that are now passing. I have verified that those tests are also passing in
Firefox and Chrome.

* web-platform-tests/html/browsers/windows/nested-browsing-contexts/window-parent-null-expected.txt:
* web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe-synchronously-discard-expected.txt:

Source/WebCore:

A Document / Window should lose its browsing context (aka Frame) as soon as its iframe is removed from
the document. In WebKit, a Document / Window's Frame was only getting nulled out when the frame gets
destroyed, which happens later usually after a GC happens.

Specification:
- https://html.spec.whatwg.org/#the-iframe-element
"""
When an iframe element is removed from a document, the user agent must discard the element's nested browsing
context, if it is not null, and then set the element's nested browsing context to null.
"""

This was not consistent with the specification or other browsers (tested Chrome and Firefox) so this
patch is aligning our behavior.

In a follow-up, I am planning to look into making the Window not be a FrameDestructionObserver, and instead
get its frame from the Document. This should make the code simpler.

No new tests, rebaselined existing tests.

* Modules/mediastream/MediaDevices.cpp:
(WebCore::MediaDevices::getUserMedia const):
* Modules/mediastream/MediaDevices.h:
Update getUserMedia() to reject a the Promise with an InvalidStateError when calling after the
document has been detached, instead of throwing an InvalidStateError. This behavior is as per
specification:
- https://w3c.github.io/mediacapture-main/#dom-mediadevices-getusermedia (Step 4)
I needed to make this change to keep one of our layout tests passing.

* dom/Document.cpp:
(WebCore::Document::attachToCachedFrame):
(WebCore::Document::detachFromFrame):
* dom/Document.h:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::didSecureTransitionTo):
(WebCore::DOMWindow::willDetachDocumentFromFrame):
(WebCore::DOMWindow::setStatus):
(WebCore::DOMWindow::detachFromFrame):
(WebCore::DOMWindow::attachToFrame):
* page/DOMWindow.h:
* page/DOMWindowProperty.cpp:
(WebCore::DOMWindowProperty::disconnectFrameForDocumentSuspension):
(WebCore::DOMWindowProperty::willDestroyGlobalObjectInCachedFrame):
(WebCore::DOMWindowProperty::willDestroyGlobalObjectInFrame):
* page/Frame.cpp:
(WebCore::Frame::disconnectOwnerElement):

* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::drawText):
Calling drawText() with a null String hits an assertion in debug. This was triggered by one of
our layout tests so I made sure we only call drawText when the String is not null.

LayoutTests:

Update existing layout test to reflect behavior change.

* fast/dom/Window/BarInfo-after-frame-removed.html:
* fast/dom/Window/dom-access-from-closure-iframe-expected.txt:
* fast/dom/Window/dom-access-from-closure-window-expected.txt:
* fast/dom/Window/dom-access-from-closure-window-with-gc-expected.txt:
* fast/dom/Window/resources/dom-access-from-closure-iframe-child.html:
* fast/dom/Window/resources/dom-access-from-closure-window-child.html:
* fast/events/resources/before-unload-return-string-conversion-frame.html:
* fast/parser/resources/set-parent-to-javascript-url.html:
* http/tests/media/media-stream/disconnected-frame.html:
* http/tests/security/contentSecurityPolicy/resources/checkDidSameOriginChildWindowLoad.js:
(checkDidLoad):
* http/tests/security/named-window-property-from-same-origin-inactive-document-expected.txt:
* http/tests/security/named-window-property-from-same-origin-inactive-document.html:
* http/tests/security/xss-DENIED-contentWindow-eval-expected.txt:
* http/tests/security/xss-DENIED-named-window-property-from-cross-origin-inactive-document-expected.txt:
* http/tests/security/xss-DENIED-named-window-property-from-cross-origin-inactive-document.html:

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

10 months agoAdd retry for test groups with failed build requests.
dewei_zhu@apple.com [Fri, 5 Oct 2018 00:17:49 +0000 (00:17 +0000)]
Add retry for test groups with failed build requests.
https://bugs.webkit.org/show_bug.cgi?id=190188

Reviewed by Ryosuke Niwa.

Added retry logic in run-analysis script.
Current retry logic will only be triggered when there is at least one successful build request for each commit set
in a test group.

* init-database.sql: Added 'testgroup_initial_repetition_count' and 'testgroup_may_need_more_requests'.
SQL to update existing database:
'''
BEGIN;
    ALTER TABLE analysis_test_groups
        ADD COLUMN testgroup_initial_repetition_count integer DEFAULT NULL,
        ADD COLUMN testgroup_may_need_more_requests boolean DEFAULT FALSE;
    UPDATE analysis_test_groups SET testgroup_initial_repetition_count = (
        SELECT DISTINCT(COUNT(*)) FROM build_requests WHERE request_group = testgroup_id AND request_order >= 0 GROUP BY request_commit_set
    );
    ALTER TABLE analysis_test_groups ALTER COLUMN testgroup_initial_repetition_count DROP DEFAULT, ALTER COLUMN testgroup_may_need_more_requests SET NOT NULL;
END;
'''
'testgroup_initial_repetition_count' represents the number of successful build request for each commit set when
test group is created.
'testgroup_may_need_more_requests' will be set when any build request in test group is set to 'failed'.
* public/api/build-requests.php: Added the logic to set 'testgroup_may_need_more_requests'.
* public/api/test-groups.php: Updated 'ready-for-notification' to 'ready-for-further-processing' so that it returns finished test
groups those either have 'needs_notification' or  'may_need_more_requests' set.
* public/include/commit-sets-helpers.php: Set 'initial_repetition_count' to repetition count.
* public/privileged-api/update-test-group.php: Added APIs to add build request for a test group and
update 'may_need_more_requests' flag.
* public/v3/models/test-group.js:
(TestGroup): Added '_mayNeedMoreRequests' and '_initialRepetitionCount' field.
Refactored code that interacts with '/api/update-test-group'.
(TestGroup.prototype.updateSingleton):
(TestGroup.prototype.mayNeedMoreRequests):
(TestGroup.prototype.initialRepetitionCount):
(TestGroup.prototype.async._updateBuildRequest):
(TestGroup.prototype.updateName):
(TestGroup.prototype.updateHiddenFlag):
(TestGroup.prototype.async.didSendNotification):
(TestGroup.prototype.async.addMoreBuildRequests):
(TestGroup.prototype.async.clearMayNeedMoreBuildRequests): Added API to clear 'may_need_more_requests' flag.
(TestGroup.fetchAllReadyForFurtherProcessing): Refactored 'TestGroup.fetchAllWithNotificationReady' to return test groups either
have 'needs_notification' or  'may_need_more_requests' set.
(TestGroup.fetchAllThatMayNeedMoreRequests): Fetches test groups those may need more build requests.
* server-tests/api-test-groups.js: Added unit tests.
* server-tests/privileged-api-add-build-requests-tests.js: Added unit tests for 'add-build-requests' API.
* server-tests/privileged-api-update-test-group-tests.js: Added unit tests.
* server-tests/resources/mock-data.js:
(MockData.addMockData):
* server-tests/resources/test-server.js:
(TestServer.prototype._determinePgsqlDirectory): Fixed a bug that 'childProcess.execFileSync' may return a buffer.
* tools/run-analysis.js: Added logic to add extra build request before sennding notification.
* tools/js/retry-failed-build-requests.js:
(async.createAdditionalBuildRequestsForTestGroupsWithFailedRequests): Module that add extra build requests.
* unit-tests/retry-failed-build-requests-tests.js: Added.
* unit-tests/test-groups-tests.js: Added unit tests.

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

10 months agoUnify implementation in VideoFullscreenInterfaceAVKit
commit-queue@webkit.org [Thu, 4 Oct 2018 23:52:39 +0000 (23:52 +0000)]
Unify implementation in VideoFullscreenInterfaceAVKit
https://bugs.webkit.org/show_bug.cgi?id=190091
rdar://problem/44734523

Patch by Jeremy Jones <jeremyj@apple.com> on 2018-10-04
Reviewed by Jer Noble.

Source/WebCore:

No new tests because no behavior change.

Unified code in VideoFullscreenInterfaceAVKit now that new code path is proven and include
any changes that had been made in the old path.

* platform/ios/VideoFullscreenInterfaceAVKit.h:
* platform/ios/VideoFullscreenInterfaceAVKit.mm:
(-[WebAVPlayerViewControllerDelegate playerViewControllerShouldStartPictureInPictureFromInlineWhenEnteringBackground:]):
(VideoFullscreenInterfaceAVKit::preparedToExitFullscreen):
(VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
* platform/ios/WebVideoFullscreenControllerAVKit.mm:
(VideoFullscreenControllerContext::requestUpdateInlineRect):
(VideoFullscreenControllerContext::requestVideoContentLayer):
(VideoFullscreenControllerContext::returnVideoContentLayer):
(VideoFullscreenControllerContext::didSetupFullscreen):
(VideoFullscreenControllerContext::didExitFullscreen):

Source/WebKit:

Unified code in VideoFullscreenInterfaceAVKit now that new code path is proven and include
any changes that had been made in the old path.

* UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
* WebProcess/cocoa/VideoFullscreenManager.mm:
(WebKit::VideoFullscreenManager::supportsVideoFullscreenStandby const):
(WebKit::VideoFullscreenManager::didSetupFullscreen):
(WebKit::VideoFullscreenManager::didExitFullscreen):

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

10 months agoMore Carbon build-fixing.
mitz@apple.com [Thu, 4 Oct 2018 23:31:06 +0000 (23:31 +0000)]
More Carbon build-fixing.

* Carbon/CarbonWindowAdapter.mm:
(-[CarbonWindowAdapter _destroyRealWindow:]):
(-[CarbonWindowAdapter _growBoxRect]):

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

10 months agoUnreviewed, add self as contributor.
alancoon@apple.com [Thu, 4 Oct 2018 23:25:53 +0000 (23:25 +0000)]
Unreviewed, add self as contributor.

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

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

10 months agoBindings generator should support static attributes that are interfaces with CallWith
commit-queue@webkit.org [Thu, 4 Oct 2018 23:18:12 +0000 (23:18 +0000)]
Bindings generator should support static attributes that are interfaces with CallWith
https://bugs.webkit.org/show_bug.cgi?id=190292

Patch by Justin Michaud <justin_michaud@apple.com> on 2018-10-04
Reviewed by Chris Dumez.

Add support for static attributes that support callWith to the bindings generator. This
is needed for CSS.paintWorklet.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateAttributeGetterBodyDefinition):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjConstructorTestStaticReadonlyObjGetter):
(WebCore::jsTestObjConstructorTestStaticReadonlyObj):
* bindings/scripts/test/TestObj.idl:

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

10 months agoUnreviewed test gardening for WinCairo (and one cross-platform test).
ross.kirsling@sony.com [Thu, 4 Oct 2018 22:40:45 +0000 (22:40 +0000)]
Unreviewed test gardening for WinCairo (and one cross-platform test).

* TestExpectations:
Remove a cross-platform failure that seems to be passing on all platforms now.

* platform/wincairo/TestExpectations:
* platform/wincairo/editing/pasteboard/emacs-ctrl-k-y-001-expected.txt: Added.

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

10 months agoUnreviewed, rolling out r236730.
jlewis3@apple.com [Thu, 4 Oct 2018 22:25:04 +0000 (22:25 +0000)]
Unreviewed, rolling out r236730.

Source/WebCore:

This caused a consistent crash in test http/tests/media/media-stream/get-display-media-prompt.html.

Reverted changeset:

"[MediaStream] RealtimeMediaSource should be able to vend
hashed IDs"
https://bugs.webkit.org/show_bug.cgi?id=190142
https://trac.webkit.org/changeset/236730

Source/WebKit:

This caused a consistent crash in test http/tests/media/media-
stream/get-display-media-prompt.html.

Reverted changeset:

"[MediaStream] RealtimeMediaSource should be able to vend
hashed IDs"
https://bugs.webkit.org/show_bug.cgi?id=190142
https://trac.webkit.org/changeset/236730

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

10 months ago[macOS] Fix some font attribute conversion bugs in preparation for "Font > Styles...
wenson_hsieh@apple.com [Thu, 4 Oct 2018 22:08:51 +0000 (22:08 +0000)]
[macOS] Fix some font attribute conversion bugs in preparation for "Font > Styles…" support in WebKit2
https://bugs.webkit.org/show_bug.cgi?id=190289
<rdar://problem/45020806>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Makes some small adjustments to fix two bugs in font attribute conversion logic. See below for more detail.

Tests:  FontManagerTests.AddFontShadowUsingFontOptions
        FontManagerTests.AddAndRemoveColorsUsingFontOptions

* editing/FontAttributeChanges.cpp:
(WebCore::cssValueListForShadow):
* editing/cocoa/FontAttributesCocoa.mm:

Currently, we bail from adding a font shadow if the shadow's offset is empty. However, valid shadow offsets may
have negative dimensions, so a check for `isZero()` should be used instead.

(WebCore::FontAttributes::createDictionary const):
* platform/mac/WebCoreNSFontManagerExtras.mm:

Fall back to a transparent background color; this allows senders to remove the current background color by just
removing NSBackgroundColorAttributeName from the attribute dictionary, rather than explicitly setting it to the
transparent color (this scenario is exercised when using "Font > Styles…" to specify a font style without a
background color).

(WebCore::computedFontAttributeChanges):

Tools:

Add new API tests to exercise two corner cases when using NSFontOptions ("Font > Styles…") to change font
attributes at the current selection.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/TestWebKitAPI/mac/AppKitSPI.h:
* TestWebKitAPI/Tests/mac/FontManagerTests.mm:
(webViewForFontManagerTesting):
(TestWebKitAPI::TEST):
* TestWebKitAPI/mac/TestFontOptions.h: Copied from Source/WebCore/editing/cocoa/FontAttributesCocoa.mm.
* TestWebKitAPI/mac/TestFontOptions.mm: Added.

Introduce TestFontOptions, which wraps the shared NSFontOptions and swizzles `-sharedFontOptions` to return a
global instance of itself. TestFontOptions supports several testing helpers to add or remove font shadows,
foreground colors, and background colors.

(sharedFontOptionsForTesting):
(+[TestFontOptions sharedInstance]):
(-[TestFontOptions initWithFontOptions:]):
(-[TestFontOptions selectedAttributes]):
(-[TestFontOptions fontOptions]):
(-[TestFontOptions shadowWidth]):
(-[TestFontOptions setShadowWidth:]):
(-[TestFontOptions shadowHeight]):
(-[TestFontOptions setShadowHeight:]):
(-[TestFontOptions setShadowBlurRadius:]):
(-[TestFontOptions setHasShadow:]):
(-[TestFontOptions foregroundColor]):
(-[TestFontOptions setForegroundColor:]):
(-[TestFontOptions backgroundColor]):
(-[TestFontOptions setBackgroundColor:]):
(-[TestFontOptions _dispatchFontAttributeChanges]):
(-[TestFontOptions convertAttributes:]):
(-[TestFontOptions setSelectedAttributes:isMultiple:]):
(-[TestFontOptions forwardInvocation:]):

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

10 months agoWeb Inspector: Table should support multiple selection and Cmd-click behavior
mattbaker@apple.com [Thu, 4 Oct 2018 21:54:14 +0000 (21:54 +0000)]
Web Inspector: Table should support multiple selection and Cmd-click behavior
https://bugs.webkit.org/show_bug.cgi?id=189705
<rdar://problem/44571170>

Reviewed by Devin Rousso.

Source/WebInspectorUI:

Add multiple row selection to Table, with new methods for programmatic
selection (deselectRow, deselectAll), and Command-click support for
selecting/deselecting Table rows.

* UserInterface/Base/IndexSet.js: Added.
(WI.IndexSet):
(WI.IndexSet.prototype.get size):
(WI.IndexSet.prototype.get firstIndex):
(WI.IndexSet.prototype.get lastIndex):
(WI.IndexSet.prototype.add):
(WI.IndexSet.prototype.delete):
(WI.IndexSet.prototype.has):
(WI.IndexSet.prototype.clear):
(WI.IndexSet.prototype.indexGreaterThan):
(WI.IndexSet.prototype.indexLessThan):
(WI.IndexSet.prototype.Symbol.iterator):
(WI.IndexSet.prototype._indexClosestTo):
(WI.IndexSet.prototype._validateIndex):
Helper container for managing an ordered sequence of unique positive
integers, with set semantics, backed by a sorted array. Used by Table,
and eventually by TreeOutline.

* UserInterface/Main.html:
* UserInterface/Test.html:
* UserInterface/Test/Test.js:
New files and stubs to make Table layout tests possible.

* UserInterface/Views/NetworkTableContentView.js:
(WI.NetworkTableContentView.prototype.reset):
(WI.NetworkTableContentView.prototype.showRepresentedObject):
(WI.NetworkTableContentView.prototype.networkResourceDetailViewClose):
(WI.NetworkTableContentView.prototype.tableSelectionDidChange):
(WI.NetworkTableContentView.prototype._restoreSelectedRow):
(WI.NetworkTableContentView.prototype.tableSelectedRowChanged): Deleted.
Replace uses of `clearSelectedRow` with `deselectAll`, and updated
selection changed delegate.

* UserInterface/Views/Table.css:
(.table > .data-container > .data-list > li):
(.table > .data-container > .data-list > li.selected):
(@media (prefers-dark-interface)):
(.table,): Deleted.
Removed styles that are no longer needed after https://webkit.org/b/189766,
and provide a visual separation between adjacent selected rows.

* UserInterface/Views/Table.js:
(WI.Table):
(WI.Table.prototype.get selectedRows):
(WI.Table.prototype.get allowsMultipleSelection):
(WI.Table.prototype.set allowsMultipleSelection):
(WI.Table.prototype.reloadData):
(WI.Table.prototype.selectRow):
(WI.Table.prototype.deselectRow):
(WI.Table.prototype.deselectAll):
(WI.Table.prototype._getOrCreateRow):
(WI.Table.prototype._handleMouseDown):
(WI.Table.prototype._deselectAllAndSelect):
(WI.Table.prototype._isRowSelected):
(WI.Table.prototype._notifySelectionDidChange):
(WI.Table.prototype.clearSelectedRow): Deleted.
Table now tracks selected rows using an IndexSet. selectRow accepts an
optional parameter, `extendSelection`, for adding rows to the selection.
_selectedRowIndex is now used to track the most recently selected row.
This will be the only selected row unless multiple selection is enabled,
in which case it is the row that has the "focus", for purposes of selecting
a new row using the up or down arrow keys.

LayoutTests:

* inspector/table/resources/table-utilities.js: Added.
(TestPage.registerInitializer.InspectorTest.TableDataSource):
(TestPage.registerInitializer.InspectorTest.TableDataSource.prototype.get items):
(TestPage.registerInitializer.InspectorTest.TableDataSource.prototype.tableNumberOfRows):
(TestPage.registerInitializer.InspectorTest.TableDelegate):
(TestPage.registerInitializer.InspectorTest.TableDelegate.prototype.tableSelectionDidChange):
(TestPage.registerInitializer.InspectorTest.TableDelegate.prototype.tablePopulateCell):
(TestPage.registerInitializer.InspectorTest.createTable):
(TestPage.registerInitializer):

* inspector/table/table-selection-expected.txt: Added.
* inspector/table/table-selection.html: Added.
* inspector/unit-tests/index-set-expected.txt: Added.
* inspector/unit-tests/index-set.html: Added.

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

10 months agoWeb Automation: clear pending callbacks when the session terminates
bburg@apple.com [Thu, 4 Oct 2018 21:47:13 +0000 (21:47 +0000)]
Web Automation: clear pending callbacks when the session terminates
https://bugs.webkit.org/show_bug.cgi?id=190259
<rdar://problem/44958352>

Reviewed by Joseph Pecoraro.

WebAutomationSession::terminate() can be called at any time to nuke the session.
However, it's possible that the session is in the midst of simulating keyboard/mouse
events. While in that state, there are some CompletionHandler objects waiting
for key/mouse events to be flushed. We need to empty out callback maps with
CompletionHandler instances so that they do not assert because they were never called.

I was able to test this manually by running a test that erroneously hangs
while waiting for keyboard input. While the test was hung, I killed the NetworkProcess
manually to trigger WebAutomationSession::terminate(). From there, I saw that the
Perform Actions REST API call gets cancelled with the appropriate error code.

* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::terminate):

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

10 months agoRetried to fix 32-bit macOS builds after r236846.
mitz@apple.com [Thu, 4 Oct 2018 21:14:58 +0000 (21:14 +0000)]
Retried to fix 32-bit macOS builds after r236846.

* WebView/WebHTMLView.mm:
(-[WebHTMLView setMarkedText:selectedRange:]):

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

10 months agoMutationRecord doesn't keep JS wrappers of target, addedNodes, and removedNodes alive
rniwa@webkit.org [Thu, 4 Oct 2018 21:12:04 +0000 (21:12 +0000)]
MutationRecord doesn't keep JS wrappers of target, addedNodes, and removedNodes alive
https://bugs.webkit.org/show_bug.cgi?id=190277

Reviewed by Antti Koivisto.

Source/WebCore:

The bug was caused by JSMutationRecord not visiting any of the nodes referenced by mutation records.

Fixed the bug by adding JSMutationRecord::visitAdditionalChildren, which adds the root nodes of
the root nodes of the target, addedNodes, and removedNodes in each mutation record.

Test: fast/dom/MutationObserver/mutation-record-keeps-js-wrappers-of-nodes-alive.html

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSMutationRecordCustom.cpp: Added.
(WebCore::JSMutationRecord::visitAdditionalChildren): Added.
* bindings/js/JSPerformanceObserverCustom.cpp: This file got dumped out of a unified build file
where using namespace JSC was defined. Use the fully qualified names to refer to JSC types.
(WebCore::JSPerformanceObserverOwner::isReachableFromOpaqueRoots):
* dom/MutationRecord.cpp:
(WebCore::ChildListRecord::visitNodesConcurrently): Added.
(WebCore::RecordWithEmptyNodeLists::visitNodesConcurrently): Added.
(WebCore::MutationRecordWithNullOldValue::visitNodesConcurrently): Added.
* dom/MutationRecord.h:
* dom/MutationRecord.idl:

LayoutTests:

Added two regression tests for making sure mutation observers and mutation records keep JS wrappers
of the enqueued nodes alive. Also see r236799 for a previous failed attempt to add a similar test.

* fast/dom/MutationObserver/mutation-observer-keeps-js-wrappers-of-nodes-alive-expected.txt: Added.
* fast/dom/MutationObserver/mutation-observer-keeps-js-wrappers-of-nodes-alive.html: Added.
* fast/dom/MutationObserver/mutation-record-keeps-js-wrappers-of-nodes-alive-expected.txt: Added.
* fast/dom/MutationObserver/mutation-record-keeps-js-wrappers-of-nodes-alive.html: Added.

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

10 months agoRetried to fix 32-bit macOS builds after r236846.
mitz@apple.com [Thu, 4 Oct 2018 21:02:34 +0000 (21:02 +0000)]
Retried to fix 32-bit macOS builds after r236846.

* Carbon/HIWebView.mm:
(ActiveStateChanged):

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

10 months agoWeb Inspector: REGRESSION(r236540): Uncaught Exception: TypeError: pauseReasonBreakpo...
drousso@apple.com [Thu, 4 Oct 2018 20:58:14 +0000 (20:58 +0000)]
Web Inspector: REGRESSION(r236540): Uncaught Exception: TypeError: pauseReasonBreakpointTreeElement.removeStatusImage is not a function.
https://bugs.webkit.org/show_bug.cgi?id=190230

Reviewed by Matt Baker.

* UserInterface/Views/DebuggerSidebarPanel.js:
(WI.DebuggerSidebarPanel._removeBreakpoint):
Leverage existing `status` getter/setter for creating/removing the breakpoint icon element.

* UserInterface/Views/BreakpointTreeElement.js:
(WI.BreakpointTreeElement):
(WI.BreakpointTreeElement.prototype.populateContextMenu):
(WI.BreakpointTreeElement.prototype._updateStatus):
(WI.BreakpointTreeElement.prototype.removeStatusImage): Deleted.

* UserInterface/Views/DOMBreakpointTreeElement.js:
(WI.DOMBreakpointTreeElement):
(WI.DOMBreakpointTreeElement.prototype.onattach):
(WI.DOMBreakpointTreeElement.prototype.ondetach):
(WI.DOMBreakpointTreeElement.prototype._updateStatus):

* UserInterface/Views/EventBreakpointTreeElement.js:
(WI.EventBreakpointTreeElement):
(WI.EventBreakpointTreeElement.prototype.onattach):
(WI.EventBreakpointTreeElement.prototype.ondetach):
(WI.EventBreakpointTreeElement.prototype._updateStatus):

* UserInterface/Views/XHRBreakpointTreeElement.js:
(WI.XHRBreakpointTreeElement):
(WI.XHRBreakpointTreeElement.prototype.onattach):
(WI.XHRBreakpointTreeElement.prototype.ondetach):
(WI.XHRBreakpointTreeElement.prototype._updateStatus):

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

10 months agoTried to fix 32-bit macOS builds after r236846.
mitz@apple.com [Thu, 4 Oct 2018 20:47:32 +0000 (20:47 +0000)]
Tried to fix 32-bit macOS builds after r236846.

* Carbon/HIWebView.mm:
(_NSSelectorForHICommand):

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

10 months agoWebInspectorUI and WebKitLegacy parts of [Xcode] Update some build settings as recomm...
mitz@apple.com [Thu, 4 Oct 2018 20:36:56 +0000 (20:36 +0000)]
WebInspectorUI and WebKitLegacy parts of [Xcode] Update some build settings as recommended by Xcode 10
https://bugs.webkit.org/show_bug.cgi?id=190250

Reviewed by Andy Estes.

Source/WebCore/PAL:

* pal/spi/mac/NSWindowSPI.h: Added a private API declaration.

Source/WebInspectorUI:

* Configurations/Base.xcconfig: Enabled CLANG_WARN_COMMA, CLANG_WARN_INFINITE_RECURSION,
  CLANG_WARN_SUSPICIOUS_MOVE, CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS, and
  CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF.

* WebInspectorUI.xcodeproj/project.pbxproj: Let Xcode update LastUpgradeCheck.

Source/WebKitLegacy:

* WebKitLegacy.xcodeproj/project.pbxproj: Let Xcode update LastUpgradeCheck.

Source/WebKitLegacy/mac:
WebKitLegacy part of [Xcode] Update some build settings as recommended by Xcode 10
https://bugs.webkit.org/show_bug.cgi?id=190250

Reviewed by Andy Estes.

* Configurations/Base.xcconfig: Enabled CLANG_WARN_COMMA, CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF,
  CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS, and CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED.
  Also enabled GCC_WARN_UNDECLARED_SELECTOR by deleting the line that set it to NO, which let
  an earlier line set it to YES.

Enabling -Wundeclared-selector exposed some long-standing mistakes and required the most
changes below.

* DefaultDelegates/WebDefaultContextMenuDelegate.mm: Imported an internal header that
  provides some missing method declarations.

* Misc/WebDownload.mm:
(-[WebDownload initWithRequest:delegate:]): Suppressed warning about this implementation of
  a deprecated method.

* Misc/WebIconDatabase.mm: Suppressed warning around our implementation of a deprecated class.

* Misc/WebNSObjectExtras.mm: Declare a category that is implemented in this file, because
  other code in the file uses a method from it.

* Plugins/WebBaseNetscapePluginView.mm:
(-[WebBaseNetscapePluginView renewGState]): Suppressed warning about this implementation of
  a deprecated method.

* Plugins/WebPluginController.mm:
(installFlip4MacPlugInWorkaroundIfNecessary): Suppressed the undeclared selector warning
  around use of a selector that may be present in some WebKit client.

* Plugins/WebPluginDatabase.mm: Imported an internal header that provides some missing
  method declarations.

* WebCoreSupport/PopupMenuMac.mm: Imported a header that delcares delegate methods we call
  from here.

* WebCoreSupport/WebCachedFramePlatformData.h: Imported an internal header that provides some
  missing method declarations.

* WebCoreSupport/WebChromeClient.mm: Imported a header that declares delegate methods we call
  from here.

* WebCoreSupport/WebFrameLoaderClient.mm: Imported headers that declare delegate methods we
  call from here.
(WebFrameLoaderClient::setTitle): Suppressed the undeclared selector warning around use of
  an obsolete delegate method for binary compatibility.
(pluginView): Ditto.

* WebCoreSupport/WebVisitedLinkStore.mm: Imported a header that declares delegate methods we
  call from here.

* WebView/WebDeviceOrientationInternal.h: Declared -setController in a new
  WebDeviceOrientationProviderMock protocol.

* WebView/WebDeviceOrientationProviderMock.mm:
(-[WebDeviceOrientationProviderMock setController:]): Moved from an internal category to the
  main @implementation.

* WebView/WebDeviceOrientationProviderMockInternal.h: Declared that
  WebDeviceOrientationProviderMock conforms to WebDeviceOrientationProviderMock.

* WebView/WebDynamicScrollBarsView.mm:
(-[WebDynamicScrollBarsView accessibilityIsIgnored]): Suppressed warning about this implementation
  of a deprecated method.

* WebView/WebHTMLView.mm:
(-[WebHTMLView validateUserInterfaceItemWithoutDelegate:]): Suppressed the undeclared
  selector warning around action methods that are not declared anywhere in WebKit.

(-[WebHTMLView dragImage:at:offset:event:pasteboard:source:slideBack:]): Suppressed warning
  about implementing this deprecated method.
(-[WebHTMLView draggingSourceOperationMaskForLocal:]): Ditto.
(-[WebHTMLView draggedImage:endedAt:operation:]): Ditto.
(-[WebHTMLView namesOfPromisedFilesDroppedAtDestination:]): Ditto.
(-[WebHTMLView accessibilityAttributeValue:]): Ditto.
(-[WebHTMLView characterIndexForPoint:]): Ditto.
(-[WebHTMLView firstRectForCharacterRange:]): Ditto.
(-[WebHTMLView attributedSubstringFromRange:]): Ditto.
(-[WebHTMLView setMarkedText:selectedRange:]): Ditto.
(-[WebHTMLView doCommandBySelector:]): Ditto.
(-[WebHTMLView insertText:]): Ditto.

* WebView/WebHTMLViewInternal.h: Declared an internal method that’s used from another file.

* WebView/WebJSPDFDoc.mm: Imported a header that declares delegate methods we call from here.

* WebView/WebPDFView.h: Removed previewView ivar.

* WebView/WebPDFView.mm:
  Removed declaration of FileInternal category and merged its implementation with the main
  implementation.
(-[WebPDFView dealloc]): Removed previewView ivar.
(-[WebPDFView initWithFrame:]): Removed code to deal with PDFPreviewView, which doesn’t
  exist in macOS versions we support.
(+[WebPDFView _PDFPreviewViewClass]): Deleted. PDFPreviewView doesn’t exist anymore.
(-[WebPDFView _canLookUpInDictionary]): Suppressed undeclared selector warning around use of
  action methods internal to PDFKit.
(-[WebPDFView _lookUpInDictionaryFromMenu:]): Ditto.
(-[WebPDFView _menuItemsFromPDFKitForEvent:]): Ditto.

* WebView/WebUIDelegatePrivate.h: Restored declarations of the delegate methods we actually
  call on macOS, even though in r86988 we started calling different methods on iOS.

* WebView/WebView.mm:
- Imported headers that declare delegate methods that we call.
- Removed declaration of WebFileInternal category and merged its implementation with the
  main implementation.
- Many internal methods were inexplicibly implemented as part of the WebViewEditingInMail
  category, which made them impossible to call from the main implementation. Moved those
  into the main implementation. One of those had to be declared in a class extension,
  because it is called from a method implemented in the WebPrivate category, and that
  category’s implementation appears first in the file.

(-[WebView _cacheHistoryDelegateImplementations]): Suppressed undeclared selector warning
  around use of obsolete delegate method for binary compatibility.

* WebView/WebViewInternal.h: Declared an internal method that’s used from another file.

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

10 months agoWeb Inspector: merge ProbeManager into DebuggerManager
drousso@apple.com [Thu, 4 Oct 2018 20:27:45 +0000 (20:27 +0000)]
Web Inspector: merge ProbeManager into DebuggerManager
https://bugs.webkit.org/show_bug.cgi?id=190225

Reviewed by Joseph Pecoraro.

Source/WebInspectorUI:

* UserInterface/Main.html:
* UserInterface/Base/Main.js:
(WI.loaded):
* UserInterface/Test.html:
* UserInterface/Test/Test.js:
(WI.loaded):

* UserInterface/Controllers/DebuggerManager.js:
(WI.DebuggerManager.prototype.get probeSets): Added.
(WI.DebuggerManager.prototype.probeForIdentifier): Added.
(WI.DebuggerManager.prototype.addBreakpoint):
(WI.DebuggerManager.prototype.removeBreakpoint):
(WI.DebuggerManager.prototype.didSampleProbe): Added.
(WI.DebuggerManager.prototype._handleBreakpointActionsDidChange): Added.
(WI.DebuggerManager.prototype._addProbesForBreakpoint): Added.
(WI.DebuggerManager.prototype._removeProbesForBreakpoint): Added.
(WI.DebuggerManager.prototype._updateProbesForBreakpoint): Added.
(WI.DebuggerManager.prototype._probeSetForBreakpoint): Added.
* UserInterface/Controllers/ProbeManager.js: Removed.

* UserInterface/Protocol/DebuggerObserver.js:
(WI.DebuggerObserver.prototype.didSampleProbe):

* UserInterface/Controllers/TimelineManager.js:
(WI.TimelineManager.prototype._processRecord):

* UserInterface/Views/BreakpointTreeElement.js:
(WI.BreakpointTreeElement.prototype.onattach):

* UserInterface/Views/ProbeDetailsSidebarPanel.js:
(WI.ProbeDetailsSidebarPanel.prototype.closed):
(WI.ProbeDetailsSidebarPanel.prototype.initialLayout):

* UserInterface/Views/TextResourceContentView.js:
(WI.TextResourceContentView):
(WI.TextResourceContentView.prototype.get supplementalRepresentedObjects):
(WI.TextResourceContentView.prototype.closed):

LayoutTests:

* http/tests/inspector/debugger/debugger-test.js:
(TestPage.registerInitializer.InspectorTest.startTracingProbes):
(TestPage.registerInitializer):
* http/tests/inspector/resources/probe-test.js:
(TestPage.registerInitializer.ProtocolTest.Probe.installTracingListeners):
(TestPage.registerInitializer):

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

10 months agoWeb Inspector: some files not listed in OpenResourceDialog
drousso@apple.com [Thu, 4 Oct 2018 20:08:54 +0000 (20:08 +0000)]
Web Inspector: some files not listed in OpenResourceDialog
https://bugs.webkit.org/show_bug.cgi?id=190272

Reviewed by Joseph Pecoraro.

Source/WebInspectorUI:

* UserInterface/Controllers/ResourceQueryController.js:
(WI.ResourceQueryController.prototype._findQueryMatches):
Allow the `searchIndex` to go past the end of the `searchString` to allow for backtracking
if the last character of `searchString` is not found in `query`.

LayoutTests:

* inspector/unit-tests/resource-query-controller-expected.txt:
* inspector/unit-tests/resource-query-controller.html:

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

10 months agoWeb Inspector: REGRESSION(r236783): Uncaught Exception: Can't find variable: sourceMapURL
drousso@apple.com [Thu, 4 Oct 2018 20:03:50 +0000 (20:03 +0000)]
Web Inspector: REGRESSION(r236783): Uncaught Exception: Can't find variable: sourceMapURL
https://bugs.webkit.org/show_bug.cgi?id=190276

Reviewed by Joseph Pecoraro.

* UserInterface/Controllers/NetworkManager.js:
(WI.NetworkManager.prototype._sourceMapLoadAndParseFailed):

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

10 months ago[WebAuthN] Move time out control from WebProcess to UIProcess
jiewen_tan@apple.com [Thu, 4 Oct 2018 19:32:14 +0000 (19:32 +0000)]
[WebAuthN] Move time out control from WebProcess to UIProcess
https://bugs.webkit.org/show_bug.cgi?id=189642
<rdar://problem/44476765>

Reviewed by Chris Dumez.

Source/WebCore:

Since now the control unit of WebAuthN has been moved to UI Process, i.e. AuthenticatorManager,
the time out timer should move to UI Process as well.

Tests: http/wpt/webauthn/public-key-credential-create-failure-local-silent.https.html
       http/wpt/webauthn/public-key-credential-get-failure-local-silent.https.html

* Modules/webauthn/AuthenticatorCoordinator.cpp:
(WebCore::AuthenticatorCoordinator::create const):
(WebCore::AuthenticatorCoordinator::discoverFromExternalSource const):
(WebCore::AuthenticatorCoordinatorInternal::initTimeoutTimer): Deleted.
(WebCore::AuthenticatorCoordinatorInternal::didTimeoutTimerFire): Deleted.
* Modules/webauthn/PublicKeyCredentialCreationOptions.h:
(WebCore::PublicKeyCredentialCreationOptions::encode const):
(WebCore::PublicKeyCredentialCreationOptions::decode):
* Modules/webauthn/PublicKeyCredentialRequestOptions.h:
(WebCore::PublicKeyCredentialRequestOptions::encode const):
(WebCore::PublicKeyCredentialRequestOptions::decode):

Source/WebKit:

Besides adding a time out timer in the AuthenticatorManager, this patch also adds a new
option in MockWebAuthenticationConfiguration to turn on silent failure which is the
default policy of treating authenticators' error as suggested by spec.

* UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
* UIProcess/WebAuthentication/AuthenticatorManager.cpp:
(WebKit::AuthenticatorManagerInternal::collectTransports):
(WebKit::AuthenticatorManager::makeCredential):
(WebKit::AuthenticatorManager::getAssertion):
(WebKit::AuthenticatorManager::respondReceived):
(WebKit::AuthenticatorManager::initTimeOutTimer):
* UIProcess/WebAuthentication/AuthenticatorManager.h:
(WebKit::AuthenticatorManager::requestTimeOutTimer):
* UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
(WebKit::MockAuthenticatorManager::respondReceivedInternal):
* UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:

Tools:

* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setWebAuthenticationMockConfiguration):

LayoutTests:

This patch also fixes some flaky behaviours regarding to the dirty ASN.1 decoder.

* http/wpt/webauthn/public-key-credential-create-failure-local-silent.https-expected.txt: Added.
* http/wpt/webauthn/public-key-credential-create-failure-local-silent.https.html: Copied from LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-local.https.html.
* http/wpt/webauthn/public-key-credential-create-failure-local.https-expected.txt:
* http/wpt/webauthn/public-key-credential-create-failure-local.https.html:
* http/wpt/webauthn/public-key-credential-create-failure.https-expected.txt:
* http/wpt/webauthn/public-key-credential-create-failure.https.html:
* http/wpt/webauthn/public-key-credential-get-failure-local-silent.https-expected.txt: Added.
* http/wpt/webauthn/public-key-credential-get-failure-local-silent.https.html: Copied from LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-local.https.html.
* http/wpt/webauthn/public-key-credential-get-failure-local.https-expected.txt:
* http/wpt/webauthn/public-key-credential-get-failure-local.https.html:
* http/wpt/webauthn/public-key-credential-get-failure.https-expected.txt:
* http/wpt/webauthn/public-key-credential-get-failure.https.html:
* http/wpt/webauthn/resources/util.js:

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

10 months agoRegression(r236779): Crash when changing the input element type from inside an 'input...
cdumez@apple.com [Thu, 4 Oct 2018 19:31:15 +0000 (19:31 +0000)]
Regression(r236779): Crash when changing the input element type from inside an 'input' event listener
https://bugs.webkit.org/show_bug.cgi?id=190252

Reviewed by Alex Christensen.

Source/WebCore:

Add a null check for element() after firing the 'input' event and before firing the 'change' event
in case the input event listener changes the input type.

Tests: fast/dom/HTMLInputElement/change-type-in-click-event-listener.html
       fast/dom/HTMLInputElement/change-type-in-input-event-listener.html

* html/BaseCheckableInputType.cpp:
(WebCore::BaseCheckableInputType::fireInputAndChangeEvents):

LayoutTests:

Add layout test coverage.

* fast/dom/HTMLInputElement/change-type-in-click-event-listener-expected.txt: Added.
* fast/dom/HTMLInputElement/change-type-in-click-event-listener.html: Added.
* fast/dom/HTMLInputElement/change-type-in-input-event-listener-expected.txt: Added.
* fast/dom/HTMLInputElement/change-type-in-input-event-listener.html: Added.

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

10 months agoLayoutTests/imported/w3c:
commit-queue@webkit.org [Thu, 4 Oct 2018 19:27:10 +0000 (19:27 +0000)]
LayoutTests/imported/w3c:
runtime flag and IDL for MediaRecorder
https://bugs.webkit.org/show_bug.cgi?id=190018

Patch by YUHAN WU <yuhan_wu@apple.com> on 2018-10-04
Reviewed by Youenn Fablet and Chris Dumez.

* web-platform-tests/mediacapture-record/BlobEvent-constructor-expected.txt:
* web-platform-tests/mediacapture-record/MediaRecorder-constructor-expected.txt: Added.
* web-platform-tests/mediacapture-record/MediaRecorder-constructor.html: Added.

Source/WebCore:
runtime flag and IDL for MediaRecorder
https://bugs.webkit.org/show_bug.cgi?id=190018

Patch by Yuhan Wu <yuhan_wu@apple.com> on 2018-10-04
Reviewed by Youenn Fablet and Chris Dumez.

Covered by tests:
imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-constructor.html
imported/w3c/web-platform-tests/mediacapture-record/BlobEvent-constructor.html

Add an architecture of the IDL and the class for MediaRecorder and BlobEvent.

* CMakeLists.txt:
* DerivedSources.make:
* Modules/mediarecorder/BlobEvent.h:
(WebCore::BlobEvent::create):
(WebCore::BlobEvent:::Event):
* Modules/mediarecorder/BlobEvent.idl:
* Modules/mediarecorder/MediaRecorder.cpp:
(WebCore::MediaRecorder::create):
(WebCore::MediaRecorder::MediaRecorder):
(WebCore::MediaRecorder::activeDOMObjectName const):
(WebCore::MediaRecorder::canSuspendForDocumentSuspension const):
* Modules/mediarecorder/MediaRecorder.h: Added.
(WebCore::MediaRecorder::state const):
(WebCore::MediaRecorder::~MediaRecorder):
* Modules/mediarecorder/MediaRecorder.idl:
* Modules/mediastream/RTCRtpReceiver.cpp:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::mediaRecorderEnabled const):
(WebCore::RuntimeEnabledFeatures::setMediaRecorderEnabled):

Source/WebKit:
runtime flag and IDL for MediaRecorder
https://bugs.webkit.org/show_bug.cgi?id=190018

Patch by Yuhan Wu <yuhan_wu@apple.com> on 2018-10-04
Reviewed by Youenn Fablet and Chris Dumez.

* Shared/WebPreferences.yaml:

Source/WebKitLegacy/mac:
Runtime flag and IDL for MediaRecorder
https://bugs.webkit.org/show_bug.cgi?id=190018

Patch by YUHAN WU <yuhan_wu@apple.com> on 2018-10-04
Reviewed by Youenn Fablet and Chris Dumez.

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

Tools:
Runtime flag and IDL for MediaRecorder
https://bugs.webkit.org/show_bug.cgi?id=190018

Patch by YUHAN WU <yuhan_wu@apple.com> on 2018-10-04
Reviewed by Youenn Fablet and Chris Dumez.

* DumpRenderTree/mac/DumpRenderTree.mm:
(enableExperimentalFeatures):

LayoutTests:
runtime flag and IDL for MediaRecorder
https://bugs.webkit.org/show_bug.cgi?id=190018

Patch by YUHAN WU <yuhan_wu@apple.com> on 2018-10-04
Reviewed by Youenn Fablet and Chris Dumez.

* platform/win/TestExpectations:
* fast/mediacapturefromelement/CanvasCaptureMediaStream-capture-out-of-DOM-element-expected.txt:
* fast/mediacapturefromelement/CanvasCaptureMediaStream-framerate-0-expected.txt:
* fast/mediacapturefromelement/CanvasCaptureMediaStream-imagebitmaprenderingcontext-expected.txt:

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

10 months agoDisable Options::useWebAssemblyFastMemory() on linux if ASAN signal handling is not...
mark.lam@apple.com [Thu, 4 Oct 2018 19:23:34 +0000 (19:23 +0000)]
Disable Options::useWebAssemblyFastMemory() on linux if ASAN signal handling is not disabled.
https://bugs.webkit.org/show_bug.cgi?id=190283
<rdar://problem/45015752>

Reviewed by Keith Miller.

* runtime/Options.cpp:
(JSC::Options::initialize):
* wasm/WasmFaultSignalHandler.cpp:
(JSC::Wasm::enableFastMemory):

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

10 months agoFixed engineering builds using the Apple internal SDK as well as building with older
mitz@apple.com [Thu, 4 Oct 2018 18:27:15 +0000 (18:27 +0000)]
Fixed engineering builds using the Apple internal SDK as well as building with older
versions of Xcode.

* Configurations/yasm.xcconfig: Migrated some build settings that were defined at the target
  level in the project file. Some didn’t make sense to migrate, because they could be
  inherited, or because they were warnings that were then being negated by OTHER_CFLAGS.
* libwebrtc.xcodeproj/project.pbxproj:

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

10 months agoUnreviewed, rolling out r236803.
cdumez@apple.com [Thu, 4 Oct 2018 17:52:42 +0000 (17:52 +0000)]
Unreviewed, rolling out r236803.

Caused crashes on some bots

Reverted changeset:

"Regression(r236779): Crash when changing the input element
type from inside an 'input' event listener"
https://bugs.webkit.org/show_bug.cgi?id=190252
https://trac.webkit.org/changeset/236803

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

10 months agoTried to fix the Mojave build after r236832.
mitz@apple.com [Thu, 4 Oct 2018 17:34:22 +0000 (17:34 +0000)]
Tried to fix the Mojave build after r236832.

* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(-[WebAVStreamDataParserListener streamDataParserWillProvideContentKeyRequestInitializationData:forTrackID:]):
(-[WebAVStreamDataParserListener streamDataParser:didProvideContentKeyRequestInitializationData:forTrackID:]):

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

10 months ago[LayoutTests][Win] Stop wpt server correctly.
Basuke.Suzuki@sony.com [Thu, 4 Oct 2018 16:56:13 +0000 (16:56 +0000)]
[LayoutTests][Win] Stop wpt server correctly.
https://bugs.webkit.org/show_bug.cgi?id=190248

Reviewed by Fujii Hironori.

Use signal.CTRL_C_EVENT instead of signal.SIGINT for Windows.
Also refactoring the detection of Windows and cygwin environment check.

* Scripts/webkitpy/common/system/executive.py:
(Executive.__init__): Check environment once.
(Executive._should_close_fds):
(Executive.kill_process):
(Executive.check_running_pid):
(Executive.running_pids):
(Executive.interrupt): Use signal.CTRL_C_EVENT for Windows.
(Executive.kill_all):
(Executive._child_process_encoding):
(Executive._should_encode_child_process_arguments):
(Executive.popen):
(Executive.run_in_parallel):

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

10 months agoENABLE(ASSERT) used in grid code when !ASSERT_DISABLED is desired
mcatanzaro@igalia.com [Thu, 4 Oct 2018 16:56:11 +0000 (16:56 +0000)]
ENABLE(ASSERT) used in grid code when !ASSERT_DISABLED is desired
https://bugs.webkit.org/show_bug.cgi?id=190145

Reviewed by Javier Fernandez.

Replace ENABLE(ASSERT), which doesn't exist, with !ASSERT_DISABLED.

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::placeItemsOnGrid const):
(WebCore::RenderGrid::baselinePosition const):
* rendering/style/GridArea.h:
(WebCore::GridSpan::GridSpan):

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

10 months agoConvert tests to use navigation client
mcatanzaro@igalia.com [Thu, 4 Oct 2018 16:55:47 +0000 (16:55 +0000)]
Convert tests to use navigation client
https://bugs.webkit.org/show_bug.cgi?id=190153

Reviewed by Alex Christensen.

Convert these tests from PagePolicyClient and PageLoaderClient to PageNavigationClient.

* TestWebKitAPI/Tests/WebKit/DownloadDecideDestinationCrash.cpp:
(TestWebKitAPI::decidePolicyForNavigationAction):
(TestWebKitAPI::setPagePolicyClient):
* TestWebKitAPI/Tests/WebKit/ProvisionalURLAfterWillSendRequestCallback.cpp:
(TestWebKitAPI::didCommitNavigationCallback):
(TestWebKitAPI::TEST):
(TestWebKitAPI::didCommitLoadForFrame): Deleted.

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

10 months agoSource/WebCore:
mitz@apple.com [Thu, 4 Oct 2018 16:46:49 +0000 (16:46 +0000)]
Source/WebCore:
WebCore part of [Xcode] Update some build settings as recommended by Xcode 10
https://bugs.webkit.org/show_bug.cgi?id=190250

Reviewed by Andy Estes.

* Configurations/Base.xcconfig: Enabled CLANG_WARN_COMMA, CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF,
  CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED, and CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS.

* WebCore.xcodeproj/project.pbxproj: Let Xcode update LastUpgradeCheck and remove a
  duplicate reference in a Compile Sources build phase.

* accessibility/mac/WebAccessibilityObjectWrapperMac.mm: Suppress -Wdeprecated-implementations
  around implementations of deprecated accessibility methods.

* loader/TextResourceDecoder.cpp:
(WebCore::TextResourceDecoder::checkForBOM): Addressed CLANG_WARN_COMMA.

* platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveAuthenticationChallenge:]):
  Suppress -Wdeprecated-implementations around implementations of this deprecated delegate method.
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]): Ditto.

Source/WebCore/PAL:
PAL part of [Xcode] Update some build settings as recommended by Xcode 10
https://bugs.webkit.org/show_bug.cgi?id=190250

Reviewed by Andy Estes.

* Configurations/Base.xcconfig: Enabled CLANG_WARN_COMMA, CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF,
  CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED, and CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS.

* PAL.xcodeproj/project.pbxproj: Let Xcode update LastUpgradeCheck.

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

10 months agoAudioNode.connect should use [ReturnValue]
darin@apple.com [Thu, 4 Oct 2018 16:20:24 +0000 (16:20 +0000)]
AudioNode.connect should use [ReturnValue]
https://bugs.webkit.org/show_bug.cgi?id=190231

Reviewed by Eric Carlson.

This is a slightly more efficient way to return a value that is always
identical to one of the arguments, so use it here.

* Modules/webaudio/AudioBasicInspectorNode.cpp:
(WebCore::AudioBasicInspectorNode::connect): Return ExceptionOr<void>.
* Modules/webaudio/AudioBasicInspectorNode.h: Ditto.
* Modules/webaudio/AudioNode.cpp:
(WebCore::AudioNode::connect): Ditto.
* Modules/webaudio/AudioNode.h: Ditto.

* Modules/webaudio/AudioNode.idl: Use [ReturnValue].

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

10 months agoRegistered custom properties should allow inheritance to be controlled
commit-queue@webkit.org [Thu, 4 Oct 2018 06:23:02 +0000 (06:23 +0000)]
Registered custom properties should allow inheritance to be controlled
https://bugs.webkit.org/show_bug.cgi?id=190038

Patch by Justin Michaud <justin_michaud@apple.com> on 2018-10-03
Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

Update web platform tests for css registered custom properties to fail in a different way.

* web-platform-tests/css/css-properties-values-api/registered-properties-inheritance-expected.txt:
* web-platform-tests/css/css-properties-values-api/registered-property-computation-expected.txt:
* web-platform-tests/css/css-properties-values-api/registered-property-cssom-expected.txt:
* web-platform-tests/css/css-properties-values-api/url-resolution-expected.txt:
* web-platform-tests/css/css-properties-values-api/var-reference-registered-properties-cycles-expected.txt:
* web-platform-tests/css/css-properties-values-api/var-reference-registered-properties-expected.txt:

Source/WebCore:

Tests: css-custom-properties-api/inherits.html
       css-custom-properties-api/length.html
       css-custom-properties-api/length2.html

Add support for inherits property on registered css custom properties, as well
as a starting point for evaluating registered custom properties with types. Registered
custom properties are evaluated as length values before being substituted. Currently,
relative unit cycles are not detected.

A proper solution is still needed to resolve relative unit cycles, and to apply properties like font
and line-height before they are needed by custom properties. In this patch, the font-size property is
applied twice, once before and once after resolving custom property values.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::customPropertyValue):
(WebCore::CSSComputedStyleDeclaration::length const):
(WebCore::CSSComputedStyleDeclaration::item const):

Allow JS to get custom properties that have been resolved to a length. Also add properties from
m_rareNonInheritedData.

* css/CSSCustomPropertyValue.cpp:
(WebCore::CSSCustomPropertyValue::checkVariablesForCycles const):
(WebCore::CSSCustomPropertyValue::resolveVariableReferences const):
* css/CSSCustomPropertyValue.h:
* css/CSSRegisteredCustomProperty.cpp: Copied from Source/WebCore/css/CSSRegisteredCustomProperty.h.
(WebCore::CSSRegisteredCustomProperty::CSSRegisteredCustomProperty):
(WebCore::CSSRegisteredCustomProperty::initialValueCopy const):
* css/CSSRegisteredCustomProperty.h:
(WebCore::CSSRegisteredCustomProperty::initialValue const):
* css/CSSVariableData.cpp:
(WebCore::CSSVariableData::checkVariablesForCycles const):
(WebCore::CSSVariableData::checkVariablesForCyclesWithRange const):
(WebCore::CSSVariableData::resolveVariableFallback const):
(WebCore::CSSVariableData::resolveVariableReference const):
(WebCore::CSSVariableData::resolveVariableReferences const):
(WebCore::CSSVariableData::resolveTokenRange const):
* css/CSSVariableData.h:
* css/CSSVariableReferenceValue.cpp:
(WebCore::CSSVariableReferenceValue::checkVariablesForCycles const):
* css/CSSVariableReferenceValue.h:
* css/DOMCSSRegisterCustomProperty.cpp:
(WebCore::DOMCSSRegisterCustomProperty::registerProperty):

Use RenderStyle over passing in a customProperties map.

* css/StyleBuilder.h:
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertLength):
(WebCore::StyleBuilderConverter::convertLengthOrAuto):
(WebCore::StyleBuilderConverter::convertLengthSizing):
(WebCore::StyleBuilderConverter::convertLengthMaxSizing):
* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderCustom::applyInitialCustomProperty):
(WebCore::StyleBuilderCustom::applyInheritCustomProperty):
(WebCore::StyleBuilderCustom::applyValueCustomProperty):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::useSVGZoomRules const):
(WebCore::StyleResolver::useSVGZoomRulesForLength const):
(WebCore::StyleResolver::applyProperty):
(WebCore::StyleResolver::resolvedVariableValue const):
(WebCore::StyleResolver::applyCascadedProperties):
(WebCore::StyleResolver::useSVGZoomRules): Deleted.
(WebCore::StyleResolver::useSVGZoomRulesForLength): Deleted.
(WebCore::StyleResolver::resolvedVariableValue): Deleted.
* css/StyleResolver.h:
* css/makeprop.pl:

Move custom property initial values to StyleBuilerCustom. Hook them up to correctly deal with
inheritance, unset and revert values.

* css/parser/CSSParser.cpp:
(WebCore::CSSParser::parseValueWithVariableReferences):
* css/parser/CSSParser.h:
* css/parser/CSSParserContext.cpp:
(WebCore::CSSParserContext::CSSParserContext):
* css/parser/CSSParserContext.h:
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::parseSingleValue):

Allow parsing custom property values as lengths.

* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::checkVariablesInCustomProperties):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::inheritedCustomProperties const):
(WebCore::RenderStyle::nonInheritedCustomProperties const):
(WebCore::RenderStyle::setInheritedCustomPropertyValue):
(WebCore::RenderStyle::setNonInheritedCustomPropertyValue):
(WebCore::RenderStyle::getCustomProperty const):
(WebCore::RenderStyle::customProperties const): Deleted.
(WebCore::RenderStyle::setCustomPropertyValue): Deleted.
* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator== const):
* rendering/style/StyleRareNonInheritedData.h:
* style/StyleResolveForDocument.cpp:
(WebCore::Style::resolveForDocument):

Add support for RenderStyle to deal with both inherited and non-inherited properties, and to find
cycles between them.

LayoutTests:

Add tests to check css registered custom properties with inherits. Also test
calc expression evaluation for inherited registered custom properties.

* css-custom-properties-api/inherits-expected.txt: Added.
* css-custom-properties-api/inherits.html: Added.
* css-custom-properties-api/length-expected.txt: Added.
* css-custom-properties-api/length.html: Added.
* css-custom-properties-api/length2-expected.txt: Added.
* css-custom-properties-api/length2.html: Added.

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

10 months ago[JSC] print() changes CRLF to CRCRLF on Windows
ross.kirsling@sony.com [Thu, 4 Oct 2018 05:12:19 +0000 (05:12 +0000)]
[JSC] print() changes CRLF to CRCRLF on Windows
https://bugs.webkit.org/show_bug.cgi?id=190228

Reviewed by Mark Lam.

* jsc.cpp:
(main):
Ultimately, this is just the normal behavior of printf in text mode on Windows.
Since we're reading in files as binary, we need to be printing out as binary too
(just as we do in DumpRenderTree and ImageDiff.)

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

10 months agoTried to fix non-Cocoa, ENABLE(ATTACHMENT_ELEMENT) builds after r236822.
mitz@apple.com [Thu, 4 Oct 2018 04:57:35 +0000 (04:57 +0000)]
Tried to fix non-Cocoa, ENABLE(ATTACHMENT_ELEMENT) builds after r236822.

* UIProcess/PageClient.h:

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

10 months agoClear m_pendingTargets in MutationObserver::takeRecords
rniwa@webkit.org [Thu, 4 Oct 2018 03:55:12 +0000 (03:55 +0000)]
Clear m_pendingTargets in MutationObserver::takeRecords
https://bugs.webkit.org/show_bug.cgi?id=190240

Reviewed by Geoffrey Garen.

In r236781, we delayed the clearing of m_pendingTargets until the end of microtask to avoid a race between
mutation record's JS wrappers getting created and GC marking JS wrappers of elements in mutation records.

This patch shortens this delay to until mutation record's JS wrappers are created. Specifically, we make
MutationObserver::takeRecords() return a struct which has both pending targets hash set and the vector of
mutation records so that the hash set survives through the creation of JS wrappers for mutation records.

To do this, a new IDL extended attribute "ResultField" is introduced to specify the member variable in
which the result is stored.

No new tests. Unfortunately, this race condition appears to be impossible to capture in a regression test.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateOperationBodyDefinition):
* bindings/scripts/IDLAttributes.json:
* bindings/scripts/test/JS/JSTestInterface.cpp:
(WebCore::jsTestInterfacePrototypeFunctionTakeNodesBody):
(WebCore::jsTestInterfacePrototypeFunctionTakeNodes):
* bindings/scripts/test/TestImplements.idl: Added a test case.
* dom/MutationObserver.cpp:
(WebCore::MutationObserver::takeRecords):
(WebCore::MutationObserver::deliver):
* dom/MutationObserver.h:
* dom/MutationObserver.idl:

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

10 months agolowXYZ in FTLLower should always filter the type of the incoming edge
sbarati@apple.com [Thu, 4 Oct 2018 03:29:57 +0000 (03:29 +0000)]
lowXYZ in FTLLower should always filter the type of the incoming edge
https://bugs.webkit.org/show_bug.cgi?id=189939
<rdar://problem/44407030>

Reviewed by Michael Saboff.

JSTests:

* stress/ftl-should-always-filter-for-low-type-check-functions.js: Added.
(foo):
(test):

Source/JavaScriptCore:

For example, the FTL may know more about data flow than AI in certain programs,
and it needs to inform AI of these data flow properties to appease the assertion
we have in AI that a node must perform type checks on its child nodes.

For example, consider this program:

```
bb#1
a: Phi // Let's say it has an Int32 result, so it goes into the int32 hash table in FTLLower
Branch(...,  #2, #3)

bb#2
ArrayifyToStructure(Cell:@a) // This modifies @a to have the its previous type union the type of some structure set.
Jump(#3)

bb#3
c: Add(Int32:@something, Int32:@a)
```

When the Add node does lowInt32() for @a, FTL lower used to just grab it
from the int32 hash table without filtering the AbstractValue. However,
the parent node is asking for a type check to happen, so we must inform
AI of this "type check" if we want to appease the assertion that all nodes
perform type checks for their edges that semantically perform type checks.
This patch makes it so we filter the AbstractValue in the lowXYZ even
if FTLLower proved the value must be XYZ.

* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compilePhi):
(JSC::FTL::DFG::LowerDFGToB3::simulatedTypeCheck):
(JSC::FTL::DFG::LowerDFGToB3::lowInt32):
(JSC::FTL::DFG::LowerDFGToB3::lowCell):
(JSC::FTL::DFG::LowerDFGToB3::lowBoolean):

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

10 months agoAddressed the warning “no rule to process file 'Source/ThirdParty/libwebrtc/Source...
mitz@apple.com [Thu, 4 Oct 2018 03:27:20 +0000 (03:27 +0000)]
Addressed the warning “no rule to process file 'Source/ThirdParty/libwebrtc/Source/third_party/yasm-1.3.0/modules/objfmts/macho/Makefile.inc' of type sourcecode.pascal for architecture x86_64”

* libwebrtc.xcodeproj/project.pbxproj: Removed Makefile.inc from the yasm target’s Compile
  Sources build phase.

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

10 months ago[Cocoa] Let clients specify an NSFileWrapper subclassed to be used for _WKAttachment
mitz@apple.com [Thu, 4 Oct 2018 02:04:08 +0000 (02:04 +0000)]
[Cocoa] Let clients specify an NSFileWrapper subclassed to be used for _WKAttachment
https://bugs.webkit.org/show_bug.cgi?id=190270

Reviewed by Wenson Hsieh.

Source/WebKit:

* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration copyWithZone:]): Copy new _attachmentFileWrapperClass ivar.
(-[WKWebViewConfiguration _attachmentFileWrapperClass]): Added this getter.
(-[WKWebViewConfiguration _setAttachmentFileWrapperClass:]): Added this setter, which raises
  an exception if the argument is not an NSFileWrapper subclass.

* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: Declared new property.

* UIProcess/Cocoa/PageClientImplCocoa.h:
* UIProcess/Cocoa/PageClientImplCocoa.mm:
(WebKit::PageClientImplCocoa::allocFileWrapperInstance): Added. Allocates an instance of
  the class specified in the configuration, or NSFileWrapper if no custom class is specified.

* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::platformRegisterAttachment): Use PageClient::allocFileWrapperInstance
  instead of allocating an NSFileWrapper instance.

* UIProcess/PageClient.h:
(WebKit::PageClient::allocFileWrapperInstance): Defined new function. The default
  implementation returns nil.

Tools:

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

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

10 months agoAdd VP8 support to WebRTC
youenn@apple.com [Thu, 4 Oct 2018 01:53:27 +0000 (01:53 +0000)]
Add VP8 support to WebRTC
https://bugs.webkit.org/show_bug.cgi?id=189976

Reviewed by Eric Carlson.

LayoutTests/imported/w3c:

* web-platform-tests/webrtc/RTCPeerConnection-addIceCandidate-expected.txt:

Source/ThirdParty/libwebrtc:

Add support for conditional VP8 support for both encoding and decoding.
This boolean is used by WebCore based on the new VP8 runtime flag.

Enable yasm compilation as a dependency of libvpx.

Compilation is done without using SSE4/AVX2 optimizations.

* Configurations/libvpx.xcconfig: Added.
* Configurations/libwebrtc.iOS.exp:
* Configurations/libwebrtc.iOSsim.exp:
* Configurations/libwebrtc.mac.exp:
* Configurations/libwebrtc.xcconfig:
* Configurations/libwebrtcpcrtc.xcconfig:
* Source/third_party/libvpx/run_yasm_webkit.py: Added.
* Source/third_party/libvpx/source/config/mac/x64/vpx_config.asm:
* Source/third_party/libvpx/source/config/mac/x64/vpx_config.h:
* Source/third_party/libvpx/source/config/mac/x64/vpx_dsp_rtcd.h:
* Source/webrtc/sdk/WebKit/WebKitUtilities.h:
* Source/webrtc/sdk/WebKit/WebKitUtilities.mm:
(webrtc::createWebKitEncoderFactory):
(webrtc::createWebKitDecoderFactory):
* Source/webrtc/sdk/objc/Framework/Headers/WebRTC/RTCVideoCodecFactory.h:
* libwebrtc.xcodeproj/project.pbxproj:

Source/WebCore:

Add a runtime flag to control activation of VP8 codec.
Bind this runtime flag to the video codec factories.
Test: webrtc/video-mute-vp8.html

* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
(WebCore::createLibWebRTCPeerConnectionBackend):
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::webRTCVP8CodecEnabled const):
(WebCore::RuntimeEnabledFeatures::setWebRTCVP8CodecEnabled):
* platform/mediastream/libwebrtc/LibWebRTCProvider.h:
* platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
(WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
(WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
Enable VP8 codec for tests.

Source/WebKit:

* Shared/WebPreferences.yaml:

LayoutTests:

* webrtc/audio-peer-connection-g722.html:
* webrtc/routines.js:
* webrtc/video-mute-vp8-expected.txt: Added.
* webrtc/video-mute-vp8.html: Added.

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

10 months ago[WebCrypto] ECDSA could not deal with invalid signature inputs
jiewen_tan@apple.com [Thu, 4 Oct 2018 01:32:02 +0000 (01:32 +0000)]
[WebCrypto] ECDSA could not deal with invalid signature inputs
https://bugs.webkit.org/show_bug.cgi?id=189879
<rdar://problem/44701276>

Reviewed by Brent Fulgham.

Source/WebCore:

Add some guards over detections of the start positions of r/s.

Covered by improved existing tests.

* crypto/mac/CryptoAlgorithmECDSAMac.cpp:
(WebCore::verifyECDSA):

LayoutTests:

* crypto/subtle/ecdsa-verify-malformed-parameters-expected.txt:
* crypto/subtle/ecdsa-verify-malformed-parameters.html:

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

10 months agoAdd a quirk to disable Modern EME for sites which are broken with it enabled
jer.noble@apple.com [Thu, 4 Oct 2018 00:50:46 +0000 (00:50 +0000)]
Add a quirk to disable Modern EME for sites which are broken with it enabled
https://bugs.webkit.org/show_bug.cgi?id=190051

Reviewed by Daniel Bates.

Add a new class, parallel to Settings, to track quirk behavior. Extend the bindings
generator to support a DisabledByQuirk attribute, and set this attribute for all
the Modern EME types. Check whether the quirk is set inside HTMLMediaElement in
addition to the existing Setting.

* Modules/encryptedmedia/MediaKeyMessageEvent.idl:
* Modules/encryptedmedia/MediaKeySession.idl:
* Modules/encryptedmedia/MediaKeyStatusMap.idl:
* Modules/encryptedmedia/MediaKeySystemAccess.idl:
* Modules/encryptedmedia/MediaKeys.idl:
* Modules/encryptedmedia/NavigatorEME.idl:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/scripts/CodeGenerator.pm:
(WK_ucfirst):
* bindings/scripts/CodeGeneratorJS.pm:
(NeedsRuntimeCheck):
(GenerateRuntimeEnableConditionalString):
* bindings/scripts/IDLAttributes.json:
* bindings/scripts/preprocess-idls.pl:
(GenerateConstructorAttributes):
* dom/Document.cpp:
(WebCore::Document::Document):
* dom/Document.h:
(WebCore::Document::quirks const):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaPlayerKeyNeeded):
(WebCore::HTMLMediaElement::mediaPlayerInitializationDataEncountered):
* html/HTMLMediaElement.idl:
* page/Quirks.cpp: Added.
(Quirks::Quirks):
(Quirks::disableEncryptedMediaAPIQuirk const):
* page/Quirks.h: Added.

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

10 months agoSearch does not cancel after number of matching terms exceed set max limit
commit-queue@webkit.org [Wed, 3 Oct 2018 23:34:25 +0000 (23:34 +0000)]
Search does not cancel after number of matching terms exceed set max limit
https://bugs.webkit.org/show_bug.cgi?id=190020
<rdar://problem/39585214>

Patch by Zamiul Haque <zhaque@apple.com> on 2018-10-03
Reviewed by Andy Estes.

When searching a PDF document on MobileSafari, the maximum number of matching
terms are limited to a set constant. Beyond this limit, a PDF document should not
be searched, since the UI will not be updated correspondingly. To this effect,
a new SPI was made to cancel a search when the maximum limit of matching terms
is reached. This is done without clearing the highlighting for the all the terms
that were found under the limit. This bug was a result of not having implemented
the new SPI in WKPDFView.

This will be tested in a follow-up patch, after re-enabling WKPDFView tests
on iOS 12.

* UIProcess/ios/WKPDFView.mm:
(-[WKPDFView pdfHostViewController:findStringUpdate:done:]):

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

10 months agoCommand line jsc should report memory footprint in bytes
msaboff@apple.com [Wed, 3 Oct 2018 23:24:10 +0000 (23:24 +0000)]
Command line jsc should report memory footprint in bytes
https://bugs.webkit.org/show_bug.cgi?id=190267

Reviewed by Mark Lam.

Change to leave the footprint values from the system unmodified.

* jsc.cpp:
(JSCMemoryFootprint::finishCreation):

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

10 months agoSuppress unreachable code warning for LLIntAssembly.h code.
mark.lam@apple.com [Wed, 3 Oct 2018 22:02:44 +0000 (22:02 +0000)]
Suppress unreachable code warning for LLIntAssembly.h code.
https://bugs.webkit.org/show_bug.cgi?id=190263
<rdar://problem/44986532>

Reviewed by Saam Barati.

This is needed because LLIntAssembly.h is template generated from LowLevelInterpreter
asm files, and may contain dead code which are harmless, but will trip up the warning.
We should suppress the warning so that it doesn't break builds.

* llint/LowLevelInterpreter.cpp:
(JSC::CLoop::execute):

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

10 months agoANGLE and libwebrtc parts of [Xcode] Update some build settings as recommended by...
mitz@apple.com [Wed, 3 Oct 2018 21:08:53 +0000 (21:08 +0000)]
ANGLE and libwebrtc parts of [Xcode] Update some build settings as recommended by Xcode 10
https://bugs.webkit.org/show_bug.cgi?id=190250

Reviewed by Andy Estes.

Source/ThirdParty/ANGLE:

* ANGLE.xcodeproj/project.pbxproj: Kept the unreachable code warning off for four files that
  were generated by tools: glslang_lex.cpp, glslang_tab.cpp, Tokenizer.cpp, and
  ExpressionParser.cpp. Let Xcode update LastUpgradeCheck.

* Configurations/Base.xcconfig: Enabled CLANG_WARN_COMMA, CLANG_WARN_INFINITE_RECURSION,
  CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS, CLANG_WARN_SUSPICIOUS_MOVE,
  CLANG_WARN_UNREACHABLE_CODE, CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF, and
  CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED.

Source/ThirdParty/libwebrtc:

* Configurations/Base.xcconfig: Removed a duplicate reference to x_all.c and let Xcode
  update LastUpgradeCheck.

* libwebrtc.xcodeproj/project.pbxproj: Enabled CLANG_WARN_INFINITE_RECURSION,
  CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF, CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED, and
  CLANG_WARN_SUSPICIOUS_MOVE. Other warnings that Xcode 10 recommended were incompatible
  with one or more source files in the project.

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

10 months ago[Cocoa] REGRESSION: web content process paused in debugger is considered to be unresp...
bburg@apple.com [Wed, 3 Oct 2018 21:02:19 +0000 (21:02 +0000)]
[Cocoa] REGRESSION: web content process paused in debugger is considered to be unresponsive if WebKit client is sandboxed
https://bugs.webkit.org/show_bug.cgi?id=190256
<rdar://problem/44957921>

Reviewed by Alexey Proskuryakov.

Instead of giving up when the client is sandboxed, check whether it has the
exception that's necessary to get process information. If it is possible,
proceed to check whether the web content process has a debugger attached.

* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::platformIsBeingDebugged const):
Check 'process-info-pidinfo' to see if the sysctl call would be allowed.

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

10 months ago[Web Animations] REGRESSION: setting 'animation-name: none' after a 'fill: forwards...
graouts@webkit.org [Wed, 3 Oct 2018 20:54:17 +0000 (20:54 +0000)]
[Web Animations] REGRESSION: setting 'animation-name: none' after a 'fill: forwards' animation has completed does not revert to the unanimated style
https://bugs.webkit.org/show_bug.cgi?id=190257
<rdar://problem/41341473>

Reviewed by Dean Jackson.

Source/WebCore:

Test: animations/animation-fill-forwards-removal.html

While we removed a declarative animation that was no longer targetting its element, we were not removing it from the declarative animation maps
on the timeline, which means that the animation would still be picked up when resolving styles. We now notify the timeline that the animation
was detached from the element. This preserves the DeclarativeAnimation relationship returning the element as its effect's target and the document
timeline as its timeline, but the document timeline will no longer see this animation as targeting this element.

* animation/AnimationTimeline.cpp:
(WebCore::AnimationTimeline::cancelOrRemoveDeclarativeAnimation):
* animation/DeclarativeAnimation.h:
(WebCore::DeclarativeAnimation::target const):

LayoutTests:

Add a test that checks that an animation with fill: forwards no longer applies to an element once it's been removed.

* animations/animation-fill-forwards-removal-expected.txt: Added.
* animations/animation-fill-forwards-removal.html: Added.

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

10 months agoCRASH in CVPixelBufferGetBytePointerCallback()
jer.noble@apple.com [Wed, 3 Oct 2018 19:28:31 +0000 (19:28 +0000)]
CRASH in CVPixelBufferGetBytePointerCallback()
https://bugs.webkit.org/show_bug.cgi?id=190092

Reviewed by Eric Carlson.

Speculative fix for crash that occurs when callers of CVPixelBufferGetBytePointerCallback() attempt
to read the last byte of a CVPixelBuffer (as a pre-flight check) and crash due to a memory access
error. It's speculated that mismatching CVPixelBufferLockBytePointer / CVPixelBufferUnlockBytePointer
calls could result in an incorrect state inside the CVPixelBuffer. Add log count checks, locking, and
release logging to try to pinpoint if mismatch lock counts are occurring in this code path.

* platform/graphics/cv/PixelBufferConformerCV.cpp:
(WebCore::CVPixelBufferGetBytePointerCallback):
(WebCore::CVPixelBufferReleaseBytePointerCallback):
(WebCore::CVPixelBufferReleaseInfoCallback):
(WebCore::PixelBufferConformerCV::createImageFromPixelBuffer):

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

10 months agobmalloc, WTF and JavaScriptCore parts of [Xcode] Update some build settings as recomm...
mitz@apple.com [Wed, 3 Oct 2018 18:38:11 +0000 (18:38 +0000)]
bmalloc, WTF and JavaScriptCore parts of [Xcode] Update some build settings as recommended by Xcode 10
https://bugs.webkit.org/show_bug.cgi?id=190250

Reviewed by Alex Christensen.

Source/bmalloc:

* Configurations/Base.xcconfig: Enabled CLANG_WARN_COMMA, CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS,
  and CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF.

* bmalloc.xcodeproj/project.pbxproj: Let Xcode update LastUpgradeCheck.

Source/JavaScriptCore:

* API/tests/Regress141275.mm:
(-[JSTEvaluator _sourcePerform]): Addressed newly-enabled CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF
  by making the self-retaining explicit.

* API/tests/testapi.cpp:
(testCAPIViaCpp): Addressed newly-enabled CLANG_WARN_UNREACHABLE_CODE by breaking out of the
  loop instead of returning from the lambda.

* Configurations/Base.xcconfig: Enabled CLANG_WARN_COMMA, CLANG_WARN_UNREACHABLE_CODE,
  CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS, CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF, and
  CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED.

* JavaScriptCore.xcodeproj/project.pbxproj: Removed a duplicate reference to
  UnlinkedFunctionExecutable.h, and let Xcode update the project file.

* assembler/MacroAssemblerPrinter.cpp:
(JSC::Printer::printAllRegisters): Addressed newly-enabled CLANG_WARN_COMMA by replacing
  some commas with semicolons.

Source/WTF:

* Configurations/Base.xcconfig: Enabled CLANG_WARN_COMMA, CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS,
  and CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF.

* WTF.xcodeproj/project.pbxproj: Let Xcode update LastUpgradeCheck.

* wtf/MathExtras.h:
(WTF::fastLog2): Addressed newly-enabled CLANG_WARN_COMMA by splitting some comma-separated
  expressions into individual statements.

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

10 months agoMake string MaxLength for all WTF and JS strings consistently equal to INT_MAX.
mark.lam@apple.com [Wed, 3 Oct 2018 18:28:55 +0000 (18:28 +0000)]
Make string MaxLength for all WTF and JS strings consistently equal to INT_MAX.
https://bugs.webkit.org/show_bug.cgi?id=190187
<rdar://problem/42512909>

Reviewed by Michael Saboff.

JSTests:

* stress/regress-190187.js: Added.

Source/JavaScriptCore:

Allowing different max string lengths at each level opens up opportunities for
bugs to creep in.  With 2 different max length values, it is more difficult to
keep the story straight on how we do overflow / bounds checks at each place in
the code.  It's also difficult to tell if a seemingly valid check at the WTF level
will have bad ramifications at the JSC level.  Also, it's also not meaningful to
support a max length > INT_MAX.  To eliminate this class of bugs, we'll
standardize on a MaxLength of INT_MAX at all levels.

We'll also standardize the way we do length overflow checks on using
CheckedArithmetic, and add some asserts to document the assumptions of the code.

* runtime/FunctionConstructor.cpp:
(JSC::constructFunctionSkippingEvalEnabledCheck):
- Fix OOM error handling which crashed a test after the new MaxLength was applied.
* runtime/JSString.h:
(JSC::JSString::finishCreation):
(JSC::JSString::createHasOtherOwner):
(JSC::JSString::setLength):
* runtime/JSStringInlines.h:
(JSC::jsMakeNontrivialString):
* runtime/Operations.h:
(JSC::jsString):

Source/WTF:

* wtf/text/StringConcatenate.h:
(WTF::tryMakeStringFromAdapters):
(WTF::sumWithOverflow): Deleted.
* wtf/text/StringImpl.h:
* wtf/text/WTFString.h:

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

10 months agoRegression(r236779): Crash when changing the input element type from inside an 'input...
cdumez@apple.com [Wed, 3 Oct 2018 18:26:29 +0000 (18:26 +0000)]
Regression(r236779): Crash when changing the input element type from inside an 'input' event listener
https://bugs.webkit.org/show_bug.cgi?id=190252

Reviewed by Alex Christensen.

Source/WebCore:

Add a null check for element() after firing the 'input' event and before firing the 'change' event
in case the input event listener changes the input type.

Tests: fast/dom/HTMLInputElement/change-type-in-click-event-listener.html
       fast/dom/HTMLInputElement/change-type-in-input-event-listener.html

* html/BaseCheckableInputType.cpp:
(WebCore::BaseCheckableInputType::fireInputAndChangeEvents):

LayoutTests:

Add layout test coverage.

* fast/dom/HTMLInputElement/change-type-in-click-event-listener-expected.txt: Added.
* fast/dom/HTMLInputElement/change-type-in-click-event-listener.html: Added.
* fast/dom/HTMLInputElement/change-type-in-input-event-listener-expected.txt: Added.
* fast/dom/HTMLInputElement/change-type-in-input-event-listener.html: Added.

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

10 months agoPassing noopener=NOOPENER to window.open() should cause the new window to not have...
cdumez@apple.com [Wed, 3 Oct 2018 18:23:53 +0000 (18:23 +0000)]
Passing noopener=NOOPENER to window.open() should cause the new window to not have an opener
https://bugs.webkit.org/show_bug.cgi?id=190251

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline WPT test now that it is passing.

* web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noopener-expected.txt:

Source/WebCore:

Passing noopener=NOOPENER to window.open() should cause the new window to not have an opener,
similarly to noopener=1:
- https://html.spec.whatwg.org/#window-open-steps (step 5)

It does not matter what the value is, if there is a key named "noopener", then the new window
should not have an opener.

No new tests, rebaselined existing test.

* page/WindowFeatures.cpp:
(WebCore::setWindowFeature):

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

10 months agoGC can collect JS wrappers of nodes in the mutation records waiting to be delivered
rniwa@webkit.org [Wed, 3 Oct 2018 18:16:39 +0000 (18:16 +0000)]
GC can collect JS wrappers of nodes in the mutation records waiting to be delivered
https://bugs.webkit.org/show_bug.cgi?id=190115

Reviewed by Geoffrey Garen.

Fixed the bug by retaining JS wrappers of elements in mutation records using GCReachableRef.

This patch deploys GCReachableRef in two places: MutationObserver where each mutation record's
target is kept alive and MutationObserverRegistration where each node which had been removed
from an observed tree is kept alive for a subtree observation.

No new test since the test which can reproduce this problem is too slow.

* dom/GCReachableRef.h:
(WebCore::GCReachableRef): Made it work with hash table.
(WebCore::GCReachableRef::operator T& const):
(WebCore::GCReachableRef::GCReachableRef):
(WebCore::GCReachableRef::isHashTableDeletedValue const):
(WebCore::GCReachableRef::isHashTableEmptyValue const):
(WebCore::GCReachableRef::ptrAllowingHashTableEmptyValue const):
(WebCore::GCReachableRef::ptrAllowingHashTableEmptyValue):
(WebCore::GCReachableRef::assignToHashTableEmptyValue):
(WTF::HashTraits<WebCore::GCReachableRef<P>>::emptyValue):
(WTF::HashTraits<WebCore::GCReachableRef<P>>::constructEmptyValue):
(WTF::HashTraits<WebCore::GCReachableRef<P>>::isEmptyValue):
(WTF::HashTraits<WebCore::GCReachableRef<P>>::assignToEmpty):
(WTF::HashTraits<WebCore::GCReachableRef<P>>::peek):
(WTF::HashTraits<WebCore::GCReachableRef<P>>::take):
* dom/MutationObserver.cpp:
(WebCore::MutationObserver::takeRecords): Don't clear m_pendingTargets because that would allow wrappers
to be collected before elements in mutation records are accessed. We delay until the end of the current
microtask at which point deliver() function is called.
(WebCore::MutationObserver::disconnect):
(WebCore::MutationObserver::enqueueMutationRecord): Add the target to the list of elements to keep alive.
This is needed for a newly inserted node, a node with attribute change, etc...
(WebCore::MutationObserver::deliver): Keep the set of transient registration targets alive until mutation
records are delivered to each observer. These are nodes which had been removed from a tree and whose
subtree had still been obsreved up until this point.
* dom/MutationObserver.h:
* dom/MutationObserverRegistration.cpp:
(WebCore::MutationObserverRegistration::observedSubtreeNodeWillDetach):
(WebCore::MutationObserverRegistration::takeTransientRegistrations): Return the hash set of elemenets
that need to be kept alive so that MutationObserver::deliver can keep them alive until the deliver
function had been called.
(WebCore::MutationObserverRegistration::addRegistrationNodesToSet const):
* dom/MutationObserverRegistration.h:

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

10 months agoMake the Pointer Events feature description valid
dino@apple.com [Wed, 3 Oct 2018 18:14:29 +0000 (18:14 +0000)]
Make the Pointer Events feature description valid
https://bugs.webkit.org/show_bug.cgi?id=190254

Reviewed by Simon Fraser.

* features.json:

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

10 months agoUnreviewed, rolling out r236781.
jlewis3@apple.com [Wed, 3 Oct 2018 18:02:45 +0000 (18:02 +0000)]
Unreviewed, rolling out r236781.

The test added with this commit is timing out consistently.

Reverted changeset:

"GC can collect JS wrappers of nodes in the mutation records
waiting to be delivered"
https://bugs.webkit.org/show_bug.cgi?id=190115
https://trac.webkit.org/changeset/236781

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

10 months agoVersioning.
kocsen_chung@apple.com [Wed, 3 Oct 2018 17:56:29 +0000 (17:56 +0000)]
Versioning.

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

10 months ago[macOS] Switching to discrete GPU should be done in the UI process
dino@apple.com [Wed, 3 Oct 2018 17:28:50 +0000 (17:28 +0000)]
[macOS] Switching to discrete GPU should be done in the UI process
https://bugs.webkit.org/show_bug.cgi?id=189361
<rdar://problem/43949622>

Try to fix the IOSMAC build.

* platform/graphics/GraphicsContext3D.h:

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

10 months agoinput.checked is incorrect while we're parsing its children
cdumez@apple.com [Wed, 3 Oct 2018 16:02:34 +0000 (16:02 +0000)]
input.checked is incorrect while we're parsing its children
https://bugs.webkit.org/show_bug.cgi?id=190227

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline WPT test now that it is passing.

* web-platform-tests/html/semantics/forms/the-input-element/checked-expected.txt:

Source/WebCore:

input.checked was incorrect while we're parsing its children because we were delaying updating the
checked state until HTMLInputElement::finishParsingChildren() is called, to avoid a bad interaction
with form state restoration.

In this patch, we update the checked state as soon as the 'checked' attribute is set, when we know
that no form state to restore.

fast/forms/radio/state-restore-radio-group.html covers the form restoration case and is still
passing.

No new tests, rebaselined existing test.

* html/FormController.cpp:
(WebCore::FormController::hasFormStateToRestore const):
* html/FormController.h:
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::parseAttribute):

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

10 months ago[GTK][WPE] Incorrect rendering of layers whose backingStore hasn't changed
magomez@igalia.com [Wed, 3 Oct 2018 15:47:51 +0000 (15:47 +0000)]
[GTK][WPE] Incorrect rendering of layers whose backingStore hasn't changed
https://bugs.webkit.org/show_bug.cgi?id=190249

Reviewed by Žan Doberšek.

Do not overwrite m_nicosia.performLayerSync when updating the content buffers or we lose
the value calculated during the layer flush. Use an OR instead to keep the old value.

* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::updateContentBuffers):

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

10 months ago[WPE][GTK] Enable MSE by default
mcatanzaro@igalia.com [Wed, 3 Oct 2018 13:06:21 +0000 (13:06 +0000)]
[WPE][GTK] Enable MSE by default
https://bugs.webkit.org/show_bug.cgi?id=190243

Reviewed by Xabier Rodriguez-Calvar.

* UIProcess/API/glib/WebKitSettings.cpp:
(webkit_settings_class_init):

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

10 months agoEnable H264 simulcast
youenn@apple.com [Wed, 3 Oct 2018 12:11:23 +0000 (12:11 +0000)]
Enable H264 simulcast
https://bugs.webkit.org/show_bug.cgi?id=190167

Reviewed by Eric Carlson.

Source/ThirdParty/libwebrtc:

Rename .m files to .mm to enable C++ compilation of included header files.
Rename RTCH264VideoEncoder to RTCSingleH264Encoder.
Implement a new RTCH264VideoEncoder that spawns as many RTCSingleH264Encoder as needed for simulcast.
Update ObjC API to allow passing simulcast parameters to/from RTCH264VideoEncoder.

* Configurations/libwebrtc.iOS.exp:
* Configurations/libwebrtc.iOSsim.exp:
* Configurations/libwebrtc.mac.exp:
* Source/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCDefaultVideoDecoderFactory.mm: Renamed from Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCDefaultVideoDecoderFactory.m.
* Source/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCDefaultVideoEncoderFactory.mm: Renamed from Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCDefaultVideoEncoderFactory.m.
* Source/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec+Private.h:
* Source/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodecH264.mm:
(-[RTCCodecSpecificInfoH264 nativeCodecSpecificInfo]):
* Source/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCVideoEncoderSettings.mm:
(-[RTCVideoEncoderSettings initWithNativeVideoCodec:]):
* Source/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCWrappedNativeVideoEncoder.mm:
(-[RTCWrappedNativeVideoEncoder setBitrate:framerate:]):
(-[RTCWrappedNativeVideoEncoder setRateAllocation:framerate:]):
* Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm:
(-[RTCSingleVideoEncoderH264 initWithCodecInfo:simulcastIndex:]):
(-[RTCSingleVideoEncoderH264 startEncodeWithSettings:numberOfCores:]):
(-[RTCSingleVideoEncoderH264 encode:codecSpecificInfo:frameTypes:]):
(-[RTCSingleVideoEncoderH264 resetCompressionSessionWithPixelFormat:]):
(-[RTCSingleVideoEncoderH264 scalingSettings]):
(-[RTCSingleVideoEncoderH264 setRateAllocation:framerate:]):
(-[RTCVideoEncoderH264 initWithCodecInfo:]):
(-[RTCVideoEncoderH264 setCallback:]):
(-[RTCVideoEncoderH264 startEncodeWithSettings:numberOfCores:]):
(-[RTCVideoEncoderH264 releaseEncoder]):
(-[RTCVideoEncoderH264 encode:codecSpecificInfo:frameTypes:]):
(-[RTCVideoEncoderH264 setRateAllocation:framerate:]):
(-[RTCVideoEncoderH264 implementationName]):
(-[RTCVideoEncoderH264 scalingSettings]):
(-[RTCVideoEncoderH264 setBitrate:framerate:]):
* Source/webrtc/sdk/objc/Framework/Headers/WebRTC/RTCVideoCodec.h:
* Source/webrtc/sdk/objc/Framework/Headers/WebRTC/RTCVideoCodecH264.h:
* Source/webrtc/sdk/objc/Framework/Native/src/objc_video_encoder_factory.mm:
* libwebrtc.xcodeproj/project.pbxproj:

Source/WebCore:

Activate H264 simulcast trial field.
Make track.getSettings() expose width and height for incoming tracks.

Test: webrtc/simulcast-h264.html

* Configurations/WebCore.xcconfig:
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::LibWebRTCMediaEndpoint):
* platform/mediastream/RealtimeIncomingVideoSource.cpp:
(WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource):

LayoutTests:

* TestExpectations:
* webrtc/simulcast-h264-expected.txt: Added.
* webrtc/simulcast-h264.html: Added.

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

10 months ago[JSC] Add a C++ callable overload of objectConstructorSeal
commit-queue@webkit.org [Wed, 3 Oct 2018 12:05:47 +0000 (12:05 +0000)]
[JSC] Add a C++ callable overload of objectConstructorSeal
https://bugs.webkit.org/show_bug.cgi?id=190137

Patch by Koby Boyango <koby.b@mce-sys.com> on 2018-10-03
Reviewed by Yusuke Suzuki.

* runtime/ObjectConstructor.cpp:
* runtime/ObjectConstructor.h:

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

10 months ago-Wunused-variable in RenderLayer::updateScrollableAreaSet
mcatanzaro@igalia.com [Wed, 3 Oct 2018 11:03:48 +0000 (11:03 +0000)]
-Wunused-variable in RenderLayer::updateScrollableAreaSet
https://bugs.webkit.org/show_bug.cgi?id=190200

Reviewed by Yusuke Suzuki.

Source/WebCore:

Pass it through UNUSED_VARIABLE().

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::calculateClipRects const):

Source/WTF:

Add a new UNUSED_VARIABLE() macro. It's the same as UNUSED_PARAM(), just named differently.

* wtf/Compiler.h:

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

10 months agoRef<FetchResponse> use-after-move in DOMCache::put()
zandobersek@gmail.com [Wed, 3 Oct 2018 10:09:29 +0000 (10:09 +0000)]
Ref<FetchResponse> use-after-move in DOMCache::put()
https://bugs.webkit.org/show_bug.cgi?id=190239

Reviewed by Youenn Fablet.

Retrieve reference from the Ref<FetchResponse> object before it's
move-captured in the lambda that's passed to the
FetchResponse::consumeBodyReceivedByChunk() method that is invoked on
that very same object. This is a classic use-after-move bug that pops
up on compilers with different C++ calling convention.

* Modules/cache/DOMCache.cpp:
(WebCore::DOMCache::put):

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

10 months agoEnable selectionAcrossShadowBoundariesEnabled by default in WebKitLegacy
rniwa@webkit.org [Wed, 3 Oct 2018 09:45:18 +0000 (09:45 +0000)]
Enable selectionAcrossShadowBoundariesEnabled by default in WebKitLegacy
https://bugs.webkit.org/show_bug.cgi?id=190238

Reviewed by Antti Koivisto.

Source/WebCore:

Enable the feature by default.

* page/Settings.yaml:

Source/WebKitLegacy/mac:

Enabled the feature by default.

* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):

Tools:

* DumpRenderTree/TestOptions.h:
* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebPreferencesToConsistentValues):

LayoutTests:

Removed the unnecessary webkit-test-runner directive.

* editing/pasteboard/copy-paste-across-shadow-boundaries-1.html:
* editing/pasteboard/copy-paste-across-shadow-boundaries-2.html:
* editing/pasteboard/copy-paste-across-shadow-boundaries-3.html:
* editing/pasteboard/copy-paste-across-shadow-boundaries-4.html:
* editing/pasteboard/copy-paste-across-shadow-boundaries-with-style-1.html:
* editing/pasteboard/copy-paste-across-shadow-boundaries-with-style-2.html:
* editing/pasteboard/copy-paste-with-shadow-content.html:
* editing/selection/selection-across-shadow-boundaries-mixed-editability-1.html:
* editing/selection/selection-across-shadow-boundaries-mixed-editability-2.html:
* editing/selection/selection-across-shadow-boundaries-mixed-editability-3.html:
* editing/selection/selection-across-shadow-boundaries-mixed-editability-4.html:
* editing/selection/selection-across-shadow-boundaries-mixed-editability-5.html:
* editing/selection/selection-across-shadow-boundaries-readonly-1.html:
* editing/selection/selection-across-shadow-boundaries-readonly-2.html:
* editing/selection/selection-across-shadow-boundaries-readonly-3.html:
* editing/selection/selection-across-shadow-boundaries-user-select-all-1.html:

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

10 months agoImport WPT mimesniff resources
commit-queue@webkit.org [Wed, 3 Oct 2018 07:08:48 +0000 (07:08 +0000)]
Import WPT mimesniff resources
https://bugs.webkit.org/show_bug.cgi?id=190074

Patch by Rob Buis <rbuis@igalia.com> on 2018-10-03
Reviewed by Youenn Fablet.

* resources/import-expectations.json:
* web-platform-tests/mimesniff/META.yml: Added.
* web-platform-tests/mimesniff/README.md: Added.
* web-platform-tests/mimesniff/mime-types/README.md: Added.
* web-platform-tests/mimesniff/mime-types/charset-parameter.window-expected.txt: Added.
* web-platform-tests/mimesniff/mime-types/charset-parameter.window.html: Added.
* web-platform-tests/mimesniff/mime-types/charset-parameter.window.js: Added.
(promise_test):
(isByteCompatible):
(encodeForURL):
(runTests):
* web-platform-tests/mimesniff/mime-types/parsing.any-expected.txt: Added.
* web-platform-tests/mimesniff/mime-types/parsing.any.html: Added.
* web-platform-tests/mimesniff/mime-types/parsing.any.js: Added.
(promise_test):
(isByteCompatible):
(runTests):
* web-platform-tests/mimesniff/mime-types/parsing.any.worker-expected.txt: Added.
* web-platform-tests/mimesniff/mime-types/parsing.any.worker.html: Added.
* web-platform-tests/mimesniff/mime-types/resources/generated-mime-types.json: Added.
* web-platform-tests/mimesniff/mime-types/resources/generated-mime-types.py: Added.
(isHTTPTokenCodePoint):
(isHTTPQuotedStringTokenCodePoint):
* web-platform-tests/mimesniff/mime-types/resources/mime-charset.py: Added.
(main):
* web-platform-tests/mimesniff/mime-types/resources/mime-types.json: Added.
* web-platform-tests/mimesniff/mime-types/resources/w3c-import.log: Added.
* web-platform-tests/mimesniff/mime-types/w3c-import.log: Added.
* web-platform-tests/mimesniff/w3c-import.log: Added.
* web-platform-tests/xhr/overridemimetype-blob-expected.txt:

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

10 months ago[WinCairo][BuildBot] archive-test-results fails to delete pywebsocket.ws.log-err.txt
Hironori.Fujii@sony.com [Wed, 3 Oct 2018 06:39:26 +0000 (06:39 +0000)]
[WinCairo][BuildBot] archive-test-results fails to delete pywebsocket.ws.log-err.txt
https://bugs.webkit.org/show_bug.cgi?id=190236

Unreviewed test gardening.

* platform/wincairo/TestExpectations: Skipped http/wpt and imported/w3c.

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

10 months agoCopying content with shadow DOM doesn't copy any contents
rniwa@webkit.org [Wed, 3 Oct 2018 06:28:07 +0000 (06:28 +0000)]
Copying content with shadow DOM doesn't copy any contents
https://bugs.webkit.org/show_bug.cgi?id=157443

Reviewed by Wenson Hsieh.

Source/WebCore:

This patch adds the support for copying and pasting content across shadow boundaries in HTML and plain text,
which is enabled whenever selection across shadow boundaries is enabled.

To do this, TextIterator now has a constructor which takes two Positions, and the node traversal code in
StyledMarkupAccumulator has been abstracted via helper functions as done for TextIterator.

When serializing a HTMl slot element, serialize it as a span with "display: contents" to make sure when
the content is pasted into a shadow tree, it wouldn't affect the slot assignment of the shadow tree.

Tests: editing/pasteboard/copy-paste-across-shadow-boundaries-1.html
       editing/pasteboard/copy-paste-across-shadow-boundaries-2.html
       editing/pasteboard/copy-paste-across-shadow-boundaries-3.html
       editing/pasteboard/copy-paste-across-shadow-boundaries-4.html
       editing/pasteboard/copy-paste-across-shadow-boundaries-with-style-1.html
       editing/pasteboard/copy-paste-across-shadow-boundaries-with-style-2.html
       editing/pasteboard/copy-paste-with-shadow-content.html

* dom/ComposedTreeIterator.h:
(WebCore::assignedSlotIgnoringUserAgentShadow): Moved from TextIterator.cpp.
(WebCore::shadowRootIgnoringUserAgentShadow): Ditto.
(WebCore::firstChildInComposedTreeIgnoringUserAgentShadow): Ditto.
(WebCore::nextSiblingInComposedTreeIgnoringUserAgentShadow): Ditto.
* dom/Position.h:
(WebCore::Position::treeScope const): Added.
* editing/EditingStyle.cpp:
(WebCore::EditingStyle::addDisplayContents): Added.
* editing/EditingStyle.h:
* editing/Editor.cpp:
(WebCore::Editor::selectedText const): Use the new behavior when selectionAcrossShadowBoundariesEnabled is set.
(WebCore::Editor::selectedTextForDataTransfer const): Ditto.
* editing/MarkupAccumulator.cpp:
(WebCore::MarkupAccumulator::appendEndElement): Renamed from appendEndTag. Now takes StringBuilder.
* editing/MarkupAccumulator.h:
(WebCore::MarkupAccumulator::appendEndTag):
* editing/TextIterator.cpp:
(WebCore::TextIterator::TextIterator): Added a new variant which takes two positions.
(WebCore::TextIterator::init):
(WebCore::firstChild):
(WebCore::nextSibling):
(WebCore::plainText): Ditto.
* editing/TextIterator.h:
* editing/cocoa/EditorCocoa.mm:
(WebCore::Editor::selectionInHTMLFormat): Use the new behavior if selectionAcrossShadowBoundariesEnabled is set.
* editing/gtk/EditorGtk.cpp:
(WebCore::Editor::writeSelectionToPasteboard): Ditto.
* editing/markup.cpp:
(WebCore::StyledMarkupAccumulator::parentNode): Added.
(WebCore::StyledMarkupAccumulator::firstChild): Added.
(WebCore::StyledMarkupAccumulator::nextSibling): Added.
(WebCore::StyledMarkupAccumulator::nextSkippingChildren): Added.
(WebCore::StyledMarkupAccumulator::hasChildNodes): Added.
(WebCore::StyledMarkupAccumulator::isDescendantOf): Added.
(WebCore::StyledMarkupAccumulator::StyledMarkupAccumulator):
(WebCore::StyledMarkupAccumulator::appendElement): Serialize a slot element as a span with display: contents.
(WebCore::StyledMarkupAccumulator::appendEndElement): Added. Ditto.
(WebCore::StyledMarkupAccumulator::serializeNodes):
(WebCore::StyledMarkupAccumulator::traverseNodesForSerialization): Use the newly added helper functions to
traverse the composed tree when m_useComposedTree is set.
(WebCore::commonShadowIncludingAncestor): Added.
(WebCore::serializePreservingVisualAppearanceInternal): Added SerializeComposedTree as an argument. Also use
StyledMarkupAccumulator::parentNode to serialize special common ancestors; e.g. to preserve b, i, etc...
(WebCore::serializePreservingVisualAppearance): Ditto to the variant which takes VisibleSelection.
(WebCore::sanitizedMarkupForFragmentInDocument):
* editing/markup.h:
* editing/wpe/EditorWPE.cpp:
(WebCore::Editor::writeSelectionToPasteboard):
* loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::createFromSelection):
* page/PageSerializer.cpp:
(WebCore::PageSerializer::SerializerMarkupAccumulator::appendEndElement):
* testing/Internals.cpp:
(WebCore::Internals::setSelectionWithoutValidation): Added. A helper function to create a selection across
shadow boundaries for testing purposes.
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

Added tests for copying and pasting across shadow boundaries with HTML and plain text.

* editing/pasteboard/copy-paste-across-shadow-boundaries-1-expected.txt: Added.
* editing/pasteboard/copy-paste-across-shadow-boundaries-1.html: Added.
* editing/pasteboard/copy-paste-across-shadow-boundaries-2-expected.txt: Added.
* editing/pasteboard/copy-paste-across-shadow-boundaries-2.html: Added.
* editing/pasteboard/copy-paste-across-shadow-boundaries-3-expected.txt: Added.
* editing/pasteboard/copy-paste-across-shadow-boundaries-3.html: Added.
* editing/pasteboard/copy-paste-across-shadow-boundaries-4-expected.txt: Added.
* editing/pasteboard/copy-paste-across-shadow-boundaries-4.html: Added.
* editing/pasteboard/copy-paste-across-shadow-boundaries-with-style-1-expected.txt: Added.
* editing/pasteboard/copy-paste-across-shadow-boundaries-with-style-1.html: Added.
* editing/pasteboard/copy-paste-across-shadow-boundaries-with-style-2-expected.txt: Added.
* editing/pasteboard/copy-paste-across-shadow-boundaries-with-style-2.html: Added.
* editing/pasteboard/copy-paste-with-shadow-content-expected.txt: Added.
* editing/pasteboard/copy-paste-with-shadow-content.html: Added.

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

10 months agoMessageEvent.ports should return the same object
cdumez@apple.com [Wed, 3 Oct 2018 01:59:04 +0000 (01:59 +0000)]
MessageEvent.ports should return the same object
https://bugs.webkit.org/show_bug.cgi?id=190151

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline WPT test now that it is passing.

* web-platform-tests/html/webappapis/scripting/events/messageevent-constructor.https-expected.txt:

Source/WebCore:

MessageEvent.ports should return the same object it was initialized to instead of
constructing a new JSValue every time.

No new tests, rebaselined existing test.

* bindings/js/JSMessageEventCustom.cpp:
(WebCore::JSMessageEvent::ports const):
(WebCore::JSMessageEvent::visitAdditionalChildren):
* dom/MessageEvent.cpp:
(WebCore::MessageEvent::initMessageEvent):
* dom/MessageEvent.h:
* dom/MessageEvent.idl:

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

10 months agoWeb Inspector: merge SourceMapManager into NetworkManager
drousso@apple.com [Wed, 3 Oct 2018 01:49:05 +0000 (01:49 +0000)]
Web Inspector: merge SourceMapManager into NetworkManager
https://bugs.webkit.org/show_bug.cgi?id=190224

Reviewed by Joseph Pecoraro.

* UserInterface/Main.html:
* UserInterface/Base/Main.js:
(WI.loaded):
* UserInterface/Test.html:
* UserInterface/Test/Test.js:
(WI.loaded):

* UserInterface/Controllers/NetworkManager.js:
(WI.NetworkManager):
(WI.NetworkManager.prototype.downloadSourceMap): Added.
(WI.NetworkManager.prototype.resourceRequestWasServedFromMemoryCache):
(WI.NetworkManager.prototype.resourceRequestDidFinishLoading):
(WI.NetworkManager.prototype._createResource):
(WI.NetworkManager.prototype._loadAndParseSourceMap): Added.
(WI.NetworkManager.prototype._sourceMapLoadAndParseFailed): Added.
(WI.NetworkManager.prototype._sourceMapLoadAndParseSucceeded): Added.
(WI.NetworkManager.prototype._handleFrameMainResourceDidChange): Added.
* UserInterface/Controllers/SourceMapManager.js: Removed.

* UserInterface/Models/Script.js:
(WI.Script):

* WebInspectorUI.vcxproj/WebInspectorUI.vcxproj:
* WebInspectorUI.vcxproj/WebInspectorUI.vcxproj.filters:

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

10 months agoGC can collect JS wrappers of nodes in the mutation records waiting to be delivered
rniwa@webkit.org [Wed, 3 Oct 2018 00:29:46 +0000 (00:29 +0000)]
GC can collect JS wrappers of nodes in the mutation records waiting to be delivered
https://bugs.webkit.org/show_bug.cgi?id=190115

Reviewed by Geoffrey Garen.

Source/WebCore:

Fixed the bug by retaining JS wrappers of elements in mutation records using GCReachableRef.

This patch deploys GCReachableRef in two places: MutationObserver where each mutation record's
target is kept alive and MutationObserverRegistration where each node which had been removed
from an observed tree is kept alive for a subtree observation.

Test: fast/dom/MutationObserver/mutation-observer-retains-js-wrappers-of-targets-alive.html

* dom/GCReachableRef.h:
(WebCore::GCReachableRef): Made it work with hash table.
(WebCore::GCReachableRef::operator T& const):
(WebCore::GCReachableRef::GCReachableRef):
(WebCore::GCReachableRef::isHashTableDeletedValue const):
(WebCore::GCReachableRef::isHashTableEmptyValue const):
(WebCore::GCReachableRef::ptrAllowingHashTableEmptyValue const):
(WebCore::GCReachableRef::ptrAllowingHashTableEmptyValue):
(WebCore::GCReachableRef::assignToHashTableEmptyValue):
(WTF::HashTraits<WebCore::GCReachableRef<P>>::emptyValue):
(WTF::HashTraits<WebCore::GCReachableRef<P>>::constructEmptyValue):
(WTF::HashTraits<WebCore::GCReachableRef<P>>::isEmptyValue):
(WTF::HashTraits<WebCore::GCReachableRef<P>>::assignToEmpty):
(WTF::HashTraits<WebCore::GCReachableRef<P>>::peek):
(WTF::HashTraits<WebCore::GCReachableRef<P>>::take):
* dom/MutationObserver.cpp:
(WebCore::MutationObserver::takeRecords): Don't clear m_pendingTargets because that would allow wrappers
to be collected before elements in mutation records are accessed. We delay until the end of the current
microtask at which point deliver() function is called.
(WebCore::MutationObserver::disconnect):
(WebCore::MutationObserver::enqueueMutationRecord): Add the target to the list of elements to keep alive.
This is needed for a newly inserted node, a node with attribute change, etc...
(WebCore::MutationObserver::deliver): Keep the set of transient registration targets alive until mutation
records are delivered to each observer. These are nodes which had been removed from a tree and whose
subtree had still been obsreved up until this point.
* dom/MutationObserver.h:
* dom/MutationObserverRegistration.cpp:
(WebCore::MutationObserverRegistration::observedSubtreeNodeWillDetach):
(WebCore::MutationObserverRegistration::takeTransientRegistrations): Return the hash set of elemenets
that need to be kept alive so that MutationObserver::deliver can keep them alive until the deliver
function had been called.
(WebCore::MutationObserverRegistration::addRegistrationNodesToSet const):
* dom/MutationObserverRegistration.h:

LayoutTests:

Added a regression test.

* fast/dom/MutationObserver/mutation-observer-retains-js-wrappers-of-targets-alive-expected.txt: Added.
* fast/dom/MutationObserver/mutation-observer-retains-js-wrappers-of-targets-alive.html: Added.

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

10 months agoWeb Inspector: Styles: start editing property name/value on mouseup instead of mousedown
nvasilyev@apple.com [Wed, 3 Oct 2018 00:29:42 +0000 (00:29 +0000)]
Web Inspector: Styles: start editing property name/value on mouseup instead of mousedown
https://bugs.webkit.org/show_bug.cgi?id=190114
<rdar://problem/44891030>

Reviewed by Matt Baker.

This change only affects the experimental multiple properties selection.

* UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:
(WI.SpreadsheetCSSStyleDeclarationSection):
* UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.css:
(.multiple-properties-selection .spreadsheet-style-declaration-editor :matches(.name, .value):not(.editing)):
Without this code, the focus outline flickers on click (after mousedown but before mouseup event).

* UserInterface/Views/SpreadsheetTextField.js:
(WI.SpreadsheetTextField):
(WI.SpreadsheetTextField.prototype._handleMouseUp):

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

10 months agoradio / checkbox inputs should fire "click, input, change" events in order when clicked
cdumez@apple.com [Wed, 3 Oct 2018 00:28:21 +0000 (00:28 +0000)]
radio / checkbox inputs should fire "click, input, change" events in order when clicked
https://bugs.webkit.org/show_bug.cgi?id=190223

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline a few WPT tests that are now passing. I have verified that those are passing in Gecko and Blink
as well.

* web-platform-tests/html/semantics/forms/the-input-element/checkbox-click-events-expected.txt:
* web-platform-tests/html/semantics/forms/the-input-element/checkbox-expected.txt:
* web-platform-tests/html/semantics/forms/the-input-element/radio-expected.txt:

Source/WebCore:

radio / checkbox inputs should fire "click, input, change" events in order when clicked:
- https://html.spec.whatwg.org/#radio-button-state-(type=radio)
- https://html.spec.whatwg.org/#checkbox-state-(type=checkbox)
- https://dom.spec.whatwg.org/#ref-for-eventtarget-activation-behavior③ (step 11)

Gecko and Blink already behave this way. However, WebKit has the following issues:
- the input event is not fired
- the click event is fired after the change event

No new tests, updated / rebaselined existing tests.

* html/BaseCheckableInputType.cpp:
(WebCore::BaseCheckableInputType::fireInputAndChangeEvents):
* html/BaseCheckableInputType.h:
* html/CheckboxInputType.cpp:
(WebCore::CheckboxInputType::willDispatchClick):
(WebCore::CheckboxInputType::didDispatchClick):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setChecked):
* html/HTMLInputElement.h:
* html/RadioInputType.cpp:
(WebCore::RadioInputType::willDispatchClick):
(WebCore::RadioInputType::didDispatchClick):

LayoutTests:

Update existing test to reflect behavior change. I have verified that our new behavior
on this test is consistent with Gecko and Chrome.

* fast/forms/radio/radio-group-keyboard-change-event-expected.txt:
* fast/forms/radio/radio-group-keyboard-change-event.html:

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

10 months agofieldset.elements should return an HTMLCollection instead of an HTMLFormControlsColle...
cdumez@apple.com [Wed, 3 Oct 2018 00:26:41 +0000 (00:26 +0000)]
fieldset.elements should return an HTMLCollection instead of an HTMLFormControlsCollection
https://bugs.webkit.org/show_bug.cgi?id=190218

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline existing WPT test now that it is passing.

* web-platform-tests/html/semantics/forms/the-fieldset-element/HTMLFieldSetElement-expected.txt:

Source/WebCore:

fieldset.elements should return an HTMLCollection instead of an HTMLFormControlsCollection:
- https://github.com/whatwg/html/commit/8beedf0c2ffd38853caddec67490288f47afc8eb

Gecko has always behaved this way. Blink aligned with Gecko and the HTML specification in December 2016:
- https://bugs.chromium.org/p/chromium/issues/detail?id=665291

This simplifies our HTMLFieldSetElement code a lot.

Test: fast/forms/fieldset/fieldset-elements-htmlcollection.html

* html/CollectionType.h:
* html/GenericCachedHTMLCollection.cpp:
(WebCore::GenericCachedHTMLCollection<traversalType>::elementMatches const):
* html/HTMLCollection.cpp:
(WebCore::HTMLCollection::rootTypeFromCollectionType):
(WebCore::invalidationTypeExcludingIdAndNameAttributes):
* html/HTMLFieldSetElement.cpp:
(WebCore::HTMLFieldSetElement::elements):
* html/HTMLFieldSetElement.h:
* html/HTMLFieldSetElement.idl:
* html/HTMLFormControlsCollection.cpp:
(WebCore::HTMLFormControlsCollection::HTMLFormControlsCollection):
(WebCore:: const):
(WebCore::HTMLFormControlsCollection::copyFormControlElementsVector const):
(WebCore::HTMLFormControlsCollection::ownerNode const):
(WebCore::HTMLFormControlsCollection::updateNamedElementCache const):
* html/HTMLFormControlsCollection.h:

LayoutTests:

Update existing tests to reflect behavior change, after checking that our behavior is consistent
with Gecko and Blink on these tests.

* fast/forms/fieldset/fieldset-elements-expected.txt:
* fast/forms/fieldset/fieldset-elements-htmlcollection-expected.txt: Added.
* fast/forms/fieldset/fieldset-elements-htmlcollection.html: Added.
* fast/forms/fieldset/fieldset-elements.html:
* fast/forms/fieldset/fieldset-form-collection-radionode-list-expected.txt: Removed.
* fast/forms/fieldset/fieldset-form-collection-radionode-list.html: Removed.

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

10 months agoWeb Inspector: prevent layer events from firing until the layer information is re...
drousso@apple.com [Wed, 3 Oct 2018 00:25:10 +0000 (00:25 +0000)]
Web Inspector: prevent layer events from firing until the layer information is re-requested
https://bugs.webkit.org/show_bug.cgi?id=190159

Reviewed by Joseph Pecoraro.

Source/WebCore:

Test: inspector/layers/layerTreeDidChange.html

* inspector/agents/InspectorLayerTreeAgent.h:
* inspector/agents/InspectorLayerTreeAgent.cpp:
(WebCore::InspectorLayerTreeAgent::reset):
(WebCore::InspectorLayerTreeAgent::layerTreeDidChange):
(WebCore::InspectorLayerTreeAgent::layersForNode):

Source/WebInspectorUI:

* UserInterface/Controllers/LayerTreeManager.js:
(WI.LayerTreeManager):
(WI.LayerTreeManager.prototype.get supported):
Remove `supported` member variable in favor of re-evaluating its value.

* UserInterface/Protocol/LayerTreeObserver.js:
(WI.LayerTreeObserver.prototype.layerTreeDidChange):

LayoutTests:

* inspector/layers/layerTreeDidChange-expected.txt: Added.
* inspector/layers/layerTreeDidChange.html: Added.

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

10 months agoWeb Inspector: REGRESSION(r236766): WI.IssueManager no longer exists
drousso@apple.com [Wed, 3 Oct 2018 00:21:57 +0000 (00:21 +0000)]
Web Inspector: REGRESSION(r236766): WI.IssueManager no longer exists
https://bugs.webkit.org/show_bug.cgi?id=190226

Reviewed by Joseph Pecoraro.

* UserInterface/Controllers/ConsoleManager.js:
(WI.ConsoleManager.prototype.issuesForSourceCode):

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

10 months agoDeprecate WKConnection
commit-queue@webkit.org [Wed, 3 Oct 2018 00:13:09 +0000 (00:13 +0000)]
Deprecate WKConnection
https://bugs.webkit.org/show_bug.cgi?id=190147

Patch by Alex Christensen <achristensen@webkit.org> on 2018-10-02
Reviewed by Andy Estes.

* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):
* UIProcess/API/Cocoa/WKConnection.h:
* UIProcess/API/Cocoa/WKConnection.mm:
(didReceiveMessage):
(didClose):
* UIProcess/API/Cocoa/WKConnectionInternal.h:
* UIProcess/API/Cocoa/WKProcessGroup.h:
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm:

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

10 months agoWeb Automation: tab default key handler should always cycle focus when page is contro...
bburg@apple.com [Tue, 2 Oct 2018 23:55:42 +0000 (23:55 +0000)]
Web Automation: tab default key handler should always cycle focus when page is controlled by automation
https://bugs.webkit.org/show_bug.cgi?id=190221
<rdar://problem/44914534>

Reviewed by Joseph Pecoraro.

This change progresses WPT WebDriver test special_keys.py::test_webdriver_special_key_sends_keydown[TAB-expected24].

* page/FocusController.cpp:
(WebCore::FocusController::advanceFocusInDocumentOrder):
Always cycle focus if the page is controlled by automation. If the chrome takes
focus, then the first responder will be something other than the WebView, which
causes subsequent WebDriver commands to hang.

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

10 months ago[macOS] Switching to discrete GPU should be done in the UI process
dino@apple.com [Tue, 2 Oct 2018 23:42:38 +0000 (23:42 +0000)]
[macOS] Switching to discrete GPU should be done in the UI process
https://bugs.webkit.org/show_bug.cgi?id=189361
<rdar://problem/43949622>

Reviewed by Simon Fraser.

Source/WebCore:

Based on an earlier patch by Per Arne Vollan.

Due to the fact we can't talk to the Window Server, the Web Process can
no longer muxing to the discrete GPU directly. Instead we have to get the
UI Process to process the change. Do this by adding a new Chrome client
called GPUClient, that will have implementations provided by both WebKit
and legacy WebKit.

Unfortunately this can't be tested by a regular WKTR since:
- it requires specific hardware
- swapping to/from the discrete GPU takes about 20 seconds
- running concurrent tests could confuse the tests into thinking
  the wrong GPU is active

Instead we'll write a specific test for this functionality and
run it on a separate bot.

* WebCore.xcodeproj/project.pbxproj: Add GPUClient files.

* page/Chrome.cpp: Drive by clean-up.
(WebCore::Chrome::windowScreenDidChange):

* platform/graphics/GraphicsContext3D.h: We need to keep track of
whether we've muxed for this context, in order to not respond to
the screen change notifications (they are misleading in the case
of muxing).

* platform/graphics/GraphicsContext3DManager.cpp: Rather than try
to mux directly, call into GPUClient.
(WebCore::GraphicsContext3DManager::displayWasReconfigured):
(WebCore::GraphicsContext3DManager::updateHighPerformanceState):
(WebCore::GraphicsContext3DManager::disableHighPerformanceGPUTimerFired):
(WebCore::GraphicsContext3DManager::recycleContextIfNecessary):
* platform/graphics/GraphicsContext3DManager.h:

* platform/graphics/cocoa/GraphicsContext3DCocoa.mm: Only reconfigure
the virtual display if it didn't happen from muxing.
(WebCore::GraphicsContext3D::GraphicsContext3D):
(WebCore::GraphicsContext3D::updateCGLContext):
(WebCore::GraphicsContext3D::screenDidChange):

* platform/graphics/mac/GPUClient.cpp: Added.
(WebCore::GPUClient::singleton):
(WebCore::GPUClient::setSingleton):
* platform/graphics/mac/GPUClient.h: Added.

* testing/Internals.cpp: Testing helper.
(WebCore::Internals::hasMuxableGPU):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit:

Implement the UI-side process for triggering a GPU mux.

* Platform/Logging.h: Add a WebGL logging channel.

* SourcesCocoa.txt: Add the new files: WebGPUClient and HighPerformanceGPUManager.

* UIProcess/Cocoa/WebProcessProxyCocoa.mm: UI process calls that use HighPerformanceGPUManager
to keep track of whether or not this process needs the high-performance GPU.
(WebKit::WebProcessProxy::requestHighPerformanceGPU):
(WebKit::WebProcessProxy::releaseHighPerformanceGPU):

* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::~WebProcessProxy): Make sure to unregister with the HighPerformanceGPUManager
as the process disappears without manually removing itself (e.g. crashes).
* UIProcess/WebProcessProxy.h:
* UIProcess/WebProcessProxy.messages.in: New messages.

* UIProcess/mac/HighPerformanceGPUManager.cpp: New class that copies most of what used
to live in GraphicsContext3DManager. It creates a CGLPixelFormat object when it sees
that at least one process needs the high-performance GPU.
(WebKit::HighPerformanceGPUManager::singleton):
(WebKit::HighPerformanceGPUManager::addProcessRequiringHighPerformance):
(WebKit::HighPerformanceGPUManager::removeProcessRequiringHighPerformance):
(WebKit::HighPerformanceGPUManager::updateState):
* UIProcess/mac/HighPerformanceGPUManager.h: Added.

* WebKit.xcodeproj/project.pbxproj: Add new files.

* WebProcess/WebCoreSupport/mac/WebGPUClient.cpp: Implementation of the GPUClient for
WebCore, which sends messages to the UI process.
(WebKit::WebGPUClient::singleton):
(WebKit::WebGPUClient::requestHighPerformanceGPU):
(WebKit::WebGPUClient::releaseHighPerformanceGPU):
* WebProcess/WebCoreSupport/mac/WebGPUClient.h: Added.

* WebProcess/cocoa/WebProcessCocoa.mm: Register the GPUClient.
(WebKit::WebProcess::platformInitializeProcess):

Source/WebKitLegacy:

* WebKitLegacy.xcodeproj/project.pbxproj: Add new files.

Source/WebKitLegacy/mac:

Implement a no-op GPUClient instance in legacy WebKit. We will
not support swapping to the discrete GPU in this configuration.

* WebCoreSupport/WebGPUClient.cpp: Added.
(WebKit::WebGPUClient::singleton):
* WebCoreSupport/WebGPUClient.h: Added.
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):

Source/WTF:

Define GL_SILENCE_DEPRECATION to avoid deprecation warnings for OpenGL.

* wtf/Platform.h:

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

10 months agoFix a potential crash in NetworkProcess::deleteWebsiteDataForOrigins
sihui_liu@apple.com [Tue, 2 Oct 2018 23:02:39 +0000 (23:02 +0000)]
Fix a potential crash in NetworkProcess::deleteWebsiteDataForOrigins
https://bugs.webkit.org/show_bug.cgi?id=190220

Reviewed by Chris Dumez.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::deleteWebsiteDataForOrigins):

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

10 months agoRefresh imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta...
cdumez@apple.com [Tue, 2 Oct 2018 22:59:15 +0000 (22:59 +0000)]
Refresh imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh
https://bugs.webkit.org/show_bug.cgi?id=190212

Reviewed by Youenn Fablet.

Refresh imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh
from upstream f15449622a76d0.

* web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing-expected.txt:
* web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing.html:
* web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/remove-from-document-expected.txt:
* web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/refresh.sub.html: Added.
* web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/w3c-import.log:

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

10 months ago[WebKit2] Format > Bold and Format > Italic don't toggle between bold and italic...
wenson_hsieh@apple.com [Tue, 2 Oct 2018 22:53:37 +0000 (22:53 +0000)]
[WebKit2] Format > Bold and Format > Italic don't toggle between bold and italic style
https://bugs.webkit.org/show_bug.cgi?id=179787
<rdar://problem/35593389>

Reviewed by Tim Horton.

Source/WebKit:

Fixes the bug by relaxing our policy in WebViewImpl::updateFontManagerIfNeeded. Instead of updating only when
the font panel is visible, update when either the font panel is visible, or the selection is in a richly
editable area. In the latter case, an up-to-date NSFontManager state is needed in order for certain font
formatting menu items, such as bold and italic, to correctly toggle state.

Test: FontManagerTests.ToggleBoldAndItalicWithMenuItems

* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(-[WKWindowVisibilityObserver observeValueForKeyPath:ofObject:change:context:]):
(WebKit::WebViewImpl::selectionDidChange):
(WebKit::WebViewImpl::updateFontManagerIfNeeded):

Rename updateFontPanelIfNeeded to updateFontManagerIfNeeded, to reflect the new behavior.

(WebKit::WebViewImpl::changeFontAttributesFromSender):
(WebKit::WebViewImpl::changeFontFromFontManager):
(WebKit::WebViewImpl::updateFontPanelIfNeeded): Deleted.

Tools:

Add a test to verify that NSFontManager's selected font is updated when applying italic and bold styles using
menu items.

* TestWebKitAPI/Tests/mac/FontManagerTests.mm:
(webViewForFontManagerTesting):
(menuItemCellForFontAction):
(TestWebKitAPI::TEST):

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

10 months agoImage.__proto__ should be Function.prototype, not HTMLElement.prototype
cdumez@apple.com [Tue, 2 Oct 2018 22:53:33 +0000 (22:53 +0000)]
Image.__proto__ should be Function.prototype, not HTMLElement.prototype
https://bugs.webkit.org/show_bug.cgi?id=190216

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline existing WPT test now that it is passing.

* web-platform-tests/html/semantics/embedded-content/the-img-element/Image-constructor-expected.txt:

Source/WebCore:

Properties created for named constructors should always use Function.prototype as prototype, as per:
- https://heycam.github.io/webidl/#named-constructors

Gecko and Blink agree with the Web IDL specification. However, WebKit was using the parent interface's
prototype if such a parent existing. So Image.__proto__ would end up being HTMLElement.prototype
instead of Function.prototype.

No new tests, rebaselined existing test.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateConstructorHelperMethods):

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

10 months agoFix Disassembler-output on ARM Thumb2
commit-queue@webkit.org [Tue, 2 Oct 2018 22:53:26 +0000 (22:53 +0000)]
Fix Disassembler-output on ARM Thumb2
https://bugs.webkit.org/show_bug.cgi?id=190203

On ARMv7 with Thumb2 addresses have bit 0 set to 1 to force
execution in thumb mode for jumps and calls. The actual machine
instructions are still aligned to 2-bytes though. Use dataLocation() as
start address for disassembling since it unsets the thumb bit.
Until now the disassembler would start at the wrong address (off by 1),
resulting in the wrong disassembled machine instructions.

Patch by Dominik Infuehr <dinfuehr@igalia.com> on 2018-10-02
Reviewed by Mark Lam.

* disassembler/CapstoneDisassembler.cpp:
(JSC::tryToDisassemble):

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

10 months agoPrepare WebCoreNSURLExtras for ARC
achristensen@apple.com [Tue, 2 Oct 2018 22:34:09 +0000 (22:34 +0000)]
Prepare WebCoreNSURLExtras for ARC
https://bugs.webkit.org/show_bug.cgi?id=190219

Reviewed by Tim Horton.

ARC doesn't like the explicit sending of -release.
Use RetainPtr instead.

* platform/mac/WebCoreNSURLExtras.mm:
(WebCore::collectRangesThatNeedMapping):
(WebCore::collectRangesThatNeedEncoding):
(WebCore::collectRangesThatNeedDecoding):
(WebCore::applyHostNameFunctionToMailToURLString):
(WebCore::applyHostNameFunctionToURLString):
(WebCore::mapHostNames):
(WebCore::stringByTrimmingWhitespace):
(WebCore::URLWithUserTypedString):
(WebCore::userVisibleString):
(WebCore::rangeOfURLScheme):
(WebCore::looksLikeAbsoluteURL):
(WebCore::retain): Deleted.

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

10 months agoWeb Inspector: rename frontend managers to be more consistent with backend agents
drousso@apple.com [Tue, 2 Oct 2018 22:14:52 +0000 (22:14 +0000)]
Web Inspector: rename frontend managers to be more consistent with backend agents
https://bugs.webkit.org/show_bug.cgi?id=190160

Reviewed by Joseph Pecoraro.

Source/WebInspectorUI:

* UserInterface/Test.html:
* UserInterface/Test/Test.js:
* UserInterface/Main.html:
* UserInterface/Base/Main.js:
* UserInterface/Base/DOMUtilities.js:
* UserInterface/Controllers/ApplicationCacheManager.js:
* UserInterface/Controllers/CSSManager.js: Renamed from Source/WebInspectorUI/UserInterface/Controllers/CSSStyleManager.js.
* UserInterface/Controllers/ConsoleManager.js: Renamed from Source/WebInspectorUI/UserInterface/Controllers/LogManager.js.
* UserInterface/Controllers/DOMDebuggerManager.js:
* UserInterface/Controllers/DOMManager.js: Renamed from Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js.
* UserInterface/Controllers/DOMStorageManager.js: Renamed from Source/WebInspectorUI/UserInterface/Controllers/StorageManager.js.
* UserInterface/Controllers/DashboardManager.js: Removed.
* UserInterface/Controllers/DatabaseManager.js: Copied from Source/WebInspectorUI/UserInterface/Controllers/DOMStorageManager.js.
* UserInterface/Controllers/HARBuilder.js:
* UserInterface/Controllers/IndexedDBManager.js: Copied from Source/WebInspectorUI/UserInterface/Controllers/DOMStorageManager.js.
* UserInterface/Controllers/IssueManager.js: Removed.
* UserInterface/Controllers/JavaScriptLogViewController.js:
* UserInterface/Controllers/NetworkManager.js: Renamed from Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js.
* UserInterface/Controllers/SourceMapManager.js:
* UserInterface/Controllers/TimelineManager.js:
* UserInterface/Debug/UncaughtExceptionReporter.js:
* UserInterface/Models/CSSProperty.js:
* UserInterface/Models/CSSSelector.js:
* UserInterface/Models/CallFrame.js:
* UserInterface/Models/Canvas.js:
* UserInterface/Models/ConsoleMessage.js:
* UserInterface/Models/DOMBreakpoint.js:
* UserInterface/Models/DOMNode.js:
* UserInterface/Models/DOMNodeStyles.js:
* UserInterface/Models/DOMTree.js:
* UserInterface/Models/DefaultDashboard.js:
* UserInterface/Models/Script.js:
* UserInterface/Models/ScriptTimelineRecord.js:
* UserInterface/Models/SourceMapResource.js:
* UserInterface/Models/TimelineRecording.js:
* UserInterface/Protocol/CSSObserver.js:
* UserInterface/Protocol/ConsoleObserver.js:
* UserInterface/Protocol/DOMObserver.js:
* UserInterface/Protocol/DOMStorageObserver.js:
* UserInterface/Protocol/DatabaseObserver.js:
* UserInterface/Protocol/InspectorFrontendAPI.js:
* UserInterface/Protocol/InspectorObserver.js:
* UserInterface/Protocol/MainTarget.js:
* UserInterface/Protocol/NetworkObserver.js:
* UserInterface/Protocol/PageObserver.js:
* UserInterface/Protocol/RemoteObject.js:
* UserInterface/Protocol/RuntimeObserver.js:
* UserInterface/Protocol/WorkerTarget.js:
* UserInterface/Views/BoxModelDetailsSectionRow.js:
* UserInterface/Views/CanvasOverviewContentView.js:
* UserInterface/Views/CanvasTreeElement.js:
* UserInterface/Views/ContentView.js:
* UserInterface/Views/ContextMenuUtilities.js:
* UserInterface/Views/CookieStorageContentView.js:
* UserInterface/Views/DOMDetailsSidebarPanel.js:
* UserInterface/Views/DOMNodeDetailsSidebarPanel.js:
* UserInterface/Views/DOMNodeTreeElement.js:
* UserInterface/Views/DOMTreeContentView.js:
* UserInterface/Views/DOMTreeDataGrid.js:
* UserInterface/Views/DOMTreeElement.js:
* UserInterface/Views/DOMTreeElementPathComponent.js:
* UserInterface/Views/DOMTreeOutline.js:
* UserInterface/Views/DOMTreeUpdater.js:
* UserInterface/Views/DebuggerSidebarPanel.js:
* UserInterface/Views/ElementsTabContentView.js:
* UserInterface/Views/EventBreakpointPopover.js:
* UserInterface/Views/EventBreakpointTreeElement.js:
* UserInterface/Views/EventListenerSectionGroup.js:
* UserInterface/Views/FormattedValue.js:
* UserInterface/Views/FrameTreeElement.js:
* UserInterface/Views/GeneralStyleDetailsSidebarPanel.js:
* UserInterface/Views/IndexedDatabaseObjectStoreContentView.js:
* UserInterface/Views/LayerDetailsSidebarPanel.js:
* UserInterface/Views/LayerTreeDataGridNode.js:
* UserInterface/Views/LayerTreeDetailsSidebarPanel.js:
* UserInterface/Views/Layers3DContentView.js:
* UserInterface/Views/LogContentView.js:
* UserInterface/Views/NetworkTableContentView.js:
* UserInterface/Views/ObjectTreeBaseTreeElement.js:
* UserInterface/Views/ObjectTreeView.js:
* UserInterface/Views/OpenResourceDialog.js:
* UserInterface/Views/ResourceSidebarPanel.js:
* UserInterface/Views/SearchSidebarPanel.js:
* UserInterface/Views/SettingsTabContentView.js:
* UserInterface/Views/SourceCodeTextEditor.js:
* UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:
* UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js:
* UserInterface/Views/StorageSidebarPanel.js:
* UserInterface/Views/StyleDetailsPanel.js:
* WebInspectorUI.vcxproj/WebInspectorUI.vcxproj:
* WebInspectorUI.vcxproj/WebInspectorUI.vcxproj.filters:

LayoutTests:

* http/tests/inspector/dom/cross-domain-inspected-node-access.html:
* http/tests/inspector/dom/disconnect-dom-tree-after-main-frame-navigation.html:
* http/tests/inspector/dom/shapes-test.js:
* http/tests/inspector/network/har/har-page.html:
* http/tests/inspector/network/loadResource-insecure-resource.html:
* http/tests/inspector/network/resource-response-source-memory-cache-revalidate-expired-only.html:
* http/tests/inspector/network/resource-response-source-memory-cache.html:
* http/tests/inspector/network/resource-sizes-memory-cache.html:
* http/tests/inspector/network/set-resource-caching-disabled-memory-cache.html:
* http/tests/websocket/tests/hybi/inspector/before-load.html:
* http/tests/websocket/tests/hybi/inspector/resolveWebSocket.html:
* inspector/canvas/requestNode.html:
* inspector/codemirror/resources/prettyprinting/utilities.js:
(TestPage.registerInitializer.loadPrettyPrintingTestAndExpectedResults):
(TestPage.registerInitializer.window.addPrettyPrintingTests):
(TestPage.registerInitializer):
* inspector/console/clearMessages.html:
* inspector/console/command-line-api.html:
* inspector/console/console-api.html:
* inspector/console/console-count.html:
* inspector/console/console-table.html:
* inspector/console/console-time.html:
* inspector/console/message-stack-trace.html:
* inspector/console/messageAdded-from-named-evaluations.html:
* inspector/console/messageRepeatCountUpdated.html:
* inspector/console/messagesCleared.html:
* inspector/console/webcore-logging-expected.txt:
* inspector/console/webcore-logging.html:
* inspector/controller/runtime-controller-import.html:
* inspector/controller/runtime-controller.html:
* inspector/css/add-rule.html:
* inspector/css/createStyleSheet.html:
* inspector/css/css-property.html:
* inspector/css/getAllStyleSheets.html:
* inspector/css/manager-preferredInspectorStyleSheetForFrame.html:
* inspector/css/matched-style-properties.html:
* inspector/css/modify-css-property.html:
* inspector/css/modify-rule-selector.html:
* inspector/css/pseudo-element-matches-for-pseudo-element-node.html:
* inspector/css/pseudo-element-matches.html:
* inspector/css/selector-dynamic-specificity.html:
* inspector/css/selector-specificity.html:
* inspector/css/shadow-scoped-style.html:
* inspector/css/stylesheet-events-basic.html:
* inspector/css/stylesheet-events-imports.html:
* inspector/css/stylesheet-events-inspector-stylesheet.html:
* inspector/css/stylesheet-events-multiple-documents.html:
* inspector/css/stylesheet-with-mutations.html:
* inspector/debugger/csp-exceptions.html:
* inspector/debugger/js-stacktrace.html:
* inspector/debugger/resources/log-pause-location.js:
(TestPage.registerInitializer.window.findScript):
(TestPage.registerInitializer.window.loadMainPageContent):
(TestPage.registerInitializer.window.logResolvedBreakpointLinesWithContext):
(TestPage.registerInitializer.window.logLinesWithContext):
* inspector/debugger/stepping/stepping-through-autoContinue-breakpoint.html:
* inspector/dom-debugger/dom-breakpoints.html:
* inspector/dom-debugger/xhr-breakpoints.html:
* inspector/dom/breakpoint-for-event-listener.html:
* inspector/dom/csp-big5-hash.html:
* inspector/dom/csp-hash.html:
* inspector/dom/customElementState.html:
* inspector/dom/domutilities-csspath.html:
* inspector/dom/domutilities-path-dump.html:
* inspector/dom/domutilities-xpath.html:
* inspector/dom/event-listener-add-remove.html:
* inspector/dom/getEventListenersForNode.html:
* inspector/dom/getOuterHTML.html:
* inspector/dom/hideHighlight.html:
* inspector/dom/highlightFrame.html:
* inspector/dom/highlightNode.html:
* inspector/dom/highlightNodeList.html:
* inspector/dom/highlightSelector.html:
* inspector/dom/insertAdjacentHTML.html:
* inspector/dom/inspect.html:
* inspector/dom/pseudo-element-dynamic.html:
* inspector/dom/pseudo-element-static.html:
* inspector/dom/push-node-by-path-to-frontend.html:
* inspector/dom/setEventListenerDisabled.html:
* inspector/dom/setInspectedNode.html:
* inspector/dom/setOuterHTML-no-document-element.html:
* inspector/dom/setOuterHTML.html:
* inspector/dom/shadow-and-non-shadow-children.html:
* inspector/dom/shadowRootType.html:
* inspector/dom/template-content.html:
* inspector/formatting/resources/utilities.js:
(TestPage.registerInitializer.loadFormattingTestAndExpectedResults):
(TestPage.registerInitializer.window.addFormattingTests):
(TestPage.registerInitializer):
* inspector/indexeddb/clearObjectStore.html:
* inspector/indexeddb/deleteDatabaseNamesWithSpace.html:
* inspector/indexeddb/requestData.html:
* inspector/indexeddb/requestDatabase.html:
* inspector/indexeddb/requestDatabaseNames.html:
* inspector/layers/layer-tree-manager.html:
* inspector/model/dom-node.html:
* inspector/model/frame-extra-scripts.html:
* inspector/model/script-resource-relationship.html:
* inspector/model/stack-trace.html:
* inspector/page/empty-or-missing-resources.html:
* inspector/page/hidpi-snapshot-size.html:
* inspector/page/main-frame-resource.html:
* inspector/runtime/change-execution-context-identifier.html:
* inspector/runtime/saveResult.html:
* inspector/storage/domStorage-events.html:
* inspector/worker/console-basic.html:
* inspector/worker/resources-in-worker.html:

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

10 months ago[Curl] Fix missing values of resource timing API.
Basuke.Suzuki@sony.com [Tue, 2 Oct 2018 20:45:30 +0000 (20:45 +0000)]
[Curl] Fix missing values of  resource timing API.
https://bugs.webkit.org/show_bug.cgi?id=190193

Reviewed by Alex Christensen.

Source/WebCore:

The property nextHopProtocol was not returned correctly. It was
returned only when remote inspector is opened.

Tests: http/wpt/resource-timing/rt-nextHopProtocol.html
       http/wpt/resource-timing/rt-nextHopProtocol.worker.html

* platform/network/curl/CurlContext.cpp:
(WebCore::CurlHandle::getNetworkLoadMetrics):
(WebCore::CurlHandle::addExtraNetworkLoadMetrics):

LayoutTests:

* platform/wincairo/TestExpectations:

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

10 months agoREGRESSION: TestWebKitAPI.WKWebView.ProvisionalURLNotChange API test is failing
cdumez@apple.com [Tue, 2 Oct 2018 20:44:27 +0000 (20:44 +0000)]
REGRESSION: TestWebKitAPI.WKWebView.ProvisionalURLNotChange API test is failing
https://bugs.webkit.org/show_bug.cgi?id=190176
<rdar://problem/44925871>

Reviewed by Alex Christensen.

Use a URL that is truly recognized as invalid by WebCore's URL parser.

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

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

10 months agoRemove unused linked-on-or-before-iOS5 check
achristensen@apple.com [Tue, 2 Oct 2018 20:26:15 +0000 (20:26 +0000)]
Remove unused linked-on-or-before-iOS5 check
https://bugs.webkit.org/show_bug.cgi?id=190164

Reviewed by Michael Saboff.

Source/WebCore:

If an app hasn't been updated since iOS5, it can't run supported iOS.
This value is also only checked in an uninstantiated template function.

* platform/URL.cpp:
(WebCore::enableURLSchemeCanonicalization): Deleted.
(WebCore::equal): Deleted.
* platform/URL.h:

Source/WebKitLegacy/ios:

* Misc/WebUIKitSupport.mm:
(WebKitInitialize):
(linkedOnOrAfterIOS5): Deleted.

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

10 months agoRemove ParsedURLString
achristensen@apple.com [Tue, 2 Oct 2018 20:24:42 +0000 (20:24 +0000)]
Remove ParsedURLString
https://bugs.webkit.org/show_bug.cgi?id=190154

Reviewed by Chris Dumez.

Source/WebCore:

Before the introduction of URLParser, it would indicate that we should assume the String
is from a valid URL so we can skip canonicalization and just find the offsets inside the String
to quickly create a URL.  It was a performance optimization that caused security issues when
misused.  Since the introduction of URLParser, we have a fast path for all URL parsing, so
right now it actually doesn't change any behavior.  It's just a relic of the past that complicates
the URL class, making it harder to express which constructor to use and making it harder to move
the class.

* Modules/navigatorcontentutils/NavigatorContentUtils.cpp:
(WebCore::NavigatorContentUtils::registerProtocolHandler):
(WebCore::NavigatorContentUtils::isProtocolHandlerRegistered):
(WebCore::NavigatorContentUtils::unregisterProtocolHandler):
* dom/Document.cpp:
(WebCore::Document::updateBaseURL):
(WebCore::Document::initSecurityContext):
* dom/ExtensionStyleSheets.cpp:
(WebCore::ExtensionStyleSheets::updateInjectedStyleSheetCache const):
* dom/ProcessingInstruction.cpp:
(WebCore::ProcessingInstruction::checkStyleSheet):
* editing/markup.cpp:
(WebCore::completeURLs):
* fileapi/BlobURL.cpp:
(WebCore::BlobURL::createBlobURL):
* history/HistoryItem.cpp:
(WebCore::HistoryItem::url const):
(WebCore::HistoryItem::originalURL const):
* html/HTMLFrameElementBase.cpp:
(WebCore::HTMLFrameElementBase::location const):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
* html/PublicURLManager.cpp:
(WebCore::PublicURLManager::stop):
* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyleSheet::resourceStyleSheetText const):
* inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::getCookies):
(WebCore::InspectorPageAgent::deleteCookie):
(WebCore::InspectorPageAgent::getResourceContent):
(WebCore::InspectorPageAgent::searchInResource):
* inspector/agents/page/PageDebuggerAgent.cpp:
(WebCore::PageDebuggerAgent::sourceMapURLForScript):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::subresources const):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::init):
(WebCore::FrameLoader::initForSynthesizedDocument):
* loader/HistoryController.cpp:
(WebCore::HistoryController::pushState):
(WebCore::HistoryController::replaceState):
* loader/appcache/ApplicationCache.cpp:
(WebCore::ApplicationCache::addResource):
(WebCore::ApplicationCache::resourceForURL):
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::startLoadingEntry):
(WebCore::ApplicationCacheGroup::addEntry):
* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::ApplicationCacheStorage::cacheGroupForURL):
(WebCore::ApplicationCacheStorage::fallbackCacheGroupForURL):
(WebCore::ApplicationCacheStorage::loadCache):
(WebCore::ApplicationCacheStorage::manifestURLs):
* loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::create):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::createWindow):
* page/PageSerializer.cpp:
(WebCore::PageSerializer::urlForBlankFrame):
* platform/URL.cpp:
(WebCore::blankURL):
* platform/URL.h:
(): Deleted.
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::load):
* platform/network/BlobRegistryImpl.cpp:
(WebCore::BlobRegistryImpl::populateBlobsForFileWriting):
* platform/network/ResourceRequestBase.h:
(WebCore::ResourceRequestBase::decodeBase):
* platform/network/ResourceResponseBase.cpp:
(WebCore::ResourceResponseBase::sanitizeSuggestedFilename):
* platform/network/cf/DNSResolveQueueCFNet.cpp:
(WebCore::DNSResolveQueueCFNet::updateIsUsingProxy):
* platform/network/cf/ResourceRequest.h:
(WebCore::ResourceRequest::ResourceRequest):
* platform/network/curl/CookieJarDB.cpp:
(WebCore::CookieJarDB::searchCookies):
(WebCore::CookieJarDB::setCookie):
(WebCore::CookieJarDB::deleteCookie):
* platform/network/curl/ResourceRequest.h:
(WebCore::ResourceRequest::ResourceRequest):
* platform/network/soup/ResourceRequest.h:
(WebCore::ResourceRequest::ResourceRequest):
* xml/XSLTProcessorLibxslt.cpp:
(WebCore::docLoaderFunc):

Source/WebKit:

* NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
(WebKit::NetworkBlobRegistry::writeBlobToFilePath):
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
* PluginProcess/PluginControllerProxy.cpp:
(WebKit::PluginControllerProxy::streamWillSendRequest):
(WebKit::PluginControllerProxy::streamDidReceiveResponse):
(WebKit::PluginControllerProxy::manualStreamDidReceiveResponse):
* Shared/API/APIUserContentURLPattern.h:
(API::UserContentURLPattern::matchesURL const):
* Shared/WebBackForwardListItem.cpp:
(WebKit::WebBackForwardListItem::itemIsInSameDocument const):
* UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
(WebKit::RemoteInspectorProtocolHandler::handleRequest):
(WebKit::RemoteInspectorProtocolHandler::targetListChanged):
* UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
(WebKit::PluginProcessProxy::openURL):
* UIProcess/SuspendedPageProxy.cpp:
(WebKit::SuspendedPageProxy::SuspendedPageProxy):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::loadFile):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::decidePolicyForNewWindowAction):
(WebKit::WebPageProxy::createNewPage):
(WebKit::WebPageProxy::processDidTerminate):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::addProcessToOriginCacheSet):
(WebKit::WebProcessPool::processForNavigationInternal):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::WebContextMenuProxyMac::createShareMenuItem):
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::addUserScript):
(WebKit::InjectedBundle::addUserStyleSheet):
(WebKit::InjectedBundle::removeUserScript):
(WebKit::InjectedBundle::removeUserStyleSheet):
* WebProcess/Plugins/Plugin.cpp:
(WebKit::Plugin::Parameters::decode):
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::url):
(WebKit::WebPlatformStrategies::readURLFromPasteboard):

Source/WebKitLegacy/mac:

* WebView/WebScriptDebugger.mm:
(toNSURL):

Source/WebKitLegacy/win:

* WebDownloadCurl.cpp:
(WebDownload::initWithRequest):
* WebURLResponse.cpp:
(WebURLResponse::createInstance):

Tools:

* TestWebKitAPI/Tests/WebCore/URL.cpp:
(TestWebKitAPI::TEST_F):
* TestWebKitAPI/Tests/WebCore/UserAgentQuirks.cpp:
(TestWebKitAPI::assertUserAgentForURLHasChromeBrowserQuirk):
(TestWebKitAPI::assertUserAgentForURLHasLinuxPlatformQuirk):
(TestWebKitAPI::assertUserAgentForURLHasMacPlatformQuirk):
(TestWebKitAPI::TEST):

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

10 months agoFix iOS TestWebKitAPI failures following <https://trac.webkit.org/changeset/236619>
dbates@webkit.org [Tue, 2 Oct 2018 19:42:25 +0000 (19:42 +0000)]
Fix iOS TestWebKitAPI failures following <https://trac.webkit.org/changeset/236619>
(https://bugs.webkit.org/show_bug.cgi?id=190017)

For now swizzle +[UIKeyboard isInHardwareKeyboardMode] to return NO in the following tests:
    WKWebViewAutofillTests.AutofillRequiresInputSession
    DragAndDropTests.ExternalSourceJPEGOnly
    DragAndDropTests.ExternalSourceUTF8PlainTextOnly

so that the presence of a hardware keyboad does not effect their results. In <https://bugs.webkit.org/show_bug.cgi?id=190211>
we will look to swizzle this method for all test by default.

* TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:
(TestWebKitAPI::overrideIsInHardwareKeyboardMode):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/ios/WKWebViewAutofillTests.mm:
(TestWebKitAPI::overrideIsInHardwareKeyboardMode):
(TestWebKitAPI::TEST):
* TestWebKitAPI/ios/UIKitSPI.h:

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

10 months ago[JSC] Add stub of ExecutableAllocator used when JIT is disabled
yusukesuzuki@slowstart.org [Tue, 2 Oct 2018 19:01:28 +0000 (19:01 +0000)]
[JSC] Add stub of ExecutableAllocator used when JIT is disabled
https://bugs.webkit.org/show_bug.cgi?id=190215

Reviewed by Mark Lam.

When ENABLE(JIT) is disabled, we do not use JIT. But we ExecutableAllocator is still available since
it is guarded by ENABLE(ASSEMBLER). ENABLE(ASSEMBLER) is necessary for LLInt ASM interpreter since
our MacroAssembler tells machine architecture information. Eventually, we would like to decouple
this machine architecture information from MacroAssembler. But for now, we use ENABLE(ASSEMBLER)
for LLInt ASM interpreter even if JIT is disabled by ENABLE(JIT).

To ensure any executable memory allocation is not done, we add a stub of ExecutableAllocator for
non-JIT configurations. This does not have any functionality allocating executable memory, thus
any accidental operation cannot attempt to allocate executable memory if ENABLE(JIT) = OFF.

* jit/ExecutableAllocator.cpp:
(JSC::ExecutableAllocator::initializeAllocator):
(JSC::ExecutableAllocator::singleton):
* jit/ExecutableAllocator.h:
(JSC::ExecutableAllocator::isValid const):
(JSC::ExecutableAllocator::underMemoryPressure):
(JSC::ExecutableAllocator::memoryPressureMultiplier):
(JSC::ExecutableAllocator::dumpProfile):
(JSC::ExecutableAllocator::allocate):
(JSC::ExecutableAllocator::isValidExecutableMemory):
(JSC::ExecutableAllocator::committedByteCount):
(JSC::ExecutableAllocator::getLock const):
(JSC::performJITMemcpy):

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

10 months agoUnreviewed, rolling out r236751.
realdawei@apple.com [Tue, 2 Oct 2018 18:39:08 +0000 (18:39 +0000)]
Unreviewed, rolling out r236751.

broke the iOS Build

Reverted changeset:

"Fix iOS TestWebKitAPI failures following
<https://trac.webkit.org/changeset/236619>"
https://bugs.webkit.org/show_bug.cgi?id=190017
https://trac.webkit.org/changeset/236751

Patch by Dawei Fenton <realdawei@apple.com> on 2018-10-02

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

10 months ago[WebVTT] Cue with line setting is not rendered correctly
pvollan@apple.com [Tue, 2 Oct 2018 18:36:32 +0000 (18:36 +0000)]
[WebVTT] Cue with line setting is not rendered correctly
https://bugs.webkit.org/show_bug.cgi?id=190168

Reviewed by Eric Carlson.

Source/WebCore:

When the line setting contains an optional alignment value, the cue is not rendered at the correct position,
see https://w3c.github.io/webvtt/#webvtt-line-cue-setting. This patch does not implement correct handling of
the line setting alignment values, it only makes sure parsing does not fail when the cue has line alignment
settings.

Test: media/track/track-cue-line-position.html

* html/track/VTTCue.cpp:
(WebCore::VTTCueBox::applyCSSProperties):
(WebCore::VTTCue::getPositionCoordinates const):
(WebCore::VTTCue::setCueSettings):

LayoutTests:

* media/track/captions-webvtt/line-position.vtt: Added.
* media/track/track-cue-line-position-expected-mismatch.html: Added.
* media/track/track-cue-line-position.html: Added.

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

10 months agoUser installed fonts are not always disabled when they should be
antti@apple.com [Tue, 2 Oct 2018 17:57:41 +0000 (17:57 +0000)]
User installed fonts are not always disabled when they should be
https://bugs.webkit.org/show_bug.cgi?id=190195

Reviewed by Geoffrey Garen.

SVG images and some theme cases fail to respect the setting. Besides the obvious problem this
is also a performance issue as various font caches include this setting in the key.

* platform/graphics/FontDescription.cpp:
(WebCore::m_shouldAllowUserInstalledFonts):

Initialize to 'No' by default. All paths where user fonts make sense already set the bit from
settings. This fixes some cases in system themes that construct FontDescriptions from scratch.

* rendering/RenderElement.cpp:
(WebCore::RenderElement::styleWillChange):

Add assertion. This verified the change with the existing tests.

* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::dataChanged):

Always disallow user fonts in SVG used as images.

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

10 months ago[GTK] fast/forms/color/input-appearance-color.html is failing
commit-queue@webkit.org [Tue, 2 Oct 2018 17:52:04 +0000 (17:52 +0000)]
[GTK] fast/forms/color/input-appearance-color.html is failing
https://bugs.webkit.org/show_bug.cgi?id=189350

Patch by Carlos Eduardo Ramalho <cadubentzen@gmail.com> on 2018-10-02
Reviewed by Michael Catanzaro.

Update test expectations to match changes introduced in r235435.

* platform/gtk/TestExpectations:
* platform/gtk/fast/forms/color/input-appearance-color-expected.png:
* platform/gtk/fast/forms/color/input-appearance-color-expected.txt:

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