WebKit-https.git
22 months agoREGRESSION(r226160) Build broken when MEDIA_STREAM is disabled with MediaStreamReques...
Ms2ger@igalia.com [Wed, 20 Dec 2017 14:31:58 +0000 (14:31 +0000)]
REGRESSION(r226160) Build broken when MEDIA_STREAM is disabled with MediaStreamRequest namespace confusion
https://bugs.webkit.org/show_bug.cgi?id=181026

Unreviewed build fix.

Source/WebCore:

* platform/mediastream/MediaStreamRequest.h: Fix namespace, unconditionally include header.

Source/WebKit:

* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
  Remove UNUSED_PARAM macros that check for (undefined) members rather than params.

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

22 months agoRefactor RenderMathMLFraction to remove members modified during layout
commit-queue@webkit.org [Wed, 20 Dec 2017 14:28:05 +0000 (14:28 +0000)]
Refactor RenderMathMLFraction to remove members modified during layout
https://bugs.webkit.org/show_bug.cgi?id=180151

Patch by Frederic Wang <fwang@igalia.com> on 2017-12-20
Reviewed by Manuel Rego Casasnovas.

Currently, RenderMathMLFraction has three LayoutUnit members m_defaultLineThickness,
m_lineThickness and m_ascent that are set during layout. In the past such members have caused
MathML rendering bugs due to update issues. This patch refactors the layout of MathML
fractions so that it does not require to store and keep these LayoutUnit members up-to-date.
New helper functions are introduced to perform the simple arithmetic calculations required.

No new tests, behavior unchanged and already covered by existing tests.

* rendering/mathml/RenderMathMLFraction.cpp: We add new helper functions to calculate line
thickness values. This allows to remove updateLineThickness(), m_defaultLineThickness and
m_lineThickness. We also introduce the ascentOverHorizontalAxis() helper function to
calculate the ascent over the middle of its fraction bar or stack gap. This allows to remove
the m_ascent member.
(WebCore::RenderMathMLFraction::defaultLineThickness const): Helper function to calculate
the default thickness of the fraction bar given in the MATH table or a fallback value.
This replaces the use of m_defaultLineThickness.
(WebCore::RenderMathMLFraction::lineThickness const): Helper function to resolve the
actual thickness based on the @linethickness attribute and the default value. This replaces
the use of m_lineThickness.
(WebCore::RenderMathMLFraction::relativeLineThickness const): Rewrite this function using
the new helper functions.
(WebCore::RenderMathMLFraction::fractionParameters const): Make this const and replaces
isStack() with !lineThickness().
(WebCore::RenderMathMLFraction::stackParameters const): Ditto. Also move from layoutBlock
the adjustment of parameters to ensure a minimum gap. Doing so assumes that the fraction is
valid so we add an ASSERT.
(WebCore::RenderMathMLFraction::horizontalOffset const): Make this a const since it does not
mutate anything.
(WebCore::RenderMathMLFraction::ascentOverHorizontalAxis const): Move this code from
layoutBlock() to determine the middle of the stack gap or of the fraction bar. This helper
function replaces m_ascent - mathAxisHeight(). Note that the adjustment of topShiftUp is now
done in stackParameters().
(WebCore::RenderMathMLFraction::layoutBlock): Remove the call to updateLineThickness().
Rely on stackParameters() and ascentOverHorizontalAxis() to perform the necessary calculation
of bottomShiftDown and ascent respectively.
(WebCore::RenderMathMLFraction::paint): Use lineThickness() and ascentOverHorizontalAxis()
instead of m_lineThickness, m_ascent and isStack().
(WebCore::RenderMathMLFraction::firstLineBaseline const): Use ascentOverHorizontalAxis() and
mathAxisHeight() instead of m_ascent.
(WebCore::RenderMathMLFraction::updateLineThickness): Deleted.
* rendering/mathml/RenderMathMLFraction.h: Declare new helper functions for line thickness
values and ascent and remove the old LayoutUnit members. Make horizontalOffset(),
fractionParameter() and stackParameters() const since they do not modify anything and the two
last are used in the const function ascentOverHorizontalAxis(), itself used in
firstLineBaseline().

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

22 months ago[CMake][WTF] Lowercase ForwardingHeaders directory name of WTF
commit-queue@webkit.org [Wed, 20 Dec 2017 14:25:50 +0000 (14:25 +0000)]
[CMake][WTF] Lowercase ForwardingHeaders directory name of WTF
https://bugs.webkit.org/show_bug.cgi?id=181022

Patch by Fujii Hironori <Hironori.Fujii@sony.com> on 2017-12-20
Reviewed by Konstantin Tokarev.

.:

ForwardingHeaders of WTF are included as <wtf/FooBar.h>. But, the
directory name was uppercase DerivedSources/ForwardingHeaders/WTF.
This confuses Ninja dependency tracking. It should be lowercase.

* Source/cmake/WebKitMacros.cmake: Renamed ForwardingHeaders directory name WTF to wtf.

Source/WTF:

* wtf/CMakeLists.txt: Renamed ForwardingHeaders directory name WTF to wtf.
* wtf/PlatformWin.cmake: Ditto.

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

22 months agoMake fast/css-generated-content/quotes-lang.html pass on GTK
Ms2ger@igalia.com [Wed, 20 Dec 2017 14:24:00 +0000 (14:24 +0000)]
Make fast/css-generated-content/quotes-lang.html pass on GTK
https://bugs.webkit.org/show_bug.cgi?id=93976

Unreviewed test gardening.

Adding a span to the reference file avoids a one-pixel difference in the
font rendering between test and reference on GTK.

* fast/css-generated-content/quotes-lang-expected.html:
* platform/gtk/TestExpectations:

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

22 months ago[GTK][Clang] Build fix after r226138
clopez@igalia.com [Wed, 20 Dec 2017 12:46:29 +0000 (12:46 +0000)]
[GTK][Clang] Build fix after r226138
https://bugs.webkit.org/show_bug.cgi?id=180984

Unreviewed build fix.

No new tests, its a build fix.

* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::collectSubrangesForDocumentMarkers):

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

22 months agoREGRESSION(r222699): Drag & drop from a web page to Gmail fails
rniwa@webkit.org [Wed, 20 Dec 2017 12:44:10 +0000 (12:44 +0000)]
REGRESSION(r222699): Drag & drop from a web page to Gmail fails
https://bugs.webkit.org/show_bug.cgi?id=181019

Reviewed by Wenson Hsieh.

Source/WebCore:

The bug was caused by imageTypeToFakeFilename returning "image/png" instead of "image.png" for
the filename for a PING image converted from a TIFF image. Fixed the bug by correcting this typo.

Tests: PasteImage.PasteLegacyTIFFImage
       PasteImage.PasteTIFFImage

* platform/cocoa/PasteboardCocoa.mm:
(WebCore::imageTypeToFakeFilename):

Tools:

Added assertions for filenames.

* TestWebKitAPI/Tests/WebKitCocoa/PasteImage.mm:

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

22 months agoRefactor user-installed font setting for clarity
mmaxfield@apple.com [Wed, 20 Dec 2017 03:24:15 +0000 (03:24 +0000)]
Refactor user-installed font setting for clarity
https://bugs.webkit.org/show_bug.cgi?id=181013

Reviewed by Simon Fraser.

Source/WebCore:

Pave the way for https://bugs.webkit.org/show_bug.cgi?id=180951.

This patch renames the Setting to not have so many grammatical negatives, and moves
some CoreText-specific FontCache function signatures into a new FontCacheCoreText.h
header file. It also uses the AllowUserInstalledFonts enum class in more places instead
of the old boolean we were using, and puts this enum class in the common TextFlags.h
header.

No new tests because there is no behavior change.

* WebCore.xcodeproj/project.pbxproj:
* css/CSSFontFaceSet.cpp:
(WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::initializeFontStyle):
* page/Settings.yaml:
* platform/graphics/FontCache.h:
(WebCore::SynthesisPair::SynthesisPair): Deleted.
(WebCore::SynthesisPair::boldObliquePair const): Deleted.
* platform/graphics/FontDescription.cpp:
(WebCore::m_shouldAllowUserInstalledFonts):
(WebCore::m_mayRepresentUserInstalledFont): Deleted.
* platform/graphics/FontDescription.h:
(WebCore::FontDescription::shouldAllowUserInstalledFonts const):
(WebCore::FontDescription::setShouldAllowUserInstalledFonts):
(WebCore::FontDescription::operator== const):
(WebCore::FontDescription::mayRepresentUserInstalledFont const): Deleted.
(WebCore::FontDescription::setMayRepresentUserInstalledFont): Deleted.
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::FontDatabase::singleton):
(WebCore::FontDatabase::singletonAllowingUserInstalledFonts):
(WebCore::FontDatabase::singletonDisallowingUserInstalledFonts):
(WebCore::FontDatabase::FontDatabase):
(WebCore::platformFontLookupWithFamily):
(WebCore::fontWithFamily):
* platform/graphics/cocoa/FontCacheCoreText.h: Added.
(WebCore::SynthesisPair::SynthesisPair):
(WebCore::SynthesisPair::boldObliquePair const):
* platform/text/TextFlags.h:
* style/StyleResolveForDocument.cpp:
(WebCore::Style::resolveForDocument):

Source/WebKit:

There are no clients of this SPI yet, so we can rename it to remove the
grammatical negative.

* Shared/WebPreferences.yaml:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetShouldAllowUserInstalledFonts):
(WKPreferencesGetShouldAllowUserInstalledFonts):
(WKPreferencesSetShouldDisallowUserInstalledFonts): Deleted.
(WKPreferencesGetShouldDisallowUserInstalledFonts): Deleted.
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _shouldAllowUserInstalledFonts]):
(-[WKPreferences _setShouldAllowUserInstalledFonts:]):
(-[WKPreferences _shouldDisallowUserInstalledFonts]): Deleted.
(-[WKPreferences _setShouldDisallowUserInstalledFonts:]): Deleted.
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:

LayoutTests:

* fast/text/user-installed-fonts/disable.html:
* fast/text/user-installed-fonts/shadow-disable.html:
* fast/text/user-installed-fonts/shadow-family-disable.html:
* fast/text/user-installed-fonts/shadow-postscript-disable.html:
* fast/text/user-installed-fonts/shadow-postscript-family-disable.html:

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

22 months agoUserMediaRequest should stop a request when Document is being stopped
commit-queue@webkit.org [Wed, 20 Dec 2017 03:17:24 +0000 (03:17 +0000)]
UserMediaRequest should stop a request when Document is being stopped
https://bugs.webkit.org/show_bug.cgi?id=180962

Patch by Youenn Fablet <youenn@apple.com> on 2017-12-19
Reviewed by Eric Carlson.

Covered by fast/mediastream/destroy-document-while-enumerating-devices.html not crashing anymore under guardmalloc.
Stopping to wait for the media stream to be active whenDocument goes away.

* Modules/mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::UserMediaRequest):
(WebCore::UserMediaRequest::stop):
(WebCore::UserMediaRequest::activeDOMObjectName const):
(WebCore::UserMediaRequest::canSuspendForDocumentSuspension const):
(WebCore::UserMediaRequest::contextDestroyed): Deleted.
* Modules/mediastream/UserMediaRequest.h:

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

22 months agoMove first-letter building code to RenderTreeBuilder
antti@apple.com [Wed, 20 Dec 2017 01:44:37 +0000 (01:44 +0000)]
Move first-letter building code to RenderTreeBuilder
https://bugs.webkit.org/show_bug.cgi?id=180992

Reviewed by Zalan Bujtas.

All special case tree building logic should go to RenderTreeBuilder.

- RenderTreeUpdater::FirstLetter -> RenderTreeBuilder::FirstLetter
- Make the builder non-static and stop using RenderTreeBuilder::current() there.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* rendering/TextAutoSizing.cpp:
(WebCore::TextAutoSizingValue::adjustTextNodeSizes):
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::RenderTreeBuilder):
(WebCore::RenderTreeBuilder::insertChild):
(WebCore::RenderTreeBuilder::updateAfterDescendants):
* rendering/updating/RenderTreeBuilder.h:
(WebCore::RenderTreeBuilder::firstLetterBuilder):
(WebCore::RenderTreeBuilder::tableBuilder):
* rendering/updating/RenderTreeBuilderFirstLetter.cpp: Copied from rendering/updating/RenderTreeUpdaterFirstLetter.cpp.
(WebCore::supportsFirstLetter):
(WebCore::RenderTreeBuilder::FirstLetter::FirstLetter):
(WebCore::RenderTreeBuilder::FirstLetter::updateAfterDescendants):
(WebCore::RenderTreeBuilder::FirstLetter::updateStyle):
(WebCore::RenderTreeBuilder::FirstLetter::createRenderers):
(WebCore::updateFirstLetterStyle): Deleted.
(WebCore::createFirstLetterRenderer): Deleted.
(WebCore::RenderTreeUpdater::FirstLetter::update): Deleted.
* rendering/updating/RenderTreeBuilderFirstLetter.h: Copied from rendering/updating/RenderTreeUpdaterFirstLetter.h.
* rendering/updating/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::updateAfterDescendants):
* rendering/updating/RenderTreeUpdater.h:
* rendering/updating/RenderTreeUpdaterFirstLetter.cpp: Removed.
* rendering/updating/RenderTreeUpdaterFirstLetter.h: Removed.

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

22 months agoMarkerSubrange.SubdivideGrammarAndSelectionOverlap{Frontmost, FrontmostWithLongestEff...
dbates@webkit.org [Wed, 20 Dec 2017 01:33:46 +0000 (01:33 +0000)]
MarkerSubrange.SubdivideGrammarAndSelectionOverlap{Frontmost, FrontmostWithLongestEffectiveRange} are failing
https://bugs.webkit.org/show_bug.cgi?id=181014

Temporarily disable tests while I investigate offline.

* TestWebKitAPI/Tests/WebCore/MarkerSubrange.cpp:
(TestWebKitAPI::TEST):

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

22 months agoUnreviewed, rebaseline an API test result for El Capitan and Sierra.
wenson_hsieh@apple.com [Wed, 20 Dec 2017 01:31:21 +0000 (01:31 +0000)]
Unreviewed, rebaseline an API test result for El Capitan and Sierra.

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

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

22 months agoWeb Inspector: InspectorTest.evaluateInPage should return a rejection if an error...
bburg@apple.com [Wed, 20 Dec 2017 01:29:57 +0000 (01:29 +0000)]
Web Inspector: InspectorTest.evaluateInPage should return a rejection if an error was thrown
https://bugs.webkit.org/show_bug.cgi?id=180956

Reviewed by Joseph Pecoraro.

Source/WebInspectorUI:

* UserInterface/Test/FrontendTestHarness.js:
(FrontendTestHarness.prototype.evaluateInPage.translateResult): Renamed.
(FrontendTestHarness.prototype.evaluateInPage):
If the result was thrown, then reject with the error.
Rename the helper method to match the same one in RemoteObject.prototype.fetchProperties.

LayoutTests:

* inspector/unit-tests/test-harness-evaluate-in-page-expected.txt:
* inspector/unit-tests/test-harness-evaluate-in-page.html:
Update test case to expect an exception when an error was thrown in our evaluation.

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

22 months ago[Fetch] Extracting a body of type Blob should not set Content-Type to the empty string
cdumez@apple.com [Wed, 20 Dec 2017 01:15:58 +0000 (01:15 +0000)]
[Fetch] Extracting a body of type Blob should not set Content-Type to the empty string
https://bugs.webkit.org/show_bug.cgi?id=180991

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Rebaseline WPT test now that it is passing.

* web-platform-tests/service-workers/service-worker/invalid-blobtype.https-expected.txt:

Source/WebCore:

Extracting a body of type Blob should not set Content-Type to the empty string as per:
- https://fetch.spec.whatwg.org/#concept-bodyinit-extract

No new tests, rebaselined existing test.

* Modules/fetch/FetchBody.cpp:
(WebCore::FetchBody::extract):

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

22 months agoUnreviewed, rolling out r226094.
commit-queue@webkit.org [Wed, 20 Dec 2017 01:10:11 +0000 (01:10 +0000)]
Unreviewed, rolling out r226094.
https://bugs.webkit.org/show_bug.cgi?id=181012

No longer needed to build without error. (Requested by xenon
on #webkit).

Reverted changeset:

"[GTK][WPE] Conditionalize libTASN1 use behind
ENABLE_SUBTLE_CRYPTO in the CMake files"
https://bugs.webkit.org/show_bug.cgi?id=180949
https://trac.webkit.org/changeset/226094

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

22 months ago[MediaStream] Clean up RealtimeMediaSource interfaces
eric.carlson@apple.com [Wed, 20 Dec 2017 01:08:40 +0000 (01:08 +0000)]
[MediaStream] Clean up RealtimeMediaSource interfaces
https://bugs.webkit.org/show_bug.cgi?id=180934
<rdar://problem/36108648>

Reviewed by Youenn Fablet.

Source/WebCore:

No new tests, updated http/tests/media/media-stream/disconnected-frame.html.

Wrap video and audio constraints in a struct instead of passing both around as separate
parameters. Cleanup up the interface to RealTimeMediaSourceCenter.

* Modules/mediastream/MediaDevices.cpp:
(WebCore::MediaDevices::getUserMedia const):
* Modules/mediastream/MediaDevicesRequest.cpp:
(WebCore::MediaDevicesRequest::start):
* Modules/mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::create):
(WebCore::UserMediaRequest::UserMediaRequest):
(WebCore::UserMediaRequest::start):
(WebCore::UserMediaRequest::allow):
(WebCore::UserMediaRequest::contextDestroyed):
* Modules/mediastream/UserMediaRequest.h:
(WebCore::UserMediaRequest::request const):
* WebCore.xcodeproj/project.pbxproj:
* platform/mediastream/CaptureDevice.h:
(WebCore::CaptureDevice::persistentId const):
(WebCore::CaptureDevice::label const):
(WebCore::CaptureDevice::groupId const):
(WebCore::CaptureDevice::type const):
(WebCore::CaptureDevice::setPersistentId): Deleted.
(WebCore::CaptureDevice::setLabel): Deleted.
(WebCore::CaptureDevice::setGroupId): Deleted.
(WebCore::CaptureDevice::setType): Deleted.
* platform/mediastream/CaptureDeviceManager.cpp:
(CaptureDeviceManager::getAudioSourcesInfo): Deleted.
(CaptureDeviceManager::getVideoSourcesInfo): Deleted.
(CaptureDeviceManager::deviceWithUID): Deleted.
* platform/mediastream/CaptureDeviceManager.h:
(WebCore::CaptureDeviceManager::captureDeviceWithPersistentID):
(WebCore::CaptureDeviceManager::refreshCaptureDevices):
* platform/mediastream/MediaStreamRequest.h: Copied from Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDevice.mm.
(WebCore::MediaStreamRequest::encode const):
(WebCore::MediaStreamRequest::decode):
* platform/mediastream/RealtimeMediaSourceCenter.cpp:
(WebCore::RealtimeMediaSourceCenter::createMediaStream):
(WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices):
(WebCore::RealtimeMediaSourceCenter::validateRequestConstraints):
(WebCore::RealtimeMediaSourceCenter::captureDeviceWithPersistentID):
* platform/mediastream/RealtimeMediaSourceCenter.h:
* platform/mediastream/RealtimeMediaSourceSettings.h:
* platform/mediastream/ios/AVAudioSessionCaptureDevice.mm:
(WebCore::AVAudioSessionCaptureDevice::AVAudioSessionCaptureDevice):
* platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h:
* platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
(WebCore::AVAudioSessionCaptureDeviceManager::captureDevices):
(WebCore::AVAudioSessionCaptureDeviceManager::captureDeviceWithPersistentID):
* platform/mediastream/mac/AVCaptureDeviceManager.h:
* platform/mediastream/mac/AVCaptureDeviceManager.mm:
(WebCore::AVCaptureDeviceManager::captureDevicesInternal):
(WebCore::AVCaptureDeviceManager::captureDevices):
(WebCore::AVCaptureDeviceManager::refreshAVCaptureDevicesOfType):
(WebCore::AVCaptureDeviceManager::refreshCaptureDevices):
(WebCore::AVCaptureDeviceManager::deviceDisconnected):
(WebCore::AVCaptureDeviceManager::getAudioSourcesInfo): Deleted.
(WebCore::AVCaptureDeviceManager::getVideoSourcesInfo): Deleted.
* platform/mediastream/mac/CoreAudioCaptureDevice.cpp:
(WebCore::CoreAudioCaptureDevice::CoreAudioCaptureDevice):
* platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:
(WebCore::CoreAudioCaptureDeviceManager::captureDevices):
(WebCore::CoreAudioCaptureDeviceManager::captureDeviceWithPersistentID):
(WebCore::CoreAudioCaptureDeviceManager::refreshAudioCaptureDevices):
* platform/mediastream/mac/CoreAudioCaptureDeviceManager.h:
* platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
* platform/mock/MockRealtimeAudioSource.cpp:
(WebCore::MockRealtimeAudioSource::startProducingData):
(WebCore::MockRealtimeAudioSource::createMuted): Deleted.
* platform/mock/MockRealtimeAudioSource.h:
* platform/mock/MockRealtimeMediaSource.cpp:
(WebCore::deviceMap):
(WebCore::MockRealtimeMediaSource::captureDeviceWithPersistentID):
(WebCore::MockRealtimeMediaSource::audioDevices):
(WebCore::MockRealtimeMediaSource::videoDevices):
(WebCore::MockRealtimeMediaSource::MockRealtimeMediaSource):
* platform/mock/MockRealtimeMediaSource.h:
(WebCore::MockRealtimeMediaSource::device const):
(WebCore::MockRealtimeMediaSource::deviceIndex): Deleted.
* platform/mock/MockRealtimeMediaSourceCenter.h:
* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource):
(WebCore::MockRealtimeVideoSource::initializeCapabilities):
(WebCore::MockRealtimeVideoSource::generateFrame):
(WebCore::MockRealtimeVideoSource::createMuted): Deleted.
* platform/mock/MockRealtimeVideoSource.h:

