WebKit-https.git
3 years agoDeny third-party cookie creation for prevalent resources without interaction
bfulgham@apple.com [Wed, 6 Sep 2017 17:30:50 +0000 (17:30 +0000)]
Deny third-party cookie creation for prevalent resources without interaction
https://bugs.webkit.org/show_bug.cgi?id=175232
<rdar://problem/33709386>

Reviewed by Alex Christensen.

Source/WebCore:

Prior to Intelligent Tracking Prevention, WebKit would deny the ability to create a third party cookie if the user's
settings prohibited it. Due to the internal mechanics of cookie partitioning, we now accept the third party cookie,
but destroy it at some arbitrary moment which is difficult for websites to work with.

This patch revises WebKit so that attempts to set third party cookies without user interaction fails immediately,
which is what sites are expecting from Safari.

Tests: http/tests/loading/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction.html

* platform/network/NetworkStorageSession.h:
* platform/network/cf/NetworkStorageSessionCFNet.cpp:
(WebCore::NetworkStorageSession::shouldPartitionCookies const): Revise for new naming.
(WebCore::NetworkStorageSession::shouldAllowThirdPartyCookies const): Allow third party cookies when the
user interaction property applies.
(WebCore::NetworkStorageSession::shouldBlockCookies const): Deny cookies for origins that are not allowed by
user interaction, and that are not being partitioned.
(WebCore::NetworkStorageSession::setPrevalentDomainsWithAndWithoutInteraction): Revise for new naming, and
to track prevalent origins with and without user interaction.
(WebCore::NetworkStorageSession::setShouldPartitionCookiesForHosts): Renamed to setPrevalentDomainsWithAndWithoutInteraction.
(WebCore::NetworkStorageSession::removePrevalentDomains): New helper function for testing.

Source/WebKit:

Prior to Intelligent Tracking Prevention, WebKit would deny the ability to create a third party cookie if the user's
settings prohibited it. Due to the internal mechanics of cookie partitioning, we now accept the third party cookie,
but destroy it at some arbitrary moment which is difficult for websites to work with.

This patch revises WebKit so that attempts to set third party cookies without user interaction fails immediately,
which is what sites are expecting from Safari.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::updatePrevalentDomainsWithAndWithoutInteraction):
(WebKit::NetworkProcess::updateCookiePartitioningForTopPrivatelyOwnedDomains): Renamed to updatePrevalentDomainsWithAndWithoutInteraction.
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in: Renamed the UpdateCookiePartitioningForTopPrivatelyOwnedDomains message
to UpdatePrevalentDomainsWithAndWithoutInteraction.
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Recognize cases where a network session should block cookies, and
use the stateless session so we fail immediately when attempting an invalid cookie set operation.
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(WebKit::WKWebsiteDataStore::_resourceLoadStatisticsSetShouldPartitionCookies): Use new helper function to clear partitioning state.
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore): Update for revised naming.
(WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning): Track domains with and without interaction so that we can recognize
domains that should be immediately blocked from setting cookies.
(WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains): Update for revised naming.
(WebKit::WebResourceLoadStatisticsStore::scheduleClearPartitioningStateForDomains): Added helper function for testing.
* UIProcess/WebResourceLoadStatisticsStore.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::updatePrevalentDomainsWithAndWithoutInteraction): Update for revised naming.
(WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback): Ditto.
(WebKit::WebsiteDataStore::updateCookiePartitioningForTopPrivatelyOwnedDomains): Renamed to updatePrevalentDomainsWithAndWithoutInteraction.
* UIProcess/WebsiteData/WebsiteDataStore.h:

LayoutTests:

* http/tests/loading/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction-expected.txt: Added.
* http/tests/loading/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction.html: Added.
* platform/mac-highsierra-wk2/TestExpectations: Add new test expectation.

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

3 years agoLayout Test http/tests/preload/single_download_preload.html is flaky.
pvollan@apple.com [Wed, 6 Sep 2017 17:24:38 +0000 (17:24 +0000)]
Layout Test http/tests/preload/single_download_preload.html is flaky.
https://bugs.webkit.org/show_bug.cgi?id=176465.

Unreviewed test gardening.

* platform/win/TestExpectations:

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

3 years ago[WPE][CMake] Fix path to the WebKitApplicationInfo.h header.
aperez@igalia.com [Wed, 6 Sep 2017 17:05:47 +0000 (17:05 +0000)]
[WPE][CMake] Fix path to the WebKitApplicationInfo.h header.

Unreviewed build fix.

This doesn't really make a difference for the build bots, but it makes
it possible to craft working release tarballs of WPE.

* PlatformWPE.cmake: Use the WPE version of WebKitApplicationInfo.h

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

3 years ago[WPE] Add missing test expectations
commit-queue@webkit.org [Wed, 6 Sep 2017 17:02:14 +0000 (17:02 +0000)]
[WPE] Add missing test expectations
https://bugs.webkit.org/show_bug.cgi?id=176453

Unreviewed test gardening.

Patch by Ms2ger <Ms2ger@igalia.com> on 2017-09-06

* platform/wpe/TestExpectations:
* platform/wpe/fast/events/context-no-deselect-expected.txt: Added.
* platform/wpe/fast/events/event-listener-on-link-expected.txt: Added.
* platform/wpe/fast/events/ghostly-mousemoves-in-subframe-expected.txt: Added.
* platform/wpe/fast/events/onload-re-entry-expected.txt: Added.
* platform/wpe/fast/events/pointer-events-2-expected.txt: Added.
* platform/wpe/fast/events/resize-events-expected.txt: Added.
* platform/wpe/fast/events/reveal-link-when-focused-expected.txt: Added.
* platform/wpe/fast/events/updateLayoutForHitTest-expected.txt: Added.
* platform/wpe/fast/inspector-support/matchedrules-expected.txt: Added.

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

3 years agoCopy WebKit Permalink may generate wrong URL with SVN checkout
dbates@webkit.org [Wed, 6 Sep 2017 16:55:49 +0000 (16:55 +0000)]
Copy WebKit Permalink may generate wrong URL with SVN checkout
https://bugs.webkit.org/show_bug.cgi?id=176427

Reviewed by Darin Adler.

Fixes an issue where Copy WebKit Permalink would generate an incorrect URL for
any file not in the top-level directory of the repository when using an SVN
checkout of WebKit.

Copy WebKit Permalink changes directories to the containing directory D of the
active Xcode document F before running "svn info <path to F>". Currently we use
the value of "Path" from the output of "svn info" when generating the permalink.
This path is relative to D. But we want the path to F relative to the top-level
checkout directory. We need to explicitly compute this.

* CopyPermalink/Copy WebKit Permalink.workflow/Contents/document.wflow:

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

3 years agoUnreviewed GTK+ gardening. Rebaseline tests after Freetype version bump in r221670...
carlosgc@webkit.org [Wed, 6 Sep 2017 16:39:45 +0000 (16:39 +0000)]
Unreviewed GTK+ gardening. Rebaseline tests after Freetype version bump in r221670. Part 7.

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

3 years agoMissing break in URLParser
tpopela@redhat.com [Wed, 6 Sep 2017 16:37:57 +0000 (16:37 +0000)]
Missing break in URLParser
https://bugs.webkit.org/show_bug.cgi?id=176357

Reviewed by Darin Adler.

Add a missing break so the currently set state is not overwritten
after the block. Found by Coverity scan.

* platform/URLParser.cpp:
(WebCore::URLParser::parse):

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

3 years agoUnreviewed GTK+ gardening. Rebaseline tests after Freetype version bump in r221670...
carlosgc@webkit.org [Wed, 6 Sep 2017 16:25:52 +0000 (16:25 +0000)]
Unreviewed GTK+ gardening. Rebaseline tests after Freetype version bump in r221670. Part 6.

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

3 years agoUnreviewed GTK+ gardening. Rebaseline tests after Freetype version bump in r221670...
carlosgc@webkit.org [Wed, 6 Sep 2017 16:15:12 +0000 (16:15 +0000)]
Unreviewed GTK+ gardening. Rebaseline tests after Freetype version bump in r221670. Part 5.

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

3 years agoUnreviewed GTK+ gardening. Rebaseline tests after Freetype version bump in r221670...
carlosgc@webkit.org [Wed, 6 Sep 2017 16:04:56 +0000 (16:04 +0000)]
Unreviewed GTK+ gardening. Rebaseline tests after Freetype version bump in r221670. Part 4.

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

3 years agoUnreviewed GTK+ gardening. Rebaseline tests after Freetype version bump in r221670...
carlosgc@webkit.org [Wed, 6 Sep 2017 15:51:06 +0000 (15:51 +0000)]
Unreviewed GTK+ gardening. Rebaseline tests after Freetype version bump in r221670. Part 3.

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

3 years agoUnreviewed GTK+ gardening. Rebaseline tests after Freetype version bump in r221670...
carlosgc@webkit.org [Wed, 6 Sep 2017 15:37:27 +0000 (15:37 +0000)]
Unreviewed GTK+ gardening. Rebaseline tests after Freetype version bump in r221670. Part 2.

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

3 years agoUnreviewed GTK+ gardening. Rebaseline tests after Freetype version bump in r221670...
carlosgc@webkit.org [Wed, 6 Sep 2017 15:25:58 +0000 (15:25 +0000)]
Unreviewed GTK+ gardening. Rebaseline tests after Freetype version bump in r221670. Part 1.

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

3 years ago[GTK] Bump freetype version to 2.8.0
carlosgc@webkit.org [Wed, 6 Sep 2017 15:10:56 +0000 (15:10 +0000)]
[GTK] Bump freetype version to 2.8.0
https://bugs.webkit.org/show_bug.cgi?id=176351

Source/WebCore:

Patch by Dominik Röttsches <dominik.rottsches@intel.com> on 2017-09-06
Reviewed by Carlos Alberto Lopez Perez.

Retrieving line spacing info without metrics hinting - FreeType's metric hinting
uses rounding which results in the sum of ascent and descent being larger
than the line height. To work around this without globally disabling font metrics
hinting, I am temporarily creating a new cairo scaled font with metrics hinting
off and retrieving the height values from this one.

* platform/graphics/freetype/SimpleFontDataFreeType.cpp:
(WebCore::scaledFontWithoutMetricsHinting): New function to clone the existing font, only with metrics hinting
disabled.
(WebCore::Font::platformInit): Get height info from non-metrics hinted font, disable rounding for linespacing.

Tools:

Reviewed by Carlos Alberto Lopez Perez.

Remove the patch we were using since it was reverted upstream.

* gtk/jhbuild.modules:
* gtk/patches/freetype6-2.4.11-truetype-font-height-fix.patch: Removed.

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

3 years agoIntroduce ScrollingTreeScrollingNodeDelegateIOS to share code between overflow and...
commit-queue@webkit.org [Wed, 6 Sep 2017 12:42:46 +0000 (12:42 +0000)]
Introduce ScrollingTreeScrollingNodeDelegateIOS to share code between overflow and frame scrolling
https://bugs.webkit.org/show_bug.cgi?id=174097

Patch by Frédéric Wang <fwang@igalia.com> on 2017-09-06
Reviewed by Darin Adler.

Source/WebCore:

No new tests, behavior unchanged.

* WebCore.xcodeproj/project.pbxproj: Add ScrollingTreeScrollingNodeDelegate.
* page/scrolling/ScrollingTreeScrollingNode.h: Make ScrollingTreeScrollingNodeDelegate a
friend so that it can access private members.
* page/scrolling/ScrollingTreeScrollingNodeDelegate.cpp: Added. New delegate class for a
scrolling node, which is used by the UI process.
(WebCore::ScrollingTreeScrollingNodeDelegate::ScrollingTreeScrollingNodeDelegate):
Constructor, taking the scrolling node as a parameter.
(WebCore::ScrollingTreeScrollingNodeDelegate::~ScrollingTreeScrollingNodeDelegate):
(WebCore::ScrollingTreeScrollingNodeDelegate::scrollingTree const): Expose the scrolling
tree containing the scrolling node.
(WebCore::ScrollingTreeScrollingNodeDelegate::lastCommittedScrollPosition const): Expose
the last committed scroll position of the scrolling node.
* page/scrolling/ScrollingTreeScrollingNodeDelegate.h: Added.
(WebCore::ScrollingTreeScrollingNodeDelegate::scrollingNode): Expose the scrolling node.
(WebCore::ScrollingTreeScrollingNodeDelegate::scrollingNode const): Ditto.

Source/WebKit:

This patch introduces a new ScrollingTreeScrollingNodeDelegateIOS that can be used by
WKOverflowScrollViewDelegate to communicate to the scrolling tree and nodes. It can also be
used as a helper class by ScrollingTreeOverflowScrollingNodeIOS. For now, only the non-
overriden member functions of ScrollingTreeOverflowScrollingNodeIOS are moved to that new
class. In follow-up commits, WKOverflowScrollViewDelegate can become a generic
ScrollViewDelegate and more code can be moved into the ScrollingTreeScrollingNodeDelegateIOS
file. Frame scrolling nodes will then be able to share the same UI code as overflow:auto when
iOS frame scrolling is implemented (bug 149264).

* UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h: Move non-overriden member
functions and m_updatingFromStateNode into the delegate class. Also define a member to store
that delegate.
* UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm: Use the node delegate to
communicate to the scrolling tree and node.
(-[WKOverflowScrollViewDelegate initWithScrollingTreeNodeDelegate:]): Init with a delegate.
(-[WKOverflowScrollViewDelegate scrollViewDidScroll:]): Call the delegate function.
(-[WKOverflowScrollViewDelegate scrollViewWillBeginDragging:]): Ditto.
(-[WKOverflowScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
Use the delegate functions or pass by ScrollingTreeScrollingNodeDelegateIOS::scrollingNode().
(-[WKOverflowScrollViewDelegate scrollViewDidEndDragging:willDecelerate:]): Use the delegate
functions.
(-[WKOverflowScrollViewDelegate scrollViewDidEndDecelerating:]): Ditto.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::ScrollingTreeOverflowScrollingNodeIOS):
Init the delegate for this class.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateAfterChildren): Use the delegate.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::setScrollLayerPosition): Use the delegate
function.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterDelegatedScroll): Ditto.
(-[WKOverflowScrollViewDelegate initWithScrollingTreeNode:]): Deleted. This is renamed
initWithScrollingTreeNodeDelegate and accepts a delegate.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateChildNodesAfterScroll): Deleted. Moved
to ScrollingTreeScrollingNodeDelegateIOS.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::overflowScrollWillStart): Ditto.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::overflowScrollDidEnd): Ditto.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::overflowScrollViewWillStartPanGesture): Ditto.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::scrollViewDidScroll): Ditto.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::currentSnapPointIndicesDidChange): Ditto.
* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h: Added. New delegate class
for ScrollingTreeOverflowScrollingNodeIOS. The members used by WKOverflowScrollViewDelegate
are public and the others are private. ScrollingTreeOverflowScrollingNodeIOS is a friend of
ScrollingTreeScrollingNodeDelegateIOS so that it can access private members e.g.
updateChildNodesAfterScroll() or  m_updatingFromStateNode.
* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: Added.
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::ScrollingTreeScrollingNodeDelegateIOS):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::~ScrollingTreeScrollingNodeDelegateIOS):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateChildNodesAfterScroll): Code extracted
from ScrollingTreeOverflowScrollingNodeIOS.
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollWillStart): Ditto.
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollDidEnd): Ditto.
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewWillStartPanGesture): Ditto.
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll): Ditto.
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::currentSnapPointIndicesDidChange): Ditto.
* WebKit.xcodeproj/project.pbxproj: Add ScrollingTreeScrollingNodeDelegateIOS files to the
build system.

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

3 years ago[css-grid] grid shorthand should not reset the gutter properties
rego@igalia.com [Wed, 6 Sep 2017 09:59:26 +0000 (09:59 +0000)]
[css-grid] grid shorthand should not reset the gutter properties
https://bugs.webkit.org/show_bug.cgi?id=176375

Reviewed by Sergio Villar Senin.

LayoutTests/imported/w3c:

Import new test from WPT.

* web-platform-tests/css/css-grid-1/grid-definition/grid-shorthand-001-expected.txt: Added.
* web-platform-tests/css/css-grid-1/grid-definition/grid-shorthand-001.html: Added.
* web-platform-tests/css/css-grid-1/grid-definition/w3c-import.log:

Source/WebCore:

The CSS WG has resolved that the "grid" shorthand shouldn't reset
the gutter properties anymore:
https://github.com/w3c/csswg-drafts/issues/1036

This was originally implemented in r195529, so this is somehow
a revert of that change.

Test: imported/w3c/web-platform-tests/css/css-grid-1/grid-definition/grid-shorthand-001.html

* css/CSSProperties.json:
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::consumeGridShorthand):

LayoutTests:

Update the test to check the new behavior.

* fast/css-grid-layout/grid-shorthand-get-set-expected.txt:
* fast/css-grid-layout/grid-shorthand-get-set.html:

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

3 years ago[WebGL2] Implement getActiveUniforms()
zandobersek@gmail.com [Wed, 6 Sep 2017 08:17:59 +0000 (08:17 +0000)]
[WebGL2] Implement getActiveUniforms()
https://bugs.webkit.org/show_bug.cgi?id=175203

Reviewed by Darin Adler.

Source/WebCore:

Align getActiveUniforms() WebIDL signature with the spec -- making it
return a WebGLAny object, making the program parameter non-nullable,
and making the uniformIndices parameter a sequence on GLuint values.

The getActiveUniforms() implementation in WebGL2RenderingContext
validates the passed-in program and parameter name and then calls the
GraphicsContext3D::getActiveUniforms() method, retrieving an array of
integers that represent values of the requested parameter name for
each uniform whose index was passed through uniformIndices.

Test: fast/canvas/webgl/webgl2-getActiveUniforms.html

* bindings/js/JSDOMConvertWebGL.cpp:
(WebCore::convertToJSValue):
* html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::getActiveUniforms):
* html/canvas/WebGL2RenderingContext.h:
* html/canvas/WebGL2RenderingContext.idl:
* html/canvas/WebGLAny.h:
* platform/graphics/GraphicsContext3D.h:
* platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
(WebCore::GraphicsContext3D::getActiveUniforms):

LayoutTests:

Add a basic gl.getActiveUniforms() test that checks proper return values
for a mat4 uniform in the simple vertex shader that's used when creating
the 'standard' program through webgl-test.js utilities. The test remains
skipped on GTK+ and Windows (WebGL 2.0 disabled). Mac port skips it as
well since the shader can't be compiled properly. WPE and iOS run the
test and are passing it.

* fast/canvas/webgl/webgl2-getActiveUniforms-expected.txt: Added.
* fast/canvas/webgl/webgl2-getActiveUniforms.html: Added.
* platform/gtk/TestExpectations:
* platform/mac/TestExpectations:

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

3 years ago[Win] Tools/TestWebKitAPI/Tests/WTF/PriorityQueue.cpp fails to compile with MSVC...
commit-queue@webkit.org [Wed, 6 Sep 2017 07:23:38 +0000 (07:23 +0000)]
[Win] Tools/TestWebKitAPI/Tests/WTF/PriorityQueue.cpp fails to compile with MSVC 2015
https://bugs.webkit.org/show_bug.cgi?id=176442

Patch by Yoshiaki Jitsukawa <Yoshiaki.Jitsukawa@sony.com> on 2017-09-06
Reviewed by Keith Miller.

* TestWebKitAPI/Tests/WTF/PriorityQueue.cpp:
(TEST):

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