Source/WebKit:

* Shared/WebCoreArgumentCoders.h: Update CaptureDevice encoder.

* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::createPermissionRequest): Renamed from createRequest.
(WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame): Update for
API change.
(WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame): Filter the
vector returned by getMediaStreamDevices.
(WebKit::UserMediaPermissionRequestManagerProxy::createRequest): Deleted.
* UIProcess/UserMediaPermissionRequestManagerProxy.h:

* UIProcess/UserMediaPermissionRequestProxy.cpp:
(WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy): Update for API change.
(WebKit::UserMediaPermissionRequestProxy::allow): Ditto.
* UIProcess/UserMediaPermissionRequestProxy.h:
(WebKit::UserMediaPermissionRequestProxy::create):
(WebKit::UserMediaPermissionRequestProxy::requestType const):

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::requestUserMediaPermissionForFrame): Ditto.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:

* WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
(WebKit::UserMediaPermissionRequestManager::startUserMediaRequest): m_blockedRequests -> m_blockedUserMediaRequests.
(WebKit::UserMediaPermissionRequestManager::sendUserMediaRequest): Ditto.
(WebKit::UserMediaPermissionRequestManager::mediaCanStart): Ditto.
(WebKit::UserMediaPermissionRequestManager::removeMediaRequestFromMaps): Ditto.
* WebProcess/MediaStream/UserMediaPermissionRequestManager.h:

LayoutTests:

* http/tests/media/media-stream/disconnected-frame-expected.txt:
* http/tests/media/media-stream/disconnected-frame.html:

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

22 months agoMarked http/tests/images/image-supports-video.html as flaky on macOS WK1.
jlewis3@apple.com [Wed, 20 Dec 2017 00:59:16 +0000 (00:59 +0000)]
Marked http/tests/images/image-supports-video.html as flaky on macOS WK1.
https://bugs.webkit.org/show_bug.cgi?id=181008

Unreviewed test gardening.

* platform/mac-wk1/TestExpectations:

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

22 months agoWeb Inspector: Network Table - Redesign the waterfall popover showing timing data
joepeck@webkit.org [Wed, 20 Dec 2017 00:56:31 +0000 (00:56 +0000)]
Web Inspector: Network Table - Redesign the waterfall popover showing timing data
https://bugs.webkit.org/show_bug.cgi?id=180996
<rdar://problem/34072542>

Reviewed by Matt Baker.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Main.html:
New strings and files.

* UserInterface/Views/NetworkTableContentView.js:
(WI.NetworkTableContentView.prototype._waterfallPopoverContentForResource):
(WI.NetworkTableContentView.prototype._handleMousedownWaterfall):
Use the ResourceTimingBreakdownView with a fixed width size.

* UserInterface/Views/ResourceTimingContentView.css: Removed.
* UserInterface/Views/ResourceTimingContentView.js:
(WI.ResourceTimingContentView.prototype.initialLayout):
(WI.ResourceTimingContentView.prototype._refreshTimingSection):
(WI.ResourceTimingContentView.prototype._refreshTimingSection.createBlock): Deleted.
(WI.ResourceTimingContentView.prototype._refreshTimingSection.createTimeLabel): Deleted.
(WI.ResourceTimingContentView.prototype._refreshTimingSection.createRow): Deleted.
Use the ResourceTimingBreakdownView with a flexible size.
Also changed the loading indicator and empty message to match
normal ContentView loading indicator and message only UI.

* UserInterface/Views/ResourceTimingBreakdownView.css:
(.waterfall-popover .resource-timing-breakdown):
(.resource-timing-breakdown > table > tr > td.label):
(.resource-timing-breakdown > table > tr > td.graph):
(.resource-timing-breakdown > table > tr > td.time):
(.resource-timing-breakdown > table > tr.empty):
(.resource-timing-breakdown > table > tr.header:not(.total-row) > td):
(.resource-timing-breakdown > table hr):
(.resource-timing-breakdown .waterfall .block):
(.resource-timing-breakdown): Deleted.
(.resource-timing-breakdown > .waterfall): Deleted.
(.resource-timing-breakdown > .waterfall .block): Deleted.
(.resource-timing-breakdown ul): Deleted.
(.resource-timing-breakdown ul > li): Deleted.
(.resource-timing-breakdown ul > li > .row-label): Deleted.
(body[dir=ltr] .resource-timing-breakdown ul > li > .row-label): Deleted.
(body[dir=rtl] .resource-timing-breakdown ul > li > .row-label): Deleted.
(.resource-timing-breakdown ul > li > .section-label): Deleted.
(.resource-timing-breakdown ul > li > .time-label): Deleted.
(.resource-timing-breakdown .time-section): Deleted.
(.resource-timing-breakdown ul > li > .time-section > .label): Deleted.
(.resource-timing-breakdown ul > li.total .block): Deleted.
(.resource-timing-breakdown ul > li.total .time-label): Deleted.
* UserInterface/Views/ResourceTimingBreakdownView.js:
(WI.ResourceTimingBreakdownView):
(WI.ResourceTimingBreakdownView.prototype._appendEmptyRow):
(WI.ResourceTimingBreakdownView.prototype._appendHeaderRow):
(WI.ResourceTimingBreakdownView.prototype._appendRow):
(WI.ResourceTimingBreakdownView.prototype.initialLayout):
(WI.ResourceTimingBreakdownView.prototype.initialLayout.createBlock): Deleted.
(WI.ResourceTimingBreakdownView.prototype.initialLayout.createSectionLabel): Deleted.
(WI.ResourceTimingBreakdownView.prototype.initialLayout.createTimeLabel): Deleted.
(WI.ResourceTimingBreakdownView.prototype.initialLayout.createTimeSection): Deleted.
(WI.ResourceTimingBreakdownView.prototype.initialLayout.createRow): Deleted.
(WI.ResourceTimingBreakdownView.prototype.initialLayout.emptyRow): Deleted.
(WI.ResourceTimingBreakdownView.prototype.initialLayout.appendGraphRow): Deleted.
(WI.ResourceTimingBreakdownView.prototype.initialLayout.appendEmptyRow): Deleted.
(WI.ResourceTimingBreakdownView.prototype.initialLayout.getCurrentSectionMetrics): Deleted.
Redesign the breakdown view.

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

22 months agoDon't convert pasted content to use blob URL in WebKit1
rniwa@webkit.org [Wed, 20 Dec 2017 00:07:31 +0000 (00:07 +0000)]
Don't convert pasted content to use blob URL in WebKit1
https://bugs.webkit.org/show_bug.cgi?id=180969

Reviewed by Wenson Hsieh.

Source/WebCore:

Turns out that some WebKit1 clients are relying on being able to see the original URLs of the pasted content;
e.g. not storing content referenced by HTTP/HTTPS protocol as opposed to local files.

This patch restores the behavior prior to r223440 and r222839 for WebKit1 clients by overriding resources in
DocumentLoader instead of converting URLs used in the pasted contents by blob URLs. In addition, this patch
disables the pasteboard sanitization and custom data transfer types for WebKit1 clients as the feature poses
a compatibility concern for WebKit1 clients.

Tests: WebKitLegacy.AccessingImageInPastedRTFD
       WebKitLegacy.AccessingImageInPastedWebArchive

* editing/cocoa/WebContentReaderCocoa.mm:
(WebCore::createFragmentAndAddResources):
(WebCore::WebContentReader::readWebArchive):
* page/DeprecatedGlobalSettings.cpp:
(WebCore::DeprecatedGlobalSettings::defaultCustomPasteboardDataEnabled):

Tools:

Added API tests to make sure we can access the images in the pasted content.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/paste-rtfd.html:
* TestWebKitAPI/Tests/WebKitLegacy/mac: Added.
* TestWebKitAPI/Tests/WebKitLegacy/mac/AccessingPastedImage.mm: Added.
(writeRTFDToPasteboard):
(-[SubresourceForBlobURLFrameLoadDelegate webView:didFinishLoadForFrame:]):
(-[SubresourceForBlobURLFrameLoadDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:]):
(TestWebKitAPI::TEST):

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

22 months agoWeb Inspector: add TestPage.debug() to inspect evaluations being sent to Inspector...
bburg@apple.com [Wed, 20 Dec 2017 00:06:43 +0000 (00:06 +0000)]
Web Inspector: add TestPage.debug() to inspect evaluations being sent to Inspector page
https://bugs.webkit.org/show_bug.cgi?id=181005

Reviewed by Joseph Pecoraro.

When TestPage.debug() is called, dump out all code that is sent to be evaluated in
the inspector page. This is useful for debugging initialization and InspectorTest.awaitEvent.

* http/tests/inspector/resources/inspector-test.js:
(runTest):
(TestPage.debug):
(TestPage.evaluateInWebInspector):
(TestPage.dispatchEventToFrontend):

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

22 months agoLayout Test imported/w3c/web-platform-tests/service-workers/service-worker/getregistr...
commit-queue@webkit.org [Wed, 20 Dec 2017 00:03:55 +0000 (00:03 +0000)]
Layout Test imported/w3c/web-platform-tests/service-workers/service-worker/getregistrations.https.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=180497
<rdar://problem/35947470>

Unreviewed.

Patch by Youenn Fablet <youenn@apple.com> on 2017-12-19

* TestExpectations: Marking test as slow on Debug.

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

22 months agoWeb Inspector: InspectorTest.expectException does not handle implicitly resolved...
bburg@apple.com [Tue, 19 Dec 2017 23:53:02 +0000 (23:53 +0000)]
Web Inspector: InspectorTest.expectException does not handle implicitly resolved async functions correctly
https://bugs.webkit.org/show_bug.cgi?id=180944

Reviewed by Joseph Pecoraro.

Source/WebInspectorUI:

* UserInterface/Test/TestHarness.js:
(TestHarness.prototype.expectException):
Don't chain .catch after we might have just returned a rejected promise.

LayoutTests:

Add a new test case for implicitly resolved async functions passed to expectException.
Rebaseline one existing test that had a failing assertion that progresses with
this change. I didn't notice it because the assertion just prior is expected to fail.

* inspector/unit-tests/test-harness-expect-functions-async-expected.txt:
* inspector/unit-tests/test-harness-expect-functions-async.html:

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

22 months agoSLEEP_THREAD_FOR_DEBUGGER() macro should try to print out the PID of the affected...
bburg@apple.com [Tue, 19 Dec 2017 23:50:04 +0000 (23:50 +0000)]
SLEEP_THREAD_FOR_DEBUGGER() macro should try to print out the PID of the affected process
https://bugs.webkit.org/show_bug.cgi?id=180947

Reviewed by Joseph Pecoraro.

* wtf/DebugUtilities.h:
- Use sleep() from CurrentTime.h as it is more cross-platform.
- Print a message with the process PID to simplify attaching to sleeping thread.
- Include source location in case multiple such macros are being used.

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

22 months agoWeb Inspector: Network Table - Update the Time column to include the total duration...
joepeck@webkit.org [Tue, 19 Dec 2017 23:40:16 +0000 (23:40 +0000)]
Web Inspector: Network Table - Update the Time column to include the total duration not just the download duration
https://bugs.webkit.org/show_bug.cgi?id=180998
<rdar://problem/36140424>

Reviewed by Matt Baker.

* UserInterface/Models/Resource.js:
(WI.Resource.prototype.get totalDuration):
(WI.Resource.prototype.get duration): Deleted.
Rename and group getters to be clearer.

* UserInterface/Views/NetworkTableContentView.js:
(WI.NetworkTableContentView.prototype._entryForResource):
Use the totalDuration for the network table time column.

* UserInterface/Views/ResourceTimelineDataGridNode.js:
(WI.ResourceTimelineDataGridNode.prototype._mouseoverRecordBar graphDataSource.get secondsPerPixel):
Using the download duration was incorrect here.

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

22 months agoPlaying media elements which call "pause(); play()" will have the play promise rejected.
jer.noble@apple.com [Tue, 19 Dec 2017 23:16:09 +0000 (23:16 +0000)]
Playing media elements which call "pause(); play()" will have the play promise rejected.
https://bugs.webkit.org/show_bug.cgi?id=180781
<rdar://problem/33191377>

Reviewed by Eric Carlson.

Source/WebCore:

Follow-up to address failing iOS API tests. Rather than skipping the call to
prepareForLoad() in the case where media elements are not allowed to load data,
unconditionally call prepareForLoad(), but conditionally call selectMediaResource() inside
that function only if the media elemnet is allowed to load. This ensures that the
MediaPlayer is created when play(), pause(), or load() are called during a user gesture
later, and selectMediaResource() (which depends on having a non-null m_player) is called.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::parseAttribute):
(WebCore::HTMLMediaElement::insertedIntoAncestor):
(WebCore::HTMLMediaElement::load):
(WebCore::HTMLMediaElement::prepareForLoad):
(WebCore::HTMLMediaElement::playInternal):

Source/WebKit:

shouldRequireUserGestureToLoadVideo() should default to false on Mac.

* UIProcess/API/Cocoa/WKWebView.mm:
(shouldRequireUserGestureToLoadVideo):

Source/WebKitLegacy/mac:

shouldRequireUserGestureToLoadVideo() should default to false on Mac.

* WebView/WebView.mm:
(shouldRequireUserGestureToLoadVideo):

LayoutTests:

* media/video-load-require-user-gesture.html:

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

22 months agoWeb Inspector: Styles Redesign: Typing semicolon at the end of value should move...
webkit@devinrousso.com [Tue, 19 Dec 2017 23:13:05 +0000 (23:13 +0000)]
Web Inspector: Styles Redesign: Typing semicolon at the end of value should move to the next property
https://bugs.webkit.org/show_bug.cgi?id=178498
<rdar://problem/35065995>

Reviewed by Joseph Pecoraro.

* UserInterface/Views/SpreadsheetStypeProperty.js:
(WI.SpreadsheetStypeProperty.prototype._update):
(WI.SpreadsheetStypeProperty.prototype._handleValueBeforeInput):
Only move to the next property if there are no unbalanced quotes. For example, adding a
semicolon after `url("foo` or `url('bar` would not move to the next property.