3 years ago[WebCrypto] Downcast parameters and keys at the platform operation callsites
zandobersek@gmail.com [Wed, 6 Sep 2017 06:48:49 +0000 (06:48 +0000)]
[WebCrypto] Downcast parameters and keys at the platform operation callsites
https://bugs.webkit.org/show_bug.cgi?id=176392

Reviewed by Sam Weinig.

Downcast to algorithm-specific parameter and key types in the shared
code that then invokes platform-specific operation implementations.
This reduces the duplicated downcasts across different implementations
that don't differ at all in this behavior.

Covered by existing tests.

* crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
(WebCore::CryptoAlgorithmAES_CBC::encrypt):
(WebCore::CryptoAlgorithmAES_CBC::decrypt):
* crypto/algorithms/CryptoAlgorithmAES_CBC.h:
* crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
(WebCore::CryptoAlgorithmAES_CFB::encrypt):
(WebCore::CryptoAlgorithmAES_CFB::decrypt):
* crypto/algorithms/CryptoAlgorithmAES_CFB.h:
* crypto/algorithms/CryptoAlgorithmAES_CTR.cpp:
(WebCore::CryptoAlgorithmAES_CTR::encrypt):
(WebCore::CryptoAlgorithmAES_CTR::decrypt):
* crypto/algorithms/CryptoAlgorithmAES_CTR.h:
* crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
(WebCore::CryptoAlgorithmAES_GCM::encrypt):
(WebCore::CryptoAlgorithmAES_GCM::decrypt):
* crypto/algorithms/CryptoAlgorithmAES_GCM.h:
* crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
(WebCore::CryptoAlgorithmAES_KW::wrapKey):
(WebCore::CryptoAlgorithmAES_KW::unwrapKey):
* crypto/algorithms/CryptoAlgorithmAES_KW.h:
* crypto/algorithms/CryptoAlgorithmECDH.cpp:
(WebCore::CryptoAlgorithmECDH::deriveBits):
* crypto/algorithms/CryptoAlgorithmECDH.h:
* crypto/algorithms/CryptoAlgorithmECDSA.cpp:
(WebCore::CryptoAlgorithmECDSA::sign):
(WebCore::CryptoAlgorithmECDSA::verify):
* crypto/algorithms/CryptoAlgorithmECDSA.h:
* crypto/algorithms/CryptoAlgorithmHKDF.cpp:
(WebCore::CryptoAlgorithmHKDF::deriveBits):
* crypto/algorithms/CryptoAlgorithmHKDF.h:
* crypto/algorithms/CryptoAlgorithmHMAC.cpp:
(WebCore::CryptoAlgorithmHMAC::sign):
(WebCore::CryptoAlgorithmHMAC::verify):
* crypto/algorithms/CryptoAlgorithmHMAC.h:
* crypto/algorithms/CryptoAlgorithmPBKDF2.cpp:
(WebCore::CryptoAlgorithmPBKDF2::deriveBits):
* crypto/algorithms/CryptoAlgorithmPBKDF2.h:
* crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt):
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt):
* crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
* crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
* crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
* crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
(WebCore::CryptoAlgorithmRSA_OAEP::encrypt):
(WebCore::CryptoAlgorithmRSA_OAEP::decrypt):
* crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
* crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
(WebCore::CryptoAlgorithmRSA_PSS::sign):
(WebCore::CryptoAlgorithmRSA_PSS::verify):
* crypto/algorithms/CryptoAlgorithmRSA_PSS.h:
* crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
(WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
(WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
* crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp:
(WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
(WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
* crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp:
(WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
(WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
* crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp:
(WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
(WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
* crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp:
(WebCore::CryptoAlgorithmAES_KW::platformWrapKey):
(WebCore::CryptoAlgorithmAES_KW::platformUnwrapKey):
* crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp:
(WebCore::CryptoAlgorithmECDH::platformDeriveBits):
* crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp:
(WebCore::CryptoAlgorithmECDSA::platformSign):
(WebCore::CryptoAlgorithmECDSA::platformVerify):
* crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp:
(WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
* crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp:
(WebCore::CryptoAlgorithmHMAC::platformSign):
(WebCore::CryptoAlgorithmHMAC::platformVerify):
* crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp:
(WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
* crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp:
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
* crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp:
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
* crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
(WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
(WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
* crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp:
(WebCore::CryptoAlgorithmRSA_PSS::platformSign):
(WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
* crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
(WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
(WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
* crypto/mac/CryptoAlgorithmAES_CFBMac.cpp:
(WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
(WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
* crypto/mac/CryptoAlgorithmAES_CTRMac.cpp:
(WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
(WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
* crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:
(WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
(WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
* crypto/mac/CryptoAlgorithmAES_KWMac.cpp:
(WebCore::CryptoAlgorithmAES_KW::platformWrapKey):
(WebCore::CryptoAlgorithmAES_KW::platformUnwrapKey):
* crypto/mac/CryptoAlgorithmECDHMac.cpp:
(WebCore::CryptoAlgorithmECDH::platformDeriveBits):
* crypto/mac/CryptoAlgorithmECDSAMac.cpp:
(WebCore::CryptoAlgorithmECDSA::platformSign):
(WebCore::CryptoAlgorithmECDSA::platformVerify):
* crypto/mac/CryptoAlgorithmHKDFMac.cpp:
(WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
* crypto/mac/CryptoAlgorithmHMACMac.cpp:
(WebCore::CryptoAlgorithmHMAC::platformSign):
(WebCore::CryptoAlgorithmHMAC::platformVerify):
* crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp:
(WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
* crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp:
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
* crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
* crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
(WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
(WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
* crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp:
(WebCore::CryptoAlgorithmRSA_PSS::platformSign):
(WebCore::CryptoAlgorithmRSA_PSS::platformVerify):

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

3 years agoAdd a button to show two weeks of data to perf dashboard
rniwa@webkit.org [Wed, 6 Sep 2017 05:25:14 +0000 (05:25 +0000)]
Add a button to show two weeks of data to perf dashboard
https://bugs.webkit.org/show_bug.cgi?id=176438

Reviewed by Saam Barati.

Add "2W" button to show 14 days of data on dashboard pages.

* public/v3/pages/dashboard-toolbar.js:
(DashboardToolbar):

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

3 years agoUnreviewed, rebaseline test after r221639.
cdumez@apple.com [Wed, 6 Sep 2017 05:02:43 +0000 (05:02 +0000)]
Unreviewed, rebaseline test after r221639.

* fast/forms/file/entries-api/drag-folder-webkitEntries-expected.txt:
* fast/forms/file/entries-api/drag-folder-webkitEntries.html:

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

3 years agoWeb Inspector: Styles Redesign: display "Inherited From" section headers
nvasilyev@apple.com [Wed, 6 Sep 2017 03:55:27 +0000 (03:55 +0000)]
Web Inspector: Styles Redesign: display "Inherited From" section headers
https://bugs.webkit.org/show_bug.cgi?id=176033
<rdar://problem/34116930>

Reviewed by Devin Rousso.

Compared to the old styles sidebar, the new "Inherited From" sections are more compact.
One of the goals of the styles redesign is to make it fit more data vertically.

The contrast is inceased. The text is darker while the background stayed the same.

* UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.css:
(.spreadsheet-style-panel .section-inherited):
(.spreadsheet-style-panel .section-inherited .node-link):
(.spreadsheet-style-panel .section-inherited .node-link:hover):
* UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js:
(WI.SpreadsheetRulesStyleDetailsPanel):
(WI.SpreadsheetRulesStyleDetailsPanel.prototype.refresh):
Don't show two identical "Inherited From" sections.

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

3 years agoFix a few minor problems found while working toward removing unneeded calls to update...
darin@apple.com [Wed, 6 Sep 2017 03:35:42 +0000 (03:35 +0000)]
Fix a few minor problems found while working toward removing unneeded calls to updateStyle
https://bugs.webkit.org/show_bug.cgi?id=176279

Reviewed by Antti Koivisto.

Source/WebCore:

* dom/Document.cpp:
(WebCore::Document::updateTitleElement): Fix the algorithm so that an SVG title won't
ever become the title when the document element is not an SVG element. We had this wrong
before but we were passing the test because SVGTitleElement::insertedInto had a bug that
hid the problem.
(WebCore::Document::titleElementAdded): Pass a reference instead of a pointer.
(WebCore::Document::titleElementRemoved): Pass a reference instead of nullptr since we
want to know which element is being removed.

* dom/Document.h: Update the argument name and type for updateTitleElement.

* html/HTMLTitleElement.cpp:
(WebCore::HTMLTitleElement::insertedInto): Call titleElementAdded unconditionally.
The checks to see if the title element is connected to the document and not in the
shadow tree are now handled by the Document class.
(WebCore::HTMLTitleElement::removedFrom): Same for titleElementRemoved.

* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::applySize): Removed incorrect caching of FontCascade
objects; these need to be created each time we draw.
(WebCore::MockRealtimeVideoSource::drawText): Create all the fonts here. Since this is
a mock for testing, there is no real performance concern with doing this.
* platform/mock/MockRealtimeVideoSource.h: Removed the FontCascade data members.

* rendering/RenderTreeAsText.cpp:
(WebCore::updateLayoutIgnoringPendingStylesheetsIncludingSubframes): Added. Used below
to update layout more thoroughly.
(WebCore::externalRepresentation): Update layout of all descendant frames, not just
the top level frame.

* svg/SVGTitleElement.cpp:
(WebCore::SVGTitleElement::insertedInto): Removed bogus firstChild check, bogus isSVGDocument
check, and unneeded isConnected check and call titleElementAdded unconditionally. The checks
are now handled by the Document class.
(WebCore::SVGTitleElement::removedFrom): Same for titleElementRemoved.

* testing/Internals.cpp:
(WebCore::Internals::layerTreeAsText const): Added missing updateLayoutIgnorePendingStylesheets,
since dumping the layer tree without first doing a layout will yield stale results.
(WebCore::Internals::layerIDForElement): Added missing updateLayoutIgnorePendingStylesheets,
since using a renderer to check if a layer exists without first doing a layout will yield stale results.
(WebCore::Internals::setElementUsesDisplayListDrawing): Ditto.
(WebCore::Internals::setElementTracksDisplayListReplay): Ditto.
(WebCore::Internals::displayListForElement): Ditto.
(WebCore::Internals::replayDisplayListForElement): Ditto.
(WebCore::Internals::isSelectPopupVisible): Added missing updateLayoutIgnorePendingStylesheets,
since working with the RenderMenuList without first doing a layout will yield stale results.
Also removed unneeded strict handling of null renderer, instead just returning false.
(WebCore::Internals::isPluginUnavailabilityIndicatorObscured): Removed unnneeded check of
renderer class, since the HTMLPlugInElement::isReplacementObscured already handles that correctly.
(WebCore::Internals::pageOverlayLayerTreeAsText const): Use updateLayoutIgnorePendingStylesheets
instead of the normal updateLayout for consistency with the behavior of the other functions in this
file, and because we need a real answer here.
(WebCore::Internals::scrollSnapOffsets): Ditto. Also rearranged the code so the renderer check is
done after updating the renderer tree.

Tools:

* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::setSelectedChild const): Handle null here. The old code instead
would trigger an Objective-C exception unnecessarily.

LayoutTests:

* svg/hittest/svg-tooltip.svg: Made this test easier to run outside of WebKitTestRunnner,
by removing some overzealous checks.

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

3 years ago[iOS WK2] Add plumbing for WKContentView to ask the web process for additional drag...
wenson_hsieh@apple.com [Wed, 6 Sep 2017 02:41:52 +0000 (02:41 +0000)]
[iOS WK2] Add plumbing for WKContentView to ask the web process for additional drag items
https://bugs.webkit.org/show_bug.cgi?id=176348
Work towards <rdar://problem/31144674>

Reviewed by Tim Horton.

Source/WebKit:

Adds boilerplate plumbing to request additional items to an existing session. This implements some UI-side logic
in WKContentView to send an additional drag items request and handle a response from the web process.
To start, WebPageProxy::requestAdditionalItemsForDragSession is invoked by -_dragInteraction:
itemsForAddingToSession:withTouchAtPoint:completion: in WKContentView, and the response from the web process is
handled in -[WKContentView _didHandleAdditionalDragItemsRequest:].

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _simulateItemsForAddingToSession:atLocation:completion:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:

Add SPI to simulate a request for additional drag items. See Tools/ChangeLog for more detail.

* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:

Add an IPC message handler for the additional drag items response from the web process.

* UIProcess/ios/DragDropInteractionState.h:
(WebKit::DragDropInteractionState::BlockPtr<void):
* UIProcess/ios/DragDropInteractionState.mm:
(WebKit::DragDropInteractionState::shouldRequestAdditionalItemForDragSession const):
(WebKit::DragDropInteractionState::dragSessionWillRequestAdditionalItem):

Invoke the new additional items completion handler when tearing down to avoid getting UIKit into a bad state.

(WebKit::DragDropInteractionState::dragAndDropSessionsDidEnd):
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::didHandleAdditionalDragItemsRequest):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _didHandleAdditionalDragItemsRequest:]):
(-[WKContentView _itemsForBeginningOrAddingToSessionWithRegistrationList:stagedDragSource:]):

Factors common logic to convert a staged WebItemProviderRegistrationInfoList and DragSourceState into a list of
drag items, invoking the private UI delegate in the process. This is called both when starting a drag session,
and adding items to an existing drag session.

(-[WKContentView _dragInteraction:itemsForAddingToSession:withTouchAtPoint:completion:]):

Implements a (proposed) additional drag item delegate that serves as an asynchronous alternative to the API
variant, -_dragInteraction:itemsForAddingToSession:withTouchAtPoint:. See <rdar://problem/33146803> for more
information.

(-[WKContentView dragInteraction:itemsForBeginningSession:]):

Refactored to use -_itemsForBeginningOrAddingToSessionWithRegistrationList:stagedDragSource:.

(-[WKContentView _simulateItemsForAddingToSession:atLocation:completion:]):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::didHandleAdditionalDragItemsRequest):
(WebKit::WebPageProxy::requestAdditionalItemsForDragSession):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

Add an IPC message handler for the additional drag items request from the UI process.

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

Tools:

Introduces new test infrastructure to simulate tapping to add additional items to the current drag session. We
add -[DataInteractionSimulator runFrom:to:additionalItemRequestLocations:], for which the last argument is a
dictionary mapping progress (a double between 0 and 1) to NSValues representing the location from which the drag
and drop simulation will request an additional drag item. During the simulated drag and drop, when the progress
value exceeds a value in the map of remaining additional item request locations, we halt drag simulation
progress for that runloop and instead request additional items from the location specified.

The only (useful) passing test we can create using the new machinery is one that verifies that preventDefault()
on dragstart works as expected, preventing additional items from being added. While this trivially passes now,
since the web-process-side of the additional items flow is not yet implemented, it should continue to pass after
the web process portion is implemented.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/selected-text-image-link-and-editable.html: Added.

Add a new test page that contains some non-editable text, an image, a link, and a rich text editable area.

* TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/ios/DataInteractionSimulator.h:
* TestWebKitAPI/ios/DataInteractionSimulator.mm:
(-[MockDragDropSession addItems:]):

Convenience method to add additional mock drag items to a drag or drop session.

(-[DataInteractionSimulator _resetSimulatedState]):
(-[DataInteractionSimulator runFrom:to:]):

Converted into a convenience wrapper around the latter version, passing in nil for the additional item request
locations dictionary.

(-[DataInteractionSimulator runFrom:to:additionalItemRequestLocations:]):
(-[DataInteractionSimulator _enqueuePendingAdditionalItemRequestLocations]):
(-[DataInteractionSimulator _sendQueuedAdditionalItemRequest]):

New helper methods to detect when and where additional items should be "added", and subsequently simulate adding
drag items at these given locations.

(-[DataInteractionSimulator _advanceProgress]):

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

3 years agoCompute the final score using geometric mean in Speedometer 2.0
rniwa@webkit.org [Wed, 6 Sep 2017 02:37:41 +0000 (02:37 +0000)]
Compute the final score using geometric mean in Speedometer 2.0
https://bugs.webkit.org/show_bug.cgi?id=172968

Reviewed by Saam Barati.

Make Speedometer 2.0 use the geometric mean of the subtotal of each test suite instead of the total..

In Speedometer 1.0, we used the total time to compute the final score because we wanted to make
the slowest framework and library faster. The fastest suite (FlightJS) still accounted for ~6% and
the slowest case (React) accounted for ~25% so we felt the total time, or the arithmetic mean with
a constant factor, was a good metric to track.

In the latest version of Speedometer 2.0, however, the fastest suite (Preact) runs in ~55ms whereas
the slowest suite (Inferno) takes 1.5s on Safari. Since the total time is 6.5s, Preact's suite only
accounts for ~0.8% of the total score while Inferno's suite accounts for ~23% of the total score.
Since the goal of Speedometer is to approximate different kinds of DOM API use patterns on the Web,
we want each framework & library to have some measurement impact on the overall benchmark score.

Furthermore, after r221205, we're testing both debug build of Ember.js as well as release build.
Since debug build is 4x slower, using the total time or the arithmetic mean thereof will effectively
give 4x as much weight to debug build of Ember.js relative to release build of Ember.js. Given only
~5% of websites that deploy Ember.js use debug build, this weighting is clearly not right.

This patch, therefore, replaces the arithmetic mean by the geometric mean to compute the final score.
It also moves the code to compute the final score to BenchmarkRunner to be shared between main.js
and InteractiveRunner.html.

* Speedometer/InteractiveRunner.html:
(.didRunSuites): Show geometric mean, arithmetic mean, total, as well as the score for completeness
since this is a debugging page for developers.
* Speedometer/resources/benchmark-runner.js:
(BenchmarkRunner.prototype.step): Added mean, geomean, and score as measuredValues' properties.
(BenchmarkRunner.prototype._runTestAndRecordResults): Removed the dead code.
(BenchmarkRunner.prototype._finalize): Compute and add total, arithmetic mean (just mean in the code),
and geometric mean (geomean) to measuredValues.
* Speedometer/resources/main.js:
(window.benchmarkClient): Replaced testsCount by stepsCount and _timeValues by _measuredValuesList.
(window.benchmarkClient.willRunTest):
(window.benchmarkClient.didRunTest):
(window.benchmarkClient.didRunSuites): Store measuredValues object instead of just the total time.
(window.benchmarkClient.didFinishLastIteration):
(window.benchmarkClient._computeResults):
(window.benchmarkClient._computeResults.valueForUnit): Renamed from totalTimeInDisplayUnit. Now simply
retrieves the values computed by BenchmarkRunner's_finalize.
(startBenchmark):
(computeScore): Deleted.

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

3 years agoAdd WKUIDelegatePrivate equivalent of WKPageUIClient's mouseDidMoveOverElement
commit-queue@webkit.org [Wed, 6 Sep 2017 01:23:38 +0000 (01:23 +0000)]
Add WKUIDelegatePrivate equivalent of WKPageUIClient's mouseDidMoveOverElement
https://bugs.webkit.org/show_bug.cgi?id=176428
<rdar://problem/29270035>

Patch by Alex Christensen <achristensen@webkit.org> on 2017-09-05
Reviewed by Tim Horton.

Source/WebKit:

Covered by a new API test.

* UIProcess/API/APIUIClient.h:
(API::UIClient::mouseDidMoveOverElement):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageUIClient):
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate):
(WebKit::UIDelegate::ContextMenuClient::menuFromProposedMenu):
(WebKit::UIDelegate::UIClient::createNewPageCommon):
(WebKit::UIDelegate::UIClient::runJavaScriptAlert):
(WebKit::UIDelegate::UIClient::runJavaScriptConfirm):
(WebKit::UIDelegate::UIClient::runJavaScriptPrompt):
(WebKit::UIDelegate::UIClient::runBeforeUnloadConfirmPanel):
(WebKit::UIDelegate::UIClient::takeFocus):
(WebKit::UIDelegate::UIClient::focus):
(WebKit::UIDelegate::UIClient::unfocus):
(WebKit::UIDelegate::UIClient::didExceedBackgroundResourceLimitWhileInForeground):
(WebKit::UIDelegate::UIClient::didNotHandleWheelEvent):
(WebKit::toNSEventModifierFlags):
(WebKit::UIDelegate::UIClient::mouseDidMoveOverElement):
(WebKit::UIDelegate::UIClient::toolbarsAreVisible):
(WebKit::UIDelegate::UIClient::didClickAutoFillButton):
(WebKit::UIDelegate::UIClient::handleAutoplayEvent):
(WebKit::requestUserMediaAuthorizationForDevices):
(WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
(WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin):
(WebKit::UIDelegate::UIClient::printFrame):
(WebKit::UIDelegate::UIClient::close):
(WebKit::UIDelegate::UIClient::fullscreenMayReturnToInline):
(WebKit::UIDelegate::UIClient::didEnterFullscreen):
(WebKit::UIDelegate::UIClient::didExitFullscreen):
(WebKit::UIDelegate::UIClient::requestPointerLock):
(WebKit::UIDelegate::UIClient::didLosePointerLock):
(WebKit::UIDelegate::UIClient::hasVideoInPictureInPictureDidChange):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::mouseDidMoveOverElement):
* UIProcess/WebPageProxy.h:

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm:
(-[MouseMoveOverElementDelegate _webView:mouseDidMoveOverElement:withFlags:userInfo:]):
(TEST):
* TestWebKitAPI/cocoa/TestWKWebView.h:
* TestWebKitAPI/cocoa/TestWKWebView.mm:
(-[TestWKWebView mouseMoveToPoint:withFlags:]):

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

3 years agoisNotCellSpeculation is wrong with respect to SpecEmpty
sbarati@apple.com [Wed, 6 Sep 2017 01:18:15 +0000 (01:18 +0000)]
isNotCellSpeculation is wrong with respect to SpecEmpty
https://bugs.webkit.org/show_bug.cgi?id=176429

Reviewed by Michael Saboff.

JSTests:

* microbenchmarks/is-not-cell-speculation-for-empty-value.js: Added.
(Foo):

Source/JavaScriptCore:

The isNotCellSpeculation(SpeculatedType t) function was not taking into account
SpecEmpty in the set for t. It should return false when SpecEmpty is present, since
the empty value will fail a NotCell check. This bug would cause us to erroneously
generate NotCellUse UseKinds for inputs that are the empty value, causing repeated OSR exits.

* bytecode/SpeculatedType.h:
(JSC::isNotCellSpeculation):

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

3 years agoBenchmark Runner WebDriver maximize window on browser launch
commit-queue@webkit.org [Wed, 6 Sep 2017 01:01:36 +0000 (01:01 +0000)]
Benchmark Runner WebDriver maximize window on browser launch
https://bugs.webkit.org/show_bug.cgi?id=175702

Patch by Matthew Stewart <matthew_r_stewart@apple.com> on 2017-09-05
Reviewed by Stephanie Lewis.

* Scripts/webkitpy/benchmark_runner/browser_driver/linux_browser_driver.py:
(LinuxBrowserDriver.launch_webdriver): added driver.maximize_window()
* Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py:
(OSXBrowserDriver._launch_webdriver): added driver.maximize_window()
* Scripts/webkitpy/benchmark_runner/webdriver_benchmark_runner.py:
(WebDriverBenchmarkRunner._run_one_test): added driver.quit()

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

3 years agoFix Benchmark Runner selenium autoinstall imports
commit-queue@webkit.org [Wed, 6 Sep 2017 01:00:48 +0000 (01:00 +0000)]
Fix Benchmark Runner selenium autoinstall imports
https://bugs.webkit.org/show_bug.cgi?id=175727

Patch by Matthew Stewart <matthew_r_stewart@apple.com> on 2017-09-05
Reviewed by Stephanie Lewis.

This fixes run-benchmark taking a long time to start with WebDriver.

Inside webdriver's __init__.py file, it imports many other modules.
So if we try to directly import autoinstalled.selenium.webdriver, it
will re-run the autoinstall __init__.py for each new imported module
that contains ".selenium"
TODO: fix this inside the autoinstall code, to only do one install per
import.

* Scripts/webkitpy/benchmark_runner/browser_driver/linux_chrome_driver.py:
(LinuxChromeDriver.launch_driver):
* Scripts/webkitpy/benchmark_runner/browser_driver/linux_firefox_driver.py:
(LinuxFirefoxDriver.launch_driver):
* Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py:
(OSXChromeDriver.launch_driver):
(OSXChromeCanaryDriver.launch_driver):
(create_chrome_options):
* Scripts/webkitpy/benchmark_runner/browser_driver/osx_firefox_driver.py:
(OSXFirefoxDriver.launch_driver):
(OSXFirefoxNightlyDriver.launch_driver):
* Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py:
(OSXSafariDriver.launch_driver):
* Scripts/webkitpy/benchmark_runner/webdriver_benchmark_runner.py:
(WebDriverBenchmarkRunner._run_one_test):

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

3 years agoEWS should report when a step succeeds
aakash_jain@apple.com [Tue, 5 Sep 2017 23:54:17 +0000 (23:54 +0000)]
EWS should report when a step succeeds
https://bugs.webkit.org/show_bug.cgi?id=176332
<rdar://problem/25224607>

Reviewed by Sam Weinig.

Most of the EWSes report only if a step fails, but do not report when a step succeed. For e.g.: If a build succeeds,
EWS does not report it. Information about a step passing is sometimes very valuable, especially when waiting for a
patch to complete processing. Sometimes, patch authors know that their changes are not covered by any tests. Having EWS
display that build was successful and it is currently running tests is valuable.

* Scripts/webkitpy/tool/commands/earlywarningsystem.py:
(AbstractEarlyWarningSystem.command_passed): Update the EWS status server when a command pass. This is
similar to what is done in Commit Queue and Style Queue.
* Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py:
(EarlyWarningSystemTest._default_expected_logs): Updated unit-tests appropriately.

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

3 years agoWeb Inspector: Layout flashing for internal View.prototype.layout
nvasilyev@apple.com [Tue, 5 Sep 2017 23:38:11 +0000 (23:38 +0000)]
Web Inspector: Layout flashing for internal View.prototype.layout
https://bugs.webkit.org/show_bug.cgi?id=176389

Reviewed by Matt Baker.

Add a checkbox to Settings (Debug panel) to draw an orange outline around an element every time View.prototype.layout is called.
This is similar to paint flashing, except this is only for View.prototype.layout.

* UserInterface/Base/Setting.js:
* UserInterface/Views/SettingsTabContentView.js:
(WI.SettingsTabContentView.prototype._createDebugSettingsView):
* UserInterface/Views/View.js:
(WI.View.prototype._layoutSubtree):
(WI.View.prototype._drawLayoutFlashingOutline):

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

3 years agoRelax keychain access to permit users to permanently allow client certificates
bfulgham@apple.com [Tue, 5 Sep 2017 23:36:59 +0000 (23:36 +0000)]
Relax keychain access to permit users to permanently allow client certificates
https://bugs.webkit.org/show_bug.cgi?id=175857
<rdar://problem/32293867>

Reviewed by Alex Christensen.

Further relax the write permissions on the user's Keychain directory to support local certificates.

* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:

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

3 years agoUnreviewed, rolling out r221495.
ryanhaddad@apple.com [Tue, 5 Sep 2017 23:33:49 +0000 (23:33 +0000)]
Unreviewed, rolling out r221495.

This change introduced  assertion failures on El Capitan Debug
WK2.

Reverted changeset:

"Move ServiceWorkerJob from FetchLoader to ThreadableLoader."
https://bugs.webkit.org/show_bug.cgi?id=176231
http://trac.webkit.org/changeset/221495

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

3 years agoAdd support for input.webkitEntries
cdumez@apple.com [Tue, 5 Sep 2017 23:28:54 +0000 (23:28 +0000)]
Add support for input.webkitEntries
https://bugs.webkit.org/show_bug.cgi?id=176257
<rdar://problem/34218671>

Reviewed by Andreas Kling.

Source/WebCore:

Add support for input.webkitEntries as per:
- https://wicg.github.io/entries-api/#html-forms

Our behavior matches Chrome and Firefox, rather than the specification. This means
that webkitEntries is only populated if the webkitdirectory flag is unset.

Tests: fast/forms/file/entries-api/drag-folder-webkitEntries.html
       fast/forms/file/entries-api/webkitdirectory-drag-folder-webkitEntries.html

* CMakeLists.txt:
* DerivedSources.make:
* Modules/entriesapi/HTMLInputElementEntriesAPI.cpp: Added.
(WebCore::HTMLInputElementEntriesAPI::webkitEntries):
* Modules/entriesapi/HTMLInputElementEntriesAPI.h: Added.
* Modules/entriesapi/HTMLInputElementEntriesAPI.idl: Added.
* WebCore.xcodeproj/project.pbxproj:
* bindings/scripts/generate-bindings.pl:
* bindings/scripts/test/JS/JSTestInterface.cpp:
(WebCore::jsTestInterfaceReflectAttributeGetter):
(WebCore::jsTestInterfaceReflectAttribute):
(WebCore::setJSTestInterfaceReflectAttributeSetter):
(WebCore::setJSTestInterfaceReflectAttribute):
* bindings/scripts/test/TestSupplemental.idl:
* html/HTMLInputElement.idl:

LayoutTests:

Add layout test coverage.

* fast/forms/file/entries-api/drag-folder-webkitEntries-expected.txt: Added.
* fast/forms/file/entries-api/drag-folder-webkitEntries.html: Added.
* fast/forms/file/entries-api/webkitdirectory-drag-folder-webkitEntries-expected.txt: Added.
* fast/forms/file/entries-api/webkitdirectory-drag-folder-webkitEntries.html: Added.
* http/wpt/entries-api/interfaces-expected.txt:
* platform/wk2/TestExpectations:

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

3 years agoMarked imported/w3c/web-platform-tests/html/browsers/history/the-history-interface...
pvollan@apple.com [Tue, 5 Sep 2017 23:18:44 +0000 (23:18 +0000)]
Marked imported/w3c/web-platform-tests/html/browsers/history/the-history-interface/joint_session_history/001.html as slow.

Unreviewed test gardening.

* platform/win/TestExpectations:

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

3 years agoFileSystemEntry API should ignore hidden files
cdumez@apple.com [Tue, 5 Sep 2017 22:53:59 +0000 (22:53 +0000)]
FileSystemEntry API should ignore hidden files
https://bugs.webkit.org/show_bug.cgi?id=176292
<rdar://problem/34257666>

Reviewed by Andreas Kling.

Source/WebCore:

FileSystemEntry API should ignore hidden files as the user likely does not mean
to expose those when drag'n dropping a folder.

Test: editing/pasteboard/enties-api/datatransfer-items-drop-hidden-file.html

* Modules/entriesapi/DOMFileSystem.cpp:
(WebCore::listDirectoryWithMetadata):
(WebCore::validatePathIsExpectedType):
(WebCore::fileType):
(WebCore::DOMFileSystem::getEntry):

LayoutTests:

Add layout test coverage.

* editing/pasteboard/enties-api/datatransfer-items-drop-getAsEntry-expected.txt:
* editing/pasteboard/enties-api/datatransfer-items-drop-getAsEntry.html:
* editing/pasteboard/enties-api/datatransfer-items-drop-hidden-file-expected.txt: Added.
* editing/pasteboard/enties-api/datatransfer-items-drop-hidden-file.html: Added.
* fast/forms/file/entries-api/resources/testFiles/.hidden.txt: Added.
* fast/forms/file/entries-api/resources/testFiles/.hidden/hidden.txt: Added.
* platform/win/TestExpectations:

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

3 years agoMarked svg/as-image/svg-image-with-data-uri-background.html as flaky.
jlewis3@apple.com [Tue, 5 Sep 2017 22:36:10 +0000 (22:36 +0000)]
Marked svg/as-image/svg-image-with-data-uri-background.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=172877

Unreviewed test gardening.

* platform/mac-wk1/TestExpectations:

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

3 years agoMake the distinction between entrypoints and CFG roots more clear by naming things...
sbarati@apple.com [Tue, 5 Sep 2017 21:30:05 +0000 (21:30 +0000)]
Make the distinction between entrypoints and CFG roots more clear by naming things better
https://bugs.webkit.org/show_bug.cgi?id=176336

Reviewed by Mark Lam and Keith Miller and Michael Saboff.

This patch does renaming to make the distinction between Graph::m_entrypoints
and Graph::m_numberOfEntrypoints more clear. The source of confusion is that
Graph::m_entrypoints.size() is not equivalent to Graph::m_numberOfEntrypoints.
Graph::m_entrypoints is really just the CFG roots. In CPS, this vector has
size >= 1. In SSA, the size is always 1. This patch renames Graph::m_entrypoints
to Graph::m_roots. To be consistent, this patch also renames Graph's m_entrypointToArguments
field to m_rootToArguments.

Graph::m_numberOfEntrypoints retains its name. This field is only used in SSA
when compiling with EntrySwitch. It represents the logical number of entrypoints
the compilation will end up with. Each EntrySwitch has m_numberOfEntrypoints
cases.

* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
(JSC::DFG::ByteCodeParser::parseCodeBlock):
* dfg/DFGCFG.h:
(JSC::DFG::CFG::roots):
(JSC::DFG::CPSCFG::CPSCFG):
* dfg/DFGCPSRethreadingPhase.cpp:
(JSC::DFG::CPSRethreadingPhase::specialCaseArguments):
* dfg/DFGDCEPhase.cpp:
(JSC::DFG::DCEPhase::run):
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::dump):
(JSC::DFG::Graph::determineReachability):
(JSC::DFG::Graph::blocksInPreOrder):
(JSC::DFG::Graph::blocksInPostOrder):
(JSC::DFG::Graph::methodOfGettingAValueProfileFor):
* dfg/DFGGraph.h:
(JSC::DFG::Graph::isRoot):
(JSC::DFG::Graph::isEntrypoint): Deleted.
* dfg/DFGInPlaceAbstractState.cpp:
(JSC::DFG::InPlaceAbstractState::initialize):
* dfg/DFGLoopPreHeaderCreationPhase.cpp:
(JSC::DFG::createPreHeader):
* dfg/DFGMaximalFlushInsertionPhase.cpp:
(JSC::DFG::MaximalFlushInsertionPhase::run):
(JSC::DFG::MaximalFlushInsertionPhase::treatRegularBlock):
* dfg/DFGOSREntrypointCreationPhase.cpp:
(JSC::DFG::OSREntrypointCreationPhase::run):
* dfg/DFGPredictionInjectionPhase.cpp:
(JSC::DFG::PredictionInjectionPhase::run):
* dfg/DFGSSAConversionPhase.cpp:
(JSC::DFG::SSAConversionPhase::run):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::checkArgumentTypes):
(JSC::DFG::SpeculativeJIT::linkOSREntries):
* dfg/DFGTypeCheckHoistingPhase.cpp:
(JSC::DFG::TypeCheckHoistingPhase::run):
* dfg/DFGValidate.cpp:

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

3 years agoStitchMarker: build fix
jfbastien@apple.com [Tue, 5 Sep 2017 21:18:24 +0000 (21:18 +0000)]
StitchMarker: build fix

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

3 years agoDataTransferItem tests are timing out on Windows.
pvollan@apple.com [Tue, 5 Sep 2017 21:17:42 +0000 (21:17 +0000)]
DataTransferItem tests are timing out on Windows.
https://bugs.webkit.org/show_bug.cgi?id=176423.

Unreviewed test gardening.

* platform/win/TestExpectations:

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

3 years agoWSL should support the bool type
mmaxfield@apple.com [Tue, 5 Sep 2017 21:11:59 +0000 (21:11 +0000)]
WSL should support the bool type
https://bugs.webkit.org/show_bug.cgi?id=176285

Reviewed by Filip Pizlo.

Very similar to the int and uint types. This patch also adds support for a logical negation expression "!x".
This patch also reverts the ability of the program author to create their own "operator!()", and instead
adds the ability of the program author to create their own "operator bool()". The code is generic, so
programmers can make two arbitrary types Foo and Bar, and implement a "operator Bar(Foo)." The logical
negation expression is a built-in, and requires its argument be a bool.

* WebGPUShadingLanguageRI/All.js:
* WebGPUShadingLanguageRI/BoolLiteral.js: Copied from Tools/WebGPUShadingLanguageRI/NativeFunc.js.
(BoolLiteral):
(BoolLiteral.prototype.get value):
(BoolLiteral.prototype.get isConstexpr):
(BoolLiteral.prototype.toString):
* WebGPUShadingLanguageRI/Checker.js:
* WebGPUShadingLanguageRI/Evaluator.js:
(Evaluator.prototype.visitBoolLiteral):
(Evaluator.prototype.visitLogicalNot):
* WebGPUShadingLanguageRI/Func.js:
(Func):
(Func.prototype.get isCast):
(Func.prototype.toDeclString):
* WebGPUShadingLanguageRI/FuncDef.js:
(FuncDef):
(FuncDef.prototype.get body):
(FuncDef.prototype.rewrite):
* WebGPUShadingLanguageRI/Intrinsics.js:
(Intrinsics):
* WebGPUShadingLanguageRI/Lexer.js:
(Lexer.prototype.next):
(Lexer):
* WebGPUShadingLanguageRI/LogicalNot.js: Copied from Tools/WebGPUShadingLanguageRI/NativeFunc.js.
(LogicalNot):
(LogicalNot.prototype.get operand):
(LogicalNot.prototype.toString):
* WebGPUShadingLanguageRI/NativeFunc.js:
(NativeFunc):
* WebGPUShadingLanguageRI/Parse.js:
(parseTerm):
(parsePossiblePrefix):
(parsePossibleRelationalEquality):
(parseFuncName):
(parseOperatorFuncDefValues):
(parseNonOperatorFuncDefValues):
(parseGenericFuncDefValues):
(parseFuncDecl):
(parseProtocolFuncDecl):
(parseFuncDef):
(parseNative):
(parse):
* WebGPUShadingLanguageRI/Rewriter.js:
(Rewriter.prototype.visitBoolLiteral):
(Rewriter.prototype.visitLogicalNot):
(Rewriter):
* WebGPUShadingLanguageRI/StandardLibrary.js:
* WebGPUShadingLanguageRI/Test.html:
* WebGPUShadingLanguageRI/Test.js:
(makeUInt):
(makeBool):
(checkUInt):
(checkBool):
(TEST_literalBool):
(TEST_identityBool):
(TEST_intSimpleMath):
(TEST_uintSimpleMath):
(TEST_equality):
(TEST_logicalNegation):
(TEST_notEquality):
(TEST_equalityTypeFailure):
(TEST_add1): Deleted.
* WebGPUShadingLanguageRI/TypeDefResolver.js:
(TypeDefResolver.prototype.visitFuncDef):
* WebGPUShadingLanguageRI/Visitor.js:
(Visitor.prototype.visitBoolLiteral):
(Visitor.prototype.visitLogicalNot):

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

3 years agoCache Storage Engine should not mix different origin caches
commit-queue@webkit.org [Tue, 5 Sep 2017 21:00:23 +0000 (21:00 +0000)]
Cache Storage Engine should not mix different origin caches
https://bugs.webkit.org/show_bug.cgi?id=176394

Patch by Youenn Fablet <youenn@apple.com> on 2017-09-05
Reviewed by Alex Christensen.

Source/WebKit:

* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::readCachesFromDisk): Initializing the salt before creating the Caches object
so that its persistency path is correctly computed.
* NetworkProcess/cache/CacheStorageEngineCaches.cpp:
(WebKit::CacheStorage::cachesRootPath): Setting origin as partition string.

LayoutTests:

* http/tests/cache-storage/cache-origins.https-expected.txt: Added.
* http/tests/cache-storage/cache-origins.https.html: Added.
* http/tests/cache-storage/resources/cache-persistency-iframe.html:

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

3 years agoUse a single network storage session for stateless connections
bfulgham@apple.com [Tue, 5 Sep 2017 20:41:31 +0000 (20:41 +0000)]
Use a single network storage session for stateless connections
https://bugs.webkit.org/show_bug.cgi?id=176386
<rdar://problem/34262148>

Reviewed by Alex Christensen.

Change the name of 'm_dataTaskMapWithoutCredentials' to 'm_dataTaskMapWithoutState'
to reflect that the data tasks do not involve credential or cookie storage. Ditto for
the change from 'm_sessionWIthoutCredentialStorage' to 'm_statelessSession'.

This update should not change behavior, unless some stateless sessions were depending
on cookies to be persistent (which would be a bug!)

* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Update for new variable names.
(WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa): Ditto.
* NetworkProcess/cocoa/NetworkSessionCocoa.h:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Update the configuration to block
cookies as well.
(WebKit::NetworkSessionCocoa::invalidateAndCancel): Update for new names.
(WebKit::NetworkSessionCocoa::clearCredentials): Ditto.
(WebKit::NetworkSessionCocoa::dataTaskForIdentifier): Ditto.

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

3 years agoUnskip two tests which was skipped by mistake.
pvollan@apple.com [Tue, 5 Sep 2017 20:19:30 +0000 (20:19 +0000)]
Unskip two tests which was skipped by mistake.

Unreviewed test gardening.

* platform/win/TestExpectations:

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

3 years agoUpdate font selection algorithm to match latest CSS spec
mmaxfield@apple.com [Tue, 5 Sep 2017 19:57:08 +0000 (19:57 +0000)]
Update font selection algorithm to match latest CSS spec
https://bugs.webkit.org/show_bug.cgi?id=175236

Reviewed by Darin Adler.

Source/WebCore:

The CSS WG tweaked the generalization of the font selection
algorithm between levels 3 and 4. In particular, the behavior
of weights between 400 and 500 works a little differently.

https://github.com/w3c/csswg-drafts/commit/f6973a21847f1c200ed38bff05dc543cebe1c827

Test: fast/text/variations/font-selection-font-weight.html

* platform/graphics/FontSelectionAlgorithm.cpp:
(WebCore::FontSelectionAlgorithm::weightDistance const):
* platform/graphics/FontSelectionAlgorithm.h:
(WebCore::lowerWeightSearchThreshold):
(WebCore::upperWeightSearchThreshold):
(WebCore::weightSearchThreshold): Deleted.

LayoutTests:

* fast/text/variations/font-selection-font-weight-expected.html: Added.
* fast/text/variations/font-selection-font-weight.html: Added.

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

3 years agoMarked media/W3C/video/events/event_progress.html as flaky.
jlewis3@apple.com [Tue, 5 Sep 2017 19:56:07 +0000 (19:56 +0000)]
Marked media/W3C/video/events/event_progress.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=175678

Unreviewed test gardening.
* platform/wk2/TestExpectations:

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

3 years ago[Win] Compile errors in pathByAppendingComponents.
pvollan@apple.com [Tue, 5 Sep 2017 19:02:30 +0000 (19:02 +0000)]
[Win] Compile errors in pathByAppendingComponents.
https://bugs.webkit.org/show_bug.cgi?id=176387

Reviewed by Brent Fulgham.

The pathByAppendingComponents function has changed signature.

* platform/win/FileSystemWin.cpp:
(WebCore::pathByAppendingComponents):

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

3 years agoFix capitalization of scheduleinvalidateStyleAndLayerComposition
simon.fraser@apple.com [Tue, 5 Sep 2017 18:17:29 +0000 (18:17 +0000)]
Fix capitalization of scheduleinvalidateStyleAndLayerComposition
https://bugs.webkit.org/show_bug.cgi?id=176266

Reviewed by Antti Koivisto.

* html/HTMLFrameOwnerElement.cpp:
(WebCore::HTMLFrameOwnerElement::scheduleInvalidateStyleAndLayerComposition):
(WebCore::HTMLFrameOwnerElement::scheduleinvalidateStyleAndLayerComposition): Deleted.
* html/HTMLFrameOwnerElement.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::attachRootLayer):
(WebCore::RenderLayerCompositor::detachRootLayer):
(WebCore::RenderLayerCompositor::notifyIFramesOfCompositingChange):

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

3 years agoUnreviewed, rolling out r221603.
jlewis3@apple.com [Tue, 5 Sep 2017 18:15:56 +0000 (18:15 +0000)]
Unreviewed, rolling out r221603.

This caused accessibility/mac/select-element-selection-with-
optgroups.html to consistently timeout on macOS

Reverted changeset:

"Fix a few minor problems found while working toward removing
unneeded calls to updateStyle"
https://bugs.webkit.org/show_bug.cgi?id=176279
http://trac.webkit.org/changeset/221603

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

3 years ago[WinCairo] Add Network Process files for wincairo webkit
commit-queue@webkit.org [Tue, 5 Sep 2017 18:08:14 +0000 (18:08 +0000)]
[WinCairo] Add Network Process files for wincairo webkit
https://bugs.webkit.org/show_bug.cgi?id=176069

Patch by Yousuke Kimoto <yousuke.kimoto@sony.com> on 2017-09-05
Reviewed by Alex Christensen.

* NetworkProcess/Downloads/curl/DownloadCurl.cpp: Added.
(WebKit::Download::resume):
(WebKit::Download::platformDidFinish):
(WebKit::Download::startNetworkLoadWithHandle):
(WebKit::Download::startNetworkLoad):
(WebKit::Download::platformInvalidate):
* NetworkProcess/EntryPoint/win/NetworkProcessMain.cpp: Added.
(main):
* NetworkProcess/curl/NetworkProcessCurl.cpp: Added.
(WebKit::NetworkProcess::platformInitializeNetworkProcess):
(WebKit::NetworkProcess::platformSetURLCacheSize):
(WebKit::NetworkProcess::allowSpecificHTTPSCertificateForHost):
(WebKit::NetworkProcess::clearCacheForAllOrigins):
(WebKit::NetworkProcess::clearDiskCache):
(WebKit::NetworkProcess::platformTerminate):
* NetworkProcess/curl/RemoteNetworkingContextCurl.cpp: Added.
(WebKit::RemoteNetworkingContext::~RemoteNetworkingContext):
(WebKit::RemoteNetworkingContext::isValid const):
(WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
(WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
(WebKit::RemoteNetworkingContext::storageSession const):
(WebKit::RemoteNetworkingContext::blockedError const):
* NetworkProcess/win/NetworkProcessMainWin.cpp: Added.
(WebKit::NetworkProcessMainWin):
* NetworkProcess/win/NetworkProcessMainWin.h: Added.
* NetworkProcess/win/SystemProxyWin.cpp: Added.
(WindowsSystemProxy::getSystemHttpProxy):
(WindowsSystemProxy::setCurlHttpProxy):
(WindowsSystemProxy::parseProxyString):
* NetworkProcess/win/SystemProxyWin.h: Added.
* PlatformWin.cmake:

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

3 years agoAllow retrieving Cache Storage records for a given URL only
commit-queue@webkit.org [Tue, 5 Sep 2017 17:52:51 +0000 (17:52 +0000)]
Allow retrieving Cache Storage records for a given URL only
https://bugs.webkit.org/show_bug.cgi?id=176202

Patch by Youenn Fablet <youenn@apple.com> on 2017-09-05
Reviewed by Alex Christensen.

Source/WebCore:

No observable change of behavior.

Adding a URL parameter to CacheStorageConnection::retrieveRecords.
If given URL is null, all records will be retrieved, which is useful for the keys method.
Other operations only need records that share the same URL (modulo query string and frag id).

* Modules/cache/Cache.cpp:
(WebCore::Cache::matchAll):
(WebCore::Cache::keys):
(WebCore::Cache::retrieveRecords):
(WebCore::Cache::queryCache):
* Modules/cache/Cache.h:
* Modules/cache/CacheStorageConnection.cpp:
(WebCore::CacheStorageConnection::retrieveRecords):
* Modules/cache/CacheStorageConnection.h:
(WebCore::CacheStorageConnection::doRetrieveRecords):
* Modules/cache/WorkerCacheStorageConnection.cpp:
(WebCore::WorkerCacheStorageConnection::doRetrieveRecords):
* Modules/cache/WorkerCacheStorageConnection.h:
* platform/URL.h:

Source/WebKit:

Update CacheStorageEngineCache to store records as a map URL -> Vector of Records.
This allows regular record retrieval to be faster.
Retrieval of all records is less efficient but this should happen less often.

* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::retrieveRecords):
* NetworkProcess/cache/CacheStorageEngine.h:
* NetworkProcess/cache/CacheStorageEngineCache.cpp:
(WebKit::CacheStorage::queryCache):
(WebKit::CacheStorage::Cache::retrieveRecords const):
(WebKit::CacheStorage::computeKeyURL):
(WebKit::CacheStorage::Cache::addNewURLRecord):
(WebKit::CacheStorage::Cache::recordsFromURL):
(WebKit::CacheStorage::Cache::recordsFromURL const):
(WebKit::CacheStorage::Cache::put):
(WebKit::CacheStorage::Cache::remove):
* NetworkProcess/cache/CacheStorageEngineCache.h:
* NetworkProcess/cache/CacheStorageEngineConnection.cpp:
(WebKit::CacheStorageEngineConnection::retrieveRecords):
* NetworkProcess/cache/CacheStorageEngineConnection.h:
* NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
* WebProcess/Cache/WebCacheStorageConnection.cpp:
(WebKit::WebCacheStorageConnection::doRetrieveRecords):
* WebProcess/Cache/WebCacheStorageConnection.h:

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

3 years agoWebKitTestRunner should set the cache storage directory path
commit-queue@webkit.org [Tue, 5 Sep 2017 17:48:42 +0000 (17:48 +0000)]
WebKitTestRunner should set the cache storage directory path
https://bugs.webkit.org/show_bug.cgi?id=176373

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

Source/WebKit:

* UIProcess/API/C/WKContextConfigurationRef.cpp:
(WKContextConfigurationCopyCacheStorageDirectory):
(WKContextConfigurationSetCacheStorageDirectory):
* UIProcess/API/C/WKContextConfigurationRef.h:

Tools:

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::generateContextConfiguration const):

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

3 years agotest262: Completion values for control flow do not match the spec
commit-queue@webkit.org [Tue, 5 Sep 2017 17:43:51 +0000 (17:43 +0000)]
test262: Completion values for control flow do not match the spec
https://bugs.webkit.org/show_bug.cgi?id=171265

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-09-05
Reviewed by Saam Barati.

JSTests:

* stress/completion-value.js:
Condensed test for completion values in top level statements.

* stress/super-get-by-id.js:
ClassDeclaration when evaled no longer produce values. Convert
these to ClassExpressions so they produce the class value.

* ChakraCore/test/GlobalFunctions/evalreturns3.baseline-jsc:
This is a progression for currect spec behavior.

* mozilla/mozilla-tests.yaml:
This test is now outdated, so mark it as failing for that reason.

* test262.yaml:
Passing all "cptn" completion value tests.

Source/JavaScriptCore:

* bytecompiler/BytecodeGenerator.h:
(JSC::BytecodeGenerator::shouldBeConcernedWithCompletionValue):
When we care about having proper completion values (global code
in programs, modules, and eval) insert undefined results for
control flow statements.

* bytecompiler/NodesCodegen.cpp:
(JSC::SourceElements::emitBytecode):
Reduce writing a default `undefined` value to the completion result to
only once before the last statement we know will produce a value.

(JSC::IfElseNode::emitBytecode):
(JSC::WithNode::emitBytecode):
(JSC::WhileNode::emitBytecode):
(JSC::ForNode::emitBytecode):
(JSC::ForInNode::emitBytecode):
(JSC::ForOfNode::emitBytecode):
(JSC::SwitchNode::emitBytecode):
Insert an undefined to handle cases where code may break out of an
if/else or with statement (break/continue).

(JSC::TryNode::emitBytecode):
Same handling for break cases. Also, finally block statement completion
values are always ignored for the try statement result.

(JSC::ClassDeclNode::emitBytecode):
Class declarations, like function declarations, produce an empty result.

* parser/Nodes.cpp:
(JSC::SourceElements::lastStatement):
(JSC::SourceElements::hasCompletionValue):
(JSC::SourceElements::hasEarlyBreakOrContinue):
(JSC::BlockNode::lastStatement):
(JSC::BlockNode::singleStatement):
(JSC::BlockNode::hasCompletionValue):
(JSC::BlockNode::hasEarlyBreakOrContinue):
(JSC::ScopeNode::singleStatement):
(JSC::ScopeNode::hasCompletionValue):
(JSC::ScopeNode::hasEarlyBreakOrContinue):
The only non-trivial cases need to loop through their list of statements
to determine if this has a completion value or not. Likewise for
determining if there is an early break / continue, meaning a break or
continue statement with no preceding statement that has a completion value.

* parser/Nodes.h:
(JSC::StatementNode::next):
(JSC::StatementNode::hasCompletionValue):
Helper to check if a statement nodes produces a completion value or not.

Tools:

* Scripts/run-jsc-stress-tests:
Include a :failDueToOutdatedOrBadTest to mark failures with justification.

LayoutTests:

* js/eval-throw-return-expected.txt:
* js/kde/completion-expected.txt:
* js/kde/script-tests/completion.js:
* js/script-tests/eval-throw-return.js:
* sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A9-expected.txt:
* sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A9.1-expected.txt:
Rebaseline expectations. These are all outdated. In fact the sputnik
tests were imported into test262 and modified for ES2015.

* js/script-tests/function-toString-vs-name.js:
ClassDeclarations on their own don't produce a value. So output
the class value so the test behaves as expected.

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

3 years agoAdd WKUIDelegatePrivate equivalent of WKPageUIClient's unavailablePluginButtonClicked
achristensen@apple.com [Tue, 5 Sep 2017 17:36:52 +0000 (17:36 +0000)]
Add WKUIDelegatePrivate equivalent of WKPageUIClient's unavailablePluginButtonClicked
https://bugs.webkit.org/show_bug.cgi?id=176274
<rdar://problem/29270035>

Reviewed by Darin Adler.

Source/WebKit:

* UIProcess/API/APIUIClient.h:
(API::UIClient::unavailablePluginButtonClicked):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageUIClient):
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _setPluginsEnabled:]):
(-[WKPreferences _pluginsEnabled]):
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate):
(WebKit::toWKPluginUnavailabilityReason):
(WebKit::UIDelegate::UIClient::unavailablePluginButtonClicked):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::unavailablePluginButtonClicked):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm:
(-[PluginDelegate _webView:unavailablePluginButtonClickedWithReason:pluginInfo:]):
(TEST):

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

3 years agoAllow classes to have modern and legacy decoders to aid transition
achristensen@apple.com [Tue, 5 Sep 2017 17:33:06 +0000 (17:33 +0000)]
Allow classes to have modern and legacy decoders to aid transition
https://bugs.webkit.org/show_bug.cgi?id=176186

Reviewed by Zan Dobersek.

To illustrate this, I made legacy and modern decoders to WTF::String and transitioned one String decoder.

* Platform/IPC/ArgumentCoder.h:
* Platform/IPC/ArgumentCoders.cpp:
(IPC::ArgumentCoder<String>::decode):
* Platform/IPC/ArgumentCoders.h:
* Platform/IPC/Decoder.h:
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::decode):

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

3 years ago[WPE] Test gardening.
commit-queue@webkit.org [Tue, 5 Sep 2017 16:44:53 +0000 (16:44 +0000)]
[WPE] Test gardening.
https://bugs.webkit.org/show_bug.cgi?id=176370

Unreviewed test gardening.

Patch by Charlie Turner <cturner@igalia.com> on 2017-09-05

* platform/wpe/TestExpectations: Updated accordingly.
* platform/wpe/js/dom/global-constructors-attributes-expected.txt: Rebaselined

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

3 years agoRemove some unused bits of code and resources
timothy_horton@apple.com [Tue, 5 Sep 2017 15:52:32 +0000 (15:52 +0000)]
Remove some unused bits of code and resources
https://bugs.webkit.org/show_bug.cgi?id=176275

Reviewed by Dan Bernstein.

Source/WebCore:

No new tests, just removing things.

* Resources/textAreaResizeCorner.tiff: Removed.
* Resources/missingImage.tiff: Removed.
These files have PNG versions that include more resolutions.

* Resources/hScrollControl_left.png: Removed.
* Resources/hScrollControl_middle.png: Removed.
* Resources/hScrollControl_right.png: Removed.
* Resources/vScrollControl_bottom.png: Removed.
* Resources/vScrollControl_middle.png: Removed.
* Resources/vScrollControl_top.png: Removed.
* Resources/decrementArrow.tiff: Removed.
* Resources/incrementArrow.tiff: Removed.
* Resources/markedLeft.png: Removed.
* Resources/markedMiddle.png: Removed.
* Resources/markedRight.png: Removed.
These were added in r161638 as part of the iOS upstreaming, but were
unused even then.

* Resources/inputSpeech.tiff: Removed.
The feature this image was for was removed in r172259; the PNG version
of this image was removed in r172384.

* WebCore.xcodeproj/project.pbxproj:
* platform/ios/FileSystemIOS.h: Removed.
* platform/ios/FileSystemIOS.mm: Removed.
Remove FileSystemIOS; one function is unused, the other is not at all
iOS-specific and can be folded into FileSystemCocoa.

* platform/FileSystem.h:
* platform/cocoa/FileSystemCocoa.mm:
(WebCore::createTemporaryDirectory):
Move this in from FileSystemIOS.

* platform/PlatformEvent.cpp: Removed.
Remove this unused file.

* platform/ios/QuickLook.mm:
* platform/ios/WebItemProviderPasteboard.mm:
Include FileSystem instead of FileSystemIOS.

Source/WebKitLegacy/mac:

* Misc/WebNSFileManagerExtras.mm:
Include FileSystem instead of FileSystemIOS.

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

3 years agoSkip service workers tests on Windows.
pvollan@apple.com [Tue, 5 Sep 2017 15:44:20 +0000 (15:44 +0000)]
Skip service workers tests on Windows.

Unreviewed test gardening.

* platform/win/TestExpectations:

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

3 years agoUse TilesBacking for iframes when async frame scrolling is enabled
commit-queue@webkit.org [Tue, 5 Sep 2017 13:38:10 +0000 (13:38 +0000)]
Use TilesBacking for iframes when async frame scrolling is enabled
https://bugs.webkit.org/show_bug.cgi?id=173644

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

Source/WebCore:

This patch adds creation of TilesBacking for non-main frames when async frame scrolling is
enabled. RenderLayerBacking::m_isMainFrameLayerWithTiledBacking is also renamed to reflect
that tiled backing is not exclusive to the main frame. More adjustments might be needed for
non-main frames and will be handled in follow-up commits.

Test: compositing/tiling/tiled-drawing-async-frame-scrolling.html

* rendering/RenderLayerBacking.cpp: Rename m_isMainFrameLayerWithTiledBacking
* rendering/RenderLayerBacking.h: Rename isMainFrameLayerWithTiledBacking and
m_isMainFrameLayerWithTiledBacking.
* rendering/RenderLayerCompositor.cpp: Use isFrameLayerWithTiledBacking

Source/WebKit:

This patch adds creation of TilesBacking for non-main frames when async frame scrolling is
enabled. RenderLayerBacking::m_isMainFrameLayerWithTiledBacking is also renamed to reflect
that tiled backing is not exclusive to the main frame. More adjustments might be needed for
non-main frames and will be handled in follow-up commits.

* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::shouldUseTiledBackingForFrameView): Also use tiled
backing when asyncFrameScrollingEnabled is true.
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::shouldUseTiledBackingForFrameView): Ditto.

LayoutTests:

This patch adds a test to verify the graphic layers created for frames when async scrolling
is enabled. On iOS and macOS and WK2, new layers appear for the tiled content, scroll bars...

* compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt: Added.
* compositing/tiling/tiled-drawing-async-frame-scrolling.html: Added.
* platform/ios-wk2/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt: Added.
* platform/mac-wk2/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt: Added.

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

3 years agoHTMLMediaElement: attach any existing EME CDMInstance in mediaEngineWasUpdated()
zandobersek@gmail.com [Tue, 5 Sep 2017 11:31:21 +0000 (11:31 +0000)]
HTMLMediaElement: attach any existing EME CDMInstance in mediaEngineWasUpdated()
https://bugs.webkit.org/show_bug.cgi?id=176354

Reviewed by Xabier Rodriguez-Calvar.

It's common for MediaKeys to be set on an HTMLMediaElement object before
any resource is loaded for that element, meaning no underlying MediaPlayer
exists at that point. In order to not stall the pipeline when encrypted
content is finally loaded, the CDMInstance object of the current MediaKeys
set on this element should be attached in mediaEngineWasUpdated() that's
called whenever the underlying MediaPlayerPrivate object is replaced.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaEngineWasUpdated):

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

3 years ago[EME] HTMLMediaElement: setMediaKeys() should attach CDMInstance from the arriving...
zandobersek@gmail.com [Tue, 5 Sep 2017 11:29:03 +0000 (11:29 +0000)]
[EME] HTMLMediaElement: setMediaKeys() should attach CDMInstance from the arriving MediaKeys
https://bugs.webkit.org/show_bug.cgi?id=176352

Reviewed by Xabier Rodriguez-Calvar.

In HTMLMediaElement::setMediaKeys(), use the incoming MediaKeys object
to retrieve the CDMInstance that is then attached to the current
MediaPlayer, if any.

Covered by existing W3C tests that focus on multi-key use cases.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setMediaKeys):

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

3 years ago[Win] Fix the wincairo build after r221558 and r221583
commit-queue@webkit.org [Tue, 5 Sep 2017 08:20:09 +0000 (08:20 +0000)]
[Win] Fix the wincairo build after r221558 and r221583
https://bugs.webkit.org/show_bug.cgi?id=176353

Patch by Yoshiaki Jitsukawa <Yoshiaki.Jitsukawa@sony.com> on 2017-09-05
Reviewed by Yusuke Suzuki.

Source/WebCore:

* platform/win/FileSystemWin.cpp:
(WebCore::isSymbolicLink): Fix a "missing type specifier" error
(WebCore::findDataToFileMetadata): Fix a narrowing convertion error

Source/WTF:

* wtf/Assertions.cpp:

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

3 years agoSpeedometer 2.0: Add dummy node to notify app is ready for Backbone suite
commit-queue@webkit.org [Tue, 5 Sep 2017 08:17:25 +0000 (08:17 +0000)]
Speedometer 2.0: Add dummy node to notify app is ready for Backbone suite
https://bugs.webkit.org/show_bug.cgi?id=176142

Patch by Shiyu Zhang <shiyu.zhang@intel.com> on 2017-09-05
Reviewed by Ryosuke Niwa.

Create a dummy node to notify that app is ready for Backbone suite. It prevents Speedometer injecting items before app.js is loaded.

* Speedometer/resources/tests.js:
(Suites.push.prepare):
* Speedometer/resources/todomvc/architecture-examples/backbone/js/app.js:

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

3 years ago[GTK] Rename PLUGIN_ARCHITECTURE(X11) as PLUGIN_ARCHITECTURE(UNIX)
carlosgc@webkit.org [Tue, 5 Sep 2017 07:39:44 +0000 (07:39 +0000)]
[GTK] Rename PLUGIN_ARCHITECTURE(X11) as PLUGIN_ARCHITECTURE(UNIX)
https://bugs.webkit.org/show_bug.cgi?id=176330

Reviewed by Michael Catanzaro.

It's no longer X11 specific since it's also used in Wayland when the X11 target is enabled. It should be renamed
as UNIX and make it available when building the wayland target even if the X11 on is disabled.

* PlatformGTK.cmake:
* PlatformWPE.cmake:
* PluginProcess/unix/PluginProcessMainUnix.cpp:
* Shared/Plugins/Netscape/NetscapePluginModule.cpp:
(WebKit::NetscapePluginModule::tryLoad):
* Shared/Plugins/Netscape/NetscapePluginModule.h:
* Shared/Plugins/Netscape/unix/NetscapePluginModuleUnix.cpp: Renamed from Source/WebKit/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp.
* UIProcess/Plugins/PluginProcessProxy.h:
* UIProcess/Plugins/gtk/PluginInfoCache.cpp:
(WebKit::PluginInfoCache::getPluginInfo):
(WebKit::PluginInfoCache::updatePluginInfo):
* UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
(WebKit::PluginProcessProxy::scanPlugin):
* WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
(WebKit::NPN_InvalidateRect):
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::initialize):
(WebKit::NetscapePlugin::destroy):
(WebKit::NetscapePlugin::geometryDidChange):
* WebProcess/Plugins/Netscape/NetscapePlugin.h:
* WebProcess/Plugins/Netscape/unix/NetscapePluginUnix.cpp:
* WebProcess/Plugins/Netscape/unix/NetscapePluginUnix.h:
* config.h:

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

3 years ago[GTK] Wrong use of PLUGIN_ARCHITECTURE(X11) in several places
carlosgc@webkit.org [Tue, 5 Sep 2017 07:16:51 +0000 (07:16 +0000)]
[GTK] Wrong use of PLUGIN_ARCHITECTURE(X11) in several places
https://bugs.webkit.org/show_bug.cgi?id=176329

Reviewed by Michael Catanzaro.

.:

Only define MOZ_X11 if X11 target is enabled and always define XP_UNIX if NETSCAPE_PLUGIN_API is enabled.

* Source/cmake/OptionsGTK.cmake:

Source/WebKit:

We are using PLUGIN_ARCHITECTURE(X11) in several places where we should actually be using PLATFORM(X11). This is
confusing because PLUGIN_ARCHITECTURE(X11) is no longer specific to X11, it will be renamed as UNIX in a follow
up patch. Because of this we only support plugins in Wayland when building with both X11 and Wayland targets
enabled.

* PluginProcess/PluginControllerProxy.cpp:
* PluginProcess/PluginControllerProxy.h:
* PluginProcess/unix/PluginProcessMainUnix.cpp:
* Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:
(WebKit::NetscapePluginModule::determineQuirks):
* Shared/Plugins/PluginQuirks.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/gtk/WebPageProxyGtk.cpp:
* WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
(WebKit::NPN_GetValue):
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::shouldLoadSrcURL):
(WebKit::NetscapePlugin::initialize):
* WebProcess/Plugins/Netscape/unix/NetscapePluginUnix.cpp:
(WebKit::NetscapePlugin::platformHandleMouseEvent):
* WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
* WebProcess/Plugins/Netscape/x11/NetscapePluginX11.h:
* WebProcess/Plugins/PluginController.h:
* WebProcess/Plugins/PluginProxy.cpp:
* WebProcess/Plugins/PluginProxy.h:
* WebProcess/Plugins/PluginProxy.messages.in:
* WebProcess/Plugins/PluginView.cpp:
* WebProcess/Plugins/PluginView.h:

Tools:

* CMakeLists.txt: Build TestNetscapePlugIn when NETSCAPE_PLUGIN_API is enabled and only link to X11 libraries
when building the X11 target.
* DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt:
* DumpRenderTree/TestNetscapePlugIn/Tests/unix/CallInvalidateRectWithNullNPPArgument.cpp: Renamed from Tools/DumpRenderTree/TestNetscapePlugIn/Tests/x11/CallInvalidateRectWithNullNPPArgument.cpp.
* DumpRenderTree/TestNetscapePlugIn/main.cpp:
(NP_Initialize):
(NPP_HandleEvent):
(NPP_GetValue):

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

3 years agoUse StringView more in DOMFileSystem code
cdumez@apple.com [Tue, 5 Sep 2017 04:55:29 +0000 (04:55 +0000)]
Use StringView more in DOMFileSystem code
https://bugs.webkit.org/show_bug.cgi?id=176347

Reviewed by Darin Adler.

* Modules/entriesapi/DOMFileSystem.cpp:
(WebCore::resolveRelativeVirtualPath):
(WebCore::DOMFileSystem::evaluatePath):
* platform/FileSystem.h:
* platform/glib/FileSystemGlib.cpp:
(WebCore::pathByAppendingComponents):
* platform/posix/FileSystemPOSIX.cpp:
(WebCore::pathByAppendingComponents):
* platform/win/FileSystemWin.cpp:
(WebCore::pathByAppendingComponents):

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

3 years agotypeCheckHoistingPhase may emit a CheckStructure on the empty value which leads to...
sbarati@apple.com [Tue, 5 Sep 2017 04:10:53 +0000 (04:10 +0000)]
typeCheckHoistingPhase may emit a CheckStructure on the empty value which leads to a dereference of zero on 64 bit platforms
https://bugs.webkit.org/show_bug.cgi?id=176317

Reviewed by Keith Miller.

JSTests:

* stress/dont-crash-when-hoist-check-structure-on-tdz.js: Added.
(Foo):

Source/JavaScriptCore:

It turns out that TypeCheckHoistingPhase may hoist a CheckStructure up to
the SetLocal of a particular value where the value is the empty JSValue.
On 64-bit platforms, the empty value is zero. This means that the empty value
passes a cell check. This will lead to a crash when we dereference null to load
the value's structure. This patch teaches TypeCheckHoistingPhase to be conservative
in the structure checks it hoists. On 64-bit platforms, instead of emitting a
CheckStructure node, we now emit a CheckStructureOrEmpty node. This node allows
the empty value to flow through. If the value isn't empty, it'll perform the normal
structure check that CheckStructure performs. For now, we only emit CheckStructureOrEmpty
on 64-bit platforms since a cell check on 32-bit platforms does not allow the empty
value to flow through.

* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGArgumentsEliminationPhase.cpp:
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGConstantFoldingPhase.cpp:
(JSC::DFG::ConstantFoldingPhase::foldConstants):
* dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGNode.h:
(JSC::DFG::Node::convertCheckStructureOrEmptyToCheckStructure):
(JSC::DFG::Node::hasStructureSet):
* dfg/DFGNodeType.h:
* dfg/DFGObjectAllocationSinkingPhase.cpp:
* dfg/DFGPredictionPropagationPhase.cpp:
* dfg/DFGSafeToExecute.h:
(JSC::DFG::SafeToExecuteEdge::SafeToExecuteEdge):
(JSC::DFG::SafeToExecuteEdge::operator()):
(JSC::DFG::SafeToExecuteEdge::maySeeEmptyChild):
(JSC::DFG::safeToExecute):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::emitStructureCheck):
(JSC::DFG::SpeculativeJIT::compileCheckStructure):
* dfg/DFGSpeculativeJIT.h:
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGTypeCheckHoistingPhase.cpp:
(JSC::DFG::TypeCheckHoistingPhase::run):
* dfg/DFGValidate.cpp:
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileCheckStructureOrEmpty):

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

3 years agoSwitch HTMLMediaElement to release logging
eric.carlson@apple.com [Tue, 5 Sep 2017 03:44:05 +0000 (03:44 +0000)]
Switch HTMLMediaElement to release logging
https://bugs.webkit.org/show_bug.cgi?id=176065

Reviewed by Jer Noble.

Source/WebCore:

* dom/Document.cpp:
(WebCore::Document::privateBrowsingStateDidChange): Disable the logger when private browsing
mode is enabled.
(WebCore::Document::logger const):
* dom/Document.h:

Convert debug-only logging to configurable release logging.
* html/HTMLMediaElement.cpp:
(PAL::LogArgument<WebCore::URL>::toString): Logger template for URL that returns the url as a
String when only when the LOG_DISABLED build flag is not defined. Returns "[url]" when it is.
* html/HTMLMediaElement.h:

Source/WTF:

* wtf/MediaTime.cpp:
(WTF::MediaTime::dump const): Use toString.
(WTF::MediaTime::toString const): New.

Tools:

* TestWebKitAPI/Tests/WebCore/Logging.cpp:
(TestWebKitAPI::LogObserver::level const):

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

3 years ago[Canvas] Move non-standard functionality/aliases back to CanvasRenderingContext2D.idl
commit-queue@webkit.org [Tue, 5 Sep 2017 03:39:45 +0000 (03:39 +0000)]
[Canvas] Move non-standard functionality/aliases back to CanvasRenderingContext2D.idl
https://bugs.webkit.org/show_bug.cgi?id=176340