* UserInterface/Views/SpreadsheetTextField.js:
(WI.SpreadsheetTextField.prototype.valueWithoutSuggestion):
(WI.SpreadsheetTextField.prototype.completionSuggestionsSelectedCompletion):
(WI.SpreadsheetTextField.prototype.completionSuggestionsClickedCompletion):
(WI.SpreadsheetTextField.prototype._handleKeyDownForSuggestionView):
(WI.SpreadsheetTextField.prototype._updateCompletions):
(WI.SpreadsheetTextField.prototype._getPrefix): Deleted.

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

22 months agoAPI test WKAttachmentTests.InsertPastedAttributedStringContainingMultipleAttachments...
wenson_hsieh@apple.com [Tue, 19 Dec 2017 23:12:00 +0000 (23:12 +0000)]
API test WKAttachmentTests.InsertPastedAttributedStringContainingMultipleAttachments is failing on El Capitan and Sierra
https://bugs.webkit.org/show_bug.cgi?id=180977

Reviewed by Tim Horton.

Fixes a failing API test by updating markup deserialization codepaths in WebKitLegacy to behave like the modern
WebCore counterpart. When determining element tags to exclude when generating markup from an attributed string,
don't add "object" as an element to exclude if the attachment element runtime feature is enabled.

* WebCoreSupport/WebEditorClient.mm:
(attributesForAttributedStringConversion):
* WebView/WebHTMLView.mm:
(+[WebHTMLView _excludedElementsForAttributedStringConversion]):

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

22 months agoBuild failure in WebGL2 when Video feature is disabled
timothy@hatcher.name [Tue, 19 Dec 2017 22:36:21 +0000 (22:36 +0000)]
Build failure in WebGL2 when Video feature is disabled
https://bugs.webkit.org/show_bug.cgi?id=180946

Reviewed by Brian Burg.

* html/canvas/WebGL2RenderingContext.h: Make TexImageSource conditional on ENABLE(VIDEO).
* html/canvas/WebGL2RenderingContext.idl: Ditto.

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

22 months agoscopeURL should start with the provided scriptURL
cdumez@apple.com [Tue, 19 Dec 2017 22:32:40 +0000 (22:32 +0000)]
scopeURL should start with the provided scriptURL
https://bugs.webkit.org/show_bug.cgi?id=180983

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Rebaseline WPT tests now that more checks are passing.

* web-platform-tests/service-workers/service-worker/register-default-scope.https-expected.txt:
* web-platform-tests/service-workers/service-worker/registration-iframe.https-expected.txt:
* web-platform-tests/service-workers/service-worker/registration-security-error.https-expected.txt:

Source/WebCore:

scopeURL should start with the provided scriptURL, as per:
- https://w3c.github.io/ServiceWorker/#update (steps 7.8 to 7.18)

No new tests, rebaselined existing tests.

* platform/network/HTTPHeaderNames.in:
* workers/service/ServiceWorkerJob.cpp:
(WebCore::ServiceWorkerJob::didReceiveResponse):

LayoutTests:

Update WebKit tests due to new restrictions.

* http/tests/workers/service/basic-unregister.https-expected.txt:
* http/tests/workers/service/controller-change.html:
* http/tests/workers/service/resources/ServiceWorkerGlobalScope_getRegistration-worker.js:
(async.runTest):
* http/tests/workers/service/resources/ServiceWorkerGlobalScope_register-worker.js:
(async.runTest):
* http/tests/workers/service/resources/basic-fetch.js:
(async.test):
* http/tests/workers/service/resources/basic-register.js:
(async.test):
* http/tests/workers/service/resources/basic-unregister.js:
(async.test):
* http/tests/workers/service/resources/service-worker-fetch.js:
(async.test):
* http/tests/workers/service/resources/service-worker-getRegistration.js:
(async.test):
* http/tests/workers/service/resources/service-worker-importScript.js:
(async.test):
* http/tests/workers/service/resources/shift-reload-navigation.js:
(async.test):
* http/tests/workers/service/service-worker-clear.html:
* http/tests/workers/service/service-worker-crossorigin-fetch.html:
* http/tests/workers/service/service-worker-getRegistration-expected.txt:
* http/tests/workers/service/service-worker-request-with-body.https.html:
* http/tests/workers/service/serviceworker-idb.https.html:
* http/tests/workers/service/serviceworker-websocket.https.html:
* http/tests/workers/service/serviceworkerclients-get.https.html:

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

22 months ago[RenderTreeBuilder] Move finding-the-parent/creating-wrapper logic from RenderTableSe...
zalan@apple.com [Tue, 19 Dec 2017 22:15:18 +0000 (22:15 +0000)]
[RenderTreeBuilder] Move finding-the-parent/creating-wrapper logic from RenderTableSection::addChild to RenderTreeBuilder
https://bugs.webkit.org/show_bug.cgi?id=180994
<rdar://problem/36139222>

Reviewed by Antti Koivisto.

This is in preparation for removing all tree mutation from renderering code.

Covered by existing tests.

* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::addChild):
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::insertChild):
* rendering/updating/RenderTreeBuilderTable.cpp:
(WebCore::RenderTreeBuilder::Table::findOrCreateParentForChild):
* rendering/updating/RenderTreeBuilderTable.h:

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

22 months agoWe forgot to do index masking for in bounds int32 arrays in the FTL
sbarati@apple.com [Tue, 19 Dec 2017 21:51:27 +0000 (21:51 +0000)]
We forgot to do index masking for in bounds int32 arrays in the FTL
https://bugs.webkit.org/show_bug.cgi?id=180987

Reviewed by Keith Miller.

* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileGetByVal):

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

22 months agoImplement InlineTextBox painting using marker subranges
dbates@webkit.org [Tue, 19 Dec 2017 21:48:19 +0000 (21:48 +0000)]
Implement InlineTextBox painting using marker subranges
https://bugs.webkit.org/show_bug.cgi?id=180984
<rdar://problem/36139364>

Reviewed by David Hyatt.

Source/WebCore:

As a step towards implementing CSS Pseudo-Elements Module Level 4, explicitly decompose a
text line into subrange objects that may be styled (say, to give the appearance of selected
text) and painted.

No functionality changed. So, no new tests.

* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::localSelectionRect const): Update comments.

(WebCore::InlineTextBox::MarkerSubrangeStyle::operator== const):
(WebCore::InlineTextBox::MarkerSubrangeStyle::operator!= const):
(WebCore::InlineTextBox::StyledMarkerSubrange::StyledMarkerSubrange):
Define a subclass to represent a marker subrange that has associated style information.
We will make use of the style information when painting the subrange.

(WebCore::createMarkerSubrangeFromSelectionInBox): Convenience function to instantiate a
MarkerSubrange instance from the current selection of a specified text box.

(WebCore::InlineTextBox::paint): Write in terms of MarkerSubrange. We keep composition backgrounds
and composition underlines as special cases for now. We represent all other subranges of the line
as MarkerSubrange instances, including unmarked text (i.e. non-selected text without an associated
document marker). The subranges for the gaps between document markers and selection are implicitly
created by subdividing the entire line. Support for PaintBehaviorExcludeSelection is implemented
by subdividing the entire line with the selection subrange and then removing the selection subrange
from the resulting list of subdivisions before painting with the resulting list.

(WebCore::InlineTextBox::paintPlatformDocumentMarkers): Renamed; formerly named paintDocumentMarkers.
(WebCore::InlineTextBox::paintPlatformDocumentMarker): Renamed; formerly named paintDocumentMarker.

(WebCore::InlineTextBox::computeStyleForUnmarkedMarkerSubrange const): Convenience function to
compute the style for unmarked text.

(WebCore::InlineTextBox::resolveStyleForSubrange): Added

(WebCore::InlineTextBox::subdivideAndResolveStyle): Subdivides the list of marker subranges and
coalesces subranges of the same type (e.g. selection) or with the same style. The latter strategy
preserves the optimization of drawing the text of the entire line in one draw command when we know
that the selected text looks identical to non-selected text. This optimization was performed in TextPainter::paint().

(WebCore::InlineTextBox::collectSubrangesForDraggedContent): Added.
(WebCore::InlineTextBox::collectSubrangesForDocumentMarkers): Added.
(WebCore::InlineTextBox::textOriginFromBoxRect const): Added.

(WebCore::InlineTextBox::paintMarkerSubranges):
(WebCore::InlineTextBox::paintTextSubrangeBackground):
(WebCore::InlineTextBox::paintTextSubrangeForeground):
(WebCore::InlineTextBox::paintTextSubrangeDecoration):
Paint the marker subrange.

(WebCore::InlineTextBox::paintCompositionBackground): Moved function to group it with the logic to
paint composition underlines. Modified to pass clamped offsets to paintTextSubrangeBackground() as
paintTextSubrangeBackground() now expects them.

(WebCore::mirrorRTLSegment): Moved function to be above paintCompositionUnderline() as it is the only
function that makes use of it.

(WebCore::InlineTextBox::paintSelection): Deleted.
(WebCore::InlineTextBox::paintTextMatchMarker): Deleted.
(WebCore::InlineTextBox::paintDecoration): Deleted.
(WebCore::InlineTextBox::paintDocumentMarker): Deleted; renamed to paintPlatformDocumentMarker.
(WebCore::InlineTextBox::paintDocumentMarkers): Deleted; renamed to paintPlatformDocumentMarkers.
* rendering/InlineTextBox.h:
(WebCore::InlineTextBox::paintMarkerSubranges): Added.
* rendering/MarkerSubrange.h:
(WebCore::MarkerSubrange::isEmpty const): Added.
(WebCore::MarkerSubrange::operator!= const): Added.
(WebCore::MarkerSubrange::operator== const): Added.
* rendering/SimpleLineLayoutFunctions.cpp:
(WebCore::SimpleLineLayout::paintFlow): Updated code as we no longer need to pass the text run length
to TextPainter::paint(). Also modernize the code while I am here.
* rendering/TextDecorationPainter.cpp:
(WebCore::TextDecorationPainter::Styles::operator== const): Added.
(WebCore::TextDecorationPainter::TextDecorationPainter): Modified to take an optional TextDecorationPainter::Styles
instance as an argument and removed the unused parameter for PseudoId.
* rendering/TextDecorationPainter.h:
(WebCore::TextDecorationPainter::Styles::operator!= const): Added.
* rendering/TextPaintStyle.cpp:
(WebCore::TextPaintStyle::operator== const): Added.
(WebCore::computeTextSelectionPaintStyle): Removed the now unused out-arguments paintSelectedTextOnly, paintSelectedTextSeparately,
and paintNonSelectedTextOnly. The values stored in these out-arguments were intended to be used by the caller to
minimize the number of drawing commands. The value of paintSelectedTextSeparately indicated whether selected text
would look identical to non-selected text so that a caller could use one paint command to draw the entire line
instead of issuing two or more drawing commands to paint non-selected and selected text separately. We now
accomplish the same optimization by coalescing subrange styles in InlineTextBox::subdivideAndResolveStyle().
The value of paintNonSelectedTextOnly, as its name states, indicated whether a caller should only paint non-selected
text and hence skip painting of selected text. This value was only used when painting dragged content (i.e. DocumentMarker::DraggedContent
markers) and its effect is now more directly achieved by the dragged content logic in InlineTextBox::paint().
* rendering/TextPaintStyle.h:
(WebCore::TextPaintStyle::operator!= const): Added.
* rendering/TextPainter.cpp:
(WebCore::TextPainter::paint): Implemented in terms TextPainter::paintRange() now that InlineTextBox::paint() optimizes
for the number of drawing calls. See remarks for WebCore::computeTextSelectionPaintStyle() for more details.
* rendering/TextPainter.h: Group together related member functions.
(WebCore::TextPainter::setSelectionStyle): Deleted.
(WebCore::TextPainter::setSelectionShadow): Deleted.

Tools:

Update unit tests now that we use subranges for the painting of dragged content.

* TestWebKitAPI/Tests/WebCore/MarkerSubrange.cpp:
(WebCore::operator<<):
(WebCore::operator==): Deleted; moved to class MarkerSubrange.

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

22 months agoAdd support for computing the frontmost longest effective marker subrange
dbates@webkit.org [Tue, 19 Dec 2017 21:28:33 +0000 (21:28 +0000)]
Add support for computing the frontmost longest effective marker subrange
https://bugs.webkit.org/show_bug.cgi?id=180985

Reviewed by Dave Hyatt.

Source/WebCore:

Add a new subdivision overlap strategy to return the minimum list of maximal length non-
overlapping subranges. We will make use of this strategy together with an algorithm to
coalesce adjacent subranges with visually indistinct styles to minimize the total number
of drawing commands needed to paint an entire line of text. We are not making use of
this functionality now. We will make use of it to simplify the patch for <https://bugs.webkit.org/show_bug.cgi?id=180984>.

* rendering/MarkerSubrange.cpp:
(WebCore::subdivide):
* rendering/MarkerSubrange.h:

Tools:

Adds a test case to ensure that we compute the minimum list of maximal length non-
overlapping subranges when using strategy OverlapStrategy::FrontmostWithLongestEffectiveRange.

* TestWebKitAPI/Tests/WebCore/MarkerSubrange.cpp:
(TestWebKitAPI::TEST):

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

22 months agoHandle Fetch should wait for the service worker's state to become activated
cdumez@apple.com [Tue, 19 Dec 2017 21:22:22 +0000 (21:22 +0000)]
Handle Fetch should wait for the service worker's state to become activated
https://bugs.webkit.org/show_bug.cgi?id=180959

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Rebaseline WPT test that is now passing.

* web-platform-tests/service-workers/service-worker/fetch-waits-for-activate.https-expected.txt:

Source/WebCore:

Handle Fetch should wait for the service worker's state to become activated when
it is currently activating.

Specification:
- https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm (Step 16)

No new tests, rebaselined existing test.

* workers/service/server/SWServerWorker.cpp:
(WebCore::SWServerWorker::~SWServerWorker):
(WebCore::SWServerWorker::whenActivated):
(WebCore::SWServerWorker::setState):
(WebCore::SWServerWorker::callWhenActivatedHandler):
* workers/service/server/SWServerWorker.h:

Source/WebKit:

Handle Fetch should wait for the service worker's state to become activated when
it is currently activating.

Specification:
- https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm (Step 16)

* StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::startFetch):

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

22 months ago[DFG][FTL] NewRegexp shoud be fast
utatane.tea@gmail.com [Tue, 19 Dec 2017 19:38:31 +0000 (19:38 +0000)]
[DFG][FTL] NewRegexp shoud be fast
https://bugs.webkit.org/show_bug.cgi?id=180960

Reviewed by Michael Saboff.

When we encounter RegExp literal like /AAA/g, we need to create a RegExp object.
Typical idiom like `string.match(/regexp/)` requires RegExp object creation
every time.

As a first step, this patch accelerates RegExp object creation by handling it
in DFG and FTL. In a subsequent patch, we would like to introduce PhantomNewRegexp
to remove unnecessary RegExp object creations.

This patch improves SixSpeed/regex-u.{es5,es6}.

                             baseline                  patched

    regex-u.es5          69.6759+-3.1951     ^     53.1425+-2.0292        ^ definitely 1.3111x faster
    regex-u.es6         129.5413+-5.4437     ^    107.2105+-7.7775        ^ definitely 1.2083x faster

* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileNewRegexp):
* dfg/DFGSpeculativeJIT.h:
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* ftl/FTLAbstractHeapRepository.h:
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNewRegexp):
* jit/JIT.h:
* jit/JITInlines.h:
(JSC::JIT::callOperation):
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_new_regexp):
* jit/JITOperations.cpp:
* jit/JITOperations.h:
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
* runtime/RegExpObject.h:
(JSC::RegExpObject::offsetOfRegExp):
(JSC::RegExpObject::allocationSize):

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

22 months agoUnreviewed, include YarrErrorCode.h in Yarr.h
utatane.tea@gmail.com [Tue, 19 Dec 2017 19:26:39 +0000 (19:26 +0000)]
Unreviewed, include YarrErrorCode.h in Yarr.h
https://bugs.webkit.org/show_bug.cgi?id=180966

* yarr/Yarr.h:

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

22 months ago[YARR] Yarr should return ErrorCode instead of error messages (const char*)
utatane.tea@gmail.com [Tue, 19 Dec 2017 19:16:21 +0000 (19:16 +0000)]
[YARR] Yarr should return ErrorCode instead of error messages (const char*)
https://bugs.webkit.org/show_bug.cgi?id=180966

Reviewed by Mark Lam.

Source/JavaScriptCore:

Currently, Yarr returns const char*` for an error message when needed.
But it is easier to handle error status if Yarr returns an error code
instead of `const char*`.

In this patch, we introduce Yarr::ErrorCode. Yarr returns it instead of
`const char*`. `std::expected<void, Yarr::ErrorCode>` would be appropriate
for the Yarr API interface. But it requires substantial changes removing
ErrorCode::NoError, so this patch just uses the current Yarr::ErrorCode as
a first step.

* JavaScriptCore.xcodeproj/project.pbxproj:
* Sources.txt:
* inspector/ContentSearchUtilities.cpp:
(Inspector::ContentSearchUtilities::findMagicComment):
* parser/ASTBuilder.h:
(JSC::ASTBuilder::createRegExp):
* parser/Parser.cpp:
(JSC::Parser<LexerType>::parsePrimaryExpression):
* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::createRegExp):
* runtime/RegExp.cpp:
(JSC::RegExp::RegExp):
(JSC::RegExp::byteCodeCompileIfNecessary):
(JSC::RegExp::compile):
(JSC::RegExp::compileMatchOnly):
* runtime/RegExp.h:
* yarr/RegularExpression.cpp:
(JSC::Yarr::RegularExpression::Private::Private):
(JSC::Yarr::RegularExpression::Private::compile):
* yarr/YarrErrorCode.cpp: Added.
(JSC::Yarr::errorMessage):
* yarr/YarrErrorCode.h: Copied from Source/JavaScriptCore/yarr/YarrSyntaxChecker.h.
(JSC::Yarr::hasError):
* yarr/YarrParser.h:
(JSC::Yarr::Parser::CharacterClassParserDelegate::CharacterClassParserDelegate):
(JSC::Yarr::Parser::CharacterClassParserDelegate::atomPatternCharacter):
(JSC::Yarr::Parser::Parser):
(JSC::Yarr::Parser::isIdentityEscapeAnError):
(JSC::Yarr::Parser::parseEscape):
(JSC::Yarr::Parser::parseCharacterClass):
(JSC::Yarr::Parser::parseParenthesesBegin):
(JSC::Yarr::Parser::parseParenthesesEnd):
(JSC::Yarr::Parser::parseQuantifier):
(JSC::Yarr::Parser::parseTokens):
(JSC::Yarr::Parser::parse):
(JSC::Yarr::Parser::tryConsumeUnicodeEscape):
(JSC::Yarr::Parser::tryConsumeUnicodePropertyExpression):
(JSC::Yarr::parse):
* yarr/YarrPattern.cpp:
(JSC::Yarr::YarrPatternConstructor::YarrPatternConstructor):
(JSC::Yarr::YarrPatternConstructor::setupDisjunctionOffsets):
(JSC::Yarr::YarrPatternConstructor::setupOffsets):
(JSC::Yarr::YarrPattern::compile):
(JSC::Yarr::YarrPattern::YarrPattern):
(JSC::Yarr::YarrPattern::errorMessage): Deleted.
* yarr/YarrPattern.h:
(JSC::Yarr::YarrPattern::reset):
* yarr/YarrSyntaxChecker.cpp:
(JSC::Yarr::checkSyntax):
* yarr/YarrSyntaxChecker.h:

Source/WebCore:

Remove unnecessary String creation.

No behavior change.

* contentextensions/URLFilterParser.cpp:
(WebCore::ContentExtensions::URLFilterParser::addPattern):

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

22 months ago[RenderTreeBuilder] Move finding-the-parent/creating-wrapper logic from RenderTableRo...
zalan@apple.com [Tue, 19 Dec 2017 18:56:47 +0000 (18:56 +0000)]
[RenderTreeBuilder] Move finding-the-parent/creating-wrapper logic from RenderTableRow::addChild to RenderTreeBuilder
https://bugs.webkit.org/show_bug.cgi?id=180964
<rdar://problem/36123315>

Reviewed by Antti Koivisto.

This is in preparation for removing all tree mutation from renderering code.

Covered by existing tests.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* rendering/RenderTableRow.cpp:
(WebCore::RenderTableRow::addChild):
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::insertChild):
* rendering/updating/RenderTreeBuilder.h:
* rendering/updating/RenderTreeBuilderTable.cpp: Added.
(WebCore::RenderTreeBuilder::Table::findOrCreateParentForChild):
* rendering/updating/RenderTreeBuilderTable.h: Copied from Source/WebCore/rendering/updating/RenderTreeBuilder.h.

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

22 months agoService Worker should not clean HTTP headers added by the application or by fetch...
commit-queue@webkit.org [Tue, 19 Dec 2017 18:37:44 +0000 (18:37 +0000)]
Service Worker should not clean HTTP headers added by the application or by fetch specification before service worker interception
https://bugs.webkit.org/show_bug.cgi?id=180939

Patch by Youenn Fablet <youenn@apple.com> on 2017-12-19
Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

* web-platform-tests/service-workers/service-worker/fetch-request-xhr.https-expected.txt:
* web-platform-tests/service-workers/service-worker/resources/fetch-request-xhr-iframe.https.html:
* web-platform-tests/service-workers/service-worker/fetch-header-visibility.https-expected.txt:

Source/WebCore:

Covered by modified WPT test.

Add support to clean only specific headers in cleanHTTPRequestHeadersForAccessControl,
renamed from cleanRedirectedRequestForAccessControl.
Compute the list of headers to keep in DocumentThreadableLoader.
Add a specific rule for Accept header which is set prior service worker interception and for
HTTP headers set by DocumentThreadableLoader clients.

* loader/CrossOriginAccessControl.cpp:
(WebCore::httpHeadersToKeepFromCleaning):
(WebCore::cleanRedirectedRequestForAccessControl):
* loader/CrossOriginAccessControl.h:
(WebCore::cleanRedirectedRequestForAccessControl):
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
* loader/ResourceLoaderOptions.h:
* workers/service/context/ServiceWorkerFetch.cpp:
(WebCore::ServiceWorkerFetch::dispatchFetchEvent):
* workers/service/context/ServiceWorkerFetch.h:
* workers/service/context/ServiceWorkerThread.cpp:
(WebCore::ServiceWorkerThread::postFetchTask):
* workers/service/context/ServiceWorkerThread.h:

Source/WebKit:

Passing referrer as an explicit parameter of StartFetch.

Cleaning request headers based on ResourceLoaderOptions.httpHeadersToKeep.

* StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::startFetch):
* StorageProcess/ServiceWorker/WebSWServerConnection.h:
* StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
* WebProcess/Storage/ServiceWorkerClientFetch.cpp:
(WebKit::ServiceWorkerClientFetch::start):
* WebProcess/Storage/WebSWClientConnection.cpp:
(WebKit::WebSWClientConnection::startFetch):
* WebProcess/Storage/WebSWClientConnection.h:
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::startFetch):
* WebProcess/Storage/WebSWContextManagerConnection.h:
* WebProcess/Storage/WebSWContextManagerConnection.messages.in:

LayoutTests:

* TestExpectations:

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

22 months agoUnreviewed, rebaseline service workers flaky tests.
cdumez@apple.com [Tue, 19 Dec 2017 18:25:54 +0000 (18:25 +0000)]
Unreviewed, rebaseline service workers flaky tests.

LayoutTests/imported/w3c:

* web-platform-tests/service-workers/service-worker/fetch-canvas-tainting-cache.https-expected.txt:
* web-platform-tests/service-workers/service-worker/fetch-canvas-tainting.https-expected.txt:
* web-platform-tests/service-workers/service-worker/fetch-cors-xhr.https-expected.txt:
* web-platform-tests/service-workers/service-worker/fetch-request-redirect.https-expected.txt:
* web-platform-tests/service-workers/service-worker/unregister-controller.https-expected.txt:
* web-platform-tests/service-workers/service-worker/update-bytecheck.https-expected.txt:

LayoutTests:

* TestExpectations:

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

22 months agoMarked accessibility/mac/search-field-cancel-button.html as flaky on macOS.
jlewis3@apple.com [Tue, 19 Dec 2017 18:01:14 +0000 (18:01 +0000)]
Marked accessibility/mac/search-field-cancel-button.html as flaky on macOS.
https://bugs.webkit.org/show_bug.cgi?id=180675

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

22 months ago[Apple Pay] Stop maintaining a list of payment networks
aestes@apple.com [Tue, 19 Dec 2017 17:49:29 +0000 (17:49 +0000)]
[Apple Pay] Stop maintaining a list of payment networks
https://bugs.webkit.org/show_bug.cgi?id=180965
<rdar://problem/34696560>

Reviewed by Tim Horton.

Source/WebCore:

Instead of maintaining the list of valid payment networks in WebCore, allow the client to
provide the list when constructing a PaymentCoordinator. Then, use PaymentCoordinator's list
to validate ApplePaySessionPaymentRequests.

Validation will now be done case-insensitively since Cocoa clients will provide a list of
network names that differ in capitalization from the names formerly accepted by WebCore.

Added new test cases to http/tests/ssl/applepay/ApplePaySession.html.

* Modules/applepay/ApplePayRequestBase.cpp:
(WebCore::convertAndValidate): Changed to return a Vector of validated strings.
(WebCore::validate): Renamed to convertAndValidate.
* Modules/applepay/ApplePayRequestBase.h:
* Modules/applepay/ApplePaySession.cpp:
(WebCore::convertAndValidate):
(WebCore::ApplePaySession::create):
* Modules/applepay/ApplePaySessionPaymentRequest.cpp:
(WebCore::ApplePaySessionPaymentRequest::isValidSupportedNetwork): Deleted.
* Modules/applepay/ApplePaySessionPaymentRequest.h:
* Modules/applepay/PaymentCoordinator.cpp:
(WebCore::toHashSet):
(WebCore::PaymentCoordinator::PaymentCoordinator): Converted availablePaymentNetworks to a
case-insensitive HashSet and stored in m_availablePaymentNetworks.
(WebCore::PaymentCoordinator::validatedPaymentNetwork const): Added special cases for "jcb"
and "carteBancaire" for API compatibility. For other networks, checked m_availablePaymentNetworks.
* Modules/applepay/PaymentCoordinator.h:
* Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
(WebCore::ApplePayPaymentHandler::show):
* page/MainFrame.cpp:
(WebCore::MainFrame::MainFrame): Constructed m_paymentCoordinator with configuration.availablePaymentNetworks.
* page/PageConfiguration.h:
* testing/Internals.cpp:
(WebCore::Internals::Internals):
* testing/MockPaymentCoordinator.cpp:
* testing/MockPaymentCoordinator.h:

Source/WebCore/PAL:

* pal/spi/cocoa/PassKitSPI.h: Defined +[PKPaymentRequest availableNetworks].

Source/WebKit:

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h: Defined availablePaymentNetworks.
* UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
* UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
(WebKit::toSupportedNetworks):
(WebKit::WebPaymentCoordinatorProxy::availablePaymentNetworks): Called
+[PKPaymentRequest availableNetworks].
(WebKit::toSupportedNetwork): Deleted.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters): Set parameters.availablePaymentNetworks by
calling WebPaymentCoordinatorProxy::availablePaymentNetworks.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage): Set pageConfiguration.availablePaymentNetworks to
parameters.availablePaymentNetworks.

LayoutTests:

* http/tests/ssl/applepay/ApplePaySession-expected.txt:
* http/tests/ssl/applepay/ApplePaySession.html: Added a test case for network names with
varying capitalization.

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

22 months agoUnreviewed, try to fix the Windows build after r226097.
wenson_hsieh@apple.com [Tue, 19 Dec 2017 17:03:48 +0000 (17:03 +0000)]
Unreviewed, try to fix the Windows build after r226097.

* editing/markup.cpp:
(WebCore::StyledMarkupAccumulator::appendCustomAttributes):

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

22 months ago[WPE] Enable the rest of the wpt html tests.
Ms2ger@igalia.com [Tue, 19 Dec 2017 15:43:45 +0000 (15:43 +0000)]
[WPE] Enable the rest of the wpt html tests.
https://bugs.webkit.org/show_bug.cgi?id=180975

Unreviewed test gardening.

* platform/wpe/TestExpectations:
* platform/wpe/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/read-media/pageload-video-expected.txt:
  Added: dependent on the supported video codecs.
* platform/wpe/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/mime-types/canPlayType-expected.txt:
  Added: dependent on the supported video codecs.
* platform/wpe/imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-elements-filter-expected.txt:
  Added: whitespace difference.

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

22 months agoMark scroll-restoration-navigation-samedoc.html as passing.
Ms2ger@igalia.com [Tue, 19 Dec 2017 15:09:09 +0000 (15:09 +0000)]
Mark scroll-restoration-navigation-samedoc.html as passing.
https://bugs.webkit.org/show_bug.cgi?id=169264

Unreviewed test gardening.

It is passing on mac, gtk, and wpe, disabled on win, and still marked
as failing on ios.

* TestExpectations:
* platform/gtk/TestExpectations:

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

22 months agoUnreviewed test gardening.
fred.wang@free.fr [Tue, 19 Dec 2017 11:50:39 +0000 (11:50 +0000)]
Unreviewed test gardening.

Patch by Frederic Wang <fwang@igalia.com> on 2017-12-19

* platform/gtk/mathml/opentype/opentype-stretchy-horizontal-expected.png:
* platform/gtk/mathml/opentype/opentype-stretchy-horizontal-expected.txt: Added.

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

22 months ago[Apple Pay] Only include phonetic name properties in ApplePayPaymentContact when...
aestes@apple.com [Tue, 19 Dec 2017 05:39:26 +0000 (05:39 +0000)]
[Apple Pay] Only include phonetic name properties in ApplePayPaymentContact when version >= 3
https://bugs.webkit.org/show_bug.cgi?id=180925
<rdar://problem/35907596>

Reviewed by Tim Horton.

No tests possible. The fix involves converting PKContacts, which we can't create in our test harness.

* Modules/applepay/ApplePayPaymentAuthorizedEvent.cpp:
(WebCore::ApplePayPaymentAuthorizedEvent::ApplePayPaymentAuthorizedEvent):
* Modules/applepay/ApplePayPaymentAuthorizedEvent.h:
* Modules/applepay/ApplePaySession.cpp:
(WebCore::ApplePaySession::create):
(WebCore::ApplePaySession::ApplePaySession):
(WebCore::ApplePaySession::version const):
(WebCore::ApplePaySession::didAuthorizePayment):
(WebCore::ApplePaySession::didSelectShippingContact):
* Modules/applepay/ApplePaySession.h:
* Modules/applepay/ApplePayShippingContactSelectedEvent.cpp:
(WebCore::ApplePayShippingContactSelectedEvent::ApplePayShippingContactSelectedEvent):
* Modules/applepay/ApplePayShippingContactSelectedEvent.h:
* Modules/applepay/Payment.h:
* Modules/applepay/PaymentContact.h:
* Modules/applepay/PaymentCoordinator.cpp:
(WebCore::PaymentCoordinator::supportsVersion const):
(WebCore::PaymentCoordinator::supportsVersion): Deleted.
* Modules/applepay/PaymentCoordinator.h:
* Modules/applepay/PaymentSession.h:
* Modules/applepay/cocoa/PaymentCocoa.mm:
(WebCore::convert):
(WebCore::Payment::toApplePayPayment const):
* Modules/applepay/cocoa/PaymentContactCocoa.mm:
(WebCore::convert):
(WebCore::PaymentContact::toApplePayPaymentContact const):
* Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
(WebCore::ApplePayPaymentHandler::document const):
(WebCore::ApplePayPaymentHandler::paymentCoordinator const):
(WebCore::ApplePayPaymentHandler::version const):
(WebCore::ApplePayPaymentHandler::didAuthorizePayment):
(WebCore::ApplePayPaymentHandler::didSelectShippingContact):
(WebCore::ApplePayPaymentHandler::document): Deleted.
(WebCore::ApplePayPaymentHandler::paymentCoordinator): Deleted.
* Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:

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

22 months ago[Attachment Support] The 'webkitattachmentbloburl' attribute should not persist after...
wenson_hsieh@apple.com [Tue, 19 Dec 2017 05:38:47 +0000 (05:38 +0000)]
[Attachment Support] The 'webkitattachmentbloburl' attribute should not persist after markup serialization
https://bugs.webkit.org/show_bug.cgi?id=180924
<rdar://problem/36099093>

Reviewed by Tim Horton.

Source/WebCore:

Work towards dragging Blob-backed attachment elements as files on iOS and Mac. It doesn't make sense for the
attachment blob URL to stick around on the element after markup serialization, so this patch removes logic that
eagerly sets the blob URL upon setting an attachment's File. Instead, we just append this attribute when
generating markup.

This patch also augments existing WKAttachmentTests to ensure that these attributes are not present.

* editing/markup.cpp:
(WebCore::StyledMarkupAccumulator::appendCustomAttributes):
(WebCore::createFragmentFromMarkup):
* html/HTMLAttachmentElement.cpp:
(WebCore::HTMLAttachmentElement::setFile):
* rendering/HitTestResult.cpp:

Fixes a related issue where an attachment is backed by Blob data (and not a file path) would specify "file:///"
as its attachment file path in DragController when starting a drag. Instead, if there is no file path, fall back
to the blob URL.

This will be tested in a future patch once a WK2 dragging simulator for Mac is implemented, and support for
dragging out Blob-backed attachments as (platform) files is implemented.

(WebCore::HitTestResult::absoluteAttachmentURL const):

Tools:

Tweaks some existing tests to check that temporary attachment serialization attributes don't stick around on the
attachment elements.

* TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:
(-[TestWKWebView hasAttribute:forQuerySelector:]):
(TestWebKitAPI::TEST):

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

22 months agoDefault scope used when registering a service worker is wrong
cdumez@apple.com [Tue, 19 Dec 2017 05:08:52 +0000 (05:08 +0000)]
Default scope used when registering a service worker is wrong
https://bugs.webkit.org/show_bug.cgi?id=180961

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Rebaseline WPT test now that more checks are passing.

* web-platform-tests/service-workers/service-worker/register-default-scope.https-expected.txt:

Source/WebCore:

The default scope we used when registering a service worker was wrong, it did not match:
- https://w3c.github.io/ServiceWorker/#start-register (Step 4)

This patch aligns our behavior with the specification.

No new tests, rebaselined existing test.

* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::addRegistration):

LayoutTests:

Update / Rebaseline WebKit tests due to behavior change.

* http/tests/workers/service/basic-register-exceptions-expected.txt:
* http/tests/workers/service/basic-unregister.https-expected.txt:
* http/tests/workers/service/resources/basic-unregister.js:
(async.test):
* http/tests/workers/service/resources/service-worker-getRegistration.js:
(async.test):
* http/tests/workers/service/self_registration-expected.txt:
* http/tests/workers/service/service-worker-clear.html:

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

22 months agoAssertion hit in DocumentOrderedMap::get while removing a form element
rniwa@webkit.org [Tue, 19 Dec 2017 04:32:43 +0000 (04:32 +0000)]
Assertion hit in DocumentOrderedMap::get while removing a form element
https://bugs.webkit.org/show_bug.cgi?id=137959
<rdar://problem/27702012>

Reviewed by Brent Fulgham.

Source/WebCore:

The assertion failure was caused by FormAssociatedElement::findAssociatedForm calling TreeScope::getElementById
for a form associated element inside FormAttributeTargetObserver::idTargetChanged during the removal of
the owner form element, or the first non-form element with the matching ID. If there are other elements with
the same ID in the removed tree at that moment, MapEntry's count for the ID can be higher than it needs to be
since Element::removedFromAncestor has not been called on those elements yet.

Fixed the bug by checking this condition explicitly. This patch introduces ContainerChildRemovalScope which
keeps track of the container node from which a subtree was removed as well as the root of the removed subtree.
DocumentOrderedMap::get then checks whether the matching element can be found in this removed subtree, and its
isConnected() still returns true (the evidence that Element::removedFromAncestor has not been called) when
count > 0 and there was no matching element in the tree scope.

In the long term, we should refactor the way FormAssociatedElement and HTMLFormElement refers to each other
and avoid calling DocumentOrderedMap::get before finish calling removedFromAncestor on the removed subtree.

Tests: fast/forms/update-form-owner-in-moved-subtree-assertion-failure-5.html
       fast/forms/update-form-owner-in-moved-subtree-assertion-failure-6.html

* dom/ContainerNodeAlgorithms.cpp:
(WebCore::notifyChildNodeRemoved):
* dom/ContainerNodeAlgorithms.h:
(WebCore::ContainerChildRemovalScope): Added.
(WebCore::ContainerChildRemovalScope::ContainerChildRemovalScope):
(WebCore::ContainerChildRemovalScope::~ContainerChildRemovalScope):
(WebCore::ContainerChildRemovalScope::parentOfRemovedTree):
(WebCore::ContainerChildRemovalScope::removedChild):
(WebCore::ContainerChildRemovalScope::currentScope):
* dom/DocumentOrderedMap.cpp:
(WebCore::DocumentOrderedMap::get const): Added a special early exit when this function is called during
a node removal.

LayoutTests:

Added regression tests for removing a subtree with a form associated element, its owner form element
and another element with the same ID.

* fast/forms/update-form-owner-in-moved-subtree-assertion-failure-5-expected.txt: Added.
* fast/forms/update-form-owner-in-moved-subtree-assertion-failure-5.html: Added.
* fast/forms/update-form-owner-in-moved-subtree-assertion-failure-6-expected.txt: Added.
* fast/forms/update-form-owner-in-moved-subtree-assertion-failure-6.html: Added.

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

22 months ago[GTK][WPE] Conditionalize libTASN1 use behind ENABLE_SUBTLE_CRYPTO in the CMake files
timothy@hatcher.name [Tue, 19 Dec 2017 04:09:11 +0000 (04:09 +0000)]
[GTK][WPE] Conditionalize libTASN1 use behind ENABLE_SUBTLE_CRYPTO in the CMake files
https://bugs.webkit.org/show_bug.cgi?id=180949

Reviewed by Carlos Alberto Lopez Perez.

* PlatformGTK.cmake: Move the include path and library additions to conditional ENABLE_SUBTLE_CRYPTO section.
* PlatformWPE.cmake: Ditto.

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

22 months ago[Attachment Support] Support representing pasted or dropped content using attachment...
wenson_hsieh@apple.com [Tue, 19 Dec 2017 04:03:21 +0000 (04:03 +0000)]
[Attachment Support] Support representing pasted or dropped content using attachment elements
https://bugs.webkit.org/show_bug.cgi?id=180892
<rdar://problem/36064210>

Reviewed by Tim Horton.

Source/WebCore:

Support dropping and pasting attributed strings that contain NSTextAttachments. Teaches
replaceRichContentWithAttachmentsIfNecessary to replace object elements with attachments; see comments below for
more details.

Test: WKAttachmentTests.InsertPastedAttributedStringContainingMultipleAttachments

* editing/WebContentReader.h:

Add BlobReplacementInfo, which contains a map of blob URLs to replacement Blobs, as well as a map of blob URLs
to replaced subresource URLs.

(WebCore::BlobReplacementInfo::isEmpty const):
* editing/cocoa/EditorCocoa.mm:
(WebCore::Editor::replaceSelectionWithAttributedString):
* editing/cocoa/WebArchiveResourceFromNSAttributedString.h:
* editing/cocoa/WebArchiveResourceFromNSAttributedString.mm:

Implement -[WebArchiveResourceFromNSAttributedString MIMEType]. UIFoundation asks for -MIMEType in the process
of generating markup from NSTextAttachments; this currently causes the web process to crash on an unrecognized
selector.

Additionally, work around <rdar://problem/36074429>, a UIFoundation bug in which all but a few hard-coded file
extensions actually yield MIME types that are more specific than "application/octet-stream". This can safely be
removed once <rdar://problem/36074429> is addressed.

(-[WebArchiveResourceFromNSAttributedString MIMEType]):
* editing/cocoa/WebContentReaderCocoa.mm:
(WebCore::replaceRichContentWithAttachmentsIfNecessary):

Try to replace object elements with attachments, and also tweak the title of the attachment's File to use the
replaced subresource's filename if possible. Additionally, abstracts out information for replacing object or
image elements (formerly a pair of { File, Element }) into a separate struct, and add a AttachmentDisplayMode
parameter to determine whether the attachment should be presented in-line (in the case of images), or as an icon.

(WebCore::attributesForAttributedStringConversion):

Only exclude object elements from being generated from NSTextAttachments if the attachment element runtime
feature is disabled, or !ENABLE(ATTACHMENT_ELEMENT).

(WebCore::createFragmentAndAddResources):

Additionally keep track of a mapping from blob URL => replaced subresource URL. In all the places where we
previously only plumbed a map of blob URL => Blob, use a BlobReplacementInfo struct instead, which now includes
a map from blob URL => replaced URL.

(WebCore::sanitizeMarkupWithArchive):
(WebCore::WebContentReader::readWebArchive):
(WebCore::WebContentMarkupReader::readWebArchive):
(WebCore::WebContentReader::readRTFD):
(WebCore::WebContentMarkupReader::readRTFD):
(WebCore::WebContentReader::readRTF):
(WebCore::WebContentMarkupReader::readRTF):
(WebCore::WebContentReader::readImage):

Tools:

Adds a new API test to exercise pasting an attributed string with multiple attachments of different types.

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

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

22 months agoUnreviewed, rebaseline imported/w3c/web-platform-tests/service-workers/service-worker...
cdumez@apple.com [Tue, 19 Dec 2017 02:15:24 +0000 (02:15 +0000)]
Unreviewed, rebaseline imported/w3c/web-platform-tests/service-workers/service-worker/registration-security-error.https.html after r226087.

* web-platform-tests/service-workers/service-worker/registration-security-error.https-expected.txt:

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

22 months ago[Win] SHOULD NEVER BE REACHED in WebFrameLoaderClient::pageID
commit-queue@webkit.org [Tue, 19 Dec 2017 02:09:10 +0000 (02:09 +0000)]
[Win] SHOULD NEVER BE REACHED in WebFrameLoaderClient::pageID
https://bugs.webkit.org/show_bug.cgi?id=180926

Patch by Fujii Hironori <Hironori.Fujii@sony.com> on 2017-12-18
Reviewed by Tim Horton.

Apply the same change of mac/WebCoreSupport/WebFrameLoaderClient.mm
of r225934 to win/WebCoreSupport/WebFrameLoaderClient.cpp.

* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::frameID const): Removed RELEASE_ASSERT_NOT_REACHED.
(WebFrameLoaderClient::pageID const): Ditto.

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

22 months agoService worker served response tainting should keep its tainting
commit-queue@webkit.org [Tue, 19 Dec 2017 01:55:40 +0000 (01:55 +0000)]
Service worker served response tainting should keep its tainting
https://bugs.webkit.org/show_bug.cgi?id=180952

Patch by Youenn Fablet <youenn@apple.com> on 2017-12-18
Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

* web-platform-tests/service-workers/service-worker/fetch-event-redirect.https-expected.txt:
* web-platform-tests/service-workers/service-worker/fetch-response-taint.https-expected.txt:

Source/WebCore:

Covered by rebased tests.

* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::setResponse):

LayoutTests:

* http/tests/workers/service/resources/tainted-image-fetch.js:
(async.test): Updated erroneous test. This test is laoding a cross origin image.
through a service worker which instead provides a synthetic response which
should be considered as same origin.
* http/tests/workers/service/tainted-image-fetch-expected.txt:

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

22 months agoUnreviewed, attempt to fix watch and TV builds after r226085
wenson_hsieh@apple.com [Tue, 19 Dec 2017 01:39:22 +0000 (01:39 +0000)]
Unreviewed, attempt to fix watch and TV builds after r226085

Explicitly include a header in WebContentReaderCocoa.mm.

* editing/cocoa/WebContentReaderCocoa.mm:

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

22 months agoAdd ability to API test Service Workers via a custom protocol.
beidson@apple.com [Tue, 19 Dec 2017 01:16:57 +0000 (01:16 +0000)]
Add ability to API test Service Workers via a custom protocol.
https://bugs.webkit.org/show_bug.cgi?id=180911

Reviewed by Chris Dumez.

Source/WebCore:

Covered by API test ServiceWorkers.Basic

This adds a set of "Service Workers can handle this" schemes to the scheme registry
and uses it for SW decisions instead of a handful of previous techniques.

* bindings/scripts/CodeGeneratorJS.pm:
(NeedsRuntimeCheck):
(GenerateRuntimeEnableConditionalString):
* bindings/scripts/IDLAttributes.json:

* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::hasServiceWorkerScheme):
* dom/ScriptExecutionContext.h:

* page/NavigatorServiceWorker.idl:

* platform/SchemeRegistry.cpp:
(WebCore::serviceWorkerSchemesLock):
(WebCore::serviceWorkerSchemes):
(WebCore::SchemeRegistry::registerURLSchemeServiceWorkersCanHandle):
(WebCore::SchemeRegistry::canServiceWorkersHandleURLScheme):
(WebCore::SchemeRegistry::isServiceWorkerContainerCustomScheme):
* platform/SchemeRegistry.h:

* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::addRegistration):

* workers/service/server/SWServerJobQueue.cpp:
(WebCore::SWServerJobQueue::runRegisterJob):

Source/WebKit:

This adds a set of "Service Workers can handle this" schemes to the scheme registry
and most of these WebKit changes are to support getting those values out to all processes.

Additionally, WebsiteDataRecords used to be file/http(s)-only. That seems bizarre and definitely
got in the way of testing. So I also added a way to allow any scheme to result in a valid record.

* Shared/ChildProcess.cpp:
(WebKit::ChildProcess::registerURLSchemeServiceWorkersCanHandle const):
* Shared/ChildProcess.h:
* Shared/ChildProcess.messages.in:

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

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

* StorageProcess/StorageProcess.cpp:
(WebKit::StorageProcess::initializeWebsiteDataStore):

* UIProcess/API/Cocoa/WKProcessPool.mm:
(-[WKProcessPool _registerURLSchemeServiceWorkersCanHandle:]):
* UIProcess/API/Cocoa/WKProcessPoolPrivate.h:

* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(+[WKWebsiteDataStore _allowWebsiteDataRecordsForAllOrigins]):
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
(WebKit::WebProcessPool::initializeNewWebProcess):
(WebKit::WebProcessPool::registerURLSchemeServiceWorkersCanHandle):
* UIProcess/WebProcessPool.h:

* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::allowWebsiteDataRecordsForAllOrigins):
(WebKit::WebsiteDataStore::fetchDataAndApply):
* UIProcess/WebsiteData/WebsiteDataStore.h:

* WebProcess/Storage/WebServiceWorkerProvider.cpp:
(WebKit::WebServiceWorkerProvider::handleFetch):

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):

Tools:

Adds a very basic SW test:
- Verify WebsiteDataStore can wipe all SW registration data.
- Fire up a web page with a service worker
- Verify SW registration data for that page exists in the WebsiteDataStore.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm: Added.

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

22 months agoWe should use "error" redirect mode for fetching service worker scripts
cdumez@apple.com [Tue, 19 Dec 2017 00:48:06 +0000 (00:48 +0000)]
We should use "error" redirect mode for fetching service worker scripts
https://bugs.webkit.org/show_bug.cgi?id=180950

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Rebaseline test now that behavior has changed. Note that we are still failing becuase we reject
the registration promise with a TypeError instead of a SecurityError. I cannot find any reason
to throw a SecurityError here based on the specification though, so the test may not match the
specification.

* web-platform-tests/service-workers/service-worker/registration-security-error.https-expected.txt:

Source/WebCore:

We should use "error" redirect mode for fetching service worker scripts, as per:
- https://w3c.github.io/ServiceWorker/#update (Step 7.5)

No new tests, rebaselined existing test.

* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::willSendRequestInternal):
* workers/Worker.cpp:
(WebCore::Worker::create):
* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::loadAsynchronously):
* workers/WorkerScriptLoader.h:
* workers/service/ServiceWorkerJob.cpp:
(WebCore::ServiceWorkerJob::fetchScriptWithContext):

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

22 months agoExtendableMessageEvent constructor fails to initialize the 'source' attribute
cdumez@apple.com [Tue, 19 Dec 2017 00:28:44 +0000 (00:28 +0000)]
ExtendableMessageEvent constructor fails to initialize the 'source' attribute
https://bugs.webkit.org/show_bug.cgi?id=180954

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Rebaseline WPT test now that more checks are passing.

* web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/extendable-message-event-constructor.https-expected.txt:

Source/WebCore:

No new tests, rebaselined existing test.

* workers/service/ExtendableMessageEvent.cpp:
(WebCore::ExtendableMessageEvent::ExtendableMessageEvent):

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

22 months ago[Attachment Support] Insert images as inline attachments when pasting and dropping
wenson_hsieh@apple.com [Tue, 19 Dec 2017 00:19:17 +0000 (00:19 +0000)]
[Attachment Support] Insert images as inline attachments when pasting and dropping
https://bugs.webkit.org/show_bug.cgi?id=180853
<rdar://problem/35756268>

Reviewed by Tim Horton.

Source/WebCore:

Adds support for transforming dropped and pasted web content fragments prior to insertion, such that inline
elements (so far, only images) are replaced with attachment elements that have an inline representation. See
below comments for more detail.

Tests: WKAttachmentTests.InsertPastedImageAsAttachment
       WKAttachmentTests.InsertPastedAttributedStringContainingImage
       WKAttachmentTestsMac.InsertPastedFileURLsAsAttachments
       WKAttachmentTestsIOS.InsertDroppedImageAsAttachment
       WKAttachmentTestsIOS.InsertDroppedAttributedStringContainingAttachment

* editing/WebContentReader.h:
* editing/cocoa/EditorCocoa.mm:
(WebCore::Editor::replaceSelectionWithAttributedString):

Add a new helper to replace elements in a DOM fragment with inline attachment elements instead, using the given
Blobs. So far, we only replace image elements with these attachments, by mapping the source of each image to a
Blob, and constructing a replacement attachment backed by a File constructed from the image's corresponding
Blob. However, this mechanism can be generalized in the future to handle transformations from arbitrary elements
to attachment elements capable of representing the same elements using inline display mode.

This function is a noop if the attachment elements are disabled via runtime-enabled features.

* editing/cocoa/WebContentReaderCocoa.mm:
(WebCore::replaceRichContentWithAttachmentsIfNecessary):
(WebCore::createFragmentAndAddResources):
(WebCore::sanitizeMarkupWithArchive):

Add out-params to both of these helper functions that capture the map of blob URLs to Blobs being used to
replace subresource URLs in the pasted/dropped DOM fragment.

(WebCore::WebContentReader::readWebArchive):
(WebCore::WebContentMarkupReader::readWebArchive):
(WebCore::createFragmentFromAttributedString):
(WebCore::WebContentReader::readRTFD):
(WebCore::WebContentMarkupReader::readRTFD):
(WebCore::WebContentReader::readRTF):
(WebCore::WebContentMarkupReader::readRTF):
(WebCore::WebContentReader::readImage):

In these places where we swap out subresource URLs for blob URLs, collect a map of blob URL => Blob, and use it
to replace images in the DOM with attachments (if needed, and possible).

* editing/mac/WebContentReaderMac.mm:
(WebCore::WebContentReader::readFilenames):

Augment existing logic to generate attachment elements when pasting or dropping file URLs, so that the generated
attachment elements also have titles, subtitles, and content type information.

* html/HTMLAttachmentElement.cpp:
(WebCore::HTMLAttachmentElement::setFile):

Add an optional second param, UpdateDisplayAttributes. If UpdateDisplayAttributes::Yes is passed in, then we set
the elements's attributes that are displayed in the attachment representation (title, subtitle, and type) using
the given File.

(WebCore::HTMLAttachmentElement::updateFileWithData):
(WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary):

Make a small tweak to correctly handle the case where an attachment with a content type that is a UTI is being
displayed inline. Content type can either be a UTI or a MIME type, but the code to construct the shadow tree of
an attachment element only handles MIME types.

* html/HTMLAttachmentElement.h:

Tools:

Adds new WKAttachment API tests and test support. See comments below for more detail.

* TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:

Tweak the editing test page markup, such that document.body.innerHTML doesn't additionally contain the contents
of the script tag.

(webViewForTestingAttachments):
(testImageFileURL):
(testImageData):
(testPDFFileURL):
(testPDFData):
(platformCopyRichTextWithAttachment):
(platformCopyPNG):
(platformImageWithData):

Add some platform helper functions, which some of the platform-agnostic tests below use to resolve differences
between iOS and macOS when writing to the pasteboard and creating an image from data.

(TestWebKitAPI::TEST):

Add new API tests to exercise drag and drop/copy and paste of rich content (namely, images and files) on iOS and
macOS. iOS attachment tests use DataInteractionSimulator to simulate UIKit drag and drop coordination. On macOS,
handling of dropped content is much closer to handling of pasted content (they use the same codepaths to read
from the platform pasteboard), so exercising paste codepaths on Mac is sufficient.

* TestWebKitAPI/ios/DataInteractionSimulator.h:
* TestWebKitAPI/ios/DataInteractionSimulator.mm:
(-[DataInteractionSimulator _resetSimulatedState]):
(-[DataInteractionSimulator insertedAttachments]):
(-[DataInteractionSimulator removedAttachments]):

Teach the iOS drag and drop simulator to keep track of attachment elements that are inserted during a drop. We
also keep track of removed attachments here too, though no default drop handling scenario should trigger
attachment removal, so we simply use this to check that no _WKAttachments were removed during a drop.

(-[DataInteractionSimulator _webView:didInsertAttachment:]):
(-[DataInteractionSimulator _webView:didRemoveAttachment:]):

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

22 months agoSameOrigin and CORS fetch should fail on opaque responses served from ServiceWorker
commit-queue@webkit.org [Tue, 19 Dec 2017 00:15:33 +0000 (00:15 +0000)]
SameOrigin and CORS fetch should fail on opaque responses served from ServiceWorker
https://bugs.webkit.org/show_bug.cgi?id=180941

Patch by Youenn Fablet <youenn@apple.com> on 2017-12-18
Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

* web-platform-tests/service-workers/service-worker/fetch-response-taint.https-expected.txt:
* web-platform-tests/service-workers/service-worker/opaque-response-preloaded.https-expected.txt:

Source/WebCore:

Covered by rebased tests.

* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl):

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

22 months agoApps that use both WK1 and WK2 can crash creating a WKWebsiteDataStore.
beidson@apple.com [Tue, 19 Dec 2017 00:14:24 +0000 (00:14 +0000)]
Apps that use both WK1 and WK2 can crash creating a WKWebsiteDataStore.
https://bugs.webkit.org/show_bug.cgi?id=180953

Reviewed by Chris Dumez.

* UIProcess/WebsiteData/WebsiteDataStore.cpp: Make an isMainThread() asset be an isUIThread() assert.

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

22 months agoWeb Inspector: Styles Redesign: Command-S should save changes in matching CSS resource
nvasilyev@apple.com [Mon, 18 Dec 2017 23:02:40 +0000 (23:02 +0000)]
Web Inspector: Styles Redesign: Command-S should save changes in matching CSS resource
https://bugs.webkit.org/show_bug.cgi?id=180900

Reviewed by Timothy Hatcher.

When focused on a CSS selector, property name or value, pressing Command-S should save
the CSS resource to the file system.

* UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:
(WI.SpreadsheetCSSStyleDeclarationSection.prototype.initialLayout):
(WI.SpreadsheetCSSStyleDeclarationSection.prototype._save):

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

22 months agoFollow up to bug#179762. Fix PreciseLocalClobberize to handle Spread/PhantomSpread...
sbarati@apple.com [Mon, 18 Dec 2017 22:20:22 +0000 (22:20 +0000)]
Follow up to bug#179762. Fix PreciseLocalClobberize to handle Spread/PhantomSpread(PhantomNewArrayBuffer)

* dfg/DFGPreciseLocalClobberize.h:
(JSC::DFG::PreciseLocalClobberizeAdaptor::readTop):

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

22 months agoMake some functions in GraphicsContextCG use call_once for statics
dino@apple.com [Mon, 18 Dec 2017 22:05:23 +0000 (22:05 +0000)]
Make some functions in GraphicsContextCG use call_once for statics
https://bugs.webkit.org/show_bug.cgi?id=180841
<rdar://problem/36058448>

Reviewed by Antoine Quint.

In preparation for making OffscreenCanvas operate inside a Worker,
make sure GraphicsContext is thread safe. Change some functions
that use a static to call_once.

* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::sRGBColorSpaceRef):
(WebCore::linearRGBColorSpaceRef):
(WebCore::extendedSRGBColorSpaceRef):
(WebCore::displayP3ColorSpaceRef):

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

22 months agoWeb Inspector: Styles Redesign: add inline swatch for CSS variables
webkit@devinrousso.com [Mon, 18 Dec 2017 22:04:36 +0000 (22:04 +0000)]
Web Inspector: Styles Redesign: add inline swatch for CSS variables
https://bugs.webkit.org/show_bug.cgi?id=180798

Reviewed by Timothy Hatcher.

* UserInterface/Views/SpreadsheetStyleProperty.js:
(WI.SpreadsheetStyleProperty):
(WI.SpreadsheetStyleProperty.prototype.updateStatus):
(WI.SpreadsheetStyleProperty.prototype._renderValue):
(WI.SpreadsheetStyleProperty.prototype._addVariableTokens):

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

22 months agoExtendableMessageEvent.data should return the value it was initialized to
cdumez@apple.com [Mon, 18 Dec 2017 21:56:54 +0000 (21:56 +0000)]
ExtendableMessageEvent.data should return the value it was initialized to
https://bugs.webkit.org/show_bug.cgi?id=180868

Reviewed by Geoffrey Garen.

LayoutTests/imported/w3c:

Rebaseline WPT test now that one more subtest is passing.

* web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/extendable-message-event-constructor.https-expected.txt:

Source/WebCore:

No new tests, rebaselined existing test.

* bindings/js/JSExtendableMessageEventCustom.cpp:
(WebCore::constructJSExtendableMessageEvent):
* workers/service/ExtendableMessageEvent.cpp:
(WebCore::ExtendableMessageEvent::ExtendableMessageEvent):
* workers/service/ExtendableMessageEvent.idl:

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

22 months agoWeb Inspector: recording view and slider have jumbled layout at narrow widths
webkit@devinrousso.com [Mon, 18 Dec 2017 21:51:36 +0000 (21:51 +0000)]
Web Inspector: recording view and slider have jumbled layout at narrow widths
https://bugs.webkit.org/show_bug.cgi?id=180597
<rdar://problem/35939904>

Reviewed by Timothy Hatcher.

* UserInterface/Views/RecordingContentView.css:
(.content-view:not(.tab).recording > header > .slider-container):
(.content-view:not(.tab).recording > header > .slider-container > *):
(.content-view:not(.tab).recording > header > .slider-container > input[type=range]):

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

22 months agoWeb Inspector: Canvas tab: placeholder/help text wrapping looks poor at narrow widths
mattbaker@apple.com [Mon, 18 Dec 2017 21:51:00 +0000 (21:51 +0000)]
Web Inspector: Canvas tab: placeholder/help text wrapping looks poor at narrow widths
https://bugs.webkit.org/show_bug.cgi?id=180943
<rdar://problem/36114431>

Reviewed by Timothy Hatcher.

* UserInterface/Views/ContentView.css:
(.content-view > .message-text-view > .description):
* UserInterface/Views/Main.css:
(.message-text-view .navigation-item-help):
(.message-text-view .navigation-item-help .navigation-bar):
(.message-text-view .navigation-item-help .navigation-bar > .item):

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

22 months agoREGRESSION (r225569): Web Inspector: Commented out properties aren't properly highlighted
webkit@devinrousso.com [Mon, 18 Dec 2017 21:49:07 +0000 (21:49 +0000)]
REGRESSION (r225569): Web Inspector: Commented out properties aren't properly highlighted
https://bugs.webkit.org/show_bug.cgi?id=180687

Reviewed by Timothy Hatcher.

* UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.css:
(.spreadsheet-style-declaration-editor .property:not(.disabled) .name):
(.spreadsheet-style-declaration-editor .property:not(.disabled) .value):
(.spreadsheet-style-declaration-editor .property.disabled):
(.spreadsheet-style-declaration-editor .name): Deleted.
(.spreadsheet-style-declaration-editor .value): Deleted.
(.spreadsheet-style-declaration-editor .property.disabled, .spreadsheet-style-declaration-editor .property.disabled > *): Deleted.

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

22 months agoMarked http/tests/resourceLoadStatistics/telemetry-generation.html as flaky.
jlewis3@apple.com [Mon, 18 Dec 2017 21:34:02 +0000 (21:34 +0000)]
Marked http/tests/resourceLoadStatistics/telemetry-generation.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=180703

Unreviewed test gardening.

* platform/wk2/TestExpectations:

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

22 months agoConditionally forward declare NSMapTable SPI
dbates@webkit.org [Mon, 18 Dec 2017 21:23:54 +0000 (21:23 +0000)]
Conditionally forward declare NSMapTable SPI
https://bugs.webkit.org/show_bug.cgi?id=180936
<rdar://problem/35037796>

Reviewed by Dan Bernstein.

* wtf/spi/cocoa/NSMapTableSPI.h:

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

22 months ago[macOS, iOS] Add new mach lookup port for CoreMedia remote control
bfulgham@apple.com [Mon, 18 Dec 2017 21:13:41 +0000 (21:13 +0000)]
[macOS, iOS] Add new mach lookup port for CoreMedia remote control
https://bugs.webkit.org/show_bug.cgi?id=180938
<rdar://problem/35447664>

Reviewed by Eric Carlson.

Update the app sandbox to support a new XPC endpoint for CoreMedia. This endpoint exposes
existing functions through a new, more-focused interface. This will (hopefully) allow us
to remove the more generic endpoints in a future update.

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

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

22 months agoRebaselined fast/mediastream/MediaStream-MediaElement-setObject-null.html.
jlewis3@apple.com [Mon, 18 Dec 2017 21:13:03 +0000 (21:13 +0000)]
Rebaselined fast/mediastream/MediaStream-MediaElement-setObject-null.html.

Unreviewed test gardening

* fast/mediastream/MediaStream-MediaElement-setObject-null-expected.txt:

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

22 months agoWeb Inspector: Network Tab - waterfall graph can be mis-sized after closing detail...
commit-queue@webkit.org [Mon, 18 Dec 2017 21:06:26 +0000 (21:06 +0000)]
Web Inspector: Network Tab - waterfall graph can be mis-sized after closing detail view
https://bugs.webkit.org/show_bug.cgi?id=180903
<rdar://problem/36087903>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-12-18
Reviewed by Matt Baker.

* UserInterface/Views/NetworkTableContentView.js:
(WI.NetworkTableContentView.prototype._hideResourceDetailView):
Redraw waterfall column after hiding the detail view.

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

22 months agoVector index masking
fpizlo@apple.com [Mon, 18 Dec 2017 20:15:41 +0000 (20:15 +0000)]
Vector index masking
https://bugs.webkit.org/show_bug.cgi?id=180909

Reviewed by Keith Miller.

Source/JavaScriptCore:

Adopt index masking for strings.

* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileGetCharCodeAt):
(JSC::DFG::SpeculativeJIT::compileGetByValOnString):
* ftl/FTLAbstractHeapRepository.h:
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileStringCharAt):
(JSC::FTL::DFG::LowerDFGToB3::compileStringCharCodeAt):
* jit/ThunkGenerators.cpp:
(JSC::stringCharLoad):

Source/WTF:

Adds index masking to StringImpl and Vector.

Perf:

- 0.4% slower on microbenchmarks.
- Octane totally even.
- Kraken may be 0.8% slower.
- Speedometer is 0.8% slower with p = 0.008.
- membuster is even:
    - snap2pre: 0.7% bigger w/ p = 0.26,
    - snap2post: 0.3% smaller w/ p = 0.81,
    - snap3pre: 1.2% bigger w/ p = 0.63,
    - snap3post: 0.4% smaller w/ p = 0.76.

* wtf/MathExtras.h:
(WTF::roundUpToPowerOfTwo):
(WTF::maskForSize):
* wtf/SizeLimits.cpp:
* wtf/Vector.h:
(WTF::VectorBufferBase::allocateBuffer):
(WTF::VectorBufferBase::tryAllocateBuffer):
(WTF::VectorBufferBase::reallocateBuffer):
(WTF::VectorBufferBase::deallocateBuffer):
(WTF::VectorBufferBase::releaseBuffer):
(WTF::VectorBufferBase::VectorBufferBase):
(WTF::VectorBufferBase::updateMask):
(WTF::VectorBuffer::allocateBuffer):
(WTF::VectorBuffer::tryAllocateBuffer):
(WTF::VectorBuffer::swap):
(WTF::VectorBuffer::restoreInlineBufferIfNeeded):
(WTF::Vector::at):
(WTF::Vector::at const):
* wtf/text/StringImpl.h:
(WTF::StringImpl::maskOffset):
(WTF::StringImpl::mask const):
(WTF::StringImplShape::StringImplShape):
(WTF::StringImpl::at const):
(WTF::StringImpl::tailOffset):
* wtf/text/StringView.h:
(WTF::StringView::StringView):
(WTF::StringView::operator=):
(WTF::StringView::initialize):
(WTF::StringView::clear):
(WTF::StringView::operator[] const):
* wtf/text/WTFString.h:
(WTF::String::mask const):

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

22 months agoSupport Autoscrolling in contenteditable for WK2
megan_gardner@apple.com [Mon, 18 Dec 2017 20:13:56 +0000 (20:13 +0000)]
Support Autoscrolling in contenteditable for WK2
https://bugs.webkit.org/show_bug.cgi?id=180789

Source/WebCore:

Reviewed by Simon Frasier and Wenson Hsieh..

Activate the autoscrollController to scroll to the position provided to us by the
UIProcess. Allows for scrolling in contentEditable for WebKit2

Test: fast/events/touch/ios/drag-to-autoscroll-in-single-line-editable.html

* page/AutoscrollController.cpp:
(WebCore::AutoscrollController::autoscrollTimerFired):
* page/EventHandler.cpp:
(WebCore::EventHandler::clearOrScheduleClearingLatchedStateIfNeeded):
(WebCore::EventHandler::targetPositionForSelectionAutoscroll const):
(WebCore::EventHandler::shouldUpdateAutoscroll):
(WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll const): Deleted.
* page/EventHandler.h:
* page/ios/EventHandlerIOS.mm:
(WebCore::EventHandler::startTextAutoscroll):
(WebCore::EventHandler::cancelTextAutoscroll):
(WebCore::EventHandler::targetPositionForSelectionAutoscroll const):
(WebCore::EventHandler::shouldUpdateAutoscroll):
* page/mac/EventHandlerMac.mm:
(WebCore::EventHandler::targetPositionForSelectionAutoscroll const):
(WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll const): Deleted.

Source/WebKit:

Reviewed by Simon Frasier and Wenson Hsieh.

Implements the UIKit protocol for autoscrolling and alerts the Web Process to start
(or stop) an autoscroll to the specified position. Allows for scrolling in contenteditable
in WebKit2.

* Platform/spi/ios/UIKitSPI.h:
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView startAutoscroll:]):
(-[WKContentView cancelAutoscroll]):
(-[WKContentView scrollSelectionToVisible:]):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::startAutoscrollAtPosition):
(WebKit::WebPageProxy::cancelAutoscroll):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::startAutoscrollAtPosition):
(WebKit::WebPage::cancelAutoscroll):

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

22 months agoAdd support for response blob given to fetch events
commit-queue@webkit.org [Mon, 18 Dec 2017 19:53:23 +0000 (19:53 +0000)]
Add support for response blob given to fetch events
https://bugs.webkit.org/show_bug.cgi?id=180894

Patch by Youenn Fablet <youenn@apple.com> on 2017-12-18
Reviewed by Darin Adler.

LayoutTests/imported/w3c:

* web-platform-tests/service-workers/service-worker/fetch-event-after-navigation-within-page.https-expected.txt:
* web-platform-tests/service-workers/service-worker/fetch-event-referrer-policy.https-expected.txt:
* web-platform-tests/service-workers/service-worker/fetch-event.https-expected.txt:
* web-platform-tests/service-workers/service-worker/fetch-header-visibility.https-expected.txt:
* web-platform-tests/service-workers/service-worker/fetch-mixed-content-to-outscope.https-expected.txt:

Source/WebCore:

Covered by updated test expectations.

Adding support for getting a blob URL from a FormData that only contains one blob.
Adding support to create a FetcLoader from a ServiceWorkerThreadProxy

* Modules/fetch/FetchLoader.cpp:
(WebCore::FetchLoader::start):
(WebCore::FetchLoader::startLoadingBlobURL):
* Modules/fetch/FetchLoader.h:
* WebCore.xcodeproj/project.pbxproj:
* platform/network/FormData.cpp:
(WebCore::FormData::asBlobURL const):
* platform/network/FormData.h:
* workers/service/context/ServiceWorkerThreadProxy.cpp:
(WebCore::ServiceWorkerThreadProxy::createBlobLoader):
* workers/service/context/ServiceWorkerThreadProxy.h:

Source/WebKit:

In case of blob data, read it from Service Worker process and send it to WebProcess.
At some point, web process should be able to read it directly from NetworkProcess.

* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::startFetch):
* WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
(WebKit::WebServiceWorkerFetchTaskClient::WebServiceWorkerFetchTaskClient):
(WebKit::WebServiceWorkerFetchTaskClient::didReceiveFormData):
(WebKit::WebServiceWorkerFetchTaskClient::didReceiveBlobChunk):
(WebKit::WebServiceWorkerFetchTaskClient::didFinishBlobLoading):
(WebKit::WebServiceWorkerFetchTaskClient::didFinish):
* WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:

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

22 months ago[SVG] Detach list wrappers before resetting the base value.
zalan@apple.com [Mon, 18 Dec 2017 19:32:49 +0000 (19:32 +0000)]
[SVG] Detach list wrappers before resetting the base value.
https://bugs.webkit.org/show_bug.cgi?id=180912
<rdar://problem/36017970>

Reviewed by Simon Fraser.

Source/WebCore:

Before resetting the animation value (and destroying the assigned SVG object -SVGLengthValue in this case),
we need to check if there's an associated tear off wrapper for the said SVG object and make a copy of it.
This is currently done in the wrong order through animValDidChange.

Test: svg/animations/crash-when-animation-is-running-while-getting-value.html

* svg/SVGAnimatedTypeAnimator.h:
(WebCore::SVGAnimatedTypeAnimator::resetFromBaseValue):
* svg/properties/SVGAnimatedPropertyTearOff.h:
* svg/properties/SVGAnimatedStaticPropertyTearOff.h:
(WebCore::SVGAnimatedStaticPropertyTearOff::synchronizeWrappersIfNeeded):

LayoutTests:

* svg/animations/crash-when-animation-is-running-while-getting-value-expected.txt: Added.
* svg/animations/crash-when-animation-is-running-while-getting-value.html: Added.

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

22 months agoREGRESSION: ASSERTION FAILED: !m_importCompleted
beidson@apple.com [Mon, 18 Dec 2017 19:20:40 +0000 (19:20 +0000)]
REGRESSION: ASSERTION FAILED: !m_importCompleted
https://bugs.webkit.org/show_bug.cgi?id=180935

Unreviewed bot gardening.

No new tests (Covered by existing tests)

The ASSERT was invalid for database pushes failing to open databases like this, so skip it for that scenario.

* workers/service/server/RegistrationStore.cpp:
(WebCore::RegistrationStore::databaseFailedToOpen):
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::registrationStoreDatabaseFailedToOpen):
* workers/service/server/SWServer.h:

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

22 months ago[WinCairo] Move the destination of WinCairoRequirements.zip into WebKitLibraries...
commit-queue@webkit.org [Mon, 18 Dec 2017 18:52:02 +0000 (18:52 +0000)]
[WinCairo] Move the destination of WinCairoRequirements.zip into WebKitLibraries and register it and related files as git ignore files.
https://bugs.webkit.org/show_bug.cgi?id=180875
<rdar://problem/36091434>

Patch by Fujii Hironori <Hironori.Fujii@sony.com> on 2017-12-18
Reviewed by Darin Adler.

update-webkit-wincairo-libs.py gets broken by r226002. Downloaded
WinCairoRequirements.zip can not be found to unzip because the
destination was changed.

* Scripts/update-webkit-wincairo-libs.py: Specify the correct zip path to unzip.

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

22 months agoSkip stress/call-apply-exponential-bytecode-size.js unless x86-64 or arm64
guijemont@igalia.com [Mon, 18 Dec 2017 17:48:31 +0000 (17:48 +0000)]
Skip stress/call-apply-exponential-bytecode-size.js unless x86-64 or arm64
https://bugs.webkit.org/show_bug.cgi?id=180712

Reviewed by Michael Catanzaro.

stress/call-apply-exponential-bytecode-size.js crashes if the
ExecutableAllocator's fixedExecutableMemoryPoolSize is less than 64
MB. Currently it is 64 MB or more only on x86-64 and arm64, so we
should skip the test on other platforms.

* stress/call-apply-exponential-bytecode-size.js:

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

22 months agoPlaying media elements which call "pause(); play()" will have the play promise rejected.
jer.noble@apple.com [Mon, 18 Dec 2017 17:43:50 +0000 (17:43 +0000)]
Playing media elements which call "pause(); play()" will have the play promise rejected.
https://bugs.webkit.org/show_bug.cgi?id=180781

Reviewed by Eric Carlson.

Source/WebCore:

Test: media/video-pause-play-resolve.html

When scheduling a rejection or resolution of existing play promises, move() the existing
promises into the block. This ensures that valid promises aren't added to the play promise
vector between when a rejection is scheduled and when it runs.

Drive-by fix: Don't return false from playInternal() just so the newly created promise will
get rejected. The pause() command will reject the promise, so just make sure it's added to
the m_pendingPlayPromises before calling playInternal().

Drive-by fix #2: The spec referenced by playInternal() and pauseInternal() doesn't say to
call the "Media Element Load Algorithm" (i.e., prepareForLoad()); it says to call the
"Resource Selection Algorithm" (i.e., selectMediaResource()). But fixing this bug caused
an assertion crash when the resource selection task was fired and m_player was null. This
was because the algorithm is being run at stop() time due to stop() calling pause(). The
solution to this ASSERT is to stop the m_resourceSelectionTaskQueue in stop().

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::scheduleRejectPendingPlayPromises):
(WebCore::HTMLMediaElement::rejectPendingPlayPromises):
(WebCore::HTMLMediaElement::resolvePendingPlayPromises):
(WebCore::HTMLMediaElement::scheduleNotifyAboutPlaying):
(WebCore::HTMLMediaElement::notifyAboutPlaying):
(WebCore::HTMLMediaElement::noneSupported):
(WebCore::HTMLMediaElement::cancelPendingEventsAndCallbacks):
(WebCore::HTMLMediaElement::play):
(WebCore::HTMLMediaElement::playInternal):
(WebCore::HTMLMediaElement::pauseInternal):
(WebCore::HTMLMediaElement::stop):
* html/HTMLMediaElement.h:

LayoutTests:

* media/audio-dealloc-crash.html:
* media/video-pause-play-resolve-expected.txt: Added.
* media/video-pause-play-resolve.html: Added.

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

22 months agoAdd a test to ensure that matched text markers are not highlighted when highlight...
dbates@webkit.org [Mon, 18 Dec 2017 17:35:28 +0000 (17:35 +0000)]
Add a test to ensure that matched text markers are not highlighted when highlight is disabled
https://bugs.webkit.org/show_bug.cgi?id=180919

Reviewed by Antti Koivisto.

* fast/text/mark-matches-rendering-when-highlight-disabled-expected.html: Added.
* fast/text/mark-matches-rendering-when-highlight-disabled.html: Added.

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

22 months agoAdd SPI to query for the current and last auto fill button type and pass user data...
dbates@webkit.org [Mon, 18 Dec 2017 17:14:04 +0000 (17:14 +0000)]
Add SPI to query for the current and last auto fill button type and pass user data object to _webView:focusShouldStartInputSession:
https://bugs.webkit.org/show_bug.cgi?id=180774
<rdar://problem/36033832>

Reviewed by Tim Horton.

Source/WebCore:

Expose a way for an embedding client to query for the auto fill button type of a specific
input element as it may not be feasible for a client to track such state themselves. For
similar reasons track and expose SPI to query for the last auto fill button type for a
specific field.

Test: fast/forms/auto-fill-button/last-auto-fill-button-type.html

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::HTMLInputElement):
(WebCore::HTMLInputElement::setShowAutoFillButton):
Update the last auto fill button type.

* html/HTMLInputElement.h:
(WebCore::HTMLInputElement::lastAutoFillButtonType const): Added.

* testing/Internals.cpp:
(WebCore::toAutoFillButtonType):
(WebCore::toInternalsAutoFillButtonType):
(WebCore::Internals::autoFillButtonType):
(WebCore::Internals::lastAutoFillButtonType):
* testing/Internals.h:
* testing/Internals.idl:
Add functions for testing.

Source/WebKit:

Have WKFocusedElementInfo own the optional user data object associated with the focused
element as opposed to having WKFormInputSession own it. This allows the Injected Bundle's
_webView:focusShouldStartInputSession: delegate callback to make use of this user data
to determine whether focus should start a new input session.

* UIProcess/API/Cocoa/_WKFocusedElementInfo.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKFormInputSession initWithContentView:focusedElementInfo:]):
(-[WKFormInputSession userObject]):
(-[WKFocusedElementInfo initWithAssistedNodeInformation:isUserInitiated:userObject:]):
(-[WKFocusedElementInfo userObject]):
(-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:]):
(-[WKFormInputSession initWithContentView:focusedElementInfo:userObject:]): Deleted.
(-[WKFocusedElementInfo initWithAssistedNodeInformation:isUserInitiated:]): Deleted.
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
(toWKAutoFillButtonType):
(-[WKWebProcessPlugInNodeHandle htmlInputElementAutoFillButtonType]):
(-[WKWebProcessPlugInNodeHandle htmlInputElementLastAutoFillButtonType]):
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h:
* WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:
(toWKAutoFillButtonType):
(WKBundleNodeHandleGetHTMLInputElementAutoFillButtonType):
(WKBundleNodeHandleGetHTMLInputElementLastAutoFillButtonType):
* WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h:
* WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
(WebKit::InjectedBundleNodeHandle::htmlInputElementAutoFillButtonType const):
(WebKit::InjectedBundleNodeHandle::htmlInputElementLastAutoFillButtonType const):
* WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:

LayoutTests:

Adds a test to ensure that we can query for the current auto fill button type and last auto fill button
type of an HTML input element.

* fast/forms/auto-fill-button/last-auto-fill-button-type-expected.txt: Added.
* fast/forms/auto-fill-button/last-auto-fill-button-type.html: Added.

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

22 months agoBitVector::OutOfLineBits is always reported as a leak
ap@apple.com [Mon, 18 Dec 2017 16:40:45 +0000 (16:40 +0000)]
BitVector::OutOfLineBits is always reported as a leak
https://bugs.webkit.org/show_bug.cgi?id=121662

Adding one more signature to ignore list.

* Scripts/webkitpy/port/leakdetector.py:
(LeakDetector._callstacks_to_exclude_from_leaks):

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

22 months agoRebaseline fast/dom/Window/window-lookup-precedence.html
Ms2ger@igalia.com [Mon, 18 Dec 2017 15:50:35 +0000 (15:50 +0000)]
Rebaseline fast/dom/Window/window-lookup-precedence.html
https://bugs.webkit.org/show_bug.cgi?id=163987

Unreviewed test gardening.

The platform-neutral baseline hasn't been anywhere close to matching the
output since r196392. However, the mac baseline seems to work for GTK as
well, so we now use it for all platforms.

The test is still marked as failing on iOS and Windows, but those
annotations can be removed as part of regularly scheduled gardening, if
needed.

* fast/dom/Window/window-lookup-precedence-expected.txt:
  Renamed from platform/mac/fast/dom/Window/window-lookup-precedence-expected.txt.
* platform/gtk/TestExpectations: Removed expectation.
* platform/gtk/fast/dom/Window/window-lookup-precedence-expected.txt: Removed.
* platform/mac/fast/dom/Window/window-lookup-precedence-expected.txt: Removed.

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

22 months ago[GTK][Darwin] Do not define mach exceptions for GTK+
csaavedra@igalia.com [Mon, 18 Dec 2017 15:25:58 +0000 (15:25 +0000)]
[GTK][Darwin] Do not define mach exceptions for GTK+

Rubber-stamped by Michael Catanzaro.
* wtf/Platform.h:

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

22 months agoBUILD FIX: Ignore NSWindow deprecation warnings from the mysterious future
ddkilzer@apple.com [Mon, 18 Dec 2017 13:43:15 +0000 (13:43 +0000)]
BUILD FIX: Ignore NSWindow deprecation warnings from the mysterious future

Attempt to fix the following warnings:

    AppKit instance variables are private, and the ability to access them will be removed in a future release. [-Werror,-Wdeprecated-declarations]

For the following instance variables:

    _borderView
    _contentView
    _frame
    _wFlags

* Carbon/CarbonWindowAdapter.mm:
(-[CarbonWindowAdapter initWithCarbonWindowRef:takingOwnership:disableOrdering:carbon:]):
(-[CarbonWindowAdapter reconcileToCarbonWindowBounds]):
(-[CarbonWindowAdapter _termWindowIfOwner]):
(-[CarbonWindowAdapter _windowMovedToRect:]):
(-[CarbonWindowAdapter setContentView:]):
(-[CarbonWindowAdapter _handleRootBoundsChanged]):
(-[CarbonWindowAdapter _handleContentBoundsChanged]):

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

22 months ago[FTL] NewArrayBuffer should be sinked if it is only used for spreading
utatane.tea@gmail.com [Mon, 18 Dec 2017 11:49:33 +0000 (11:49 +0000)]
[FTL] NewArrayBuffer should be sinked if it is only used for spreading
https://bugs.webkit.org/show_bug.cgi?id=179762

Reviewed by Saam Barati.

JSTests:

* stress/call-varargs-double-new-array-buffer.js: Added.
(assert):
(bar):
(foo):
* stress/call-varargs-spread-new-array-buffer.js: Added.
(assert):
(bar):
(foo):
* stress/call-varargs-spread-new-array-buffer2.js: Added.
(assert):
(bar):
(foo):
* stress/forward-varargs-double-new-array-buffer.js: Added.
(assert):
(test.baz):
(test.bar):
(test.foo):
(test):
* stress/new-array-buffer-sinking-osrexit.js: Added.
(target):
(test):
* stress/new-array-with-spread-double-new-array-buffer.js: Added.
(shouldBe):
(test):
* stress/new-array-with-spread-with-phantom-new-array-buffer.js: Added.
(shouldBe):
(target):
(test):
* stress/phantom-new-array-buffer-forward-varargs.js: Added.
(assert):
(test1.bar):
(test1.foo):
(test1):
(test2.bar):
(test2.foo):
(test3.baz):
(test3.bar):
(test3.foo):
(test4.baz):
(test4.bar):
(test4.foo):
* stress/phantom-new-array-buffer-forward-varargs2.js: Added.
(assert):
(test.baz):
(test.bar):
(test.foo):
(test):
* stress/phantom-new-array-buffer-osr-exit.js: Added.
(assert):
(baz):
(bar):
(effects):
(foo):

Source/JavaScriptCore:

This patch extends arguments elimination phase to accept NewArrayBuffer.
We can convert NewArrayBuffer to PhantomNewArrayBuffer if it is only
used by spreading nodes.

This improves SixSpeed spread.es6 by 3.5x.

    spread.es6           79.1496+-3.5665     ^     23.6204+-1.8526        ^ definitely 3.3509x faster

* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGArgumentsEliminationPhase.cpp:
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGNode.h:
(JSC::DFG::Node::hasNewArrayBufferData):
(JSC::DFG::Node::hasVectorLengthHint):
(JSC::DFG::Node::hasIndexingType):
(JSC::DFG::Node::indexingType):
(JSC::DFG::Node::hasCellOperand):
(JSC::DFG::Node::isPhantomAllocation):
* dfg/DFGNodeType.h:
* dfg/DFGOSRAvailabilityAnalysisPhase.cpp:
(JSC::DFG::LocalOSRAvailabilityCalculator::executeNode):
* dfg/DFGPredictionPropagationPhase.cpp:
* dfg/DFGPromotedHeapLocation.cpp:
(WTF::printInternal):
* dfg/DFGPromotedHeapLocation.h:
* dfg/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGValidate.cpp:
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileNewArrayWithSpread):
(JSC::FTL::DFG::LowerDFGToB3::compileSpread):
(JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread):
(JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargs):
(JSC::FTL::DFG::LowerDFGToB3::compileForwardVarargs):
(JSC::FTL::DFG::LowerDFGToB3::compileForwardVarargsWithSpread):
* ftl/FTLOperations.cpp:
(JSC::FTL::operationPopulateObjectInOSR):
(JSC::FTL::operationMaterializeObjectInOSR):

Source/WTF:

We add RecursableLambda<>. This can take a lambda and offer a way
to call this lambda recursively without introducing additional allocations.

C++ lambda is super useful in particular when we need to capture many
variables as references. Passing many arguments to a usual function is not
a good way. But C++ lambda does not allow us to easily call itself recursively.

Our recursableLambda offers `self` function as a first argument of the
given lambda. We can call this `self` recursively.

auto targetFunction = recursableLambda([] (auto self, ...) -> resultType {
    self(...);
});

While `std::function<> func = [&func] { ... }` allows recursion, it causes
heap allocation for std::function<>. `auto func = [&func] { ... }` causes
a compile error since we need to deduce an actual type when capturing `func`.

* WTF.xcodeproj/project.pbxproj:
* wtf/RecursableLambda.h: Added.
(WTF::RecursableLambda::RecursableLambda):
(WTF::RecursableLambda::operator() const):
(WTF::recursableLambda):

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

22 months ago[WPE] Add some test expectations for fetch wpt tests
Ms2ger@igalia.com [Mon, 18 Dec 2017 09:43:07 +0000 (09:43 +0000)]
[WPE] Add some test expectations for fetch wpt tests
https://bugs.webkit.org/show_bug.cgi?id=180927

Unreviewed test gardening.

New expectations are copied from GTK; I had forgotten to add them when
enabling these tests.

* platform/wpe/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any-expected.txt: Added.
* platform/wpe/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any.worker-expected.txt: Added.
* platform/wpe/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any-expected.txt: Added.
* platform/wpe/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any.worker-expected.txt: Added.
* platform/wpe/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-expected.txt: Added.
* platform/wpe/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-worker-expected.txt: Added.

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

22 months ago[GTK][WPE] Add WebKitWebView::web-process-terminated signal and deprecate web-process...
carlosgc@webkit.org [Mon, 18 Dec 2017 08:55:12 +0000 (08:55 +0000)]
[GTK][WPE] Add WebKitWebView::web-process-terminated signal and deprecate web-process-crashed
https://bugs.webkit.org/show_bug.cgi?id=180862

Reviewed by Michael Catanzaro.

Source/WebKit:

Once the memory pressure web process monitor is enabled in bug #180861 the web process can be killed due to
memory limits. We need to expose the reason of the web process termination to allow applications handle the
memory limit case.

* UIProcess/API/glib/WebKitNavigationClient.cpp:
* UIProcess/API/glib/WebKitWebView.cpp:
(webkit_web_view_class_init):
(webkitWebViewWebProcessTerminated):
(webkitWebViewWebProcessCrashed): Deleted.
* UIProcess/API/glib/WebKitWebViewPrivate.h:
* UIProcess/API/gtk/WebKitWebView.h:
* UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
* UIProcess/API/wpe/WebKitWebView.h:

Tools:

Use WebKitWebView::web-process-terminated instead of web-process-crashed in tests. I'm not adding a test for
WEBKIT_WEB_PROCESS_EXCEEDED_MEMORY_LIMIT because we would need to allocate more than 1GB in the test and wait
30 seconds, and we don't want to do either in unit tests.

* TestWebKitAPI/Tests/WebKitGLib/TestWebExtensions.cpp:
(webProcessTerminatedCallback):
(testWebKitWebViewProcessCrashed):
(webProcessCrashedCallback): Deleted.
* TestWebKitAPI/glib/WebKitGLib/WebViewTest.cpp:
(WebViewTest::initializeWebView):
(WebViewTest::webProcessTerminated):
(WebViewTest::webProcessCrashed): Deleted.
* TestWebKitAPI/glib/WebKitGLib/WebViewTest.h:

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

22 months ago[GTK][WPE] Enable WebProcess memory monitor
carlosgc@webkit.org [Mon, 18 Dec 2017 08:25:08 +0000 (08:25 +0000)]
[GTK][WPE] Enable WebProcess memory monitor
https://bugs.webkit.org/show_bug.cgi?id=180861

Reviewed by Michael Catanzaro.

For some reason this is only enabled in mac. We want to enable it also in GTK and WPE ports. This runs every 30
seconds to release memory or even kill the process if necessary. Carlos L├│pez has realized that in some
applications using video tags, the memory grows a lot and it's never released. It seems it's not memory leaked,
but simply large memory allocations (I guess it's gst allocating video frames) that make the heap grow. The
memory pressure calls malloc_trim that releases all that memory keeping the web process footprint stable.

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):

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

22 months ago[JSC] Use IsoSpace for JSWeakMap and JSWeakSet to use finalizeUnconditionally
utatane.tea@gmail.com [Mon, 18 Dec 2017 05:24:05 +0000 (05:24 +0000)]
[JSC] Use IsoSpace for JSWeakMap and JSWeakSet to use finalizeUnconditionally
https://bugs.webkit.org/show_bug.cgi?id=180916

Reviewed by Darin Adler.

This patch drops UnconditionalFinalizer for JSWeakMap and JSWeakSetby using IsoSpace.
Since these cells always require calling finalizeUnconditionally, we do not need to
track cells by using IsoCellSet.

Currently we still have WeakReferenceHarvester in JSWeakMap and JSWeakSet. We should
avoid using a global linked-list for this in the future.

* JavaScriptCore.xcodeproj/project.pbxproj:
* heap/Heap.cpp:
(JSC::Heap::finalizeUnconditionalFinalizersInIsoSubspace):
(JSC::Heap::finalizeUnconditionalFinalizers):
* heap/Heap.h:
* runtime/VM.cpp:
(JSC::VM::VM):
* runtime/VM.h:
* runtime/WeakMapImpl.cpp:
(JSC::WeakMapImpl<WeakMapBucket>::visitChildren):
(JSC::WeakMapImpl<WeakMapBucket>::finalizeUnconditionally): Deleted.
* runtime/WeakMapImpl.h:
(JSC::WeakMapImpl::isWeakMap):
(JSC::WeakMapImpl::isWeakSet):
(JSC::WeakMapImpl::subspaceFor):
* runtime/WeakMapImplInlines.h: Added.
(JSC::WeakMapImpl<WeakMapBucket>::finalizeUnconditionally):

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

22 months agoStorage Access API: Make document.hasStorageAccess() retrieve current status from...
wilander@apple.com [Mon, 18 Dec 2017 03:44:54 +0000 (03:44 +0000)]
Storage Access API: Make document.hasStorageAccess() retrieve current status from the network process
https://bugs.webkit.org/show_bug.cgi?id=180681
<rdar://problem/35982161>

Reviewed by Alex Christensen.

Source/WebCore:

Tests: http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction.html
       http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html

This change makes an asynchronous request to the network process
to see if storage access has been granted for this frame, on this
page, for this domain.

* dom/Document.cpp:
(WebCore::Document::hasStorageAccess):
* page/ChromeClient.h:

Source/WebKit:

This change makes an asynchronous request to the network process
to see if storage access has been granted for this frame, on this
page, for this domain.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::hasStorageAccessForPrevalentDomains):
(WebKit::NetworkProcess::updateStorageAccessForPrevalentDomains):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::hasStorageAccessForPrevalentDomains):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::hasStorageAccess):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
(WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
* UIProcess/WebResourceLoadStatisticsStore.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::hasStorageAccessForPrevalentDomainsHandler):
(WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
(WebKit::WebsiteDataStore::hasStorageAccess):
* UIProcess/WebsiteData/WebsiteDataStore.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::hasStorageAccess):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::hasStorageAccess):
* WebProcess/WebPage/WebPage.h:

LayoutTests:

This change makes an asynchronous request to the network process
to see if storage access has been granted for this frame, on this
page, for this domain.

* http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction-expected.txt: Added.
* http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction.html: Added.
* http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction-expected.txt: Added.
* http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html: Added.
* http/tests/storageAccess/resources/has-storage-access-iframe.html: Added.
* platform/mac-wk2/TestExpectations:
    New tests marked as [ Pass ].
    All http/tests/storageAccess/ tests marked [ HighSierra+ ] since
    document.hasStorageAccess() now requires code that relies on cookie
    partitioning.

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

22 months agoEnhance Ref and RefPtr to be able to work with smart pointers.
mark.lam@apple.com [Sun, 17 Dec 2017 23:22:18 +0000 (23:22 +0000)]
Enhance Ref and RefPtr to be able to work with smart pointers.
https://bugs.webkit.org/show_bug.cgi?id=180762
<rdar://problem/36027122>

Reviewed by JF Bastien and Darin Adler.

Source/WTF:

This is so we can use them with ConstExprPoisoned pointers to make PoisonedRef
and PoisonedRefPtr.

* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/DumbPtrTraits.h: Added.
(WTF::DumbPtrTraits::exchange):
(WTF::DumbPtrTraits::swap):
(WTF::DumbPtrTraits::unwrap):
* wtf/Forward.h:
* wtf/Poisoned.h:
(WTF::ConstExprPoisonedPtrTraits::exchange):
(WTF::ConstExprPoisonedPtrTraits::swap):
(WTF::ConstExprPoisonedPtrTraits::unwrap):
* wtf/Ref.h:
(WTF::Ref::~Ref):
(WTF::Ref::Ref):
(WTF::Ref::ptrAllowingHashTableEmptyValue const):
(WTF::Ref::ptrAllowingHashTableEmptyValue):
(WTF::Ref::operator-> const):
(WTF::Ref::get const):
(WTF::Ref::operator T& const):
(WTF::=):
(WTF::U>::swap):
(WTF::swap):
(WTF::U>::replace):
(WTF::static_reference_cast):
(WTF::adoptRef):
(WTF::is):
(WTF::Ref<T>::swap): Deleted.
(WTF::Ref<T>::replace): Deleted.
(WTF::GetPtrHelper<Ref<T>>::getPtr): Deleted.
* wtf/RefPtr.cpp: Added.
* wtf/RefPtr.h:
(WTF::RefPtr::RefPtr):
(WTF::RefPtr::~RefPtr):
(WTF::RefPtr::get const):
(WTF::RefPtr::operator* const):
(WTF::RefPtr::operator-> const):
(WTF::U>::RefPtr):
(WTF::U>::leakRef):
(WTF::=):
(WTF::U>::swap):
(WTF::swap):
(WTF::operator==):
(WTF::operator!=):
(WTF::static_pointer_cast):
(WTF::adoptRef):
(WTF::is):
(WTF::RefPtr<T>::RefPtr): Deleted.
(WTF::RefPtr<T>::leakRef): Deleted.
(WTF::RefPtr<T>::swap): Deleted.

Tools:

* TestWebKitAPI/CMakeLists.txt:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/ConstExprPoisoned.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WTF/Poisoned.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WTF/PoisonedRef.cpp: Added.
(TestWebKitAPI::TEST):
(TestWebKitAPI::passWithRef):
(TestWebKitAPI::PoisonedRefCheckingRefLogger::PoisonedRefCheckingRefLogger):
(TestWebKitAPI::PoisonedRefCheckingRefLogger::ref):
(TestWebKitAPI::PoisonedRefCheckingRefLogger::deref):
(TestWebKitAPI::DerivedPoisonedRefCheckingRefLogger::DerivedPoisonedRefCheckingRefLogger):
* TestWebKitAPI/Tests/WTF/PoisonedRefPtr.cpp: Added.
(TestWebKitAPI::TEST):
(TestWebKitAPI::f1):
(TestWebKitAPI::ConstRefCounted::create):
(TestWebKitAPI::returnConstRefCountedRef):
(TestWebKitAPI::returnRefCountedRef):
(TestWebKitAPI::PoisonedRefPtrCheckingRefLogger::PoisonedRefPtrCheckingRefLogger):
(TestWebKitAPI::loggerName):
(TestWebKitAPI::PoisonedRefPtrCheckingRefLogger::ref):
(TestWebKitAPI::PoisonedRefPtrCheckingRefLogger::deref):

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

22 months agoStrip fragment identifier from ServiceWorker's scriptURL
cdumez@apple.com [Sun, 17 Dec 2017 21:15:28 +0000 (21:15 +0000)]
Strip fragment identifier from ServiceWorker's scriptURL
https://bugs.webkit.org/show_bug.cgi?id=180887

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline WPT test now that one more check is passing.

* web-platform-tests/service-workers/service-worker/serviceworkerobject-scripturl.https-expected.txt:

Source/WebCore:

Strip fragment identifier from ServiceWorker's scriptURL to match Firefox and Chrome.
This behavior does not appear to be specified so I filed:
- https://github.com/w3c/ServiceWorker/issues/1249

No new tests, rebaselined existing test.

* workers/service/server/SWServerWorker.cpp:
(WebCore::m_script):

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

22 months agoMove render tree updating related files under rendering/updating/
antti@apple.com [Sun, 17 Dec 2017 21:11:27 +0000 (21:11 +0000)]
Move render tree updating related files under rendering/updating/
https://bugs.webkit.org/show_bug.cgi?id=180918

Reviewed by Darin Adler.

* CMakeLists.txt:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* rendering/RenderTreeBuilder.cpp: Removed.
* rendering/RenderTreeBuilder.h: Removed.
* rendering/updating: Added.
* rendering/updating/RenderTreeBuilder.cpp: Copied from Source/WebCore/rendering/RenderTreeBuilder.cpp.
* rendering/updating/RenderTreeBuilder.h: Copied from Source/WebCore/rendering/RenderTreeBuilder.h.
* rendering/updating/RenderTreePosition.cpp: Copied from Source/WebCore/style/RenderTreePosition.cpp.
* rendering/updating/RenderTreePosition.h: Copied from Source/WebCore/style/RenderTreePosition.h.
* rendering/updating/RenderTreeUpdater.cpp: Copied from Source/WebCore/style/RenderTreeUpdater.cpp.
* rendering/updating/RenderTreeUpdater.h: Copied from Source/WebCore/style/RenderTreeUpdater.h.
* rendering/updating/RenderTreeUpdaterFirstLetter.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterFirstLetter.cpp.
* rendering/updating/RenderTreeUpdaterFirstLetter.h: Copied from Source/WebCore/style/RenderTreeUpdaterFirstLetter.h.
* rendering/updating/RenderTreeUpdaterGeneratedContent.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterGeneratedContent.cpp.
* rendering/updating/RenderTreeUpdaterGeneratedContent.h: Copied from Source/WebCore/style/RenderTreeUpdaterGeneratedContent.h.
* rendering/updating/RenderTreeUpdaterListItem.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterListItem.cpp.
* rendering/updating/RenderTreeUpdaterListItem.h: Copied from Source/WebCore/style/RenderTreeUpdaterListItem.h.
* rendering/updating/RenderTreeUpdaterMultiColumn.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterMultiColumn.cpp.
* rendering/updating/RenderTreeUpdaterMultiColumn.h: Copied from Source/WebCore/style/RenderTreeUpdaterMultiColumn.h.
* style/RenderTreePosition.cpp: Removed.
* style/RenderTreePosition.h: Removed.
* style/RenderTreeUpdater.cpp: Removed.
* style/RenderTreeUpdater.h: Removed.
* style/RenderTreeUpdaterFirstLetter.cpp: Removed.
* style/RenderTreeUpdaterFirstLetter.h: Removed.
* style/RenderTreeUpdaterGeneratedContent.cpp: Removed.
* style/RenderTreeUpdaterGeneratedContent.h: Removed.
* style/RenderTreeUpdaterListItem.cpp: Removed.
* style/RenderTreeUpdaterListItem.h: Removed.
* style/RenderTreeUpdaterMultiColumn.cpp: Removed.
* style/RenderTreeUpdaterMultiColumn.h: Removed.

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

22 months agoHollow out stub implementation of InspectorBackendDispatcher::sendResponse().
mark.lam@apple.com [Sun, 17 Dec 2017 20:57:35 +0000 (20:57 +0000)]
Hollow out stub implementation of InspectorBackendDispatcher::sendResponse().
https://bugs.webkit.org/show_bug.cgi?id=180901
<rdar://problem/36087649>

Reviewed by Darin Adler.

We only need to keep a deprecated implementation of InspectorValues,
InspectorObjects, and InspectorBackendDispatcher::sendResponse() around so that
older versions of Safari can link against and run with a build of the latest code
in WebKit trunk. Older versions of System Safari used InspectorValues (via
WebInspector.framework) for two things:

1. Augmented JSContexts SPIs (via WebInspector.framework).
2. maybe WebDriver.

Neither of these are used when running SafariForWebKitDevelopment.  Since neither
are used, we can stub out the symbols (InspectorValues, InspectorObjects,
InspectorBackendDispatcher::sendResponse) to do nothing, and
SafariForWebKitDevelopment will still continue to launch with trunk WebKit, and
run without any observable bad behavior.

* JavaScriptCore.xcodeproj/project.pbxproj:
* SourcesCocoa.txt:
* inspector/InspectorBackendDispatcher.cpp:
* inspector/InspectorBackendDispatcher.h:
* inspector/cocoa/DeprecatedInspectorValues.cpp:
(Inspector::InspectorValue::null):
(Inspector::InspectorValue::create):
(Inspector::InspectorValue::asValue):
(Inspector::InspectorValue::asObject):
(Inspector::InspectorValue::asArray):
(Inspector::InspectorValue::parseJSON):
(Inspector::InspectorValue::toJSONString const):
(Inspector::InspectorValue::asBoolean const):
(Inspector::InspectorValue::asDouble const):
(Inspector::InspectorValue::asInteger const):
(Inspector::InspectorValue::asString const):
(Inspector::InspectorValue::writeJSON const):
(Inspector::InspectorValue::memoryCost const):
(Inspector::InspectorObjectBase::openAccessors):
(Inspector::InspectorObjectBase::memoryCost const):
(Inspector::InspectorObjectBase::getBoolean const):
(Inspector::InspectorObjectBase::getString const):
(Inspector::InspectorObjectBase::getObject const):
(Inspector::InspectorObjectBase::getArray const):
(Inspector::InspectorObjectBase::getValue const):
(Inspector::InspectorObjectBase::remove):
(Inspector::InspectorObject::create):
(Inspector::InspectorArrayBase::get const):
(Inspector::InspectorArrayBase::memoryCost const):
(Inspector::InspectorArray::create):
(Inspector::BackendDispatcher::sendResponse):
(Inspector::InspectorObjectBase::~InspectorObjectBase): Deleted.
(Inspector::InspectorObjectBase::asObject): Deleted.
(Inspector::InspectorObjectBase::writeJSON const): Deleted.
(Inspector::InspectorObjectBase::InspectorObjectBase): Deleted.
(Inspector::InspectorArrayBase::~InspectorArrayBase): Deleted.
(Inspector::InspectorArrayBase::asArray): Deleted.
(Inspector::InspectorArrayBase::writeJSON const): Deleted.
(Inspector::InspectorArrayBase::InspectorArrayBase): Deleted.
* inspector/cocoa/DeprecatedInspectorValues.h: Removed.

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

22 months ago[JSC][WebCore][CSSJIT] Remove VM reference in CSSJIT
utatane.tea@gmail.com [Sun, 17 Dec 2017 19:35:38 +0000 (19:35 +0000)]
[JSC][WebCore][CSSJIT] Remove VM reference in CSSJIT
https://bugs.webkit.org/show_bug.cgi?id=180917

Reviewed by Sam Weinig.

Source/JavaScriptCore:

We do not need to hold JIT flags in VM. We add
static VM::{canUseJIT,canUseAssembler,canUseRegExpJIT} functions.

* interpreter/AbstractPC.cpp:
(JSC::AbstractPC::AbstractPC):
* jit/JITThunks.cpp:
(JSC::JITThunks::ctiNativeCall):
(JSC::JITThunks::ctiNativeConstruct):
(JSC::JITThunks::ctiNativeTailCall):
(JSC::JITThunks::ctiNativeTailCallWithoutSavedTags):
(JSC::JITThunks::ctiInternalFunctionCall):
(JSC::JITThunks::ctiInternalFunctionConstruct):
(JSC::JITThunks::hostFunctionStub):
* llint/LLIntEntrypoint.cpp:
(JSC::LLInt::setFunctionEntrypoint):
(JSC::LLInt::setEvalEntrypoint):
(JSC::LLInt::setProgramEntrypoint):
(JSC::LLInt::setModuleProgramEntrypoint):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::shouldJIT):
(JSC::LLInt::entryOSR):
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
* runtime/RegExp.cpp:
(JSC::RegExp::compile):
(JSC::RegExp::compileMatchOnly):
* runtime/VM.cpp:
(JSC::VM::canUseAssembler):
(JSC::VM::canUseJIT):
(JSC::VM::canUseRegExpJIT):
(JSC::VM::VM):
* runtime/VM.h:
(JSC::VM::canUseJIT): Deleted.
(JSC::VM::canUseRegExpJIT): Deleted.

Source/WebCore:

Remove VM reference in CSSJIT. CSSJIT should not be
bound to a specific VM.

No behavior change.

* css/ElementRuleCollector.cpp:
(WebCore::ElementRuleCollector::ruleMatches):
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::compileSelector):
* cssjit/SelectorCompiler.h:
* dom/SelectorQuery.cpp:
(WebCore::SelectorDataList::compileSelector):
(WebCore::SelectorDataList::execute const):
* dom/SelectorQuery.h:

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

22 months ago[JSC] Number of SlotVisitors can increase after setting up m_visitCounters
utatane.tea@gmail.com [Sun, 17 Dec 2017 10:53:51 +0000 (10:53 +0000)]
[JSC] Number of SlotVisitors can increase after setting up m_visitCounters
https://bugs.webkit.org/show_bug.cgi?id=180906

Reviewed by Filip Pizlo.

The number of SlotVisitors can increase after setting up m_visitCounters.
If it happens, our m_visitCounters misses the visit count of newly added
SlotVisitors. It accidentally decides that constraints are converged.
This leads to random assertion hits in Linux environment.

In this patch, we compare the number of SlotVisitors in didVisitSomething().
If the number of SlotVisitors is changed, we conservatively say we did
visit something.

* heap/Heap.h:
* heap/HeapInlines.h:
(JSC::Heap::numberOfSlotVisitors):
* heap/MarkingConstraintSet.h:
* heap/MarkingConstraintSolver.cpp:
(JSC::MarkingConstraintSolver::didVisitSomething const):

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