Patch by Sam Weinig <sam@webkit.org> on 2017-09-04
Reviewed by Darin Adler.

In r221598 (https://webkit.org/b/176276), the CanvasRenderingContext2D was split out into
separate interfaces to the match the spec and prepare for implementing OffscreenCanvas. While
doing that, related non-standard functionality and aliases were moved as well. In retrospect,
that doesn't really makes sense, as we don't want to add these legacy properties to any new
interfaces that happen to implement/use the broken out interfaces. Since they are specific
to CanvasRenderingContext2D, let's move them back.

* html/canvas/CanvasCompositing.idl:
* html/canvas/CanvasDrawImage.idl:
* html/canvas/CanvasFillStrokeStyles.idl:
* html/canvas/CanvasImageData.idl:
* html/canvas/CanvasImageSmoothing.idl:
* html/canvas/CanvasPathDrawingStyles.idl:
* html/canvas/CanvasShadowStyles.idl:
* html/canvas/CanvasRenderingContext2D.idl:

    Move non-standard operation and attributes back to CanvasRenderingContext2D.idl.

    * html/canvas/CanvasRenderingContext2D.h:
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::stringForCanvasFillRule): Deleted.

    Remove unused function.

(WebCore::CanvasRenderingContext2D::setAlpha): Deleted.
(WebCore::CanvasRenderingContext2D::setCompositeOperation): Deleted.

    Removed. Instead, the IDL uses [ImplementedAs] to forward to the
    underlying setGlobalAlpha/setGlobalCompositeOperation. This reduces
    code and makes it clear they are strict aliases.

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

3 years ago[iOS Simulator] http/tests/preload/viewport/meta-viewport-link-headers.php is a flaky...
yoav@yoav.ws [Tue, 5 Sep 2017 03:31:20 +0000 (03:31 +0000)]
[iOS Simulator] http/tests/preload/viewport/meta-viewport-link-headers.php is a flaky failure.
https://bugs.webkit.org/show_bug.cgi?id=172518

This unflakes the test by downloading a "timer" image and kicking off the timer that runs the
test only once that image was downloaded, while potentially waiting for the preloaded images to arrive,
up to 1 second.
That means that slow test environments would have a longer timer than today, avoiding flakiness.

Reviewed by Youenn Fablet.

* http/tests/preload/viewport/meta-viewport-link-headers.php: Add a "timer" image, which load event starts the test.
* platform/ios/TestExpectations: Unflake the test in expectations.

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

3 years agoFix a few minor problems found while working toward removing unneeded calls to update...
darin@apple.com [Tue, 5 Sep 2017 03:29:46 +0000 (03:29 +0000)]
Fix a few minor problems found while working toward removing unneeded calls to updateStyle
https://bugs.webkit.org/show_bug.cgi?id=176279

Reviewed by Antti Koivisto.

Source/WebCore:

* dom/Document.cpp:
(WebCore::Document::updateTitleElement): Fix the algorithm so that an SVG title won't
ever become the title when the document element is not an SVG element. We had this wrong
before but we were passing the test because SVGTitleElement::insertedInto had a bug that
hid the problem.
(WebCore::Document::titleElementAdded): Pass a reference instead of a pointer.
(WebCore::Document::titleElementRemoved): Pass a reference instead of nullptr since we
want to know which element is being removed.

* dom/Document.h: Update the argument name and type for updateTitleElement.

* html/HTMLTitleElement.cpp:
(WebCore::HTMLTitleElement::insertedInto): Call titleElementAdded unconditionally.
The checks to see if the title element is connected to the document and not in the
shadow tree are now handled by the Document class.
(WebCore::HTMLTitleElement::removedFrom): Same for titleElementRemoved.

* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::applySize): Removed incorrect caching of FontCascade
objects; these need to be created each time we draw.
(WebCore::MockRealtimeVideoSource::drawText): Create all the fonts here. Since this is
a mock for testing, there is no real performance concern with doing this.
* platform/mock/MockRealtimeVideoSource.h: Removed the FontCascade data members.

* rendering/RenderTreeAsText.cpp:
(WebCore::updateLayoutIgnoringPendingStylesheetsIncludingSubframes): Added. Used below
to update layout more thoroughly.
(WebCore::externalRepresentation): Update layout of all descendant frames, not just
the top level frame.

* svg/SVGTitleElement.cpp:
(WebCore::SVGTitleElement::insertedInto): Removed bogus firstChild check, bogus isSVGDocument
check, and unneeded isConnected check and call titleElementAdded unconditionally. The checks
are now handled by the Document class.
(WebCore::SVGTitleElement::removedFrom): Same for titleElementRemoved.

* testing/Internals.cpp:
(WebCore::Internals::layerTreeAsText const): Added missing updateLayoutIgnorePendingStylesheets,
since dumping the layer tree without first doing a layout will yield stale results.
(WebCore::Internals::layerIDForElement): Added missing updateLayoutIgnorePendingStylesheets,
since using a renderer to check if a layer exists without first doing a layout will yield stale results.
(WebCore::Internals::setElementUsesDisplayListDrawing): Ditto.
(WebCore::Internals::setElementTracksDisplayListReplay): Ditto.
(WebCore::Internals::displayListForElement): Ditto.
(WebCore::Internals::replayDisplayListForElement): Ditto.
(WebCore::Internals::isSelectPopupVisible): Added missing updateLayoutIgnorePendingStylesheets,
since working with the RenderMenuList without first doing a layout will yield stale results.
Also removed unneeded strict handling of null renderer, instead just returning false.
(WebCore::Internals::isPluginUnavailabilityIndicatorObscured): Removed unnneeded check of
renderer class, since the HTMLPlugInElement::isReplacementObscured already handles that correctly.
(WebCore::Internals::pageOverlayLayerTreeAsText const): Use updateLayoutIgnorePendingStylesheets
instead of the normal updateLayout for consistency with the behavior of the other functions in this
file, and because we need a real answer here.
(WebCore::Internals::scrollSnapOffsets): Ditto. Also rearranged the code so the renderer check is
done after updating the renderer tree.

Tools:

* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::setSelectedChild const): Handle null here. The old code instead
would trigger an Objective-C exception unnecessarily.

LayoutTests:

* svg/hittest/svg-tooltip.svg: Made this test easier to run outside of WebKitTestRunnner,
by removing some overzealous checks.

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

3 years agoSupport compiling catch in the FTL
sbarati@apple.com [Tue, 5 Sep 2017 03:21:33 +0000 (03:21 +0000)]
Support compiling catch in the FTL
https://bugs.webkit.org/show_bug.cgi?id=175396

Reviewed by Filip Pizlo.

This patch implements op_catch in the FTL. It extends the DFG implementation
by supporting multiple entrypoints in DFG-SSA. This patch implements this
by introducing an EntrySwitch node. When converting to SSA, we introduce a new
root block with an EntrySwitch that has the previous DFG entrypoints as its
successors. By convention, we pick the zeroth entry point index to be the
op_enter entrypoint. Like in B3, in DFG-SSA, EntrySwitch just acts like a
switch over the entrypoint index argument. DFG::EntrySwitch in the FTL
simply lowers to B3::EntrySwitch. The EntrySwitch in the root block that
SSAConversion creates can not exit because we would both not know where to exit
to in the program: we would not have valid OSR exit state. This design also
mandates that anything we hoist above EntrySwitch in the new root block
can not exit since they also do not have valid OSR exit state.

This patch also adds a new metadata node named InitializeEntrypointArguments.
InitializeEntrypointArguments is a metadata node that initializes the flush format for
the arguments at a given entrypoint. For a given entrypoint index, this node
tells AI and OSRAvailabilityAnalysis what the flush format for each argument
is. This allows each individual entrypoint to have an independent set of
argument types. Currently, this won't happen in practice because ArgumentPosition
unifies flush formats, but this is an implementation detail we probably want
to modify in the future. SSAConversion will add InitializeEntrypointArguments
to the beginning of each of the original DFG entrypoint blocks.

This patch also adds the ability to specify custom prologue code generators in Air.
This allows the FTL to specify a custom prologue for catch entrypoints that
matches the op_catch OSR entry calling convention that the DFG uses. This way,
the baseline JIT code OSR enters into op_catch the same way both in the DFG
and the FTL. In the future, we can use this same mechanism to perform stack
overflow checks instead of using a patchpoint.

* b3/air/AirCode.cpp:
(JSC::B3::Air::Code::isEntrypoint):
(JSC::B3::Air::Code::entrypointIndex):
* b3/air/AirCode.h:
(JSC::B3::Air::Code::setPrologueForEntrypoint):
(JSC::B3::Air::Code::prologueGeneratorForEntrypoint):
* b3/air/AirGenerate.cpp:
(JSC::B3::Air::generate):
* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGBasicBlock.h:
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
(JSC::DFG::ByteCodeParser::parse):
* dfg/DFGCFG.h:
(JSC::DFG::selectCFG):
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGClobbersExitState.cpp:
(JSC::DFG::clobbersExitState):
* dfg/DFGCommonData.cpp:
(JSC::DFG::CommonData::shrinkToFit):
(JSC::DFG::CommonData::finalizeCatchEntrypoints):
* dfg/DFGCommonData.h:
(JSC::DFG::CommonData::catchOSREntryDataForBytecodeIndex):
(JSC::DFG::CommonData::appendCatchEntrypoint):
* dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::dump):
(JSC::DFG::Graph::invalidateCFG):
(JSC::DFG::Graph::ensureCPSCFG):
(JSC::DFG::Graph::methodOfGettingAValueProfileFor):
* dfg/DFGGraph.h:
(JSC::DFG::Graph::isEntrypoint):
* dfg/DFGInPlaceAbstractState.cpp:
(JSC::DFG::InPlaceAbstractState::initialize):
(JSC::DFG::InPlaceAbstractState::mergeToSuccessors):
* dfg/DFGJITCode.cpp:
(JSC::DFG::JITCode::shrinkToFit):
(JSC::DFG::JITCode::finalizeOSREntrypoints):
* dfg/DFGJITCode.h:
(JSC::DFG::JITCode::catchOSREntryDataForBytecodeIndex): Deleted.
(JSC::DFG::JITCode::appendCatchEntrypoint): Deleted.
* dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::noticeCatchEntrypoint):
(JSC::DFG::JITCompiler::makeCatchOSREntryBuffer):
* dfg/DFGMayExit.cpp:
* dfg/DFGNode.h:
(JSC::DFG::Node::isEntrySwitch):
(JSC::DFG::Node::isTerminal):
(JSC::DFG::Node::entrySwitchData):
(JSC::DFG::Node::numSuccessors):
(JSC::DFG::Node::successor):
(JSC::DFG::Node::entrypointIndex):
* dfg/DFGNodeType.h:
* dfg/DFGOSRAvailabilityAnalysisPhase.cpp:
(JSC::DFG::OSRAvailabilityAnalysisPhase::run):
(JSC::DFG::LocalOSRAvailabilityCalculator::executeNode):
* dfg/DFGOSREntry.cpp:
(JSC::DFG::prepareCatchOSREntry):
* dfg/DFGOSREntry.h:
* dfg/DFGOSREntrypointCreationPhase.cpp:
(JSC::DFG::OSREntrypointCreationPhase::run):
* dfg/DFGPredictionPropagationPhase.cpp:
* dfg/DFGSSAConversionPhase.cpp:
(JSC::DFG::SSAConversionPhase::SSAConversionPhase):
(JSC::DFG::SSAConversionPhase::run):
* dfg/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::linkOSREntries):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGStaticExecutionCountEstimationPhase.cpp:
(JSC::DFG::StaticExecutionCountEstimationPhase::run):
* dfg/DFGValidate.cpp:
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLCompile.cpp:
(JSC::FTL::compile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::lower):
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileExtractCatchLocal):
(JSC::FTL::DFG::LowerDFGToB3::compileGetStack):
(JSC::FTL::DFG::LowerDFGToB3::compileEntrySwitch):
(JSC::FTL::DFG::LowerDFGToB3::speculate):
(JSC::FTL::DFG::LowerDFGToB3::appendOSRExitDescriptor):
(JSC::FTL::DFG::LowerDFGToB3::appendOSRExit):
(JSC::FTL::DFG::LowerDFGToB3::blessSpeculation):
* ftl/FTLOutput.cpp:
(JSC::FTL::Output::entrySwitch):
* ftl/FTLOutput.h:
* jit/JITOperations.cpp:

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

3 years ago[DFG][FTL] Efficiently execute number#toString()
utatane.tea@gmail.com [Tue, 5 Sep 2017 03:03:03 +0000 (03:03 +0000)]
[DFG][FTL] Efficiently execute number#toString()
https://bugs.webkit.org/show_bug.cgi?id=170007

Reviewed by Keith Miller.

JSTests:

* microbenchmarks/number-to-string-strength-reduction.js: Added.
(test):
* microbenchmarks/number-to-string-with-radix-10.js: Added.
(test):
* microbenchmarks/number-to-string-with-radix-cse.js: Added.
(test):
* microbenchmarks/number-to-string-with-radix.js: Added.
(test):
* stress/number-to-string-strength-reduction.js: Added.
(shouldBe):
(test):
* stress/number-to-string-with-radix-10.js: Added.
(shouldBe):
(test):
* stress/number-to-string-with-radix-cse.js: Added.
(shouldBe):
(test):
* stress/number-to-string-with-radix-invalid.js: Added.
(shouldThrow):
* stress/number-to-string-with-radix-watchpoint.js: Added.
(shouldBe):
(test):
(i.i.1e3.Number.prototype.toString):
* stress/number-to-string-with-radix.js: Added.
(shouldBe):
(test):

Source/JavaScriptCore:

In JS, the natural way to convert number to string with radix is `number.toString(radix)`.
However, our IC only cares about cells. If the base value is a number, it always goes to the slow path.

While extending our IC for number and boolean, the most meaningful use of this IC is calling `number.toString(radix)`.
So, in this patch, we first add a fast path for this in DFG by using watchpoint. We set up a watchpoint for
Number.prototype.toString. And if this watchpoint is kept alive and GetById(base, "toString")'s base should be
speculated as Number, we emit Number related Checks and convert GetById to Number.prototype.toString constant.
It removes costly GetById slow path, and makes it non-clobbering node (JSConstant).

In addition, we add NumberToStringWithValidRadixConstant node. We have NumberToStringWithRadix node, but it may
throw an error if the valid value is incorrect (for example, number.toString(2000)). So its clobbering rule is
conservatively use read(World)/write(Heap). But in reality, `number.toString` is mostly called with the constant
radix, and we can easily figure out this radix is valid (2 <= radix && radix < 32).
We add a rule to the constant folding phase to convert NumberToStringWithRadix to NumberToStringWithValidRadixConstant.
It ensures that it has valid constant radix. And we relax our clobbering rule for NumberToStringWithValidRadixConstant.

Added microbenchmarks show performance improvement.

                                              baseline                  patched

number-to-string-with-radix-cse           43.8312+-1.3017     ^      7.4930+-0.5105        ^ definitely 5.8496x faster
number-to-string-with-radix-10             7.2775+-0.5225     ^      2.1906+-0.1864        ^ definitely 3.3222x faster
number-to-string-with-radix               39.7378+-1.4921     ^     16.6137+-0.7776        ^ definitely 2.3919x faster
number-to-string-strength-reduction       94.9667+-2.7157     ^      9.3060+-0.7202        ^ definitely 10.2049x faster

* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGConstantFoldingPhase.cpp:
(JSC::DFG::ConstantFoldingPhase::foldConstants):
* dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGGraph.h:
(JSC::DFG::Graph::isWatchingGlobalObjectWatchpoint):
(JSC::DFG::Graph::isWatchingArrayIteratorProtocolWatchpoint):
(JSC::DFG::Graph::isWatchingNumberToStringWatchpoint):
* dfg/DFGNode.h:
(JSC::DFG::Node::convertToNumberToStringWithValidRadixConstant):
(JSC::DFG::Node::hasValidRadixConstant):
(JSC::DFG::Node::validRadixConstant):
* dfg/DFGNodeType.h:
* dfg/DFGPredictionPropagationPhase.cpp:
* dfg/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileToStringOrCallStringConstructor):
(JSC::DFG::SpeculativeJIT::compileNumberToStringWithValidRadixConstant):
(JSC::DFG::SpeculativeJIT::compileToStringOrCallStringConstructorOnNumber): Deleted.
* dfg/DFGSpeculativeJIT.h:
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGStrengthReductionPhase.cpp:
(JSC::DFG::StrengthReductionPhase::handleNode):
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileNumberToStringWithValidRadixConstant):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::JSGlobalObject):
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::visitChildren):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::numberToStringWatchpoint):
(JSC::JSGlobalObject::numberProtoToStringFunction const):
* runtime/NumberPrototype.cpp:
(JSC::NumberPrototype::finishCreation):
(JSC::toStringWithRadixInternal):
(JSC::toStringWithRadix):
(JSC::int32ToStringInternal):
(JSC::numberToStringInternal):
* runtime/NumberPrototype.h:

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

3 years agoRemove OS(SOLARIS) support
utatane.tea@gmail.com [Tue, 5 Sep 2017 01:48:31 +0000 (01:48 +0000)]
Remove OS(SOLARIS) support
https://bugs.webkit.org/show_bug.cgi?id=176341

Reviewed by Sam Weinig.

Source/WebCore:

* bindings/scripts/preprocessor.pm:
(applyPreprocessor):
* dom/make_names.pl:
* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::platform):
* page/Page.h:

Source/WTF:

WebKit project does not have stake holders supporting Solaris right now.
And Solaris + SPARC in 64bit environment does not work well since its
address space includes non-48bit area. It breaks our JSVALUE64 in JSC.
In addition, Solaris a bit complicates our threading implementation
because of its special threading stack.

This patch removes OS(SOLARIS) and COMPILER(SUNCC) support from WebKit.

* wtf/Compiler.h:
* wtf/InlineASM.h:
* wtf/MathExtras.h:
(std::isfinite): Deleted.
(std::signbit): Deleted.
(std::isinf): Deleted.
* wtf/NumberOfCores.cpp:
(WTF::numberOfProcessorCores):
* wtf/Platform.h:
* wtf/StackBounds.cpp:
* wtf/ThreadingPthreads.cpp:

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

3 years agoUnreviewed, fixing unused constant for initial buffer size
utatane.tea@gmail.com [Tue, 5 Sep 2017 01:13:10 +0000 (01:13 +0000)]
Unreviewed, fixing unused constant for initial buffer size
https://bugs.webkit.org/show_bug.cgi?id=176310

Follow-up patch after r221583. Pointed by darin@.

* platform/graphics/win/FontPlatformDataWin.cpp:
(WebCore::FontPlatformData::FontPlatformData):

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

3 years ago[Canvas] Split CanvasRenderingContext2D.idl into separate IDLs to match current HTML...
weinig@apple.com [Tue, 5 Sep 2017 00:23:03 +0000 (00:23 +0000)]
[Canvas] Split CanvasRenderingContext2D.idl into separate IDLs to match current HTML spec
https://bugs.webkit.org/show_bug.cgi?id=176276

Reviewed by Dean Jackson.

Source/WebCore:

- Splits CanvasRenderingContext2D.idl out into:
    CanvasState
    CanvasTransform
    CanvasCompositing
    CanvasImageSmoothing
    CanvasFillStrokeStyles
    CanvasShadowStyles
    CanvasFilters
    CanvasRect
    CanvasDrawPath
    CanvasUserInterface
    CanvasText
    CanvasDrawImage
    CanvasImageData
    CanvasPathDrawingStyles
    CanvasTextDrawingStyles
- Renames CanvasWindingRule enum to CanvasFillRule, and moves it to its own file
  so it can be reused by multiple IDLs.
- Renames DOMPath to Path2D, which is what it is supposed to be called, and doesn't
  conflict with any WebCore names.
- Converts lineCap, lineJoin, textAlign, textBaseline, direction to use enums, rather
  than DOMStrings, allowing us to remove a bunch of custom parsing.
- Non-standard canvas API was grouped with related functionality in the broken out
  IDLs and clearly marked as non-standard.
- Comments were added for places where we break with the standard, mostly around use
  of float where we should be using double.

* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:

    Add new files.

* bindings/js/CallTracerTypes.h:
* inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::buildInitialState):
(WebCore::InspectorCanvas::buildAction):

    Update for renames, and use new convertEnumerationToString to
    serialize enumerations.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateEnumerationImplementationContent):
(GenerateEnumerationHeaderContent):

    Split string conversion out of convertEnumerationToJS, and into
    its own function, convertEnumerationToString, to allow serialization
    to string outside of the bindings context, in this case, for the
    InspectorCanvas.

(GenerateParametersCheck):

    Improve error message to make it clear which operation has the issue
    in order to make debugging easier.

* html/ImageData.idl:

    Re-order constructors to match specification, and add FIXME for incorrect
    default argument.

* html/TextMetrics.idl:

    Add spec'd exposure and spec comments, as well a FIXME to convert the
    unrestricted float parameters should be doubles.

* html/canvas/CanvasCompositing.idl: Added.
* html/canvas/CanvasDirection.h: Added.
* html/canvas/CanvasDirection.idl: Added.
* html/canvas/CanvasDrawImage.idl: Added.
* html/canvas/CanvasDrawPath.idl: Added.
* html/canvas/CanvasFillRule.h: Added.
* html/canvas/CanvasFillRule.idl: Added.
* html/canvas/CanvasFillStrokeStyles.idl: Added.
* html/canvas/CanvasFilters.idl: Added.
* html/canvas/CanvasImageData.idl: Added.
* html/canvas/CanvasImageSmoothing.idl: Added.
* html/canvas/CanvasLineCap.h: Added.
* html/canvas/CanvasLineCap.idl: Added.
* html/canvas/CanvasLineJoin.h: Added.
* html/canvas/CanvasLineJoin.idl: Added.
* html/canvas/CanvasPathDrawingStyles.idl: Added.
* html/canvas/CanvasRect.idl: Added.
* html/canvas/CanvasShadowStyles.idl: Added.
* html/canvas/CanvasState.idl: Added.
* html/canvas/CanvasText.idl: Added.
* html/canvas/CanvasTextAlign.h: Added.
* html/canvas/CanvasTextAlign.idl: Added.
* html/canvas/CanvasTextBaseline.h: Added.
* html/canvas/CanvasTextBaseline.idl: Added.
* html/canvas/CanvasTextDrawingStyles.idl: Added.
* html/canvas/CanvasTransform.idl: Added.
* html/canvas/CanvasUserInterface.idl: Added.
* html/canvas/ImageSmoothingQuality.h: Added.
* html/canvas/ImageSmoothingQuality.idl: Added.

    Move CanvasRenderingContext2D.idl content into separate files to
    match the specification.

* html/canvas/CanvasGradient.idl:
* html/canvas/CanvasPath.idl:
* html/canvas/CanvasPattern.idl:

    Add exposure and FIXMEs on changes need to match the spec.

* html/canvas/CanvasRenderingContext2D.cpp:
* html/canvas/CanvasRenderingContext2D.h:

    Switch to using enums for lineCap, lineJoin, textAlign, textBaseline, and direction.
    Rather than using the parsing / stringifying functions from GraphicsTypes, add simple
    switch based to/from converters to convert to/from the canvas type to the platform
    type. Also update for rename of DOMPath -> Path2D and WindingRule -> CanvasFillRule.

    Unfortunately, not all custom parsing could be removed. To support the legacy functions
    setLineCap and setLineJoin, which take Strings, two simply parse paths had to be
    brought back. They can't use the enums, because the rules for enums as parameters
    is stricter that what was implemented in the custom code (e.g. the bindings would
    have thrown for strings not in the enum set).

* html/canvas/CanvasRenderingContext2D.idl:

    Move most of the functions into the new files, which are then 'implemented' by
    this.

* html/canvas/DOMPath.cpp: Removed.
* html/canvas/DOMPath.h: Removed.
* html/canvas/DOMPath.idl: Removed.
* html/canvas/Path2D.cpp: Copied from Source/WebCore/html/canvas/DOMPath.cpp.
* html/canvas/Path2D.h: Copied from Source/WebCore/html/canvas/DOMPath.h.
* html/canvas/Path2D.idl: Copied from Source/WebCore/html/canvas/DOMPath.idl.

    Rename DOMPath to Path2D to match the spec..

* platform/graphics/GraphicsTypes.cpp:
(WebCore::parseLineCap): Deleted.
(WebCore::lineCapName): Deleted.
(WebCore::parseLineJoin): Deleted.
(WebCore::lineJoinName): Deleted.
(WebCore::textAlignName): Deleted.
(WebCore::parseTextAlign): Deleted.
(WebCore::textBaselineName): Deleted.
(WebCore::parseTextBaseline): Deleted.
* platform/graphics/GraphicsTypes.h:

    Remove now unused parsing / stringifying functions.

* testing/Internals.cpp:

    Remove unused #include.

* bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
* bindings/scripts/test/JS/JSTestCallbackInterface.h:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestObj.h:
* bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
* bindings/scripts/test/JS/JSTestStandaloneDictionary.h:
* bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp:
* bindings/scripts/test/JS/JSTestStandaloneEnumeration.h:

    Update test results to add convertEnumerationToString.

LayoutTests:

* fast/canvas/canvas-clip-path-expected.txt:
* fast/canvas/canvas-fill-path-expected.txt:
* fast/canvas/canvas-path-addPath-expected.txt:
* fast/canvas/canvas-path-isPointInPath-expected.txt:
* fast/canvas/canvas-path-isPointInStroke-expected.txt:
* fast/canvas/canvas-stroke-path-expected.txt:
* fast/canvas/winding-enumeration-expected.txt:
* inspector/canvas/recording-2d-expected.txt:
* js/dom/global-constructors-attributes-dedicated-worker-expected.txt:

    Update results.

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

3 years ago[DFG] Consider increasing the number of DFG worklist threads
utatane.tea@gmail.com [Tue, 5 Sep 2017 00:11:49 +0000 (00:11 +0000)]
[DFG] Consider increasing the number of DFG worklist threads
https://bugs.webkit.org/show_bug.cgi?id=176222

Reviewed by Saam Barati.

Attempt to add one more thread to DFG worklist. DFG compiler sometimes takes
very long time if the target function is very large. However, DFG worklist
has only one thread before this patch. Therefore, one function that takes
too much time to be compiled can prevent the other functions from being
compiled in DFG or upper tiers.

One example is Octane/zlib. In zlib, compiling "a1" function in DFG takes
super long time (447 ms) because of its super large size of the function.
While this function never gets compiled in FTL due to its large size,
it can be compiled in DFG and takes super long time. Subsequent "a8" function
compilation in DFG is blocked by this "a1". As a consequence, the benchmark
takes very long time in a1/Baseline code, which is slower than DFG of course.

While FTL has a bit more threads, DFG worklist has only one thread. This patch
adds one more thread to DFG worklist to alleviate the above situation. This
change significantly improves Octane/zlib performance.

                            baseline                  patched

zlib           x2     482.32825+-6.07640    ^   408.66072+-14.03856      ^ definitely 1.1803x faster

* runtime/Options.h:

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

3 years agoFollow up FrameView::updateLayoutAndStyleIfNeededRecursive changes with related impro...
darin@apple.com [Mon, 4 Sep 2017 23:50:04 +0000 (23:50 +0000)]
Follow up FrameView::updateLayoutAndStyleIfNeededRecursive changes with related improvements
https://bugs.webkit.org/show_bug.cgi?id=176277

Reviewed by Antti Koivisto.

* page/FrameView.cpp:
(WebCore::FrameView::needsStyleRecalcOrLayout): Deleted. This function was only used
by an assertion inside updateLayoutAndStyleIfNeededRecursive, and thus there is no reason
for it to be in the header file, or for it to be a public member function.
(WebCore::appendRenderedChildren): Deleted. This function was only used inside
updateLayoutAndStyleIfNeededRecursive, and it is now packaged in an even better way
for efficient use inside that function.
(WebCore::FrameView::renderedChildFrameViews): Deleted. This function was only used
inside needsStyleRecalcOrLayout, and it's now packaged in a better way inside that function.
(WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive): Created a new lambda called
nextRendereredDescendant that packages up the process of repeatedly iterating this view
and all of its descendants in an easy-to-use way. Replaces both of the functions above.
Rewrote to use it; it made the logic clear enough that it was good to get rid of the
updateOneFrame lambda, too. Added two separate functions, one that checks for needed
style recalculation and a separate one that checked for needed layout. Using those,
replaced the old single assertion with two separate assertions.

* page/FrameView.h: Removed needsStyleRecalcOrLayout, renderedChildFrameViews, and
FrameViewList.

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

3 years ago[iOS DnD] Refactor drag and drop logic in WKContentView in preparation for supporting...
wenson_hsieh@apple.com [Mon, 4 Sep 2017 23:36:20 +0000 (23:36 +0000)]
[iOS DnD] Refactor drag and drop logic in WKContentView in preparation for supporting multiple drag items in a drag session
https://bugs.webkit.org/show_bug.cgi?id=176264
<rdar://problem/31144674>

Reviewed by Darin Adler.

Source/WebCore:

Makes some small adjustments to WebItemProviderPasteboard. Rather than just -setItemProviders: on the
WebItemProviderPasteboard when initiating a drag, also stage the WebItemProviderRegistrationList that will be
used to generate an item provider. While it would be cleaner to avoid directly setting item providers so we
don't overwrite item providers on the WebItemProviderPasteboard when adding items to an existing drag session,
this isn't possible without breaking binary compability with older UIKit versions.

Importantly, WKContentView will now ignore any item providers that have been set on the
WebItemProviderPasteboard when initiating a drag or adding items to an existing drag session, and instead only
consider the staged registration list when generating item providers for dragging. This only has the drawback of
generating an unnecessary item provider, but otherwise maintains backwards compatibility while allowing us to
provide WebKit2 support for multiple items per drag session.

Tests: DataInteractionTests.DragEventClientCoordinatesBasic
       DataInteractionTests.DragEventClientCoordinatesWithScrollOffset
       DataInteractionTests.DragEventPageCoordinatesBasic
       DataInteractionTests.DragEventPageCoordinatesWithScrollOffset

* platform/ios/AbstractPasteboard.h:
* platform/ios/PlatformPasteboardIOS.mm:
(WebCore::registerItemToPasteboard):

Changed to only stage registration info on the item provider pasteboard, if possible. This has no effect on the
copy/paste codepath, since it uses a UIPasteboard.

* platform/ios/WebItemProviderPasteboard.h:
* platform/ios/WebItemProviderPasteboard.mm:

Rename _registrationInfoLists to _stagedRegistrationInfoList, and change it from an array of registration info
lists to a single registration info list. This could be updated in the future to be an array of registration
lists, but currently, it serves no purpose and makes coordination with DragItem info more difficult. This would
need to support multiple registration lists if we are to add a way to begin a drag containing multiple items in
vanilla web content, such as dragging multiple selections.

(-[WebItemProviderPasteboard init]):
(-[WebItemProviderPasteboard setItemProviders:]):
(-[WebItemProviderPasteboard stageRegistrationList:]):

Sets the staged item provider registration list.

(-[WebItemProviderPasteboard takeRegistrationList]):

Removes the staged item provider registration list from the WebItemProviderPasteboard and also returns it.

(-[WebItemProviderPasteboard registrationInfoAtIndex:]): Deleted.
(-[WebItemProviderPasteboard setRegistrationInfoLists:]): Deleted.

Source/WebKit:

Move DataInteractionState from WKContentViewInteraction.h to DragDropInteractionState.h, and also rename it to
DragDropInteractionState. Additionally, refactor drag and drop state in the UI process to capture metadata about
the dragged element in a separate DragSourceState struct. This patch also moves drag and drop state transition
logic that doesn't involve WKContentView internals out of WKContentView, and into the implementation of
DragDropInteractionState.

To support multiple drag items per session, we also introduce a simple mechanism to trace a UIDragItem back to
the DragSourceState used to generate it. When generating a DragSourceState, we assign it a unique identifier,
which we also set as the privateLocalContext of all UIDragItems generated when beginning the drag (this
includes drag items returned by an internal client that uses one of the SPI hooks to augment drag items when
starting a drag). This is subsequently used in the implementation of lift and cancellation preview delegate
methods to supply the appropriate drag preview for each UIDragItem.

Lastly, fix a bug wherein the pageX and pageY of mouse drag events are inconsistent with other synthetic mouse
events, such as synthetic clicks. For synthetic clicks, the PlatformMouseEvent is initialized with the same
position and globalPosition. Whether this is really intended is unclear (see http://webkit.org/b/173855), but
it's a trivial change for now to keep mouse events on iOS consistent by tweaking the behavior during drag and
drop. See Tools/ChangeLog for some more information.

* Platform/spi/ios/UIKitSPI.h:

Add -[UIDragItem privateLocalContext].

* UIProcess/ios/DragDropInteractionState.h: Added.
(WebKit::DragDropInteractionState::stagedDragSource const):
(WebKit::DragDropInteractionState::dropSessionDidExit):
(WebKit::DragDropInteractionState::dropSessionWillPerformDrop):
(WebKit::DragDropInteractionState::adjustedPositionForDragEnd const):
(WebKit::DragDropInteractionState::didBeginDragging const):
(WebKit::DragDropInteractionState::isPerformingDrop const):
(WebKit::DragDropInteractionState::dragSession const):
(WebKit::DragDropInteractionState::dropSession const):

Wrap private drag/drop state member variables behind const getters, and move drag and drop logic that involves
only the DragDropInteractionState into helper methods on DragDropInteractionState.

(WebKit::DragDropInteractionState::BlockPtr<void):
* UIProcess/ios/DragDropInteractionState.mm: Added.
(WebKit::dragItemMatchingIdentifier):
(WebKit::createTargetedDragPreview):
(WebKit::uiImageForImage):

Move drag preview creation logic here, from WKContentViewInteraction.mm.

(WebKit::shouldUseTextIndicatorToCreatePreviewForDragAction):
(WebKit::DragDropInteractionState::activeDragSourceForItem const):
(WebKit::DragDropInteractionState::anyActiveDragSourceIs const):
(WebKit::DragDropInteractionState::prepareForDragSession):
(WebKit::DragDropInteractionState::dragSessionWillBegin):
(WebKit::DragDropInteractionState::previewForDragItem const):
(WebKit::DragDropInteractionState::dragSessionWillDelaySetDownAnimation):
(WebKit::DragDropInteractionState::dropSessionDidEnterOrUpdate):
(WebKit::DragDropInteractionState::stageDragItem):
(WebKit::DragDropInteractionState::hasStagedDragSource const):
(WebKit::DragDropInteractionState::clearStagedDragSource):
(WebKit::DragDropInteractionState::dragAndDropSessionsDidEnd):
(WebKit::DragDropInteractionState::updatePreviewsForActiveDragSources):
* UIProcess/ios/WKContentViewInteraction.h:

Move drag-and-drop-related state tied to the WKContentView here, from DataInteractionState (for instance, the
UIView for the drop caret, the WKContentView snapshot when dropping, and a flag use to keep track of hiding the
callout bar when dragging a text selection).

(): Deleted.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:]):
(-[WKContentView actionSheetAssistant:showCustomSheetForElement:]):
(-[WKContentView _didChangeDragInteractionPolicy]):
(-[WKContentView setupDataInteractionDelegates]):
(-[WKContentView teardownDataInteractionDelegates]):
(-[WKContentView _startDrag:item:]):
(-[WKContentView _didHandleStartDataInteractionRequest:]):
(-[WKContentView computeClientAndGlobalPointsForDropSession:outClientPoint:outGlobalPoint:]):
(-[WKContentView cleanUpDragSourceSessionState]):
(-[WKContentView _didConcludeEditDataInteraction:]):
(-[WKContentView _didPerformDataInteractionControllerOperation:]):
(-[WKContentView _didChangeDataInteractionCaretRect:currentRect:]):
(-[WKContentView currentDragOrDropSession]):
(-[WKContentView _restoreCalloutBarIfNeeded]):
(-[WKContentView _dragInteraction:prepareForSession:completion:]):
(-[WKContentView dragInteraction:itemsForBeginningSession:]):
(-[WKContentView dragInteraction:previewForLiftingItem:session:]):
(-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
(-[WKContentView dragInteraction:sessionWillBegin:]):
(-[WKContentView dragInteraction:session:didEndWithOperation:]):
(-[WKContentView dragInteraction:previewForCancellingItem:withDefault:]):
(-[WKContentView _dragInteraction:item:shouldDelaySetDownAnimationWithCompletion:]):
(-[WKContentView dragInteraction:item:willAnimateCancelWithAnimator:]):
(-[WKContentView dropInteraction:sessionDidEnter:]):
(-[WKContentView dropInteraction:sessionDidUpdate:]):
(-[WKContentView dropInteraction:sessionDidExit:]):
(-[WKContentView dropInteraction:performDrop:]):
(-[WKContentView dropInteraction:sessionDidEnd:]):

Pull out logic that mutates drag and drop state into DragDropInteractionState. Adjust places that previously
accessed DataInteractionState's members directly with corresponding getters in DragDropInteractionState.

(-[WKContentView _simulateDataInteractionEntered:]):
(-[WKContentView _simulateDataInteractionUpdated:]):
(-[WKContentView _simulateDataInteractionEnded:]):
(-[WKContentView _simulateDataInteractionPerformOperation:]):
(-[WKContentView _simulateDataInteractionSessionDidEnd:]):
(-[WKContentView _simulateWillBeginDataInteractionWithSession:]):
(-[WKContentView _simulatedItemsForSession:]):
(-[WKContentView _simulatePrepareForDataInteractionSession:completion:]):

Rename _dataInteraction => _dragInteraction and _dataOperation => _dropInteraction.

(uiImageForImage): Deleted.
(shouldUseTextIndicatorToCreatePreviewForDragAction): Deleted.
(-[WKContentView dragPreviewForImage:frameInRootViewCoordinates:clippingRectsInFrameCoordinates:backgroundColor:]): Deleted.
(-[WKContentView dragPreviewForCurrentDataInteractionState]): Deleted.
(-[WKContentView _transitionDragPreviewToImageIfNecessary:]): Deleted.
* WebKit.xcodeproj/project.pbxproj:

Tools:

Adds two new iOS drag and drop tests to check that the clientX and clientY attributes of mouse events propagated
to the page during drop are correct. Each test drags from an image element and drops into three custom-drop-
handling elements; `dragenter`, `dragover`, and `drop` event listeners on the body then use the clientX and
clientY event attributes to hit-test for drop target elements. The first test is suffixed with "-Basic"; the
second test, suffixed with "-WithScrollOffset", makes the document scrollable to check that clientY is correct
when scrolled.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/drop-targets.html: Added.
* TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
(TestWebKitAPI::testDragAndDropOntoTargetElements):
(TestWebKitAPI::TEST):
* TestWebKitAPI/cocoa/TestWKWebView.mm:
(-[TestWKWebView stringByEvaluatingJavaScript:]):

Log a warning message when an API test fails due to JavaScript evaluation in TestWKWebView.

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

3 years agoWeb Inspector: Styles Redesign: hook up real data to spreadsheet style editor
nvasilyev@apple.com [Mon, 4 Sep 2017 20:24:10 +0000 (20:24 +0000)]
Web Inspector: Styles Redesign: hook up real data to spreadsheet style editor
https://bugs.webkit.org/show_bug.cgi?id=175343
<rdar://problem/33784793>

Reviewed by Devin Rousso.

Replace static HTML added in <https://webkit.org/b/174838> with actual data.

Addressed in this patch:
- CSS rules can be copied.
- Source links work as expected.
- Nonmatching selectors are grayed out.

Known limitations:
- Neither CSS selectors nor CSS properties are editable.
- "Inherited from" and media query section headers are missing.
- No syntax highlighting of complex CSS values, e.g. hsl(0, 0%, 70%).

* UserInterface/Main.html:
* UserInterface/Models/CSSStyleDeclaration.js:
* UserInterface/Views/CSSStyleDeclarationTextEditor.js:
(WI.CSSStyleDeclarationTextEditor):
* UserInterface/Views/CSSStyleDetailsSidebarPanel.js:
(WI.CSSStyleDetailsSidebarPanel):
* UserInterface/Views/RulesStyleSpreadsheetDetailsPanel.js: Removed.
Rename RulesStyleSpreadsheetDetailsPanel to SpreadsheetRulesStyleDetailsPanel. All files related to the spreadsheet editor start with "Spreadsheet" now.

* UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.css: Added.
(.spreadsheet-style-declaration-editor):
(.spreadsheet-style-declaration-editor .name):
(.spreadsheet-style-declaration-editor .value):
(.spreadsheet-style-declaration-editor.no-properties):
* UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js: Added.
(WI.SpreadsheetCSSStyleDeclarationEditor):
(WI.SpreadsheetCSSStyleDeclarationEditor.prototype.layout):
(WI.SpreadsheetCSSStyleDeclarationEditor.prototype.get delegate):
(WI.SpreadsheetCSSStyleDeclarationEditor.prototype.set delegate):
(WI.SpreadsheetCSSStyleDeclarationEditor.prototype.get style):
(WI.SpreadsheetCSSStyleDeclarationEditor.prototype.set style):
(WI.SpreadsheetCSSStyleDeclarationEditor.prototype.get _propertiesToRender):
Similar condition is commonly used in CSSStyleDeclarationTextEditor. Abstact it out to its own method.

(WI.SpreadsheetCSSStyleDeclarationEditor.prototype._renderProperty):
* UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.css: Copied from Source/WebInspectorUI/UserInterface/Views/RulesStyleSpreadsheetDetailsPanel.css.
(.spreadsheet-css-declaration):
(.spreadsheet-css-declaration .origin):
(.spreadsheet-css-declaration.locked .origin::after):
(.spreadsheet-css-declaration .origin .go-to-link):
(.spreadsheet-css-declaration .origin .go-to-link:hover):
(.spreadsheet-css-declaration .styles-source):
(.spreadsheet-css-declaration .selector.style-attribute):
(.spreadsheet-css-declaration .selector > span):
(.spreadsheet-css-declaration .selector > .matched):
(.spreadsheet-css-declaration .properties):
(.spreadsheet-css-declaration.locked):
(.spreadsheet-css-declaration .locked-icon):
* UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js: Added.
(WI.SpreadsheetCSSStyleDeclarationSection):
(WI.SpreadsheetCSSStyleDeclarationSection.prototype.get element):
(WI.SpreadsheetCSSStyleDeclarationSection.prototype.get style):
(WI.SpreadsheetCSSStyleDeclarationSection.prototype.initialLayout):
(WI.SpreadsheetCSSStyleDeclarationSection.prototype.layout):
(WI.SpreadsheetCSSStyleDeclarationSection.prototype.cssStyleDeclarationTextEditorFocused):
(WI.SpreadsheetCSSStyleDeclarationSection.prototype.get locked):
(WI.SpreadsheetCSSStyleDeclarationSection.prototype.get selectorEditable):
* UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.css: Renamed from Source/WebInspectorUI/UserInterface/Views/RulesStyleSpreadsheetDetailsPanel.css.
* UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js: Added.
(WI.SpreadsheetRulesStyleDetailsPanel):
(WI.SpreadsheetRulesStyleDetailsPanel.prototype.refresh):
* UserInterface/Views/StyleDetailsPanel.js:
(WI.StyleDetailsPanel.prototype.filterDidChange):

* UserInterface/Views/View.js:
(WI.View.prototype.removeAllSubviews):
Add a method to remove all subviews more efficiently.

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

3 years agoWSL IntLiteral should have variable type so that it can unify with things like uint
fpizlo@apple.com [Mon, 4 Sep 2017 20:15:33 +0000 (20:15 +0000)]
WSL IntLiteral should have variable type so that it can unify with things like uint
https://bugs.webkit.org/show_bug.cgi?id=176209

Reviewed by Mylex Maxfield.

This introduces IntLiteralType, which can unify with any number type that can represent the
int literal.

This means that all of the following are legal:

    double x = 0; // 0 unifies with double
    double y = x + 5; // should resolve to double+double
    double z = array[0]; // 0 unifies with uint

We can do similar things with float literals, so that you don't have to suffix "f" all the
time.

I think that this is very different from what C does. C just supports implicit type
conversions. That's why "double x = 0" works in C. We don't do type conversions. Instead, we
let each literal unify itself with one type.

Also updated Test.html so that it runs again and is better at printing things.

* WebGPUShadingLanguageRI/All.js:
* WebGPUShadingLanguageRI/Checker.js:
* WebGPUShadingLanguageRI/IntLiteral.js:
(IntLiteral):
(IntLiteral.prototype.toString):
* WebGPUShadingLanguageRI/IntLiteralType.js: Added.
(IntLiteralType):
(IntLiteralType.prototype.get origin):
(IntLiteralType.prototype.get value):
(IntLiteralType.prototype.get isPrimitive):
(IntLiteralType.prototype.get isUnifiable):
(IntLiteralType.prototype.typeVariableUnify):
(IntLiteralType.prototype.unifyImpl):
(IntLiteralType.prototype.verifyAsArgument):
(IntLiteralType.prototype.verifyAsParameter):
(IntLiteralType.prototype.commitUnification):
(IntLiteralType.prototype.toString):
* WebGPUShadingLanguageRI/Intrinsics.js:
(Intrinsics.):
(Intrinsics):
* WebGPUShadingLanguageRI/LiteralTypeChecker.js:
(LiteralTypeChecker.prototype.visitIntLiteralType):
(LiteralTypeChecker):
* WebGPUShadingLanguageRI/NativeType.js:
(NativeType):
(NativeType.prototype.get isNumber):
(NativeType.prototype.set isNumber):
(NativeType.prototype.get isInt):
(NativeType.prototype.set isInt):
(NativeType.prototype.get isFloat):
(NativeType.prototype.set isFloat):
* WebGPUShadingLanguageRI/Prepare.js:
(prepare):
* WebGPUShadingLanguageRI/Rewriter.js:
(Rewriter.prototype.visitIntLiteral):
(Rewriter.prototype.visitIntLiteralType):
* WebGPUShadingLanguageRI/StandardLibrary.js:
* WebGPUShadingLanguageRI/Test.html:
* WebGPUShadingLanguageRI/Test.js:
(this.window.this.print):
(doPrep):
(doLex):
(checkNumber):
(checkInt):
(TEST_nameResolutionFailure):
(TEST_threadArrayLoadIntLiteral):
(TEST_deviceArrayStoreIntLiteral):
(TEST_returnIntLiteralDouble):
* WebGPUShadingLanguageRI/Type.js:
(Type.prototype.get isNumber):
(Type.prototype.get isInt):
(Type.prototype.get isFloat):
* WebGPUShadingLanguageRI/Visitor.js:
(Visitor.prototype.visitIntLiteral):
(Visitor.prototype.visitIntLiteralType):

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

3 years agoAdd more tests for null behavior in WSL
fpizlo@apple.com [Mon, 4 Sep 2017 20:14:08 +0000 (20:14 +0000)]
Add more tests for null behavior in WSL
https://bugs.webkit.org/show_bug.cgi?id=176318

Reviewed by Myles Maxfield.

This adds more tests for the unification behavior of null. In the process, I found a couple
small bugs and fixed them.

* WebGPUShadingLanguageRI/Checker.js:
* WebGPUShadingLanguageRI/FuncInstantiator.js:
(FuncInstantiator.prototype.getUnique.InstantiationSubstitution.prototype.visitCallExpression):
(FuncInstantiator.prototype.getUnique.InstantiationSubstitution):
* WebGPUShadingLanguageRI/Substitution.js:
(Substitution.prototype.visitTypeRef):
* WebGPUShadingLanguageRI/Test.js:
(TEST_passNullAndNotNullFullPoly):
(TEST_passNullAndNotNullFullPolyReverse):
(TEST_nullTypeVariableUnify.recurse):
(TEST_nullTypeVariableUnify.everyOrder):
(TEST_nullTypeVariableUnify.everyPair):
(TEST_nullTypeVariableUnify):
* WebGPUShadingLanguageRI/TypeRef.js:
(TypeRef.wrap):
* WebGPUShadingLanguageRI/TypeVariable.js:
(TypeVariable.prototype.verifyAsArgument):

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

3 years agoLoosen the check in video-canvas-drawing-output.html.
commit-queue@webkit.org [Mon, 4 Sep 2017 19:34:24 +0000 (19:34 +0000)]
Loosen the check in video-canvas-drawing-output.html.
https://bugs.webkit.org/show_bug.cgi?id=127106

Patch by Ms2ger <Ms2ger@igalia.com> on 2017-09-04
Reviewed by Xabier Rodriguez-Calvar.

GStreamer needs the extra tolerance since version 1.2.1.

* media/video-canvas-drawing-output.html:
* platform/gtk/TestExpectations:

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

3 years agoUnreviewed, rolling out r221494 and r221500.
commit-queue@webkit.org [Mon, 4 Sep 2017 17:54:25 +0000 (17:54 +0000)]
Unreviewed, rolling out r221494 and r221500.
https://bugs.webkit.org/show_bug.cgi?id=176258

This caused the windows build to fail. (Requested by mlewis13
on #webkit).

Reverted changesets:

"Switch HTMLMediaElement to release logging"
https://bugs.webkit.org/show_bug.cgi?id=176065
http://trac.webkit.org/changeset/221494

"Switch HTMLMediaElement to release logging"
https://bugs.webkit.org/show_bug.cgi?id=176065
http://trac.webkit.org/changeset/221500

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

3 years agoREGRESSION (r220052): [Sierra] API test VideoControlsManager.VideoControlsManagerFull...
darin@apple.com [Mon, 4 Sep 2017 16:27:38 +0000 (16:27 +0000)]
REGRESSION (r220052): [Sierra] API test VideoControlsManager.VideoControlsManagerFullSizeVideoInWideMainFrame is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=175329

Reviewed by Wenson Hsieh.

These tests rely on using setTimeout to wait a run loop iteration for the
video controls to appear. With changes to how loading occurs, it can now
take two run loop iterations. The concept here is inherently a bit flaky
and racy -- end users will not be able to tell how many run loop cycles it
takes for controls to come up, and websites can't tell either -- but for now
changing the tests to wait one more run loop should get rid of the flakiness.

* TestWebKitAPI/Tests/WebKitCocoa/VideoControlsManager.mm: Re-enable test.

* TestWebKitAPI/Tests/WebKitCocoa/full-size-autoplaying-video-with-audio.html: Add a
second setTimeout and a comment.
* TestWebKitAPI/Tests/WebKitCocoa/skinny-autoplaying-video-with-audio.html: Ditto.
* TestWebKitAPI/Tests/WebKitCocoa/wide-autoplaying-video-with-audio.html: Ditto.

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

3 years agoUnreviewed build fix for Clang with libc++
aperez@igalia.com [Mon, 4 Sep 2017 14:01:04 +0000 (14:01 +0000)]
Unreviewed build fix for Clang with libc++

Fixes a build failure when building with Clang, -stdlib=libc++, and gigacage
support enabled, which resulted in "stderr" being undefined.

* bmalloc/Gigacage.cpp: Add missing <ctsdio> include to pull the definition.

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

3 years agoSource/JavaScriptCore:
commit-queue@webkit.org [Mon, 4 Sep 2017 10:50:58 +0000 (10:50 +0000)]
Source/JavaScriptCore:
[WebIDL] Unify and simplify EnableBySettings with the rest of the runtime settings
https://bugs.webkit.org/show_bug.cgi?id=176312

Patch by Sam Weinig <sam@webkit.org> on 2017-09-04
Reviewed by Darin Adler.

* runtime/CommonIdentifiers.h:

    Remove WebCore specific identifiers from CommonIdentifiers. They have been moved
    to WebCoreBuiltinNames in WebCore.

Source/WebCore:
[WebIDL] Simplify EnabledBySettings generation
https://bugs.webkit.org/show_bug.cgi?id=176312

Patch by Sam Weinig <sam@webkit.org> on 2017-09-04
Reviewed by Darin Adler.

* bindings/scripts/CodeGeneratorJS.pm:
(NeedsRuntimeCheck):
(OperationShouldBeOnInstance):
(GeneratePropertiesHashTable):
(GenerateRuntimeEnableConditionalString):
(GenerateImplementation):
(GenerateAttributeGetterBodyDefinition):

    - Simplify the [EnabledBySetting] code generation by merging it with the other
    runtime checks (Exposed, EnabledAtRuntime, EnabledForWorld, and SecureContext).

    - Switches to using WebCoreBuiltinNames for identifiers, rather than relying
    on the appropriate identifiers being available on JavaScriptCore's CommonIdentifiers
    which was an unnecessary layering violation. There are still problems with this
    as we continue to be inconsistent  about which identifiers deserve to be in
    WebCoreBuiltinNames, and which ones can be created each time and there is no
    automation of WebCoreBuiltinNames from the IDLs.

    - Enforce at code generation time that [EnabledBySetting] can only be used
    on interfaces that are uniquely exposed to the window environment. This is a
    condition we should find a way to remove (e.g. propagating necessary settings
    to an object the ScriptExecutionContext owns), but for now, Settings is a main
    thread only object.

* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
(WebCore::JSDOMWindow::getOwnPropertySlot):
(WebCore::JSDOMWindow::put):
(WebCore::addCrossOriginWindowPropertyNames):
(WebCore::addCrossOriginWindowOwnPropertyNames):

    Switch to using WebCoreBuiltinNames for WebCore specific identifiers.

* bindings/js/WebCoreBuiltinNames.h:

    Add WebCore specific identifiers from JavaScriptCore's CommonIdentifiers
    as well as some new ones need by the [EnableBySetting] unification.

* bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: Added.
* bindings/scripts/test/JS/JSTestEnabledBySetting.h: Added.
* bindings/scripts/test/TestEnabledBySetting.idl: Added.

    Add new test for [EnabledBySetting].

* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/TestObj.idl:

    Remove use of [EnabledBySetting] from TestObj, as it is no longer
    valid to use [EnabledBySetting] on interfaces that are no uniquely
    exposed to the window environment.

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

3 years agoRemove "malloc" and "free" use
utatane.tea@gmail.com [Mon, 4 Sep 2017 09:24:21 +0000 (09:24 +0000)]
Remove "malloc" and "free" use
https://bugs.webkit.org/show_bug.cgi?id=176310

Reviewed by Darin Adler.

Source/JavaScriptCore:

Use Vector instead.

* API/JSWrapperMap.mm:
(selectorToPropertyName):

Source/WebCore:

Use MallocPtr<>, fastMalloc/fastFree, or Vector instead of manual call of system malloc/free.
In this patch, we apply the above change if we can easily find the pair of malloc/free.
And we do not touch plugin directory since the external code could call free() onto the
fastMalloc-ed memory.

Also, we still use malloc if the system adopts the allocated memory. Later, the system
will deallocate it by calling the system "free".

* platform/audio/mac/FFTFrameMac.cpp:
(WebCore::FFTFrame::fftSetupForSize):
(WebCore::FFTFrame::cleanup):
* platform/graphics/win/FontCacheWin.cpp:
(WebCore::getLinkedFonts):
* platform/graphics/win/FontCustomPlatformData.cpp:
(WebCore::FontCustomPlatformData::fontPlatformData):
* platform/graphics/win/FontPlatformDataWin.cpp:
(WebCore::FontPlatformData::FontPlatformData):
* platform/mac/WebCoreNSURLExtras.mm:
(WebCore::URLByTruncatingOneCharacterBeforeComponent):
(WebCore::dataForURLComponentType):
(WebCore::URLByRemovingComponentAndSubsequentCharacter):
(WebCore::createStringWithEscapedUnsafeCharacters):
(WebCore::userVisibleString):
* platform/win/ClipboardUtilitiesWin.cpp:
(WebCore::markupToCFHTML):

Source/WTF:

Use Vector instead.

* wtf/Assertions.cpp:

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

3 years agoUnreviewed, support libstdc++ use with clang
utatane.tea@gmail.com [Mon, 4 Sep 2017 08:04:06 +0000 (08:04 +0000)]
Unreviewed, support libstdc++ use with clang
https://bugs.webkit.org/show_bug.cgi?id=176301

* wtf/FastMalloc.h:

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

3 years ago[Threaded Compositor] Deadlock in ThreadedDisplayRefreshMonitor
carlosgc@webkit.org [Mon, 4 Sep 2017 06:52:42 +0000 (06:52 +0000)]
[Threaded Compositor] Deadlock in ThreadedDisplayRefreshMonitor
https://bugs.webkit.org/show_bug.cgi?id=176296

Reviewed by Žan Doberšek.

The main thread tries to schedule a display refresh monitor from RAF, requestDisplayRefreshMonitorUpdate() tries
to take the attributes lock to update coordinateUpdateCompletionWithClient. The compositing thread has finished
a frame and sceneUpdateFinished() takes the attributes lock to update clientRendersNextFrame and then asks the
display refresh monitor if it requires a new callback. ThreadedDisplayRefreshMonitor::requiresDisplayRefreshCallback()
takes its lock to check the state, and requestDisplayRefreshMonitorUpdate() was called by
ThreadedDisplayRefreshMonitor::requestRefreshCallback() with the display refresh monitor lock taken. So,
the compositing thread has the attributes lock and wants the display refresh monitor one, and main thread has the
display refresh monitor lock and wants the attributes one.

* Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
(WebKit::ThreadedDisplayRefreshMonitor::requestRefreshCallback): Release the mutex before calling
ThreadedCompositor::requestDisplayRefreshMonitorUpdate().

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

3 years agoUse StringView in DOMFileSystem::evaluatePath()
cdumez@apple.com [Mon, 4 Sep 2017 06:07:09 +0000 (06:07 +0000)]
Use StringView in DOMFileSystem::evaluatePath()
https://bugs.webkit.org/show_bug.cgi?id=176324

Reviewed by Darin Adler.

Use StringView in DOMFileSystem::evaluatePath() for performance.

* Modules/entriesapi/DOMFileSystem.cpp:
(WebCore::resolveRelativeVirtualPath):
(WebCore::DOMFileSystem::evaluatePath):
* Modules/entriesapi/DOMFileSystem.h:

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

3 years ago[GTK] Libgcrypt warning: missing initialization - please fix the application
zandobersek@gmail.com [Mon, 4 Sep 2017 06:04:39 +0000 (06:04 +0000)]
[GTK] Libgcrypt warning: missing initialization - please fix the application
https://bugs.webkit.org/show_bug.cgi?id=171230

Reviewed by Michael Catanzaro.

Source/WebCore/PAL:

Add the Initialization.h header, containing the single initialize() static
function that initializes the libgcrypt library. This header only includes
the default libgcrypt header, and nothing else.

It's not added to the existing Utilities.h header because that one pulls in
other unnecessary headers that for instance use the new() operator, but that
collides with the implementation files that define WebKit process entrypoints
and intentionally don't include the config.h that brings in FastMalloc to
properly define the new() and delete() operators, resulting in compilation
errors due to the new and delete operators being defined to warning strings
in always-included WebKit2Prefix.h.

* pal/crypto/gcrypt/Initialization.h: Copied from Source/WebKit/WebProcess/EntryPoint/unix/WebProcessMain.cpp.
(PAL::GCrypt::initialize):

Source/WebKit:

Replicate the libgcrypt initialization in the NetworkProcess entrypoint.
This is required due to libgcrypt being used through digest operations
originating from the certificate hash computation in SoupNetworkSession.

The initialization is moved to the PAL library, and the initialize()
function is now leveraged in both NetworkProcess and WebProcess entrypoints.

* NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp:
(main):
* WebProcess/EntryPoint/unix/WebProcessMain.cpp:
(main):

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

3 years ago[WPE] Use the device scale factor value in WebPageCreationParameters
zandobersek@gmail.com [Mon, 4 Sep 2017 06:03:01 +0000 (06:03 +0000)]
[WPE] Use the device scale factor value in WebPageCreationParameters
https://bugs.webkit.org/show_bug.cgi?id=175377

Reviewed by Michael Catanzaro.

* WebProcess/WebPage/AcceleratedDrawingArea.cpp:
(WebKit::AcceleratedDrawingArea::AcceleratedDrawingArea):
WebPageCreationParameters::deviceScaleFactor value should be used
to set the device scale factor on the given WebPage object. This
enables correctly leveraging the scale factor for the WPE port
which enters accelerated mode unconditionally and as such doesn't
wait for the backing store update that would provide that value
otherwise.

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

3 years ago[WK2][iOS] Remove unnecessary IOHIDEventServiceFastPathUserClient access
bfulgham@apple.com [Mon, 4 Sep 2017 05:58:15 +0000 (05:58 +0000)]
[WK2][iOS] Remove unnecessary IOHIDEventServiceFastPathUserClient access
https://bugs.webkit.org/show_bug.cgi?id=175947
<rdar://problem/33353627>

Reviewed by Darin Adler.

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

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

3 years ago[Cocoa] Tidy up PassKitSPI.h
mitz@apple.com [Mon, 4 Sep 2017 04:08:46 +0000 (04:08 +0000)]
[Cocoa] Tidy up PassKitSPI.h
https://bugs.webkit.org/show_bug.cgi?id=176323

Reviewed by Darin Adler.

* pal/spi/cocoa/PassKitSPI.h: Moved the declarations of requiredShippingContactFields and
  requiredBillingContactFields to where other PKPaymentRequest properties are declared, and
  changed the guard to relate to the SDK version. Replaced use of __has_include with checking for
  the version of the Apple internal SDK in which the typedefs first appeared.

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

3 years agoWKContentViewInteraction.mm includes redundant declaration of UIPreviewItemController...
mitz@apple.com [Mon, 4 Sep 2017 03:33:50 +0000 (03:33 +0000)]
WKContentViewInteraction.mm includes redundant declaration of UIPreviewItemController's presentationSecondaryGestureRecognizer
https://bugs.webkit.org/show_bug.cgi?id=176322

Reviewed by Darin Adler.

* UIProcess/ios/WKContentViewInteraction.mm: Removed the declaration, which is already made in the
  SDK or in UIKitSPI.h.

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

3 years agoMake webkit-patch post --no-review enable EWS just like webkit-patch post-commits...
commit-queue@webkit.org [Mon, 4 Sep 2017 03:27:35 +0000 (03:27 +0000)]
Make webkit-patch post --no-review enable EWS just like webkit-patch post-commits --no-review
https://bugs.webkit.org/show_bug.cgi?id=176321

Patch by Sam Weinig <sam@webkit.org> on 2017-09-03
Reviewed by Darin Adler.

* Scripts/webkitpy/tool/commands/upload.py:
Add the SubmitToEWS step to Post command

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

3 years agoTry to fix the iOS build
timothy_horton@apple.com [Mon, 4 Sep 2017 03:01:48 +0000 (03:01 +0000)]
Try to fix the iOS build

* UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
(-[WKRemoteView initWithFrame:contextID:]):

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

3 years agoTry to fix Windows build.
darin@apple.com [Mon, 4 Sep 2017 02:51:32 +0000 (02:51 +0000)]
Try to fix Windows build.

* runtime/JSGlobalObjectFunctions.cpp: #include <unicode/utf8.h>.

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

3 years ago[Cocoa] Remove use of __has_include in CoreAudioSPI.h
mitz@apple.com [Mon, 4 Sep 2017 02:12:49 +0000 (02:12 +0000)]
[Cocoa] Remove use of __has_include in CoreAudioSPI.h
https://bugs.webkit.org/show_bug.cgi?id=176320

Reviewed by Tim Horton.

* pal/spi/cf/CoreAudioSPI.h: AudioHardwarePriv.h is available in all Apple internal SDKs and
  only in Apple internal SDKs. AudioHardwareBase.h is available only in the macOS SDK, where
  it is included by AudioHardware.h.

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