WebKit-https.git
3 years agoURLParser should correctly strip unnecessary 0's in IPv6 addresses
achristensen@apple.com [Wed, 5 Oct 2016 18:27:53 +0000 (18:27 +0000)]
URLParser should correctly strip unnecessary 0's in IPv6 addresses
https://bugs.webkit.org/show_bug.cgi?id=162979

Reviewed by Brady Eidson.

Source/WebCore:

Covered by new API tests.

* platform/URLParser.cpp:
(WebCore::URLParser::parseIPv6Host):
Strip leading 0's and any 0's before the last 0 if the value is 0.

Tools:

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

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

3 years agoUTF-8 encode queries of nonspecial and websocket schemes
achristensen@apple.com [Wed, 5 Oct 2016 18:25:02 +0000 (18:25 +0000)]
UTF-8 encode queries of nonspecial and websocket schemes
https://bugs.webkit.org/show_bug.cgi?id=162956

Reviewed by Geoffrey Garen and Brady Eidson.

Source/WebCore:

The URL spec says in the query state:
'If url is not special or url's scheme is either "ws" or "wss", set encoding to UTF-8.'
This should be determined as soon as we are done parsing the scheme.

Covered by new API tests.
This also fixes tests like fast/loader/javascript-url-encoding-2.html when URLParser is enabled.

* platform/URLParser.cpp:
(WebCore::isValidSchemeCharacter):
Renamed Scheme to ValidScheme so I can use Scheme as the name of an enum class in the same namespace.
(WebCore::isSpecial):
(WebCore::scheme):
Separate functionality so we can have different behavior for different sets of
ws and wss schemes, special, and non-special schemes.
(WebCore::URLParser::copyURLPartsUntil):
(WebCore::URLParser::parse):
Set isUTF8Encoding to true when we finish parsing the scheme if the scheme is ws, wss, or non-special,
according to spec.  This also matches existing behavior.  This way we will already know whether to go
into UTF8Query or NonUTF8Query state when we see a '?'.
(WebCore::isSpecialScheme): Deleted.

Tools:

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

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

3 years agoPrepare to enable URLParser
achristensen@apple.com [Wed, 5 Oct 2016 18:19:19 +0000 (18:19 +0000)]
Prepare to enable URLParser
https://bugs.webkit.org/show_bug.cgi?id=162974

Reviewed by Brady Eidson.

Source/WebCore:

* platform/URL.cpp:
(WebCore::URL::serialize):
When we enable the URLParser, this attempt to make serialized URLs more spec compliant
won't be needed any more.

Tools:

* TestWebKitAPI/Tests/WebCore/URLParser.cpp:
(TestWebKitAPI::TEST_F):
Added some tests that are unrelated to the code change, but these are
reflected in changed LayoutTest results when enabling the URLParser,
and they weren't in the URLParser tests yet.  They should be.

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

3 years ago[Win][Direct2D] Connect WebCore/WebKit Drawing
bfulgham@apple.com [Wed, 5 Oct 2016 17:21:55 +0000 (17:21 +0000)]
[Win][Direct2D] Connect WebCore/WebKit Drawing
https://bugs.webkit.org/show_bug.cgi?id=162924

Reviewed by Alex Christensen.

Update the Windows WebKit layer to optionally use the Direct2D
backend.

* FullscreenVideoController.cpp: Disable some CoreAnimation-based
accelerated compositing logic.
* FullscreenVideoController.h:
* WebFrame.cpp:
(WebFrame::spoolPages): Disable in Direct2D.
* WebView.cpp:
(WebView::ensureBackingStore): Add Direct2D logic.
(WebView::scrollBackingStore): Ditto.
(WebView::sizeChanged): Ditto.
(WebView::paintWithDirect2D): Added.
(WebView::WebViewWndProc): Call Direct2D paint routine.
* WebView.h:

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

3 years ago[Win][Direct2D] Add initial D2D Path and Gradient implementation
bfulgham@apple.com [Wed, 5 Oct 2016 17:18:31 +0000 (17:18 +0000)]
[Win][Direct2D] Add initial D2D Path and Gradient implementation
https://bugs.webkit.org/show_bug.cgi?id=162923

Reviewed by Alex Christensen.

This patch lands a set of new files that implements initial Path
and Gradient features on Windows using Direct2D.

No new tests until complete backend lands.

* platform/graphics/Gradient.h:
* platform/graphics/Path.cpp:
* platform/graphics/Path.h:
* platform/graphics/win/GradientDirect2D.cpp: Added.
* platform/graphics/win/PathDirect2D.cpp: Added.

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

3 years ago[Readable Streams API] Align function names with spec
commit-queue@webkit.org [Wed, 5 Oct 2016 16:46:19 +0000 (16:46 +0000)]
[Readable Streams API] Align function names with spec
https://bugs.webkit.org/show_bug.cgi?id=162967

Patch by Romain Bellessort <romain.bellessort@crf.canon.fr> on 2016-10-05
Reviewed by Darin Adler.

Align function names with spec. Behaviour was already in line with spec, but previous function names had
sometimes been preserved to track the changes more easily. This led to some inconsistencies (for instance,
enqueueInReadableStream was still used even though it works on a controller instead of a stream) and it
also made it more difficult to compare spec and implementation.

No change in behaviour.

* Modules/fetch/FetchInternals.js:
(consumeStream): Updated with new function names.
* Modules/fetch/FetchResponse.js:
(clone): Updated with new function names.
* Modules/streams/ReadableStream.js:
(tee): Updated with new function names.
* Modules/streams/ReadableStreamDefaultController.js:
(enqueue): Updated with new function names.
(error): Updated with new function names.
* Modules/streams/ReadableStreamDefaultReader.js:
(read): Updated with new function names.
* Modules/streams/ReadableStreamInternals.js:
(privateInitializeReadableStreamDefaultController): Updated with new function names.
(readableStreamDefaultControllerError): Updated with new function names.
(readableStreamTee): Updated with new function names.
(readableStreamTeePullFunction): Updated with new function names.
(readableStreamTeeBranch2CancelFunction): Updated with new function names.
(readableStreamError): Updated with new function names.
(readableStreamCancel): Updated with new function names.
(readableStreamDefaultControllerPull): Updated with new function names.
(readableStreamDefaultControllerClose): Updated with new function names.
(readableStreamClose): Updated with new function names.
(readableStreamDefaultControllerEnqueue): Updated with new function names.
(readableStreamDefaultReaderRead): Updated with new function names.

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

3 years ago[WK2][NetworkSession] Ping requests should follow redirects if applicable
dbates@webkit.org [Wed, 5 Oct 2016 16:29:37 +0000 (16:29 +0000)]
[WK2][NetworkSession] Ping requests should follow redirects if applicable
https://bugs.webkit.org/show_bug.cgi?id=162580
<rdar://problem/28631274>

Rename test anchor-ping-and-do-not-follow-redirect-when-sending-ping.html to anchor-ping-and-follow-redirect-when-sending-ping.html
to reflect what it is actually testing - that we follow a redirect when sending a ping for a <a ping>.

* http/tests/navigation/ping-attribute/anchor-ping-and-follow-redirect-when-sending-ping-expected.txt: Renamed from LayoutTests/http/tests/navigation/ping-attribute/anchor-ping-and-do-not-follow-redirect-when-sending-ping-expected.txt.
* http/tests/navigation/ping-attribute/anchor-ping-and-follow-redirect-when-sending-ping.html: Renamed from LayoutTests/http/tests/navigation/ping-attribute/anchor-ping-and-do-not-follow-redirect-when-sending-ping.html.
* http/tests/navigation/resources/save-ping-and-redirect-to-save-ping.php: Only append the query string
if we have a non-empty query string to avoid appending a superfluous "?" on redirect.

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

3 years ago[Bindings] Declare dictionary / enumeration template specializations in the header
cdumez@apple.com [Wed, 5 Oct 2016 16:09:20 +0000 (16:09 +0000)]
[Bindings] Declare dictionary / enumeration template specializations in the header
https://bugs.webkit.org/show_bug.cgi?id=162929

Reviewed by Darin Adler.

Declare dictionary / enumeration template specializations in the header
so that:
- They can be used from custom bindings code.
- Dictionaries / enumerations can be used to their own IDL files to
  share them (Bug 162912).

No new tests, rebaselined bindings tests.

* WebCore.xcodeproj/project.pbxproj:
* bindings/generic/IDLTypes.h:
* bindings/js/JSDOMConvert.h:
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateInterface):
(GenerateEnumerationImplementationContent):
(GenerateEnumerationHeaderContent):
(GenerateDictionaryHeaderContent):
(GenerateHeader):
(GenerateCallbackHeader):
(GenerateCallbackImplementation):
(GenerateDefaultValue): Deleted.
(GenerateDictionaryImplementationContent): Deleted.
(GenerateParametersCheck): Deleted.
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestObj.h:

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

3 years agoRename ENABLE_ENCRYPTED_MEDIA_V2 to ENABLE_LEGACY_ENCRYPTED_MEDIA
zandobersek@gmail.com [Wed, 5 Oct 2016 16:02:35 +0000 (16:02 +0000)]
Rename ENABLE_ENCRYPTED_MEDIA_V2 to ENABLE_LEGACY_ENCRYPTED_MEDIA
https://bugs.webkit.org/show_bug.cgi?id=162903

Reviewed by Alex Christensen.

Rename build guards for the remaining implementation of the legacy EME API
to ENABLE_LEGACY_ENCRYPTED_MEDIA. This will allow for the future implementation
of the near-finished API to be guarded with the simple ENABLE_ENCRYPTED_MEDIA guards.

.:

* Source/cmake/OptionsEfl.cmake:
* Source/cmake/OptionsMac.cmake:
* Source/cmake/OptionsWin.cmake:
* Source/cmake/WebKitFeatures.cmake:
* Source/cmake/tools/vsprops/FeatureDefines.props:
* Source/cmake/tools/vsprops/FeatureDefinesCairo.props:

Source/JavaScriptCore:

* Configurations/FeatureDefines.xcconfig:

Source/WebCore:

No new tests -- no change in behavior.

* CMakeLists.txt:
* Configurations/FeatureDefines.xcconfig:
* DerivedSources.cpp:
* DerivedSources.make:
* Modules/encryptedmedia/CDM.cpp:
* Modules/encryptedmedia/CDM.h:
* Modules/encryptedmedia/CDMPrivate.h:
* Modules/encryptedmedia/CDMPrivateClearKey.cpp:
* Modules/encryptedmedia/CDMPrivateClearKey.h:
* Modules/encryptedmedia/CDMPrivateMediaPlayer.cpp:
* Modules/encryptedmedia/CDMPrivateMediaPlayer.h:
* Modules/encryptedmedia/CDMSessionClearKey.cpp:
* Modules/encryptedmedia/CDMSessionClearKey.h:
* Modules/encryptedmedia/MediaKeyMessageEvent.cpp:
* Modules/encryptedmedia/MediaKeyMessageEvent.h:
* Modules/encryptedmedia/MediaKeyMessageEvent.idl:
* Modules/encryptedmedia/MediaKeyNeededEvent.cpp:
* Modules/encryptedmedia/MediaKeyNeededEvent.h:
* Modules/encryptedmedia/MediaKeyNeededEvent.idl:
* Modules/encryptedmedia/MediaKeySession.cpp:
* Modules/encryptedmedia/MediaKeySession.h:
* Modules/encryptedmedia/MediaKeySession.idl:
* Modules/encryptedmedia/MediaKeys.cpp:
* Modules/encryptedmedia/MediaKeys.h:
* Modules/encryptedmedia/MediaKeys.idl:
* bindings/js/JSDictionary.cpp:
* bindings/js/JSDictionary.h:
* dom/Element.idl:
* dom/EventNames.in:
* dom/EventTargetFactory.in:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::~HTMLMediaElement):
(WebCore::HTMLMediaElement::webkitGenerateKeyRequest):
(WebCore::HTMLMediaElement::webkitAddKey):
* html/HTMLMediaElement.h:
* html/HTMLMediaElement.idl:
* html/MediaError.h:
* html/MediaError.idl:
* html/MediaKeyError.h:
* html/MediaKeyError.idl:
* page/Settings.h:
* platform/graphics/CDMSession.h:
* platform/graphics/MediaPlayer.cpp:
* platform/graphics/MediaPlayer.h:
* platform/graphics/MediaPlayerPrivate.h:
* platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.h:
* platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
* platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp:
* platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.h:
* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
(WebCore::MediaPlayerPrivateAVFoundationCF::supportsKeySystem):
(WebCore::AVFWrapper::shouldWaitForLoadingOfResource):
* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h:
* platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h:
* platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
* platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
* platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h:
* platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
* platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h:
* platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::supportsKeySystem):
(WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
(WebCore::playerKVOProperties):
(-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
* platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::willProvideContentKeyRequestInitializationDataForTrackID):
(WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
* testing/Internals.cpp:
* testing/Internals.h:
* testing/Internals.idl:
* testing/MockCDM.cpp:
* testing/MockCDM.h:

Source/WebKit/mac:

* Configurations/FeatureDefines.xcconfig:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit2:

* Configurations/FeatureDefines.xcconfig:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_userInterfaceLayoutDirection):
* WebProcess/WebProcess.cpp:
(WebKit::m_resourceLoadStatisticsStorage):

Source/WTF:

* wtf/FeatureDefines.h:

Tools:

* TestWebKitAPI/Configurations/FeatureDefines.xcconfig: Also remove the
ENABLE_IOS_TEXT_AUTOSIZING feature define that was renamed in r206395 and was
throwing up style checker errors.

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

3 years ago[WK2][NetworkSession] Ping requests should follow redirects if applicable
dbates@webkit.org [Wed, 5 Oct 2016 14:26:40 +0000 (14:26 +0000)]
[WK2][NetworkSession] Ping requests should follow redirects if applicable
https://bugs.webkit.org/show_bug.cgi?id=162580
<rdar://problem/28631274>

Reviewed by Alex Christensen.

Source/WebKit2:

Implement support for following redirects, if applicable, of a ping request when using the
Network Session (ENABLE(NETWORK_SESSION)) code path in WebKit2. For ping requests that are
in response to hyperlink auditing (e.g. <a ping>) we should follow redirect responses.
For Content Security Policy and XSS Auditor violation reports we should not follow redirect
responses.

Currently we always ignore redirects for ping requests that are sent using the Network Session
code path in WebKit2. This behavior disagrees with the behavior described in section
"Hyperlink auditing" of the HTML standard, <https://html.spec.whatwg.org/multipage/semantics.html#hyperlink-auditing> (27 September 2016),
as well as the behavior in Legacy WebKit and WebKit2 with Network Session disabled. We should
follow redirects for ping requests initiated as part of hyperlink auditing to more closely
conform to the HTML standard and match the behavior in Legacy WebKit and WebKit2 with Network
Session disabled.

* NetworkProcess/PingLoad.h:

LayoutTests:

Add tests to ensure that we follow redirects for ping requests that are initiated as part
of hyperlink auditing.

Modified http/tests/navigation/resources/save-Ping.php to include the host and request URI
information in the saved report and updated expected results for existing tests as a result
of this change.

* http/tests/contentextensions/block-cookies-in-csp-report-expected.txt:
* http/tests/contentextensions/block-cookies-in-image-load-in-onunload-expected.txt:
* http/tests/contentextensions/block-cookies-in-ping-expected.txt:
* http/tests/contentextensions/hide-on-csp-report-expected.txt:
* http/tests/contentextensions/hide-on-ping-expected.txt:
* http/tests/contentextensions/hide-on-ping-with-ping-that-redirects-expected.txt: Added.
* http/tests/contentextensions/hide-on-ping-with-ping-that-redirects.html: Added.
* http/tests/contentextensions/hide-on-ping-with-ping-that-redirects.html.json: Added.
* http/tests/contentextensions/resources/save-ping-and-redirect-to-save-ping.php: Added.
* http/tests/contentextensions/resources/save-ping.php:
* http/tests/navigation/image-load-in-pagehide-handler-expected.txt:
* http/tests/navigation/image-load-in-unload-handler-expected.txt:
* http/tests/navigation/ping-attribute/anchor-cookie-expected.txt:
* http/tests/navigation/ping-attribute/anchor-cross-origin-expected.txt:
* http/tests/navigation/ping-attribute/anchor-cross-origin-from-https-expected.txt:
* http/tests/navigation/ping-attribute/anchor-ping-and-do-not-follow-redirect-when-sending-ping-expected.txt: Added.
* http/tests/navigation/ping-attribute/anchor-ping-and-do-not-follow-redirect-when-sending-ping.html: Added.
* http/tests/navigation/ping-attribute/anchor-same-origin-expected.txt:
* http/tests/navigation/ping-attribute/area-cookie-expected.txt:
* http/tests/navigation/ping-attribute/area-cross-origin-expected.txt:
* http/tests/navigation/ping-attribute/area-cross-origin-from-https-expected.txt:
* http/tests/navigation/ping-attribute/area-same-origin-expected.txt:
* http/tests/navigation/resources/save-Ping.php:
* http/tests/navigation/resources/save-ping-and-redirect-to-save-ping.php: Added.

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

3 years agoDo not follow redirects when sending violation report
dbates@webkit.org [Wed, 5 Oct 2016 14:22:43 +0000 (14:22 +0000)]
Do not follow redirects when sending violation report
https://bugs.webkit.org/show_bug.cgi?id=162520
<rdar://problem/27957639>

Reviewed by Alex Christensen.

Source/WebCore:

Do not follow redirects when sending a Content Security Policy or XSS Auditor violation report
as redirects can be used to forward report details to a third-party.

This changes makes WebKit more closely conform to the reporting requirements in section Reporting
of the Content Security Level 2 standard: <https://w3c.github.io/webappsec-csp/2/#violation-reports>
(Editor's Draft, 25 April 2016).

Tests: http/tests/security/contentSecurityPolicy/report-blocked-uri-and-do-not-follow-redirect-when-sending-report.php
       http/tests/security/xssAuditor/report-script-tag-and-do-not-follow-redirect-when-sending-report.html
       http/tests/security/xssAuditor/report-script-tag-full-block-and-do-not-follow-redirect-when-sending-report.html

* loader/LoaderStrategy.h: Modified createPingHandle() to take a boolean, shouldFollowRedirects,
whether to follow redirect responses for a ping request.
* loader/PingLoader.cpp:
(WebCore::PingLoader::loadImage): Pass ShouldFollowRedirects::Yes to PingLoader::startPingLoad to
keep our current behavior.
(WebCore::PingLoader::sendPing): Ditto. Note our current behavior of following redirects matches
the behavior described in the section "Hyperlink auditing" of the HTML standard:
<https://html.spec.whatwg.org/multipage/semantics.html#hyperlink-auditing> (23 September 2016).
(WebCore::PingLoader::sendViolationReport): Pass ShouldFollowRedirects::No to PingLoader::startPingLoad
so that we do not follow redirects when sending a violation report.
(WebCore::PingLoader::startPingLoad): Modified to take argument shouldFollowRedirects whether to
follow redirect responses for a ping request.
* loader/PingLoader.h:
* platform/network/PingHandle.h: Add boolean m_shouldFollowRedirects. I grouped this boolean with
the existing boolean, m_shouldUseCredentialStorage, as opposed to appending to the end of the class
definition to avoid increasing object size as clang will coalesces the two bools into a single
machine word. Override ResourceHandleClient::willSendRequest() and ResourceHandleClient::willSendRequestAsync()
to follow a redirect, if applicable.

Source/WebKit:

Update implementation of legacy WebKit loader strategy to pass through a boolean,
shouldFollowRedirects, to PingHandle as to whether to follow redirect responses
for a ping request.

* WebCoreSupport/WebResourceLoadScheduler.cpp:
(WebResourceLoadScheduler::createPingHandle):
* WebCoreSupport/WebResourceLoadScheduler.h:

Source/WebKit2:

Update the non-Network Session WebKit2 implementation to follow redirect responses for a ping
request, if applicable. I did not update the Network Session implementation at this time. I
will fix it in <https://bugs.webkit.org/show_bug.cgi?id=162580>.

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::loadPing): Tell PingHandle whether to follow redirects.
* NetworkProcess/NetworkLoadParameters.h:
* NetworkProcess/NetworkResourceLoadParameters.cpp:
(WebKit::NetworkResourceLoadParameters::encode): Encode NetworkResourceLoadParameters::shouldFollowRedirects.
(WebKit::NetworkResourceLoadParameters::decode): Decode NetworkResourceLoadParameters::shouldFollowRedirects.
* NetworkProcess/PingLoad.h: Added FIXME comment to implement support for following redirects,
if applicable (for hyperlink auditing). See <https://bugs.webkit.org/show_bug.cgi?id=162580>
for more details.
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::createPingHandle): Modified to take a boolean whether to follow
redirects responses and set NetworkResourceLoadParameters::shouldFollowRedirects as appropriate.
* WebProcess/Network/WebLoaderStrategy.h:

LayoutTests:

Add tests for Content Security Policy and XSS Auditor to ensure that we do not follow redirects
when sending a violation report. Modified http/tests/security/contentSecurityPolicy/resources/save-report.php
to save the URL of the original ping request and conditionally clear cookies. Modified
http/tests/security/xssAuditor/resources/echo-intertag.pl to support testing for the XSS Auditor.
These changes together with the existing HTTP Host information that is saved with the report we can detect
if a redirect occurred when saving a report.

Updated expected results of existing tests now that we emit the URL of the ping request in the saved report.

* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-cross-origin-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-cross-origin-https-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-same-origin-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-same-origin-https-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/report-uri-effective-directive-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/script-blocked-sends-multiple-reports-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scripthash-allowed-by-enforced-policy-and-blocked-by-report-policy-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scripthash-allowed-by-enforced-policy-and-blocked-by-report-policy2-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scripthash-allowed-by-legacy-enforced-policy-and-blocked-by-report-policy-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scripthash-allowed-by-legacy-enforced-policy-and-blocked-by-report-policy2-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scripthash-blocked-by-enforced-policy-and-allowed-by-report-policy-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scripthash-blocked-by-legacy-enforced-policy-and-allowed-by-report-policy-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scripthash-blocked-by-legacy-enforced-policy-and-blocked-by-report-policy-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scripthash-blocked-by-legacy-enforced-policy-and-blocked-by-report-policy2-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scriptnonce-blocked-by-enforced-policy-and-allowed-by-report-policy-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scriptnonce-blocked-by-legacy-enforced-policy-and-allowed-by-report-policy-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scriptnonce-blocked-by-legacy-enforced-policy-and-blocked-by-report-policy-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scriptnonce-blocked-by-legacy-enforced-policy-and-blocked-by-report-policy2-expected.txt:
* http/tests/security/contentSecurityPolicy/report-and-enforce-expected.txt:
* http/tests/security/contentSecurityPolicy/report-blocked-data-uri-expected.txt:
* http/tests/security/contentSecurityPolicy/report-blocked-file-uri-expected.txt:
* http/tests/security/contentSecurityPolicy/report-blocked-uri-and-do-not-follow-redirect-when-sending-report-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/report-blocked-uri-and-do-not-follow-redirect-when-sending-report.php: Added.
* http/tests/security/contentSecurityPolicy/report-blocked-uri-cross-origin-expected.txt:
* http/tests/security/contentSecurityPolicy/report-blocked-uri-expected.txt:
* http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-expected.txt:
* http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-when-private-browsing-enabled-expected.txt:
* http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-when-private-browsing-toggled-expected.txt:
* http/tests/security/contentSecurityPolicy/report-only-expected.txt:
* http/tests/security/contentSecurityPolicy/report-only-from-header-expected.txt:
* http/tests/security/contentSecurityPolicy/report-only-upgrade-insecure-expected.txt:
* http/tests/security/contentSecurityPolicy/report-same-origin-no-cookies-when-private-browsing-toggled-expected.txt:
* http/tests/security/contentSecurityPolicy/report-same-origin-with-cookies-expected.txt:
* http/tests/security/contentSecurityPolicy/report-same-origin-with-cookies-when-private-browsing-enabled-expected.txt:
* http/tests/security/contentSecurityPolicy/report-status-code-zero-when-using-https-expected.txt:
* http/tests/security/contentSecurityPolicy/report-uri-expected.txt:
* http/tests/security/contentSecurityPolicy/report-uri-from-child-frame-expected.txt:
* http/tests/security/contentSecurityPolicy/report-uri-from-inline-javascript-expected.txt:
* http/tests/security/contentSecurityPolicy/report-uri-from-javascript-expected.txt:
* http/tests/security/contentSecurityPolicy/report-uri-scheme-relative-expected.txt:
* http/tests/security/contentSecurityPolicy/resources/save-report-and-redirect-to-save-report.php: Added.
* http/tests/security/contentSecurityPolicy/resources/save-report.php:
* http/tests/security/xssAuditor/report-script-tag-and-do-not-follow-redirect-when-sending-report-expected.txt: Added.
* http/tests/security/xssAuditor/report-script-tag-and-do-not-follow-redirect-when-sending-report.html: Added.
* http/tests/security/xssAuditor/report-script-tag-expected.txt:
* http/tests/security/xssAuditor/report-script-tag-full-block-and-do-not-follow-redirect-when-sending-report-expected.txt: Added.
* http/tests/security/xssAuditor/report-script-tag-full-block-and-do-not-follow-redirect-when-sending-report.html: Added.
* http/tests/security/xssAuditor/report-script-tag-full-block-expected.txt:
* http/tests/security/xssAuditor/report-script-tag-replace-state-expected.txt:
* http/tests/security/xssAuditor/resources/echo-intertag.pl:

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

3 years agoARM EABI buildfix after r206778
ossy@webkit.org [Wed, 5 Oct 2016 10:51:06 +0000 (10:51 +0000)]
ARM EABI buildfix after r206778
https://bugs.webkit.org/show_bug.cgi?id=162964

Unreviewed trivial fix.

* jit/CCallHelpers.h:
(JSC::CCallHelpers::setupArgumentsWithExecState):

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

3 years ago[SOUP] Move global TLS errors handling from ResourceHandle to SoupNetworkSession
carlosgc@webkit.org [Wed, 5 Oct 2016 09:43:28 +0000 (09:43 +0000)]
[SOUP] Move global TLS errors handling from ResourceHandle to SoupNetworkSession
https://bugs.webkit.org/show_bug.cgi?id=162910

Reviewed by Alex Christensen.

Source/WebCore:

So that it will be shared with network session code. Also remove setHostAllowsAnyHTTPSCertificate() that we have
never actually used.

* platform/network/ResourceHandle.h:
* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::tlsErrorsChangedCallback): Use SoupNetworkSession::checkTLSErrors().
* platform/network/soup/SoupNetworkSession.cpp:
(WebCore::HostTLSCertificateSet::add):
(WebCore::HostTLSCertificateSet::contains):
(WebCore::HostTLSCertificateSet::computeCertificateHash):
(WebCore::clientCertificates):
(WebCore::SoupNetworkSession::setShouldIgnoreTLSErrors):
(WebCore::SoupNetworkSession::checkTLSErrors):
(WebCore::SoupNetworkSession::allowSpecificHTTPSCertificateForHost):
* platform/network/soup/SoupNetworkSession.h:

Source/WebKit2:

Use SoupNetworkSession instead of ResourceHandle.

* NetworkProcess/soup/NetworkProcessSoup.cpp:
(WebKit::NetworkProcess::setIgnoreTLSErrors):
(WebKit::NetworkProcess::allowSpecificHTTPSCertificateForHost):

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

3 years agoUnreviewed. Fix GTK+ build with USE_REDIRECTED_XCOMPOSITE_WINDOW disabled.
carlosgc@webkit.org [Wed, 5 Oct 2016 09:23:52 +0000 (09:23 +0000)]
Unreviewed. Fix GTK+ build with USE_REDIRECTED_XCOMPOSITE_WINDOW disabled.

* UIProcess/AcceleratedDrawingAreaProxy.cpp:
(WebKit::AcceleratedDrawingAreaProxy::setNativeSurfaceHandleForCompositing):

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

3 years ago[SOUP] Move request HTTP body handling to ResourceRequestSoup and simplify it
carlosgc@webkit.org [Wed, 5 Oct 2016 07:08:38 +0000 (07:08 +0000)]
[SOUP] Move request HTTP body handling to ResourceRequestSoup and simplify it
https://bugs.webkit.org/show_bug.cgi?id=162891

Reviewed by Michael Catanzaro.

We are currently adding the HTTP body to the message in ResourceHandleSoup, but we could do it as part of the
ResourceRequest::updateSoupMessage() method, since the HTTP body is indeed part of the request. The code can be
also simplified, especially the handling of files, by using SharedBuffer that already mmaps the file when
possible, instead of using GMappedFile API.

* platform/SharedBuffer.h: Add createSoupBuffer() method.
* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::createSoupMessageForHandleAndRequest):
(WebCore::milisecondsSinceRequest): Deleted.
(WebCore::ResourceHandle::didStartRequest): Deleted.
(WebCore::startingCallback): Deleted.
(WebCore::networkEventCallback): Deleted.
(WebCore::ResourceHandle::start): Deleted.
(WebCore::ResourceHandle::releaseForDownload): Deleted.
(WebCore::ResourceHandle::timeoutFired): Deleted.
* platform/network/soup/ResourceRequest.h:
* platform/network/soup/ResourceRequestSoup.cpp:
(WebCore::appendEncodedBlobItemToSoupMessageBody): Helper method to append the blob to the request message body.
(WebCore::ResourceRequest::updateSoupMessageBody): Add HTTPBody to the request message body.
(WebCore::ResourceRequest::updateSoupMessage): Call updateSoupMessageBody() to also update the body.
* platform/soup/SharedBufferSoup.cpp:
(WebCore::SharedBuffer::createSoupBuffer): Returns a new SoupBuffer for the SharedBuffer.

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

3 years agoString.prototype.toLowerCase should be a DFG/FTL intrinsic
sbarati@apple.com [Wed, 5 Oct 2016 06:16:15 +0000 (06:16 +0000)]
String.prototype.toLowerCase should be a DFG/FTL intrinsic
https://bugs.webkit.org/show_bug.cgi?id=162887

Reviewed by Filip Pizlo and Yusuke Suzuki.

JSTests:

* microbenchmarks/to-lower-case.js: Added.
(assert):
(foo):
(bar):
* stress/to-lower-case.js: Added.
(assert):
(foo):

Source/JavaScriptCore:

This patch makes ToLowerCase an intrinsic in the DFG/FTL. On the fast
path, the intrinsic will loop over an 8-bit string ensuring it's already
lower case, and simply return the string. In the slow path, it'll call
into C code to make a new string.

This is a 7-8% speedup on ES6SampleBench/Basic.

* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleIntrinsicCall):
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGNodeType.h:
* dfg/DFGOperations.cpp:
* dfg/DFGOperations.h:
* dfg/DFGPredictionPropagationPhase.cpp:
* dfg/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileToLowerCase):
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::callOperation):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* ftl/FTLAbstractHeapRepository.h:
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileToLowerCase):
* jit/JITOperations.h:
* runtime/Intrinsic.h:
* runtime/StringPrototype.cpp:
(JSC::StringPrototype::finishCreation):

Source/WTF:

This patch exposes a new StringImpl function called convertToLowercaseWithoutLocaleStartingAtFailingIndex8Bit
which extracts slow path for the 8-bit part of convertToLowercaseWithoutLocale
into a helper function. I decided to extract this into its own function because
it may be the case that JSCs JITs will want to continue the operation
after it has already ensured that part of an 8-bit string is lower case.

* wtf/text/StringImpl.cpp:
(WTF::StringImpl::convertToLowercaseWithoutLocale):
(WTF::StringImpl::convertToLowercaseWithoutLocaleStartingAtFailingIndex8Bit):
* wtf/text/StringImpl.h:
* wtf/text/WTFString.cpp:
(WTF::String::convertToLowercaseWithoutLocaleStartingAtFailingIndex8Bit):
* wtf/text/WTFString.h:

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

3 years agoImplement KeyboardEvent.code from the UI Event spec
cdumez@apple.com [Wed, 5 Oct 2016 03:13:35 +0000 (03:13 +0000)]
Implement KeyboardEvent.code from the UI Event spec
https://bugs.webkit.org/show_bug.cgi?id=149584

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline W3C test now that more checks are passing.

* web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt:

Source/WebCore:

Add support for Keyboard.code attribute:
- https://w3c.github.io/uievents/#dom-keyboardevent-code
- https://w3c.github.io/uievents-code/

The feature is only enabled on Mac for now as the implementation is
platform-specific and Mac only.

Test: fast/events/keyboardevent-code.html

* dom/KeyboardEvent.cpp:
(WebCore::KeyboardEvent::KeyboardEvent):
* dom/KeyboardEvent.h:
* dom/KeyboardEvent.idl:
* platform/PlatformKeyboardEvent.h:
(WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
(WebCore::PlatformKeyboardEvent::code):
(WebCore::PlatformKeyboardEvent::unmodifiedText): Deleted.
* platform/mac/PlatformEventFactoryMac.h:
* platform/mac/PlatformEventFactoryMac.mm:
(WebCore::codeForKeyEvent):
(WebCore::keyIdentifierForKeyEvent):
* replay/SerializationMethods.cpp:
(JSC::EncodingTraits<PlatformKeyboardEvent>::encodeValue):
(JSC::EncodingTraits<PlatformKeyboardEvent>::decodeValue):

Source/WebKit2:

Add support for Keyboard.code attribute:
- https://w3c.github.io/uievents/#dom-keyboardevent-code
- https://w3c.github.io/uievents-code/

* Shared/WebEvent.h:
(WebKit::WebKeyboardEvent::code):
* Shared/WebEventConversion.cpp:
(WebKit::WebKit2PlatformKeyboardEvent::WebKit2PlatformKeyboardEvent):
* Shared/WebKeyboardEvent.cpp:
(WebKit::WebKeyboardEvent::WebKeyboardEvent):
(WebKit::WebKeyboardEvent::encode):
(WebKit::WebKeyboardEvent::decode):
* Shared/mac/WebEventFactory.mm:
(WebKit::WebEventFactory::createWebKeyboardEvent):

Source/WTF:

Add build time flag to toggle support for the code attribute on
KeyboardEvent and only enable it on Mac for now, given that the
implementation is missing on other platforms.

* wtf/FeatureDefines.h:

LayoutTests:

Extend layout test coverage.

* fast/events/arrow-keys-on-body-expected.txt:
* fast/events/arrow-keys-on-body.html:
* fast/events/constructors/keyboard-event-constructor-expected.txt:
* fast/events/constructors/keyboard-event-constructor.html:
* fast/events/key-events-in-input-button-expected.txt:
* fast/events/key-events-in-input-button.html:
* fast/events/key-events-in-input-text-expected.txt:
* fast/events/key-events-in-input-text.html:
* fast/events/keyboardevent-code-expected.txt: Added.
* fast/events/keyboardevent-code.html: Added.
* fast/events/special-key-events-in-input-text-expected.txt:
* fast/events/special-key-events-in-input-text.html:

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

3 years agoThe dragged image should be the current frame only of the animated image
commit-queue@webkit.org [Wed, 5 Oct 2016 01:52:35 +0000 (01:52 +0000)]
The dragged image should be the current frame only of the animated image
https://bugs.webkit.org/show_bug.cgi?id=162109

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2016-10-04
Reviewed by Tim Horton.

Source/WebCore:

Instead of creating an NSImage with all the frames for the dragImage,
create an NSImage with the current frame only.

* dom/DataTransferMac.mm:
(WebCore::DataTransfer::createDragImage): Call snapshotNSImage() to create the dragImage.
* editing/cocoa/HTMLConverter.mm:
(fileWrapperForElement):  Call the Image function with its new name.
* platform/graphics/BitmapImage.h:
* platform/graphics/Image.h:
(WebCore::Image::nsImage): Rename getNSImage() to nsImage().
(WebCore::Image::snapshotNSImage): Returns the NSImage of the current frame.
(WebCore::Image::tiffRepresentation): Rename getTIFFRepresentation() to tiffRepresentation().
(WebCore::Image::getNSImage): Deleted.
(WebCore::Image::getTIFFRepresentation): Deleted.
* platform/graphics/mac/ImageMac.mm:
(WebCore::BitmapImage::tiffRepresentation): Rename getTIFFRepresentation() to tiffRepresentation().
(WebCore::BitmapImage::nsImage): Rename getNSImage() to nsImage().
(WebCore::BitmapImage::snapshotNSImage): Returns the NSImage of the current frame.
(WebCore::BitmapImage::getTIFFRepresentation): Deleted.
(WebCore::BitmapImage::getNSImage): Deleted.
* platform/mac/CursorMac.mm:
(WebCore::createCustomCursor): Call snapshotNSImage() since the cursor does not animate anyway.
* platform/mac/DragImageMac.mm:
(WebCore::createDragImageFromImage): Use snapshotNSImage() for the dragImage.
* platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::write): Call the Image function with its new name.

Source/WebKit/mac:

* DOM/DOM.mm:
(-[DOMElement image]): Call the Image function with its new name.
(-[DOMElement _imageTIFFRepresentation]): Ditto.
* Misc/WebElementDictionary.mm:
(-[WebElementDictionary _image]): Call the Image function with its new name.
* Misc/WebIconDatabase.mm:
(-[WebIconDatabase defaultIconWithSize:]): Call snapshotNSImage() to create the icon image.
(webGetNSImage): Call the Image function with its new name.
* WebCoreSupport/WebContextMenuClient.mm:
(WebContextMenuClient::imageForCurrentSharingServicePickerItem): Call snapshotNSImage() instead of nsImage()..
(WebContextMenuClient::contextMenuForEvent): Ditto.
* WebView/WebHTMLView.mm:
(-[WebHTMLView pasteboard:provideDataForType:]): Call the Image function with its new name.

Source/WebKit2:

* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::provideDataForPasteboard): Call the Image function with its new name.

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

3 years ago[iOS] Crash in WebResourceLoaderQuickLookDelegate when the client cancels the navigat...
aestes@apple.com [Wed, 5 Oct 2016 01:02:27 +0000 (01:02 +0000)]
[iOS] Crash in WebResourceLoaderQuickLookDelegate when the client cancels the navigation to a QuickLook resource
https://bugs.webkit.org/show_bug.cgi?id=162950
<rdar://problem/23759114>

Reviewed by Brady Eidson.

Source/WebCore:

When we receive data from QLPreviewConverter for the first time, we call
ResourceLoader::didReceiveResponse() with the preview NSURLResponse from QuickLook. If the
client decides to cancel this navigation in decidePolicyForResponse(),
WebResourceLoaderQuickLookDelegate will end up with a null _resourceLoader after
didReceiveResponse() returns. This change adds null checks in the methods that use
_resourceLoader after calling -_sendDidReceiveResponseIfNecessary.

New API test: QuickLook.CancelNavigationAfterResponse

* platform/network/ios/QuickLook.mm:
(-[WebResourceLoaderQuickLookDelegate connection:didReceiveDataArray:]): Changed to only
call ResourceLoader::didReceiveDataArray() if _resourceLoader is non-null.
(-[WebResourceLoaderQuickLookDelegate connection:didReceiveData:lengthReceived:]): Ditto for
ResourceLoader::didReceiveData().
(-[WebResourceLoaderQuickLookDelegate connection:didFailWithError:]): Ditto for
ResourceLoader::didFail().

Tools:

Added a new API test.

* TestWebKitAPI/Tests/WebKit2Cocoa/QuickLook.mm: Sorted imports and removed redundant
initialization of static bools.
(runTest): Factored out the common test logic between QuickLook.NavigationDelegate and
QuickLook.CancelNavigationAfterResponse.
(TEST): Added QuickLook.CancelNavigationAfterResponse.
(-[QuickLookDecidePolicyDelegate
webView:decidePolicyForNavigationResponse:decisionHandler:]): Canceled the navigation.
(-[QuickLookDecidePolicyDelegate webView:didFailProvisionalNavigation:withError:]): Set
isDone to true.

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

3 years agoAdd the support for running ES6SampleBench to run-benchmark
rniwa@webkit.org [Wed, 5 Oct 2016 00:42:37 +0000 (00:42 +0000)]
Add the support for running ES6SampleBench to run-benchmark
https://bugs.webkit.org/show_bug.cgi?id=162890

Reviewed by Saam Barati.

Added the support for running ES6SampleBench as "es6bench".
e.g. ./Tools/Scripts/run-benchmark --platform osx --plan es6bench --browser safari

Instead of the default 10 iterations, run the test 4 iterations using 5 instances of browser
for the total of 20 iterations.

* Scripts/webkitpy/benchmark_runner/data/patches/ES6SampleBench.patch: Added.
* Scripts/webkitpy/benchmark_runner/data/plans/es6bench.plan: Added.
* Scripts/webkitpy/benchmark_runner/run_benchmark.py:
(start): Fixed the bug that the linter will complain about the presence of "debugOutput" by
removing it if it's present.

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

3 years agoRevert a change erroneously committed in r206795.
rniwa@webkit.org [Wed, 5 Oct 2016 00:40:25 +0000 (00:40 +0000)]
Revert a change erroneously committed in r206795.

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

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

3 years ago[iOS WK2] Make it possible for a test to describe a user gesture as a stream of event...
simon.fraser@apple.com [Wed, 5 Oct 2016 00:23:51 +0000 (00:23 +0000)]
[iOS WK2] Make it possible for a test to describe a user gesture as a stream of events in JSON format
https://bugs.webkit.org/show_bug.cgi?id=162934

Reviewed by Dean Jackson.

Tools:

With this change, a test can describe a user gesture in an "event stream", which is
some JSON describing an array of events with their underlying touches. The added
test describes a single tap.

The implementation fires up an NSThread, and sleeps the thread between events to dispatch
them at close to real time.

In future, HIDEventGenerator could use this internally for all of the "compound" interactions.

* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::sendEventStream):
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::sendEventStream):
* TestRunnerShared/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/ios/HIDEventGenerator.h:
* WebKitTestRunner/ios/HIDEventGenerator.mm:
(transducerTypeFromString):
(phaseFromString):
(-[HIDEventGenerator eventMaskFromEventInfo:]):
(-[HIDEventGenerator touchFromEventInfo:]):
(-[HIDEventGenerator _createIOHIDEventWithInfo:]):
(-[HIDEventGenerator dispatchEventWithInfo:]):
(-[HIDEventGenerator eventDispatchThreadEntry:]):
(-[HIDEventGenerator sendEventStream:completionBlock:]):
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::sendEventStream):

LayoutTests:

* fast/events/ios/event-stream-single-tap-expected.txt: Added.
* fast/events/ios/event-stream-single-tap.html: Added.

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

3 years agoWeb Inspector: don't synchronously send a listing message if we might need to query...
bburg@apple.com [Wed, 5 Oct 2016 00:15:39 +0000 (00:15 +0000)]
Web Inspector: don't synchronously send a listing message if we might need to query _WKAutomationDelegate
https://bugs.webkit.org/show_bug.cgi?id=162810
<rdar://problem/28571460>

Reviewed by Timothy Hatcher.

We shouldn't ever access the _WKAutomationDelegate through RemoteInspector::Client methods
off of the main thread, because it could cause problems. This happens when we pushListingsNow()
in response to a WIRApplicationGetListingMessage XPC message. In this case, just use
pushListingsSoon() since it dispatches on the correct (main) queue to gather listing information.

This may induce a slight update delay when first connecting to the UIProcess through RemoteInspector,
but this is at most 200ms and will coalesce with other updates that happen when UIProcess gets set up.

There are no other code paths through RemoteInspector (for UIProcess) that could cause a call
to pushListingsNow(), so this only needs to be changed in the XPC message handler.

* inspector/remote/RemoteInspector.mm:
(Inspector::RemoteInspector::receivedGetListingMessage):

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

3 years agoAdd support for KeyboardEvent.isComposing attribute
cdumez@apple.com [Wed, 5 Oct 2016 00:02:48 +0000 (00:02 +0000)]
Add support for KeyboardEvent.isComposing attribute
https://bugs.webkit.org/show_bug.cgi?id=162921

Reviewed by Darin Adler.

Source/WebCore:

Add support for KeyboardEvent.isComposing attribute:
- https://www.w3.org/TR/uievents/#dom-keyboardevent-iscomposing
- https://www.w3.org/TR/uievents/#ref-for-dom-keyboardevent-iscomposing-3

Manual test: https://jsfiddle.net/ay92sr08/9/

No new tests, extended existing tests.

* dom/KeyboardEvent.cpp:
(WebCore::KeyboardEvent::KeyboardEvent):
* dom/KeyboardEvent.h:
* dom/KeyboardEvent.idl:

LayoutTests:

Extend layout test coverage to test KeyboardEvent.isComposing.

* editing/mac/input/kotoeri-enter-to-confirm-and-newline-expected.txt:
* editing/mac/input/kotoeri-enter-to-confirm-and-newline.html:
* fast/events/constructors/keyboard-event-constructor-expected.txt:
* fast/events/constructors/keyboard-event-constructor.html:

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

3 years agoShadowRoot interface should have elementFromPoint
rniwa@webkit.org [Tue, 4 Oct 2016 23:42:18 +0000 (23:42 +0000)]
ShadowRoot interface should have elementFromPoint
https://bugs.webkit.org/show_bug.cgi?id=162882

Reviewed by Chris Dumez.

Source/WebCore:

Add elementFromPoint to ShadowRoot's prototype as specified at:
https://www.w3.org/TR/shadow-dom/#extensions-to-the-documentorshadowroot-mixin
with changes proposed at https://github.com/w3c/csswg-drafts/issues/556

Added TreeScope::retargetToScope which implements

This patch also factors DocumentOrShadowRoot.idl out of Document and ShadowRoot interfaces to better match
the latest DOM specification: https://dom.spec.whatwg.org/#mixin-documentorshadowroot

Test: fast/shadow-dom/Document-prototype-elementFromPoint.html

* CMakeLists.txt:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* dom/Document.cpp:
(WebCore::Document::nodeFromPoint): Moved to TreeScope.
(WebCore::Document::elementFromPoint): Moved to TreeScope.
* dom/Document.h:
* dom/Document.idl: Moved elementFromPoint and activeElement to DocumentOrShadowRoot.idl.
* dom/DocumentOrShadowRoot.idl: Added.
* dom/EventPath.cpp:
(WebCore::RelatedNodeRetargeter::checkConsistency): Use newly added TreeScope::retargetToScope.
* dom/ShadowRoot.idl: Moved activeElement to DocumentOrShadowRoot.idl.
* dom/TreeScope.cpp:
(WebCore::TreeScope::retargetToScope): Added. Implements https://dom.spec.whatwg.org/#retarget efficiently.
Instead of checking whether A (node) is a shadow-including inclusive ancestor of B (this scope) at each
parent, find the lowest ancestor which contains both A and B, and return the self-inclusive ancestor of B
in that tree. To find the lowest common ancestor in O(n), traverse all ancestors of A and B separately and
do a top-down traversal. The last tree scope in which A's ancestor and B's ancestor match is the lowest
common ancestor.
(WebCore::TreeScope::nodeFromPoint): Moved from Document.
(WebCore::TreeScope::elementFromPoint): Moved from Document. Use retargetToScope and parentInComposedTree
instead of parentNode and ancestorInThisScope to match the semantics proposed in
https://github.com/w3c/csswg-drafts/issues/556
* dom/TreeScope.h:

LayoutTests:

Add a W3C style testharness.js test for elementFromPoint on ShadowRoot.

* fast/shadow-dom/DocumentOrShadowRoot-prototype-elementFromPoint-expected.txt: Added.
* fast/shadow-dom/DocumentOrShadowRoot-prototype-elementFromPoint.html: Added.

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

3 years agoWebAssembly: handle a few corner cases
jfbastien@apple.com [Tue, 4 Oct 2016 23:25:33 +0000 (23:25 +0000)]
WebAssembly: handle a few corner cases
https://bugs.webkit.org/show_bug.cgi?id=162884

Reviewed by Keith Miller.

JSTests:

* stress/wasm/generate-wasmops-header.js:
(const.opcodeIterator): max opcode value

Source/JavaScriptCore:

* wasm/JSWASMModule.cpp: missing include broke cmake build
* wasm/WASMFunctionParser.h:
(JSC::WASM::FunctionParser<Context>::parseBlock): check op is valid
(JSC::WASM::FunctionParser<Context>::parseExpression): switch covers all cases
* wasm/WASMOps.h:
(JSC::WASM::isValidOpType): op is valid
* wasm/WASMParser.h:
(JSC::WASM::Parser::consumeString): avoid str[i] being one-past-the-end
(JSC::WASM::Parser::parseUInt32): shift math around to avoid overflow

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

3 years agoAdd Megan to contributor's list
commit-queue@webkit.org [Tue, 4 Oct 2016 23:20:39 +0000 (23:20 +0000)]
Add Megan to contributor's list
https://bugs.webkit.org/show_bug.cgi?id=162944

Patch by Megan Gardner <megan_gardner@apple.com> on 2016-10-04
Reviewed by Tim Horton.

Add Megan to the contributor's lists so that her e-mail autocompletes for CC

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

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

3 years agoAdd tests verifying non-special URL hosts are parsed according to spec
achristensen@apple.com [Tue, 4 Oct 2016 23:13:33 +0000 (23:13 +0000)]
Add tests verifying non-special URL hosts are parsed according to spec
https://bugs.webkit.org/show_bug.cgi?id=162885

Reviewed by Sam Weinig.

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

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

3 years agofont-family: cursive should map to KaiTi in Chinese
mmaxfield@apple.com [Tue, 4 Oct 2016 23:10:26 +0000 (23:10 +0000)]
font-family: cursive should map to KaiTi in Chinese
https://bugs.webkit.org/show_bug.cgi?id=162889
<rdar://problem/28363547>

Reviewed by Tim Horton.

Source/WebCore:

According to Bobby Tung, this is a better mapping. Previously, we were
relying on the system fallback mechanism. However, an explicit mapping
is more robust.

Test: fast/text/cursive-zh.html

* page/cocoa/SettingsCocoa.mm:
(WebCore::Settings::initializeDefaultFontFamilies):

LayoutTests:

* fast/text/cursive-zh-expected.html: Added.
* fast/text/cursive-zh.html: Added.

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

3 years agoREGRESSION (r206778): Release JSC test ChakraCore.yaml/ChakraCore/test/Error/validate...
utatane.tea@gmail.com [Tue, 4 Oct 2016 22:51:38 +0000 (22:51 +0000)]
REGRESSION (r206778): Release JSC test ChakraCore.yaml/ChakraCore/test/Error/validate_line_column.js.default failing
https://bugs.webkit.org/show_bug.cgi?id=162937

Reviewed by Saam Barati.

We dropped expression info accidentally at r206777.

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitCallDefineProperty):
* bytecompiler/BytecodeGenerator.h:
* bytecompiler/NodesCodegen.cpp:
(JSC::PropertyListNode::emitPutConstantProperty):
(JSC::ClassExprNode::emitBytecode):

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

3 years agoProperly kill web processes in the launching state
andersca@apple.com [Tue, 4 Oct 2016 22:41:01 +0000 (22:41 +0000)]
Properly kill web processes in the launching state
https://bugs.webkit.org/show_bug.cgi?id=162938

Reviewed by Tim Horton.

Source/WebKit2:

* UIProcess/Launcher/ProcessLauncher.h:
Add m_xpcConnection member.

* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::ProcessLauncher::launchProcess):
Store the XPC connection in the m_xpcConnection member variable.
In the reply handler, handle m_xpcConnection being null.

(WebKit::ProcessLauncher::platformInvalidate):
Cancel and kill the connection.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::terminateProcess):
Get rid of an assertion.

* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::requestTermination):
Handle the launching state.

Tools:

* TestWebKitAPI/Tests/WebKit2/TerminateTwice.cpp:
Enable this test again.

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

3 years agoMarking http/tests/cache/disk-cache/disk-cache-media.html as flaky on mac-wk2.
ryanhaddad@apple.com [Tue, 4 Oct 2016 22:26:44 +0000 (22:26 +0000)]
Marking http/tests/cache/disk-cache/disk-cache-media.html as flaky on mac-wk2.
https://bugs.webkit.org/show_bug.cgi?id=162946

Unreviewed test gardening.

* platform/mac-wk2/TestExpectations:

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

3 years agoMarking http/tests/cache/disk-cache/disk-cache-request-max-stale.html as flaky on...
ryanhaddad@apple.com [Tue, 4 Oct 2016 22:26:41 +0000 (22:26 +0000)]
Marking http/tests/cache/disk-cache/disk-cache-request-max-stale.html as flaky on mac-wk2.
https://bugs.webkit.org/show_bug.cgi?id=162945

Unreviewed test gardening.

* platform/mac-wk2/TestExpectations:

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

3 years agoMarking http/tests/cache/disk-cache/resource-becomes-uncacheable.html as flaky on...
ryanhaddad@apple.com [Tue, 4 Oct 2016 22:11:01 +0000 (22:11 +0000)]
Marking http/tests/cache/disk-cache/resource-becomes-uncacheable.html as flaky on mac-wk2.
https://bugs.webkit.org/show_bug.cgi?id=161649

Unreviewed test gardening.

* platform/mac-wk2/TestExpectations:

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

3 years agoMarking transitions/background-position-transitions.html as flaky.
ryanhaddad@apple.com [Tue, 4 Oct 2016 21:52:00 +0000 (21:52 +0000)]
Marking transitions/background-position-transitions.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=162881

Unreviewed test gardening.

* TestExpectations:

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

3 years agoURLParser: query-only URLs relative to file URLs should just add a query
achristensen@apple.com [Tue, 4 Oct 2016 21:22:34 +0000 (21:22 +0000)]
URLParser: query-only URLs relative to file URLs should just add a query
https://bugs.webkit.org/show_bug.cgi?id=162888

Reviewed by Tim Horton.

Source/WebCore:

Covered by new API tests.

* platform/URLParser.cpp:
(WebCore::URLParser::parse):
Like bug 206749 but with queries instead of fragments.

Tools:

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

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

3 years agoURLParser should match URL::parse and other browsers when parsing a URL containing...
achristensen@apple.com [Tue, 4 Oct 2016 21:20:54 +0000 (21:20 +0000)]
URLParser should match URL::parse and other browsers when parsing a URL containing only scheme://
https://bugs.webkit.org/show_bug.cgi?id=162909

Reviewed by Tim Horton.

Source/WebCore:

If there's no host in this case we shouldn't fail, but rather make a valid URL with the // in the path.
This matches Chrome, Firefox, and Safari's behavior.
Covered by API tests.

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

Tools:

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

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

3 years agoFix the build.
timothy_horton@apple.com [Tue, 4 Oct 2016 21:13:18 +0000 (21:13 +0000)]
Fix the build.

* Shared/WebBackForwardListItem.cpp:
(WebKit::WebBackForwardListItem::WebBackForwardListItem):
(WebKit::WebBackForwardListItem::highestUsedItemID):

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

3 years agoFix a typo in WebBackForwardListItem (highed->highest)
timothy_horton@apple.com [Tue, 4 Oct 2016 21:08:39 +0000 (21:08 +0000)]
Fix a typo in WebBackForwardListItem (highed->highest)
https://bugs.webkit.org/show_bug.cgi?id=162935

Reviewed by Anders Carlsson.

* Shared/WebBackForwardListItem.cpp:
(WebKit::WebBackForwardListItem::highestUsedItemID):
(WebKit::WebBackForwardListItem::highedUsedItemID): Deleted.
* Shared/WebBackForwardListItem.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):

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

3 years agoUnreviewed build fix after r206773.
bfulgham@apple.com [Tue, 4 Oct 2016 19:37:42 +0000 (19:37 +0000)]
Unreviewed build fix after r206773.

Exclude Direct2D definitions when building for normal CG Windows.

* platform/graphics/GraphicsContext.h:

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

3 years ago[DOMJIT] Introduce DOMJIT::GetterSetter to tell JIT information
utatane.tea@gmail.com [Tue, 4 Oct 2016 19:34:52 +0000 (19:34 +0000)]
[DOMJIT] Introduce DOMJIT::GetterSetter to tell JIT information
https://bugs.webkit.org/show_bug.cgi?id=162916

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

In this patch, we introduce DOMJIT::GetterSetter.
This class maintains information required to emit JIT code in DFG and FTL.
DOMJIT::GetterSetter has 2 virtual functions: checkDOM and callDOM.
These functions can return a DOMJIT::Patchpoint that allows us to inject
appropriate machine code during DFG and FTL phases. DFG and FTL will invoke
these functions to get a patchpoint. And this patchpoint will be used to
emit code corresponding to CheckDOM and CallDOM DFG nodes, which will be added
in subsqeunt patch.

We propagate DOMJIT::GetterSetter through PropertySlot, AccessCase, GetByIdVariant,
and GetByIdStatus along with CustomGetter to teach DFG that this custom access
code has a chance to be inlined with this DOMJIT::GetterSetter information.
Instead of propagating CustomGetterSetter holding DOMJIT::GetterSetter and CustomGetter,
we propagate CustomGetter and DOMJIT::GetterSetter. This is because of the current
CustomGetterSetter design that we reify CustomGetterSetters only when we need to reify
all the properties. This design allows us to avoid frequent CustomGetterSetter allocations
and structure transitions.

Currently, domJIT field is always nullptr since there is no DOMJITAttribute user.
When we add this, we will add code handling this DOMJIT::GetterSetter in DFG::ByteCodeParser.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* bytecode/GetByIdStatus.cpp:
(JSC::GetByIdStatus::computeForStubInfoWithoutExitSiteFeedback):
* bytecode/GetByIdVariant.cpp:
(JSC::GetByIdVariant::GetByIdVariant):
(JSC::GetByIdVariant::operator=):
(JSC::GetByIdVariant::attemptToMerge):
(JSC::GetByIdVariant::dumpInContext):
* bytecode/GetByIdVariant.h:
(JSC::GetByIdVariant::domJIT):
(JSC::GetByIdVariant::intrinsic): Deleted.
* bytecode/PolymorphicAccess.cpp:
(JSC::AccessCase::get):
(JSC::AccessCase::clone):
* bytecode/PolymorphicAccess.h:
(JSC::AccessCase::domJIT):
(JSC::AccessCase::RareData::RareData):
* dfg/DFGNode.h:
* domjit/DOMJITGetterSetter.h: Added.
(JSC::DOMJIT::GetterSetter::GetterSetter):
(JSC::DOMJIT::GetterSetter::~GetterSetter):
(JSC::DOMJIT::GetterSetter::getter):
(JSC::DOMJIT::GetterSetter::setter):
(JSC::DOMJIT::GetterSetter::thisClassInfo):
* domjit/DOMJITPatchpoint.h: Added.
(JSC::DOMJIT::Patchpoint::create):
(JSC::DOMJIT::Patchpoint::setGenerator):
(JSC::DOMJIT::Patchpoint::generator):
* jit/Repatch.cpp:
(JSC::tryCacheGetByID):
* runtime/CustomGetterSetter.h:
* runtime/JSObject.h:
(JSC::JSObject::fillCustomGetterPropertySlot):
* runtime/Lookup.h:
(JSC::HashTableValue::domJIT):
(JSC::getStaticPropertySlotFromTable):
(JSC::putEntry):
(JSC::reifyStaticProperty):
* runtime/PropertySlot.h:
(JSC::PropertySlot::domJIT):
(JSC::PropertySlot::setCacheableCustom):

Source/WebCore:

* ForwardingHeaders/domjit/DOMJITGetterSetter.h: Added.
* PlatformEfl.cmake:
* PlatformGTK.cmake:
* PlatformMac.cmake:
* PlatformWin.cmake:

Source/WebKit2:

* CMakeLists.txt:

Tools:

* DumpRenderTree/CMakeLists.txt:

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

3 years ago[JSC] Add a new byte code op_define_property instead of calling defineProperty
utatane.tea@gmail.com [Tue, 4 Oct 2016 19:31:24 +0000 (19:31 +0000)]
[JSC] Add a new byte code op_define_property instead of calling defineProperty
https://bugs.webkit.org/show_bug.cgi?id=162108

Reviewed by Saam Barati.

To construct ES6 class, we emitted bytecode that performs the following operations.

    1. construct a new object
    2. put "configurable", "enumerable" etc. fields
    3. call "defineProperty" function

However, this approach has problems. Every time we define a class method, we need to create
a new object to represent property descriptor. This can be removed if we can introduce
a special bytecode or special function.

This patch introduces new bytecodes, op_define_data_property and op_define_accessor_property.
Instead of taking an object, they takes several registers to avoid object allocations.
We're planning to use this bytecode to implement Object.defineProperty in builtin JS next.
This allows us to leverage object allocation sinking. And it also gives us a chance to use
faster ::get and ::hasProperty in JS.

Originally, I attempted to create one bytecode, op_define_property. However, it takes too many
children in DFG and uses so many registers in DFG. This leads tricky program in 32bit platforms.
Furthermore, it does not fit to the number of x64 argument registers. So instead, we introduce
two bytecodes.

And for op_define_accessor_property, we perform CellUse edge filter to getter and setter children.
This edge filter makes us possible to use SpeculateCellOperand and reduce the number of used registers
in comparison with JSValueOperand. To make children Cells even if we do not specify some accessors (for
example, { get: func, set: null } case), we fill registers with special throwTypeErrorFunction.
The attributes bitset keep information like "This property descriptor only has getter slot".

In these two bytecodes, we take attributes (configurable, enumerable, writable, hasGetter etc.) as
register instead of embedding constant int value because we will use these bytecodes to implement
Object.defineProperty next. In Object.defineProperty case, an attributes are not statically defined
at bytecode compiling time.

Run ES6SampleBench/Air 20 times. The result shows ~2% performance improvement.

Baseline:
    firstIteration:     84.05 ms +- 4.37 ms
    averageWorstCase:   40.54 ms +- 2.81 ms
    steadyState:        3317.49 ms +- 48.25 ms
    summary:            223.51 ms +- 5.07 ms

Patched:
    firstIteration:     84.46 ms +- 4.22 ms
    averageWorstCase:   41.48 ms +- 2.33 ms
    steadyState:        3253.48 ms +- 29.31 ms
    summary:            224.40 ms +- 4.72 ms

* JavaScriptCore.xcodeproj/project.pbxproj:
* bytecode/BytecodeList.json:
* bytecode/BytecodeUseDef.h:
(JSC::computeUsesForBytecodeOffset):
(JSC::computeDefsForBytecodeOffset):
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::dumpBytecode):
* bytecode/SpecialPointer.h:
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitMoveLinkTimeConstant):
(JSC::BytecodeGenerator::emitCallDefineProperty):
* bytecompiler/BytecodeGenerator.h:
* bytecompiler/NodesCodegen.cpp:
(JSC::PropertyListNode::emitPutConstantProperty):
(JSC::BitwiseNotNode::emitBytecode):
(JSC::ClassExprNode::emitBytecode):
(JSC::ObjectPatternNode::bindValue):
* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGCapabilities.cpp:
(JSC::DFG::capabilityLevel):
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGNodeType.h:
* dfg/DFGOperations.cpp:
* dfg/DFGOperations.h:
* dfg/DFGPredictionPropagationPhase.cpp:
* dfg/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileDefineDataProperty):
(JSC::DFG::SpeculativeJIT::compileDefineAccessorProperty):
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::callOperation):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileDefineDataProperty):
(JSC::FTL::DFG::LowerDFGToB3::compileDefineAccessorProperty):
(JSC::FTL::DFG::LowerDFGToB3::compilePutByValWithThis): Deleted.
* jit/CCallHelpers.cpp:
(JSC::CCallHelpers::setupFourStubArgsGPR): Deleted.
* jit/CCallHelpers.h:
(JSC::CCallHelpers::setupFourStubArgsGPR):
(JSC::CCallHelpers::setupFiveStubArgsGPR):
(JSC::CCallHelpers::setupArgumentsWithExecState):
(JSC::CCallHelpers::setupStubArgsGPR):
(JSC::CCallHelpers::prepareForTailCallSlow): Deleted.
* jit/JIT.cpp:
(JSC::JIT::privateCompileMainPass):
* jit/JIT.h:
* jit/JITOperations.h:
* jit/JITPropertyAccess.cpp:
(JSC::JIT::emit_op_define_data_property):
(JSC::JIT::emit_op_define_accessor_property):
* llint/LowLevelInterpreter.asm:
* runtime/CommonSlowPaths.cpp:
(JSC::SLOW_PATH_DECL):
* runtime/CommonSlowPaths.h:
* runtime/DefinePropertyAttributes.h: Added.
(JSC::DefinePropertyAttributes::DefinePropertyAttributes):
(JSC::DefinePropertyAttributes::rawRepresentation):
(JSC::DefinePropertyAttributes::hasValue):
(JSC::DefinePropertyAttributes::setValue):
(JSC::DefinePropertyAttributes::hasGet):
(JSC::DefinePropertyAttributes::setGet):
(JSC::DefinePropertyAttributes::hasSet):
(JSC::DefinePropertyAttributes::setSet):
(JSC::DefinePropertyAttributes::writable):
(JSC::DefinePropertyAttributes::configurable):
(JSC::DefinePropertyAttributes::enumerable):
(JSC::DefinePropertyAttributes::setWritable):
(JSC::DefinePropertyAttributes::setConfigurable):
(JSC::DefinePropertyAttributes::setEnumerable):
(JSC::DefinePropertyAttributes::fillWithTriState):
(JSC::DefinePropertyAttributes::extractTriState):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::visitChildren):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::throwTypeErrorFunction):
(JSC::JSGlobalObject::definePropertyFunction): Deleted.
* runtime/ObjectConstructor.cpp:
(JSC::ObjectConstructor::addDefineProperty): Deleted.
* runtime/ObjectConstructor.h:
* runtime/PropertyDescriptor.h:
(JSC::toPropertyDescriptor):

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

3 years agoReturn null when window.open() is popup blocked
cdumez@apple.com [Tue, 4 Oct 2016 19:00:06 +0000 (19:00 +0000)]
Return null when window.open() is popup blocked
https://bugs.webkit.org/show_bug.cgi?id=162897

Reviewed by Michael Catanzaro.

Source/WebCore:

The return value of window.open() when the popup is blocked should be null:
- https://github.com/whatwg/html/pull/1854
- https://github.com/whatwg/html/issues/1851

Firefox / Edge return null.

No new tests, rebaselined existing tests.

* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::open):

LayoutTests:

Rebaseline existing tests to reflect behavior change.

* fast/events/popup-blocked-from-fake-button-click-expected.txt:
* fast/events/popup-blocked-from-fake-button-click.html:
* fast/events/popup-blocked-from-fake-focus-expected.txt:
* fast/events/popup-blocked-from-fake-focus.html:
* fast/events/popup-blocked-from-fake-user-gesture-expected.txt:
* fast/events/popup-blocked-from-fake-user-gesture.html:
* fast/events/popup-blocked-from-untrusted-click-event-on-anchor-expected.txt:
* fast/events/popup-blocked-from-untrusted-click-event-on-anchor.html:
* fast/events/popup-blocking-timers3-expected.txt:
* fast/events/popup-blocking-timers3.html:
* fast/events/popup-blocking-timers4-expected.txt:
* fast/events/popup-blocking-timers4.html:
* fast/events/popup-blocking-timers6-expected.txt:
* fast/events/popup-blocking-timers6.html:

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

3 years ago[Web IDL] Add support for dictionary inheritance
cdumez@apple.com [Tue, 4 Oct 2016 18:51:44 +0000 (18:51 +0000)]
[Web IDL] Add support for dictionary inheritance
https://bugs.webkit.org/show_bug.cgi?id=162907

Reviewed by Sam Weinig.

Add support for dictionary inheritance to our Web IDL parser and
bindings generator. Leverage this new support for EventTarget's
EventListenerOptions / AddEventListenerOptions dictionaries, in
order to match the DOM specification:
- https://dom.spec.whatwg.org/#interface-eventtarget

Also update the bindings generator to convert the dictionary
members in lexicographical order, as per:
- https://heycam.github.io/webidl/#es-dictionary (Step 5.1)

No new tests, rebaselined bindings tests.

* bindings/scripts/CodeGenerator.pm:
(GetDictionaryByName):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateDictionaryImplementationContent):
* bindings/scripts/IDLParser.pm:
(parseDictionary):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::convertDictionary<TestObj::Dictionary>):
(WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>):
(WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>):
(WebCore::convertDictionary<AlternateDictionaryName>):
(WebCore::convertDictionary<TestObj::ParentDictionary>):
(WebCore::convertDictionary<TestObj::ChildDictionary>):
* bindings/scripts/test/TestObj.idl:
* dom/EventTarget.idl:

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

3 years agoMarking http/tests/cache/disk-cache/disk-cache-204-status-code.html as flaky on mac...
ryanhaddad@apple.com [Tue, 4 Oct 2016 18:45:20 +0000 (18:45 +0000)]
Marking http/tests/cache/disk-cache/disk-cache-204-status-code.html as flaky on mac-wk2.
https://bugs.webkit.org/show_bug.cgi?id=162685

Unreviewed test gardening.

* platform/mac-wk2/TestExpectations:

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

3 years agoLand TestExpectations for rdar://problem/28586837.
ryanhaddad@apple.com [Tue, 4 Oct 2016 18:41:07 +0000 (18:41 +0000)]
Land TestExpectations for rdar://problem/28586837.

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

3 years ago[Win][Direct2D] Add initial D2D GraphicsContext implementation
bfulgham@apple.com [Tue, 4 Oct 2016 18:31:21 +0000 (18:31 +0000)]
[Win][Direct2D] Add initial D2D GraphicsContext implementation
https://bugs.webkit.org/show_bug.cgi?id=162917

Reviewed by Dean Jackson.

This patch lands a set of new files that implement the GraphicsContext
features on Windows using Direct2D.

No new tests until complete backend lands.

* platform/graphics/Color.h: Add new casting operator.
* platform/graphics/FloatSize.h: Ditto.
* platform/graphics/GraphicsContext.cpp: Update for Direct2D
implementation.
* platform/graphics/GraphicsContext.h:
* platform/graphics/win/ColorDirect2D.cpp:
(WebCore::Color::operator D2D1_VECTOR_4F): Added.
* platform/graphics/win/GraphicsContextCGWin.cpp: Add compiler
guard to avoid building when using Direct2D.
* platform/graphics/win/GraphicsContextDirect2D.cpp: Added.
* platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h: Added.
* platform/graphics/win/GraphicsContextWin.cpp: Update for Direct2D
includes.
* platform/graphics/win/TransformationMatrixDirect2D.cpp: Fix comment.

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

3 years ago[SOUP] Remove SSLPolicyFlags from SoupNetworkSession
commit-queue@webkit.org [Tue, 4 Oct 2016 16:53:43 +0000 (16:53 +0000)]
[SOUP] Remove SSLPolicyFlags from SoupNetworkSession
https://bugs.webkit.org/show_bug.cgi?id=162906

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2016-10-04
Reviewed by Michael Catanzaro.

Source/WebCore:

All soup based ports are setting SSLUseSystemCAFile flag unconditionally, so we can just use that when creating
the session like we do for all other construct parameters.

* platform/network/soup/SoupNetworkSession.cpp:
(WebCore::SoupNetworkSession::createTestingSession):
(WebCore::SoupNetworkSession::setupLogger):
(WebCore::SoupNetworkSession::SoupNetworkSession): Deleted.
(WebCore::SoupNetworkSession::clearOldSoupCache): Deleted.
(WebCore::SoupNetworkSession::setHTTPProxy): Deleted.
* platform/network/soup/SoupNetworkSession.h:
(WebCore::SoupNetworkSession::soupSession): Deleted.

Source/WebKit2:

* NetworkProcess/soup/NetworkProcessMainSoup.cpp:
(WebKit::NetworkProcessMainUnix):

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

3 years agoMedia controls are displayed in the incorrect state momentarily after switching betwe...
wenson_hsieh@apple.com [Tue, 4 Oct 2016 15:35:30 +0000 (15:35 +0000)]
Media controls are displayed in the incorrect state momentarily after switching between tabs playing media
https://bugs.webkit.org/show_bug.cgi?id=162766
<rdar://problem/28533523>

Reviewed by Jer Noble.

Source/WebCore:

When showing Now Playing controls for a media session, we should first set up the Now Playing info and
playback state before telling MediaRemote to make the session visible. This is WebKit work in ensuring that
when switching Now Playing sessions by switching tabs, we do not first display an invalid Now Playing state
before updating to the expected state.

Adds 2 new WebKit API tests in NowPlayingControlsTests: NowPlayingControlsHideAfterShowingClearsInfo and
NowPlayingControlsClearInfoAfterSessionIsNoLongerValid.

* platform/audio/PlatformMediaSessionManager.h:
(WebCore::PlatformMediaSessionManager::lastUpdatedNowPlayingTitle):
(WebCore::PlatformMediaSessionManager::lastUpdatedNowPlayingDuration):
(WebCore::PlatformMediaSessionManager::lastUpdatedNowPlayingElapsedTime):
(WebCore::PlatformMediaSessionManager::hasActiveNowPlayingSession): Deleted.
* platform/audio/mac/MediaSessionManagerMac.h:
* platform/audio/mac/MediaSessionManagerMac.mm:
(WebCore::MediaSessionManagerMac::updateNowPlayingInfo):

Source/WebKit2:

Plumbs some more Now Playing information from the web process to the UI process for testing purposes. See
WebCore ChangeLog for more details.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _handleActiveNowPlayingSessionInfoResponse:title:duration:elapsedTime:]):
(-[WKWebView _handleActiveNowPlayingSessionInfoResponse:]): Deleted.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::handleActiveNowPlayingSessionInfoResponse):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/mac/PageClientImpl.h:
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::handleActiveNowPlayingSessionInfoResponse):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::requestActiveNowPlayingSessionInfo):

Tools:

Adds new tests and tweaks existing tests to verify last updated Now Playing information.

* TestWebKitAPI/Tests/WebKit2Cocoa/NowPlayingControlsTests.mm:
(-[NowPlayingTestWebView _handleActiveNowPlayingSessionInfoResponse:title:duration:elapsedTime:]):
(TestWebKitAPI::TEST):
(-[NowPlayingTestWebView _handleActiveNowPlayingSessionInfoResponse:]): Deleted.
* TestWebKitAPI/Tests/WebKit2Cocoa/large-video-test-now-playing.html:

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

3 years ago[Fetch API] ReadableStream should be errored with TypeError values
commit-queue@webkit.org [Tue, 4 Oct 2016 15:17:34 +0000 (15:17 +0000)]
[Fetch API] ReadableStream should be errored with TypeError values
https://bugs.webkit.org/show_bug.cgi?id=162895

Patch by Youenn Fablet <youenn@apple.com> on 2016-10-04
Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

* web-platform-tests/fetch/api/basic/error-after-response-expected.txt: Added.
* web-platform-tests/fetch/api/basic/error-after-response.html: Added.
* web-platform-tests/fetch/api/resources/bad-chunk-encoding.py: Added.
(main):
* web-platform-tests/fetch/api/response/response-consume-stream-expected.txt:

Source/WebCore:

Test: imported/w3c/web-platform-tests/fetch/api/basic/error-after-response.html

* Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::BodyLoader::didFail): Removing FIXME.
* bindings/js/ReadableStreamDefaultController.h:
(WebCore::ReadableStreamDefaultController::error<String>): Erroring with TypeError values.

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

3 years ago[mac-wk1] LayoutTest http/tests/security/cached-cross-origin-preloading-css-styleshee...
commit-queue@webkit.org [Tue, 4 Oct 2016 15:15:35 +0000 (15:15 +0000)]
[mac-wk1] LayoutTest http/tests/security/cached-cross-origin-preloading-css-stylesheet.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=162791

Patch by Youenn Fablet <youenn@apple.com> on 2016-10-04
Reviewed by Alex Christensen.

Flackiness was due to one preload sometimes arriving after the test was finished.
This causes the issue of not having the preload actually being checked against CORS and the console error was not displayed.
Making the test wait 1 second after all loads finish to ensure the preload will also finishes.

Cleaning the test and improving it by:
- making each load to take 1 second (so that preload is not finished when actual load happens
- adding some comments explaining each subtest
- printing DONE at the end of all loads.

* http/tests/security/cached-cross-origin-preloading-css-stylesheet-expected.txt:
* http/tests/security/cached-cross-origin-preloading-css-stylesheet.html:
* platform/mac-wk1/TestExpectations: Removed flaky expectation.

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

3 years agoUnreviewed GTK+ build fix.
zandobersek@gmail.com [Tue, 4 Oct 2016 13:49:38 +0000 (13:49 +0000)]
Unreviewed GTK+ build fix.

* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageNavigationClient): Guard the call to getDefaultWebCryptoMasterKey()
with ENABLE(SUBTLE_CRYPTO), since the same guard is used for the definition. Fixes
GTK+ production builds where the feature is disabled.

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

3 years agoFollow up fix to GetMapBucket and MapHash speculating on child node types.
sbarati@apple.com [Tue, 4 Oct 2016 09:19:48 +0000 (09:19 +0000)]
Follow up fix to GetMapBucket and MapHash speculating on child node types.
To fix this, on 32-bit platforms, we do not speculate on the child
type since we just call into C code for these nodes.

* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):

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

3 years agoBindings do not throw a TypeError if a required dictionary member is missing
cdumez@apple.com [Tue, 4 Oct 2016 06:28:55 +0000 (06:28 +0000)]
Bindings do not throw a TypeError if a required dictionary member is missing
https://bugs.webkit.org/show_bug.cgi?id=162734

Reviewed by Geoffrey Garen.

Bindings should throw a TypeError if a required dictionary member is missing.
For example, if there is a "required long id" member in a dictionary that is
missing, our bindings would prevously pass 0 to the implementation instead
of throwing a TypeError.

Relevant specification:
- https://heycam.github.io/webidl/#es-dictionary

I aligned our bindings generator implementation with the specification,
except for the support for dictionary inheritance that is still missing
and will be addressed in a follow-up patch.

No new tests, I rebaselined the bindings tests and this is already covered
by fast/events/touch/touch-constructor.html on iOS.

* bindings/js/JSCustomElementRegistryCustom.cpp:
(WebCore::JSCustomElementRegistry::define):
* bindings/js/JSDOMConvert.h:
(WebCore::convert): Deleted.
(WebCore::Converter<bool>::convert): Deleted.
(WebCore::Converter<String>::convert): Deleted.
(WebCore::Converter<IDLDOMString>::convert): Deleted.
(WebCore::Converter<IDLUSVString>::convert): Deleted.
(WebCore::Converter<JSC::JSValue>::convert): Deleted.
(WebCore::Converter<int8_t>::convert): Deleted.
(WebCore::Converter<uint8_t>::convert): Deleted.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateDictionaryImplementationContent):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::convertDictionary<TestObj::Dictionary>):
(WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>):
(WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>):
(WebCore::convertDictionary<AlternateDictionaryName>):

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

3 years ago[ListItems] Render tree should be all clean by the end of FrameView::layout().
zalan@apple.com [Tue, 4 Oct 2016 03:33:57 +0000 (03:33 +0000)]
[ListItems] Render tree should be all clean by the end of FrameView::layout().
https://bugs.webkit.org/show_bug.cgi?id=162832

Reviewed by Simon Fraser.

List item markers are inserted into the tree during layout, right before laying out
the list item (that's a big FIXME). At this point we already know what part of the tree
needs to be laid out. Inserting a list item marker does not expand this dirty area.
However whenever we insert a new renderer into the tree, we call setNeedsLayout on the contining block chain.
In certain cases (floating renderers), it could potentially trigger some unintentional markings
and we return from FrameView::layout() with a dirty subtree.

This patch preemptively marks the list item and its marker dirty so that
when the marker is getting inserted into the tree, we stop the marking at the parent.

Not testable.

* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::insertOrMoveMarkerRendererIfNeeded):

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

3 years agoGetMapBucket node should speculate on the type of its 'key' child
sbarati@apple.com [Tue, 4 Oct 2016 00:35:52 +0000 (00:35 +0000)]
GetMapBucket node should speculate on the type of its 'key' child
https://bugs.webkit.org/show_bug.cgi?id=161638

Reviewed by Filip Pizlo.

This eliminates type-check branches when we've already
proven the type of the incoming key. Also, it reduces
the branches we emit when type checking the bucket's key.

This is a 2-3% speedup on ES6SampleBench/Basic.

* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileGetMapBucket):

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

3 years agoMore logging to diagnose "WebKit encountered an internal error" messages
krollin@apple.com [Tue, 4 Oct 2016 00:32:41 +0000 (00:32 +0000)]
More logging to diagnose "WebKit encountered an internal error" messages
https://bugs.webkit.org/show_bug.cgi?id=162754

Reviewed by Antti Koivisto.

Add more logging around calls to internalError, as well as some
low-level logging around SharedMemory, and mach_vm_map in particular.

* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::startNetworkLoad):
* Platform/Logging.h:
* Platform/mac/SharedMemoryMac.cpp:
(WebKit::SharedMemory::allocate):
(WebKit::makeMemoryEntry):
(WebKit::SharedMemory::map):
(WebKit::SharedMemory::~SharedMemory):
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::networkProcessCrashed):
(WebKit::WebLoaderStrategy::loadResourceSynchronously):
* WebProcess/Network/WebResourceLoader.cpp:
(WebKit::WebResourceLoader::didReceiveResource):

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

3 years agoImplement rendering of font-variation-settings
mmaxfield@apple.com [Tue, 4 Oct 2016 00:06:25 +0000 (00:06 +0000)]
Implement rendering of font-variation-settings
https://bugs.webkit.org/show_bug.cgi?id=162782

Reviewed by Zalan Bujtas.

Source/WebCore:

(Re-landing after fixing tests.)

Because the heavy lifting for font-variation-settings is done by CoreText,
this patch is fairly minimal. It simply hooks up the CSS property to CoreText.

There is an existing bug in CoreText where variations inside fonts do not
survive the addition of a cascade list. Therefore, FontPlatformData::ctFont()
needs to work around this (conditionally) by resupplying the variation at
the same time as the cascade list. The CoreText bug is <rdar://problem/28449441>.

Tests: fast/text/variations/duplicate.html
       fast/text/variations/exist.html
       fast/text/variations/inheritance.html
       fast/text/variations/order.html
       fast/text/variations/outofbounds.html

* platform/graphics/FontCache.h:
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::preparePlatformFont):
(WebCore::fontWithFamily):
(WebCore::FontCache::createFontPlatformData):
(WebCore::FontCache::systemFallbackForCharacters):
* platform/graphics/cocoa/FontPlatformDataCocoa.mm:
(WebCore::cascadeToLastResortAttributesDictionary):
(WebCore::cascadeToLastResortAndVariationsFontDescriptor):
(WebCore::FontPlatformData::ctFont):
(WebCore::cascadeToLastResortFontDescriptor): Deleted.
* platform/graphics/mac/FontCustomPlatformData.cpp:
(WebCore::FontCustomPlatformData::fontPlatformData):
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::updateCachedSystemFontDescription):

LayoutTests:

* fast/text/variations/duplicate-expected.html: Added.
* fast/text/variations/duplicate.html: Added.
* fast/text/variations/exist-expected-mismatch.html: Added.
* fast/text/variations/exist.html: Added.
* fast/text/variations/getComputedStyle.html:
* fast/text/variations/inheritance-expected.html: Added.
* fast/text/variations/inheritance.html: Added.
* fast/text/variations/order-expected.html: Added.
* fast/text/variations/order.html: Added.
* fast/text/variations/outofbounds-expected.html: Added.
* fast/text/variations/outofbounds.html: Added.

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

3 years agoMarking svg/custom/animate-initial-pause-unpause.html as flaky on mac and ios-simulat...
ryanhaddad@apple.com [Mon, 3 Oct 2016 23:26:32 +0000 (23:26 +0000)]
Marking svg/custom/animate-initial-pause-unpause.html as flaky on mac and ios-simulator-wk2 debug.
https://bugs.webkit.org/show_bug.cgi?id=127116

Unreviewed test gardening.

* platform/ios-simulator-wk2/TestExpectations:
* platform/mac/TestExpectations:

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

3 years agoOffline asm should not output masm assembly when using a x86_64 asm backend
commit-queue@webkit.org [Mon, 3 Oct 2016 23:24:56 +0000 (23:24 +0000)]
Offline asm should not output masm assembly when using a x86_64 asm backend
https://bugs.webkit.org/show_bug.cgi?id=162705

When cross compiling on windows to Clang, masm was being generated simply because
the os was windows. This change adds a command line parameter --assembler=MASM
to set the output assembly to masm.
The functions isGCC and isCompilingToWindows were removed as they are no longer called.

Patch by Christopher Reid <Christopher.Reid@am.sony.com> on 2016-10-03
Reviewed by Mark Lam.

* CMakeLists.txt:
* offlineasm/asm.rb:
* offlineasm/x86.rb:

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

3 years agoSource/WebCore:
achristensen@apple.com [Mon, 3 Oct 2016 22:55:46 +0000 (22:55 +0000)]
Source/WebCore:
URLParser should strip tabs at all locations
https://bugs.webkit.org/show_bug.cgi?id=162836

Reviewed by Geoffrey Garen.

Covered by adding tabs to each location of each API test
except tests that test the encoding of surrogate pairs,
because inserting a tab between the pairs changes the encoding.

* platform/URLParser.cpp:
(WebCore::URLParser::takesTwoAdvancesUntilEnd):
(WebCore::URLParser::parse):
(WebCore::URLParser::parseIPv4Number):
(WebCore::URLParser::parseIPv4Host):
* platform/URLParser.h:

Tools:
URLParser should ignore tabs at all locations
https://bugs.webkit.org/show_bug.cgi?id=162836

Reviewed by Geoffrey Garen.

* TestWebKitAPI/Tests/WebCore/URLParser.cpp:
(TestWebKitAPI::checkURL):
(TestWebKitAPI::checkRelativeURL):
(TestWebKitAPI::checkURLDifferences):
(TestWebKitAPI::checkRelativeURLDifferences):
(TestWebKitAPI::TEST_F):

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

3 years agoUnreviewed, rolling out r206754.
ryanhaddad@apple.com [Mon, 3 Oct 2016 22:53:43 +0000 (22:53 +0000)]
Unreviewed, rolling out r206754.

This change broke the El Capitan and Yosemite debug builds.

Reverted changeset:

"More logging to diagnose "WebKit encountered an internal
error" messages"
https://bugs.webkit.org/show_bug.cgi?id=162754
http://trac.webkit.org/changeset/206754

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

3 years agoAuto-generate WASMOps.h, share with testing JSON file
jfbastien@apple.com [Mon, 3 Oct 2016 22:43:37 +0000 (22:43 +0000)]
Auto-generate WASMOps.h, share with testing JSON file
https://bugs.webkit.org/show_bug.cgi?id=162870

Reviewed by Keith Miller.

JSTests:

* stress/wasm/to-c++.js: Added. Generates WASMOps.h, siilar to the current one but with more data.
(const.opcode_iterator):
(opcode_macroizer):
* stress/wasm/wasm.json: Added. Data from 0xC binary format version.

Source/JavaScriptCore:

Add a few new opcodes, but keep this mostly as-is for now. I want
to generate smarter code but will do so in a later update to
reduce disruption.

* wasm/WASMOps.h: auto-generated from ./JSTests/stress/wasm/to-c++.js

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

3 years agoMarking fast/events/tabindex-focus-blur-all.html as a flaky timeout on mac-debug.
ryanhaddad@apple.com [Mon, 3 Oct 2016 22:32:11 +0000 (22:32 +0000)]
Marking fast/events/tabindex-focus-blur-all.html as a flaky timeout on mac-debug.
https://bugs.webkit.org/show_bug.cgi?id=162830

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

3 years agoMore logging to diagnose "WebKit encountered an internal error" messages
krollin@apple.com [Mon, 3 Oct 2016 22:18:24 +0000 (22:18 +0000)]
More logging to diagnose "WebKit encountered an internal error" messages
https://bugs.webkit.org/show_bug.cgi?id=162754

Reviewed by Antti Koivisto.

Add more logging around calls to internalError, as well as some
low-level logging around SharedMemory, and mach_vm_map in particular.

* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::startNetworkLoad):
* Platform/Logging.h:
* Platform/mac/SharedMemoryMac.cpp:
(WebKit::SharedMemory::allocate):
(WebKit::makeMemoryEntry):
(WebKit::SharedMemory::map):
(WebKit::SharedMemory::~SharedMemory):
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::networkProcessCrashed):
(WebKit::WebLoaderStrategy::loadResourceSynchronously):
* WebProcess/Network/WebResourceLoader.cpp:
(WebKit::WebResourceLoader::didReceiveResource):

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

3 years agoRemove Document::elementSheet()
antti@apple.com [Mon, 3 Oct 2016 21:52:37 +0000 (21:52 +0000)]
Remove Document::elementSheet()
https://bugs.webkit.org/show_bug.cgi?id=162876

Reviewed by Andreas Kling.

This is a Document owned stylesheet that exists as a context for parsing element inline style.
It never contains any rules and is generally confusing.

This patch removes the requirement for a stylesheet to be present for CSSParser to operate in
the correct context. Inline style is now parsed without stylesheet and a context object is
passed instead.

* bindings/js/JSCSSStyleDeclarationCustom.cpp:
(WebCore::root):
* bindings/js/JSCSSStyleDeclarationCustom.h:
(WebCore::root): Deleted.
* css/PropertySetCSSStyleDeclaration.cpp:
(WebCore::PropertySetCSSStyleDeclaration::setCssText):
(WebCore::PropertySetCSSStyleDeclaration::setProperty):
(WebCore::PropertySetCSSStyleDeclaration::setPropertyInternal):
(WebCore::PropertySetCSSStyleDeclaration::cssParserContext):
(WebCore::StyleRuleCSSStyleDeclaration::parentStyleSheet):
(WebCore::StyleRuleCSSStyleDeclaration::cssParserContext):
(WebCore::InlineCSSStyleDeclaration::parentStyleSheet):
(WebCore::InlineCSSStyleDeclaration::cssParserContext):
* css/PropertySetCSSStyleDeclaration.h:
(WebCore::PropertySetCSSStyleDeclaration::didMutate): Deleted.
* css/StyleProperties.cpp:
(WebCore::MutableStyleProperties::setProperty):
(WebCore::MutableStyleProperties::setCustomProperty):
(WebCore::MutableStyleProperties::parseDeclaration):
* css/parser/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseCustomPropertyValue):
(WebCore::CSSParser::parseInlineStyleDeclaration):
* css/parser/CSSParser.h:
* css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::parseInlineStyleDeclaration):
* dom/Document.cpp:
(WebCore::Document::~Document):
(WebCore::Document::updateBaseURL):
(WebCore::Document::usesStyleBasedEditability):
(WebCore::Document::setHasElementUsingStyleBasedEditability):
(WebCore::Document::elementSheet): Deleted.
* dom/Document.h:
* dom/StyledElement.cpp:
(WebCore::StyledElement::setInlineStyleFromString):
(WebCore::StyledElement::invalidateStyleAttribute):

    The usesStyleBasedEditability bit used to be set via the elementSheet. Instead check for it after inline style mutations.

(WebCore::StyledElement::setInlineStyleProperty):
(WebCore::StyledElement::addPropertyToPresentationAttributeStyle):
* dom/StyledElement.h:
(WebCore::StyledElement::invalidateStyleAttribute): Deleted.
* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyleSheetForInlineStyle::getStyleAttributeRanges):
* svg/SVGAnimateElementBase.cpp:
(WebCore::applyCSSPropertyToTarget):

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

3 years agoCreating pcToOriginMap in FTL shouldn't insert unnecessary NOPs
msaboff@apple.com [Mon, 3 Oct 2016 21:51:11 +0000 (21:51 +0000)]
Creating pcToOriginMap in FTL shouldn't insert unnecessary NOPs
https://bugs.webkit.org/show_bug.cgi?id=162879

Reviewed by Filip Pizlo.

If there is a recent watchpoint label, using MacroAssembler::label() will pad
the instruction stream with NOPs to provide space for a jump.  This changes
Air::generate() to use labelIgnoringWatchpoints() to create pcToOriginMap
entries to eliminate unneccesary NOPs.

* b3/air/AirGenerate.cpp:
(JSC::B3::Air::generate):
* b3/testb3.cpp:
(JSC::B3::testPCOriginMapDoesntInsertNops): New test.
(JSC::B3::run):

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

3 years agoAvoid null dereference when changing focus in design mode.
bfulgham@apple.com [Mon, 3 Oct 2016 21:36:46 +0000 (21:36 +0000)]
Avoid null dereference when changing focus in design mode.
https://bugs.webkit.org/show_bug.cgi?id=162877
<rdar://problem/28061261>

Reviewed by Chris Dumez.

Source/WebCore:

The bare m_frame pointer in DOMWindow can be cleared when setting focus to a new element. Check
that the m_frame pointer is non-null before using it after calling a routine that could
clear the pointer value.

Test: fast/frames/iframe-focus-crash.html

* page/DOMWindow.cpp:
(WebCore::DOMWindow::focus): Check that the pointer is still non-null after setting the
current focused element to nullptr.

LayoutTests:

* fast/frames/iframe-focus-crash-expected.txt: Added.
* fast/frames/iframe-focus-crash.html: Added.
* fast/frames/resources/iframe-focus-crash.html: Added.

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

3 years agoAdd support for KeyboardEvent.key attribute
cdumez@apple.com [Mon, 3 Oct 2016 21:32:47 +0000 (21:32 +0000)]
Add support for KeyboardEvent.key attribute
https://bugs.webkit.org/show_bug.cgi?id=36267

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline because that the tests are failing differently now that we support
the key attribute on KeyboardEvent but are still missing other standard API
on this interface.

* web-platform-tests/dom/events/Event-init-while-dispatching-expected.txt:
* web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt:

Source/WebCore:

Add support for KeyboardEvent.key attribute:
- https://w3c.github.io/uievents/#dom-keyboardevent-key

This is behind a compile time flag that is only enabled on Mac and
iOS and the implementation is still missing for other platforms.

Test: fast/events/keyboardevent-key.html

* dom/KeyboardEvent.cpp:
(WebCore::KeyboardEvent::KeyboardEvent):
* dom/KeyboardEvent.h:
* dom/KeyboardEvent.idl:
* platform/PlatformKeyboardEvent.h:
(WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
(WebCore::PlatformKeyboardEvent::key):
* platform/cocoa/KeyEventCocoa.h:
* platform/cocoa/KeyEventCocoa.mm:
(WebCore::keyForCharCode):
* platform/ios/PlatformEventFactoryIOS.h:
* platform/ios/PlatformEventFactoryIOS.mm:
(WebCore::keyForKeyEvent):
(WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
* platform/mac/PlatformEventFactoryMac.h:
* platform/mac/PlatformEventFactoryMac.mm:
(WebCore::keyForKeyEvent):
(WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
(WebCore::PlatformWheelEventBuilder::PlatformWheelEventBuilder): Deleted.
* replay/SerializationMethods.cpp:
(JSC::EncodingTraits<PlatformKeyboardEvent>::encodeValue):
(JSC::EncodingTraits<PlatformKeyboardEvent>::decodeValue):

Source/WebKit2:

Add support for KeyboardEvent.key attribute.

* Shared/WebEvent.h:
(WebKit::WebKeyboardEvent::key):
(WebKit::WebKeyboardEvent::unmodifiedText): Deleted.
* Shared/WebEventConversion.cpp:
(WebKit::WebKit2PlatformKeyboardEvent::WebKit2PlatformKeyboardEvent):
* Shared/WebKeyboardEvent.cpp:
(WebKit::WebKeyboardEvent::WebKeyboardEvent):
(WebKit::WebKeyboardEvent::encode):
(WebKit::WebKeyboardEvent::decode):
* Shared/mac/WebEventFactory.mm:
(WebKit::WebEventFactory::createWebKeyboardEvent):

Source/WTF:

Add compile time flag for the key attribute on KeyboardEvent and enable
it on Cocoa only.

* wtf/FeatureDefines.h:

LayoutTests:

Extend layout test coverage.

* fast/events/constructors/keyboard-event-constructor-expected.txt:
* fast/events/constructors/keyboard-event-constructor.html:
* fast/events/key-events-in-input-button-expected.txt:
* fast/events/key-events-in-input-button.html:
* fast/events/key-events-in-input-text-expected.txt:
* fast/events/key-events-in-input-text.html:
* fast/events/keyboardevent-key-expected.txt: Added.
* fast/events/keyboardevent-key.html: Added.
* fast/events/special-key-events-in-input-text-expected.txt:
* fast/events/special-key-events-in-input-text.html:
* platform/ios-simulator/TestExpectations:

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

3 years agoURLParser: fragment-only URLs relative to file URLs should just add a fragment
achristensen@apple.com [Mon, 3 Oct 2016 21:31:15 +0000 (21:31 +0000)]
URLParser: fragment-only URLs relative to file URLs should just add a fragment
https://bugs.webkit.org/show_bug.cgi?id=162871

Reviewed by Geoffrey Garen.

Source/WebCore:

Covered by new API tests.

* platform/URLParser.cpp:
(WebCore::URLParser::parse):
Instead of adding ///# after copying the base URL to the query, just add an #.

Tools:

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

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

3 years agoMarking storage/indexeddb/index-cursor.html as flaky on mac-wk2.
ryanhaddad@apple.com [Mon, 3 Oct 2016 21:30:17 +0000 (21:30 +0000)]
Marking storage/indexeddb/index-cursor.html as flaky on mac-wk2.
https://bugs.webkit.org/show_bug.cgi?id=161926

Unreviewed test gardening.

* platform/mac-wk2/TestExpectations:

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

3 years agoMarking http/tests/security/anchor-download-allow-data.html as flaky on mac-wk2.
ryanhaddad@apple.com [Mon, 3 Oct 2016 21:27:55 +0000 (21:27 +0000)]
Marking http/tests/security/anchor-download-allow-data.html as flaky on mac-wk2.
https://bugs.webkit.org/show_bug.cgi?id=161745

Unreviewed test gardening.

* platform/mac-wk2/TestExpectations:

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

3 years agoMapHash should speculate on the type of its child node
sbarati@apple.com [Mon, 3 Oct 2016 20:49:34 +0000 (20:49 +0000)]
MapHash should speculate on the type of its child node
https://bugs.webkit.org/show_bug.cgi?id=161922

Reviewed by Filip Pizlo.

JSTests:

* microbenchmarks/map-key-well-typed.js: Added.
(assert):
(intKey):
(doubleKey):
(objectKey):
(stringKey):
(booleanKey):
(symbolKey):
(cellKey):
(assert.doubleKey):
(assert.booleanKey):

PerformanceTests:

I gave the main generator a name so it's easier to see what
it is when using the sampling profiler.

* ES6SampleBench/Basic/ast.js:
(Basic.Program):

Source/JavaScriptCore:

This allows us to remove runtime type checks when we've already
proven the type of the incoming value.

This is a 2-3% speedup on ES6SampleBench/Basic.

* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::wangsInt64Hash):
(JSC::FTL::DFG::LowerDFGToB3::mapHashString):
(JSC::FTL::DFG::LowerDFGToB3::compileMapHash):

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

3 years ago[Modern Media Controls] LayoutItem and Button classes
commit-queue@webkit.org [Mon, 3 Oct 2016 20:31:06 +0000 (20:31 +0000)]
[Modern Media Controls] LayoutItem and Button classes
https://bugs.webkit.org/show_bug.cgi?id=162868
<rdar://problem/28590166>

Patch by Antoine Quint <graouts@apple.com> on 2016-10-03
Reviewed by Dean Jackson.

Source/WebCore:

We introduce the new Button class and its parent class LayoutItem. We will subclass Button
a lot in coming patches, as it provides a way to create a button and provide a delegate to
respond to UI events via the `uiDelegate` property. A Button extends a LayoutItem, another
class that we'll subclass heavily in coming patches, which is simply a LayoutNode with a
`layoutDelegate` which allows to set the node's `layoutTraits`, a bit-mask allowing to
specify layout attributes such as the platform and playback styles.

Tests: media/modern-media-controls/button/button.html
       media/modern-media-controls/layout-item/layout-item.html

* Modules/modern-media-controls/controls/button.css: Added.
(button):
* Modules/modern-media-controls/controls/button.js: Added.
(Button):
(Button.prototype.get enabled):
(Button.prototype.set enabled):
(Button.prototype.handleEvent):
(Button.prototype._handleUIEvent):
* Modules/modern-media-controls/controls/layout-item.js: Added.
(LayoutItem.prototype.get layoutTraits):
(LayoutItem):

LayoutTests:

Testing all public properties and methods of the LayoutItem and Button classes.

* media/modern-media-controls/button/button-expected.txt: Added.
* media/modern-media-controls/button/button.html: Added.
* media/modern-media-controls/layout-item/layout-item-expected.txt: Added.
* media/modern-media-controls/layout-item/layout-item.html: Added.

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

3 years agoASSERTION FAILED: url.containsOnlyASCII() in WebCore::checkEncodedString() when parsi...
aestes@apple.com [Mon, 3 Oct 2016 20:27:33 +0000 (20:27 +0000)]
ASSERTION FAILED: url.containsOnlyASCII() in WebCore::checkEncodedString() when parsing an invalid CSS cursor URL
https://bugs.webkit.org/show_bug.cgi?id=162763
<rdar://problem/28572758>

Reviewed by Youenn Fablet.

Source/WebCore:

CSSCursorImageValue copies the URL of its underlying CSSImageValue by using the
ParsedURLString URL constructor on the String returned by CSSImageValue::url(). While
CSSImageValues were always being constructed from a URL implicitly converted to a String,
nothing ensured that the URL was valid. For invalid URLs, URL::string() returns the string
it was constructed with, which might still represent a relative URL or contain non-ASCII
characters, violating the preconditions of the ParsedURLString URL constructor and causing
an assertion to fail in Debug builds.

Fix this by having CSSImageValue store its image URL using a WebCore::URL rather than a
String. CSSCursorImageValue can then copy this URL instead of attempting to re-parse a
possibly-invalid URL string.

Test: fast/css/cursor-with-invalid-url.html

* css/CSSCursorImageValue.cpp:
(WebCore::CSSCursorImageValue::CSSCursorImageValue): Copied m_imageValue.url() into
m_originalURL instead of using the ParsedURLString URL constructor, since
CSSImageValue::url() now returns a WebCore::URL.
(WebCore::CSSCursorImageValue::loadImage): Created a URL from cursorElement->href() by
calling Document::completeURL().
* css/CSSImageValue.cpp:
(WebCore::CSSImageValue::CSSImageValue): Changed to take a URL&& instead of a const String&.
(WebCore::CSSImageValue::loadImage): Stopped calling Document::completeURL(), since m_url is
now a WebCore::URL.
* css/CSSImageValue.h: Changed url() to return a const URL&, and changed m_url to be a URL.
* html/HTMLBodyElement.cpp:
(WebCore::HTMLBodyElement::collectStyleForPresentationAttribute): Removed a call to
URL::string().
* html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::collectStyleForPresentationAttribute): Ditto.
* html/HTMLTablePartElement.cpp:
(WebCore::HTMLTablePartElement::collectStyleForPresentationAttribute): Ditto.

LayoutTests:

* fast/css/cursor-with-invalid-url.html: Added.
* fast/css/cursor-with-invalid-url-expected.txt: Added.

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

3 years agoLog an error to stderr when FrameView::layout() fails to clean all the renderers.
zalan@apple.com [Mon, 3 Oct 2016 20:26:00 +0000 (20:26 +0000)]
Log an error to stderr when FrameView::layout() fails to clean all the renderers.
https://bugs.webkit.org/show_bug.cgi?id=162835

Reviewed by Simon Fraser.

We've come across multiple layout/painting bugs caused by renderers left dirty
after FrameView::layout(). This patch helps catching such issues early.
Once all the blocking bugs are fixed (webkit.org/b/162835), logging should be replaced with ASSERT().

Not testable.

* page/FrameView.cpp:
(WebCore::RenderTreeNeedsLayoutChecker::~RenderTreeNeedsLayoutChecker):
(WebCore::FrameView::layout):

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

3 years ago[Win][Direct2D] Add D2D Bitmap Image handling code
bfulgham@apple.com [Mon, 3 Oct 2016 20:22:57 +0000 (20:22 +0000)]
[Win][Direct2D] Add D2D Bitmap Image handling code
https://bugs.webkit.org/show_bug.cgi?id=162761

Reviewed by Dean Jackson.

This patch lands a set of new files that implement
Image and BitmapImage features on Windows using
Direct2D.

The desired ID2D1RenderTarget handle is needed by the
image decoder so that it can load the resulting bitmap
into the GPU.

No new tests until complete backend lands.

* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::draw): Tell the Direct2D image decoder
which render target to use.
* platform/graphics/BitmapImage.h:
* platform/graphics/ImageBuffer.cpp:
* platform/graphics/ImageBuffer.h:
* platform/graphics/ImageBufferData.h:
* platform/graphics/ImageFrameCache.cpp:
(WebCore::ImageFrameCache::setRenderTarget): Added.
* platform/graphics/ImageFrameCache.h:
(WebCore::ImageFrameCache::decoder): Added.
* platform/graphics/ImageSource.cpp:
* platform/graphics/ImageSource.h:
(WebCore::ImageSource::setRenderTarget):
* platform/graphics/win/ImageBufferDataDirect2D.cpp: Added.
* platform/graphics/win/ImageBufferDataDirect2D.h: Added.
* platform/graphics/win/ImageBufferDirect2D.cpp: Added.
* platform/graphics/win/ImageCGWin.cpp:
* platform/graphics/win/ImageDecoderDirect2D.cpp: Added.
* platform/graphics/win/ImageDecoderDirect2D.h: Added.
* platform/graphics/win/ImageDirect2D.cpp: Added.
* platform/graphics/win/NativeImageDirect2D.cpp: Added.

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

3 years ago[Win] DRT temp folder is not used.
pvollan@apple.com [Mon, 3 Oct 2016 19:26:03 +0000 (19:26 +0000)]
[Win] DRT temp folder is not used.
https://bugs.webkit.org/show_bug.cgi?id=162863

Reviewed by Alex Christensen.

Convert DRT temp folder to DOS path, which DRT can use.

* Scripts/webkitpy/port/driver.py:
(Driver._setup_environ_for_driver):

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

3 years ago[SOUP] Remove unused methods toSoupMessage from ResourceRequest/Response
commit-queue@webkit.org [Mon, 3 Oct 2016 19:13:20 +0000 (19:13 +0000)]
[SOUP] Remove unused methods toSoupMessage from ResourceRequest/Response
https://bugs.webkit.org/show_bug.cgi?id=162867

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2016-10-03
Reviewed by Sergio Villar Senin.

* platform/network/soup/ResourceRequest.h:
* platform/network/soup/ResourceRequestSoup.cpp:
(WebCore::ResourceRequest::updateSoupMessage):
(WebCore::ResourceRequest::updateFromSoupMessage): Deleted.
* platform/network/soup/ResourceResponse.h:
* platform/network/soup/ResourceResponseSoup.cpp:
(WebCore::ResourceResponse::updateFromSoupMessage): Deleted.

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

3 years agoB3 trapping memory accesses should be documented
fpizlo@apple.com [Mon, 3 Oct 2016 18:36:55 +0000 (18:36 +0000)]
B3 trapping memory accesses should be documented
https://bugs.webkit.org/show_bug.cgi?id=162845

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

While writing some documentation, I found some small holes in the code.

* b3/B3Effects.cpp:
(JSC::B3::Effects::operator==): Need this to write tests.
(JSC::B3::Effects::operator!=): Need this to write tests.
* b3/B3Effects.h:
* b3/B3HeapRange.h:
* b3/B3MemoryValue.cpp:
(JSC::B3::MemoryValue::dumpMeta): Sometimes the heap range dump won't show you the memory value's actual range. This makes the dump show you the actual range in that case.
* b3/B3Value.cpp:
(JSC::B3::Value::effects): While documenting this, I remembered that trapping also has to imply reading top. I fixed this.
* b3/testb3.cpp:
(JSC::B3::testTrappingLoad): Added checks for the effects of trapping loads.
(JSC::B3::testTrappingStore): Added checks for the effects of trapping stores.
(JSC::B3::testMoveConstants): Made this not crash with validation.

Websites/webkit.org:

Added documentation for the Traps flag, and factored out the documentation of the Chill flag
to a new flags section.

* docs/b3/intermediate-representation.html:

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

3 years ago[ES6] GeneratorFunction (a.k.a. GeneratorWrapperFunction)'s prototype object does...
utatane.tea@gmail.com [Mon, 3 Oct 2016 18:36:12 +0000 (18:36 +0000)]
[ES6] GeneratorFunction (a.k.a. GeneratorWrapperFunction)'s prototype object does not have constructor property
https://bugs.webkit.org/show_bug.cgi?id=162849

Reviewed by Geoffrey Garen.

JSTests:

* test262.yaml:

Source/JavaScriptCore:

Since GeneratorFunction is not constructible, GeneratorFunction.prototype does not have "constructor" property.

    function* generatorFunction() { }
    generatorFunction.prototype.constructor // undefined

* runtime/JSFunction.cpp:
(JSC::JSFunction::getOwnPropertySlot):

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

3 years agoRemove FetchBody::m_isEmpty
commit-queue@webkit.org [Mon, 3 Oct 2016 17:57:27 +0000 (17:57 +0000)]
Remove FetchBody::m_isEmpty
https://bugs.webkit.org/show_bug.cgi?id=162857

Patch by Youenn Fablet <youenn@apple.com> on 2016-10-03
Reviewed by Alex Christensen.

No change of behavior.

Moving handling of null bodies in FetchBodyOwner, by having an Optional<FetchBody> in FetchBodyOwner.
Moving storage of m_contentType in FetchBodyOwner.

Moving header storage from FetchResponse/FetchRequest to FetchBodyOwner, as it helps updating m_contentType.

* Modules/fetch/FetchBody.cpp: removing m_isEmpty and m_contentType.
(WebCore::FetchBody::extract): Computes the default content-type which is stored in FetchBodyOwner.
(WebCore::FetchBody::blob):
(WebCore::FetchBody::consume):
(WebCore::FetchBody::consumeAsStream):
(WebCore::FetchBody::loadingSucceeded):
(WebCore::FetchBody::bodyForInternalRequest):
(WebCore::FetchBody::clone):
* Modules/fetch/FetchBody.h:
(WebCore::FetchBody::loadingBody):
(WebCore::FetchBody::FetchBody):
* Modules/fetch/FetchBodyOwner.cpp:
(WebCore::FetchBodyOwner::FetchBodyOwner):
(WebCore::FetchBodyOwner::stop):
(WebCore::FetchBodyOwner::arrayBuffer):
(WebCore::FetchBodyOwner::blob):
(WebCore::FetchBodyOwner::cloneBody): Needs to clone m_contentType as well.
(WebCore::FetchBodyOwner::extractBody):
(WebCore::FetchBodyOwner::updateContentType):
(WebCore::FetchBodyOwner::consumeOnceLoadingFinished):
(WebCore::FetchBodyOwner::formData):
(WebCore::FetchBodyOwner::json):
(WebCore::FetchBodyOwner::text):
(WebCore::FetchBodyOwner::loadBlob):
(WebCore::FetchBodyOwner::blobLoadingSucceeded):
(WebCore::FetchBodyOwner::blobLoadingFailed):
(WebCore::FetchBodyOwner::finishBlobLoading):
* Modules/fetch/FetchBodyOwner.h:
(WebCore::FetchBodyOwner::body):
(WebCore::FetchBodyOwner::isBodyNull):
* Modules/fetch/FetchRequest.cpp:
(WebCore::FetchRequest::setBody):
(WebCore::FetchRequest::internalRequest):
(WebCore::FetchRequest::clone):
* Modules/fetch/FetchRequest.h:
(WebCore::FetchRequest::FetchRequest):
* Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::initializeWith):
(WebCore::FetchResponse::FetchResponse):
(WebCore::FetchResponse::cloneForJS):
(WebCore::FetchResponse::fetch):
(WebCore::FetchResponse::BodyLoader::didSucceed):
(WebCore::FetchResponse::BodyLoader::didReceiveResponse):
(WebCore::FetchResponse::BodyLoader::start):
(WebCore::FetchResponse::createReadableStreamSource):
* Modules/fetch/FetchResponse.h:

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

3 years agoASSERTION FAILED: result in WebCore::CSSParser::parseURI
aestes@apple.com [Mon, 3 Oct 2016 17:44:29 +0000 (17:44 +0000)]
ASSERTION FAILED: result in WebCore::CSSParser::parseURI
https://bugs.webkit.org/show_bug.cgi?id=141638
<rdar://problem/27709952>

Reviewed by Andreas Kling.

Source/WebCore:

CSSParser::parseURIInternal() failed to parse unquoted URLs with Unicode escape sequences
greater than 0xFF, even when the destination character type was multi-byte. Fixed by
checking the size of DestCharacterType instead of SrcCharacterType.

Updated fast/css/url-with-multi-byte-unicode-escape.html to test for an unquoted URL.

* css/parser/CSSParser.cpp:
(WebCore::CSSParser::parseURIInternal): For code points greater than 0xFF, only returned
false if sizeof(DestCharacterType) == 1.

LayoutTests:

* fast/css/url-with-multi-byte-unicode-escape-expected.txt: Added a test for an unquoted URL.
* fast/css/url-with-multi-byte-unicode-escape.html:

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

3 years agoURLParser: empty relative URLs should not copy fragment from the base URL
achristensen@apple.com [Mon, 3 Oct 2016 17:28:04 +0000 (17:28 +0000)]
URLParser: empty relative URLs should not copy fragment from the base URL
https://bugs.webkit.org/show_bug.cgi?id=162864

Reviewed by Chris Dumez.

Source/WebCore:

Covered by new API tests.

* platform/URL.cpp:
(WebCore::URL::removeFragmentIdentifier):
Optimize removing fragments, now that it happens more often. We don't need to reparse,
because the result will always be equal to just a substring when removing the fragment at the end.
* platform/URLParser.cpp:
(WebCore::URLParser::copyASCIIStringUntil):
(WebCore::URLParser::copyURLPartsUntil):
(WebCore::containsOnlyC0ControlOrSpace):
(WebCore::URLParser::URLParser):
(WebCore::URLParser::parse):
* platform/URLParser.h:
Because we are not copying the fragment, we can simplify and remove some unreachable code.

Tools:

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

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

3 years agoJSStringRef should define JSChar without platform checks
commit-queue@webkit.org [Mon, 3 Oct 2016 16:43:03 +0000 (16:43 +0000)]
JSStringRef should define JSChar without platform checks
https://bugs.webkit.org/show_bug.cgi?id=162808

Patch by Nicolas Breidinger <Nicolas.Breidinger@sony.com> on 2016-10-03
Reviewed by Mark Lam.

* API/JSStringRef.h:

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

3 years agotd.scope should only return known values
cdumez@apple.com [Mon, 3 Oct 2016 16:23:24 +0000 (16:23 +0000)]
td.scope should only return known values
https://bugs.webkit.org/show_bug.cgi?id=162755

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

Rebaseline W3C test now that more checks are passing.

* web-platform-tests/html/dom/reflection-tabular-expected.txt:

Source/WebCore:

td.scope should only return known values:
- https://html.spec.whatwg.org/#dom-th-scope

Firefox conforms to the specification.

No new tests, rebaselined existing test.

* html/HTMLTableCellElement.cpp:
(WebCore::HTMLTableCellElement::scope):

LayoutTests:

Update existing test to reflect behavior change.

* fast/dom/element-attribute-js-null-expected.txt:
* fast/dom/element-attribute-js-null.html:

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

3 years ago[SOUP] Simplify AuthenticationChallenge
carlosgc@webkit.org [Mon, 3 Oct 2016 10:42:11 +0000 (10:42 +0000)]
[SOUP] Simplify AuthenticationChallenge
https://bugs.webkit.org/show_bug.cgi?id=162784

Reviewed by Alex Christensen.

We don't really need to keep references to the SoupSession and SoupMessage in AuthenticationChallenge, the
SoupNetworkSession callback already forwards the challenge to the right ResourceHandle.

* platform/network/soup/AuthenticationChallenge.h:
(WebCore::AuthenticationChallenge::authenticationClient):
(WebCore::AuthenticationChallenge::soupSession): Deleted.
(WebCore::AuthenticationChallenge::soupMessage): Deleted.
* platform/network/soup/AuthenticationChallengeSoup.cpp:
(WebCore::AuthenticationChallenge::AuthenticationChallenge):
(WebCore::AuthenticationChallenge::platformCompare):
* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::ResourceHandle::continueDidReceiveAuthenticationChallenge):
(WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
(WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
(WebCore::ResourceHandle::receivedCredential):
(WebCore::ResourceHandle::receivedCancellation):
* platform/network/soup/SoupNetworkSession.cpp:
(WebCore::authenticateCallback):

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

3 years ago[SOUP] Cleanup persistent credential storage code
carlosgc@webkit.org [Mon, 3 Oct 2016 10:32:52 +0000 (10:32 +0000)]
[SOUP] Cleanup persistent credential storage code
https://bugs.webkit.org/show_bug.cgi?id=162777

Reviewed by Alex Christensen.

.:

Remove ENABLE(CREDENTIAL_STORAGE) build flag and replace it by USE(LIBSECRET).

* Source/cmake/OptionsGTK.cmake:
* Source/cmake/WebKitFeatures.cmake:

Source/WebCore:

We have this feature behind ENABLE_CREDENTIAL_STORAGE flag, which is confusing, because we use credential
storage unconditionally and this is only about persistent storage. Also the flag assumes libsecret is available,
and since it's only used by GTK sometimes we use GTK ifdefs instead of CREDENTIAL_STORAGE. So, I think we should
use USE(LIBSECRET) instead, and reduce a bit the ifdefs in common soup code. Another problem is that current
implementation is always used, while it should depend on the current network storage session and never used in
ephemeral sessions. This patch moves the code from CredentialBackingStore to NetworkStorageSessionSoup and
modernizes a bit.

* PlatformGTK.cmake: Remove CredentialBackingStore.cpp.
* platform/gtk/GRefPtrGtk.cpp: Use USE(LIBSECRET)
* platform/gtk/GRefPtrGtk.h:
* platform/network/NetworkStorageSession.h:
* platform/network/ResourceHandleInternal.h:
* platform/network/gtk/CredentialBackingStore.cpp: Removed.
* platform/network/gtk/CredentialBackingStore.h: Removed.
* platform/network/soup/NetworkStorageSessionSoup.cpp:
(WebCore::NetworkStorageSession::~NetworkStorageSession):
(WebCore::schemeFromProtectionSpaceServerType):
(WebCore::authTypeFromProtectionSpaceAuthenticationScheme):
(WebCore::NetworkStorageSession::getCredentialFromPersistentStorage):
(WebCore::NetworkStorageSession::saveCredentialToPersistentStorage):
(WebCore::NetworkStorageSession::ensurePrivateBrowsingSession): Deleted.
(WebCore::NetworkStorageSession::switchToNewTestingSession): Deleted.
* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::gotHeadersCallback):
(WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
(WebCore::ResourceHandle::receivedCredential):
(WebCore::ResourceHandle::continueDidReceiveAuthenticationChallenge): Deleted.
(WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential): Deleted.
(WebCore::ResourceHandle::receivedCancellation): Deleted.

Source/WebKit2:

Use USE(LIBSECRET) instead of ENABLE(CREDENTIAL_STORAGE).

* UIProcess/API/gtk/WebKitAuthenticationRequest.cpp:
(webkit_authentication_request_can_save_credentials):

Tools:

Use USE(LIBSECRET) instead of ENABLE(CREDENTIAL_STORAGE).

* TestWebKitAPI/Tests/WebKit2Gtk/TestAuthentication.cpp:
(testWebViewAuthenticationStorage):

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

3 years agoUnreviewed. Fix the build with coordinated graphics enabled after r206712.
carlosgc@webkit.org [Mon, 3 Oct 2016 09:51:18 +0000 (09:51 +0000)]
Unreviewed. Fix the build with coordinated graphics enabled after r206712.

* page/scrolling/ScrollingStateTree.cpp:
(WebCore::ScrollingStateTree::attachNode):

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

3 years agoWeb Inspector: Clicking twice on the color swatch square should hide the color picker
commit-queue@webkit.org [Mon, 3 Oct 2016 05:45:15 +0000 (05:45 +0000)]
Web Inspector: Clicking twice on the color swatch square should hide the color picker
https://bugs.webkit.org/show_bug.cgi?id=162759

Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2016-10-02
Reviewed by Matt Baker.

* UserInterface/Views/InlineSwatch.js:
(WebInspector.InlineSwatch):
(WebInspector.InlineSwatch.prototype.didDismissPopover):
(WebInspector.InlineSwatch.prototype._swatchElementClicked):
Remove the "click" event listener when a popover is presented to prevent improper
interaction.  Add the event listener back when the popover is dismissed.

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

3 years agoAdd support for KeyboardEvent.getModifierState() operation
cdumez@apple.com [Sun, 2 Oct 2016 21:49:44 +0000 (21:49 +0000)]
Add support for KeyboardEvent.getModifierState() operation
https://bugs.webkit.org/show_bug.cgi?id=162855

Reviewed by Darin Adler.

Source/WebCore:

Add support for KeyboardEvent.getModifierState() operation:
- https://w3c.github.io/uievents/#dom-keyboardevent-getmodifierstate

Test: fast/events/constructors/keyboard-event-getModifierState.html

* dom/KeyboardEvent.cpp:
(WebCore::KeyboardEvent::getModifierState):
* dom/KeyboardEvent.idl:

LayoutTests:

Add layout test coverage.

* fast/events/constructors/keyboard-event-getModifierState-expected.txt: Added.
* fast/events/constructors/keyboard-event-getModifierState.html: Added.

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

3 years agoAdd support for KeyboardEvent.repeat attribute
cdumez@apple.com [Sun, 2 Oct 2016 21:33:28 +0000 (21:33 +0000)]
Add support for KeyboardEvent.repeat attribute
https://bugs.webkit.org/show_bug.cgi?id=162854

Reviewed by Darin Adler.

Source/WebCore:

Add support for KeyboardEvent.repeat attribute:
- https://w3c.github.io/uievents/#dom-keyboardevent-repeat

No new tests, extended existing test.

* dom/KeyboardEvent.cpp:
(WebCore::KeyboardEvent::KeyboardEvent):
* dom/KeyboardEvent.h:
* dom/KeyboardEvent.idl:

LayoutTests:

Extend layout test coverage.

* fast/events/constructors/keyboard-event-constructor-expected.txt:
* fast/events/constructors/keyboard-event-constructor.html:

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

3 years agoRename ExceptionCode-based exception handling to "legacy"
darin@apple.com [Sun, 2 Oct 2016 21:28:31 +0000 (21:28 +0000)]
Rename ExceptionCode-based exception handling to "legacy"
https://bugs.webkit.org/show_bug.cgi?id=162859

Reviewed by Chris Dumez.

Source/WebCore:

RaisesException is now MayThrowLegacyException.

A follow-up patch soon will add MayThrowException for the new style,
where we use ExceptionOr<> as the return type instead of an ExceptionCode
out argument.

* bindings/scripts/CodeGeneratorJS.pm:
Removed the quotation marks from the syntax object->{PropertyName} so the
renaming script could handle it. Tweaked various comments and logic for clarity.
Changed to use the perl "x if y" syntax for brevity in many places.
Renamed with the script and by hand. Added code to skip including the same header
in both the implementation file and the header, just to make generated bindings
slightly smaller and faster to compile. Used "using" instead of "typedef".

* bindings/scripts/IDLAttributes.txt: Updated from old names to new ones.

* Modules/applepay/ApplePaySession.idl:
* Modules/encryptedmedia/MediaKeySession.idl:
* Modules/encryptedmedia/MediaKeys.idl:
* Modules/fetch/FetchHeaders.idl:
* Modules/fetch/FetchRequest.idl:
* Modules/fetch/FetchResponse.idl:
* Modules/indexeddb/IDBCursor.idl:
* Modules/indexeddb/IDBDatabase.idl:
* Modules/indexeddb/IDBFactory.idl:
* Modules/indexeddb/IDBIndex.idl:
* Modules/indexeddb/IDBKeyRange.idl:
* Modules/indexeddb/IDBObjectStore.idl:
* Modules/indexeddb/IDBRequest.idl:
* Modules/indexeddb/IDBTransaction.idl:
* Modules/mediasource/MediaSource.idl:
* Modules/mediasource/SourceBuffer.idl:
* Modules/mediastream/MediaDevices.idl:
* Modules/mediastream/RTCDTMFSender.idl:
* Modules/mediastream/RTCDataChannel.idl:
* Modules/mediastream/RTCIceCandidate.idl:
* Modules/mediastream/RTCPeerConnection.idl:
* Modules/mediastream/RTCRtpSender.idl:
* Modules/mediastream/RTCSessionDescription.idl:
* Modules/navigatorcontentutils/NavigatorContentUtils.idl:
* Modules/notifications/NotificationCenter.idl:
* Modules/webaudio/AnalyserNode.idl:
* Modules/webaudio/AudioBuffer.idl:
* Modules/webaudio/AudioBufferSourceNode.idl:
* Modules/webaudio/AudioContext.idl:
* Modules/webaudio/AudioNode.idl:
* Modules/webaudio/ConvolverNode.idl:
* Modules/webaudio/OfflineAudioContext.idl:
* Modules/webaudio/OscillatorNode.idl:
* Modules/webdatabase/DOMWindowWebDatabase.idl:
* Modules/webdatabase/SQLResultSet.idl:
* Modules/websockets/WebSocket.idl:
* bindings/scripts/test/TestImplements.idl:
* bindings/scripts/test/TestInterface.idl:
* bindings/scripts/test/TestNamedConstructor.idl:
* bindings/scripts/test/TestNondeterministic.idl:
* bindings/scripts/test/TestObj.idl:
* bindings/scripts/test/TestSupplemental.idl:
* bindings/scripts/test/TestTypedefs.idl:
* css/CSSCharsetRule.idl:
* css/CSSMediaRule.idl:
* css/CSSPrimitiveValue.idl:
* css/CSSRule.idl:
* css/CSSStyleDeclaration.idl:
* css/CSSStyleSheet.idl:
* css/CSSSupportsRule.idl:
* css/CSSValue.idl:
* css/FontFace.idl:
* css/FontFaceSet.idl:
* css/MediaList.idl:
* css/WebKitCSSMatrix.idl:
* dom/CharacterData.idl:
* dom/ChildNode.idl:
* dom/CustomElementRegistry.idl:
* dom/DataTransferItemList.idl:
* dom/Document.idl:
* dom/Element.idl:
* dom/EventTarget.idl:
* dom/MessagePort.idl:
* dom/MutationObserver.idl:
* dom/NamedNodeMap.idl:
* dom/Node.idl:
* dom/ParentNode.idl:
* dom/Range.idl:
* dom/ShadowRoot.idl:
* dom/Text.idl:
* fileapi/FileReader.idl:
* fileapi/FileReaderSync.idl:
* html/DOMTokenList.idl:
* html/DOMURL.idl:
* html/HTMLCanvasElement.idl:
* html/HTMLElement.idl:
* html/HTMLEmbedElement.idl:
* html/HTMLFrameElement.idl:
* html/HTMLIFrameElement.idl:
* html/HTMLInputElement.idl:
* html/HTMLMarqueeElement.idl:
* html/HTMLMediaElement.idl:
* html/HTMLObjectElement.idl:
* html/HTMLOptionElement.idl:
* html/HTMLOptionsCollection.idl:
* html/HTMLProgressElement.idl:
* html/HTMLSelectElement.idl:
* html/HTMLTableElement.idl:
* html/HTMLTableRowElement.idl:
* html/HTMLTableSectionElement.idl:
* html/HTMLTextAreaElement.idl:
* html/HTMLVideoElement.idl:
* html/ImageData.idl:
* html/MediaController.idl:
* html/TimeRanges.idl:
* html/URLUtils.idl:
* html/canvas/CanvasGradient.idl:
* html/canvas/CanvasPath.idl:
* html/canvas/CanvasRenderingContext2D.idl:
* html/canvas/OESVertexArrayObject.idl:
* html/canvas/WebGLRenderingContextBase.idl:
* html/track/DataCue.idl:
* html/track/TextTrack.idl:
* html/track/TextTrackCue.idl:
* html/track/VTTCue.idl:
* html/track/VTTRegion.idl:
* loader/appcache/DOMApplicationCache.idl:
* page/Crypto.idl:
* page/DOMSelection.idl:
* page/DOMWindow.idl:
* page/EventSource.idl:
* page/History.idl:
* page/Location.idl:
* page/Performance.idl:
* page/UserMessageHandler.idl:
* page/WindowOrWorkerGlobalScope.idl:
* storage/Storage.idl:
* svg/SVGAltGlyphElement.idl:
* svg/SVGAngle.idl:
* svg/SVGAnimatedBoolean.idl:
* svg/SVGAnimatedEnumeration.idl:
* svg/SVGAnimatedInteger.idl:
* svg/SVGAnimatedNumber.idl:
* svg/SVGAnimatedString.idl:
* svg/SVGAnimationElement.idl:
* svg/SVGColor.idl:
* svg/SVGGlyphRefElement.idl:
* svg/SVGGraphicsElement.idl:
* svg/SVGLength.idl:
* svg/SVGLengthList.idl:
* svg/SVGMatrix.idl:
* svg/SVGNumberList.idl:
* svg/SVGPaint.idl:
* svg/SVGPathSegList.idl:
* svg/SVGPointList.idl:
* svg/SVGPreserveAspectRatio.idl:
* svg/SVGStringList.idl:
* svg/SVGStyleElement.idl:
* svg/SVGTextContentElement.idl:
* svg/SVGTransformList.idl:
* svg/SVGViewSpec.idl:
* testing/InternalSettings.idl:
* testing/Internals.idl:
* workers/DedicatedWorkerGlobalScope.idl:
* workers/Worker.idl:
* xml/DOMParser.idl:
* xml/XMLHttpRequest.idl:
* xml/XPathEvaluator.idl:
* xml/XPathExpression.idl:
* xml/XPathResult.idl:
Allowed the rename script to rename the exception-related extended attributes.

* bindings/scripts/test/JS/JSInterfaceName.cpp:
* bindings/scripts/test/JS/JSInterfaceName.h:
* bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
* bindings/scripts/test/JS/JSTestActiveDOMObject.h:
* bindings/scripts/test/JS/JSTestCallback.cpp:
* bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
* bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h:
* bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
* bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h:
* bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
* bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
* bindings/scripts/test/JS/JSTestEventConstructor.cpp:
* bindings/scripts/test/JS/JSTestEventConstructor.h:
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
* bindings/scripts/test/JS/JSTestEventTarget.h:
* bindings/scripts/test/JS/JSTestException.cpp:
* bindings/scripts/test/JS/JSTestException.h:
* bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
* bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
* bindings/scripts/test/JS/JSTestGlobalObject.h:
* bindings/scripts/test/JS/JSTestInterface.cpp:
* bindings/scripts/test/JS/JSTestInterface.h:
* bindings/scripts/test/JS/JSTestIterable.cpp:
* bindings/scripts/test/JS/JSTestIterable.h:
* bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
* bindings/scripts/test/JS/JSTestJSBuiltinConstructor.h:
* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
* bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
* bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
* bindings/scripts/test/JS/JSTestNamedConstructor.h:
* bindings/scripts/test/JS/JSTestNode.cpp:
* bindings/scripts/test/JS/JSTestNode.h:
* bindings/scripts/test/JS/JSTestNondeterministic.cpp:
* bindings/scripts/test/JS/JSTestNondeterministic.h:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestObj.h:
* bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
* bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
* bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
* bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h:
* bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
* bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
* bindings/scripts/test/JS/JSTestTypedefs.h:
* bindings/scripts/test/JS/JSattribute.cpp:
* bindings/scripts/test/JS/JSattribute.h:
* bindings/scripts/test/JS/JSreadonly.cpp:
* bindings/scripts/test/JS/JSreadonly.h:
Regenerated.

Source/WebKit/win:

* Interfaces/DOMEvents.idl: Let the script rename here (in a comment).

Tools:

* Scripts/do-webcore-rename: Updated script to do this round of renames.

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

3 years agoWeb Inspector: Exception thrown when hovering network waterfall graphs during reload
mattbaker@apple.com [Sun, 2 Oct 2016 20:59:06 +0000 (20:59 +0000)]
Web Inspector: Exception thrown when hovering network waterfall graphs during reload
https://bugs.webkit.org/show_bug.cgi?id=162850
<rdar://problem/28579653>

Reviewed by Brian Burg.

* UserInterface/Views/ResourceTimelineDataGridNode.js:
(WebInspector.ResourceTimelineDataGridNode.prototype._mouseoverRecordBar):
Check that the node's data grid reference is valid before use.
(WebInspector.ResourceTimelineDataGridNode):

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

3 years agoMedia controls for Soundcloud easily falls out of sync with what's actually playing
wenson_hsieh@apple.com [Sun, 2 Oct 2016 19:22:18 +0000 (19:22 +0000)]
Media controls for Soundcloud easily falls out of sync with what's actually playing
https://bugs.webkit.org/show_bug.cgi?id=162843
<rdar://problem/28176874>

Reviewed by Beth Dakin.

Source/WebCore:

Currently, audio elements are subject to the same main content restrictions as video elements. This is
problematic on sites where audio elements are really the main content, such as soundcloud. We need a different
heuristic for determining whether audio elements such as these should be allowed to show playback controls.

Furthermore, we currently forbid autoplaying audio from showing controls if it has user gesture restrictions
(i.e. it started playing via script). This is, again, problematic on sites where audio elements are played one
after another (such as on soundcloud). Even though a subsequent audio element may have been triggered via
script, we might want still want to show controls for it if the user has explicitly triggered other elements on
the page to begin playing. However, if the user has not gestured on any media in the page, we still should not
show controls for audio elements that begin playing via script.

Adds two new unit tests to TestWebKitAPI simulating audio playback behavior on soundcloud.

* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::removeBehaviorRestriction):
(WebCore::MediaElementSession::canShowControlsManager):
(WebCore::MediaElementSession::allowsPlaybackControlsForAutoplayingAudio):
* html/MediaElementSession.h:
* page/Page.h:
(WebCore::Page::allowsPlaybackControlsForAutoplayingAudio):
(WebCore::Page::setAllowsPlaybackControlsForAutoplayingAudio):

Tools:

Adds two new tests simulating audio playback behavior on soundcloud. Also tweaks some of the WKWebView test
message handling logic to support having multiple message-handler mappings.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2Cocoa/play-audio-on-click.html: Added.
* TestWebKitAPI/mac/TestWKWebViewMac.h:
* TestWebKitAPI/mac/TestWKWebViewMac.mm:
(-[TestMessageHandler addMessage:withHandler:]):
(-[TestMessageHandler userContentController:didReceiveScriptMessage:]):
(-[TestWKWebView performAfterReceivingMessage:action:]):
(-[TestWKWebView performAfterLoading:]):
(-[TestMessageHandler initWithMessage:handler:]): Deleted.

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

3 years agoUnreviewed, rolling out r206683.
ryanhaddad@apple.com [Sun, 2 Oct 2016 19:19:29 +0000 (19:19 +0000)]
Unreviewed, rolling out r206683.

This change caused API test WebKit2.FindMatches to fail on
Mac.

Reverted changeset:

"The dragged image should be the current frame only of the
animated image"
https://bugs.webkit.org/show_bug.cgi?id=162109
http://trac.webkit.org/changeset/206683

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

3 years agoUnreviewed, rolling out r206692 and r206718.
cdumez@apple.com [Sun, 2 Oct 2016 18:19:05 +0000 (18:19 +0000)]
Unreviewed, rolling out r206692 and r206718.

Seems to have caused >200 failures on Sierra

Reverted changesets:

"Implement rendering of font-variation-settings"
https://bugs.webkit.org/show_bug.cgi?id=162782
http://trac.webkit.org/changeset/206692

"Tried to fix the build after r206692."
http://trac.webkit.org/changeset/206718

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

3 years agoTried to fix the build after r206692.
mitz@apple.com [Sun, 2 Oct 2016 14:49:13 +0000 (14:49 +0000)]
Tried to fix the build after r206692.

* platform/graphics/cocoa/FontPlatformDataCocoa.mm:
(WebCore::cascadeToLastResortAndVariationsFontDescriptor):

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

3 years agoUnreviewed, rolling out r206716.
commit-queue@webkit.org [Sun, 2 Oct 2016 14:25:08 +0000 (14:25 +0000)]
Unreviewed, rolling out r206716.
https://bugs.webkit.org/show_bug.cgi?id=162858

It is breaking Mac CMake Debug build (Requested by youenn on
#webkit).

Reverted changeset:

"[Fetch API] Forbid redirection to non-HTTP(s) URL in non-
navigation mode."
https://bugs.webkit.org/show_bug.cgi?id=162785
http://trac.webkit.org/changeset/206716

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

3 years ago[Fetch API] Forbid redirection to non-HTTP(s) URL in non-navigation mode.
commit-queue@webkit.org [Sun, 2 Oct 2016 13:59:18 +0000 (13:59 +0000)]
[Fetch API] Forbid redirection to non-HTTP(s) URL in non-navigation mode.
https://bugs.webkit.org/show_bug.cgi?id=162785

Patch by Youenn Fablet <youenn@apple.com> on 2016-10-02
Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

* web-platform-tests/fetch/api/redirect/redirect-to-dataurl-expected.txt:
* web-platform-tests/fetch/api/redirect/redirect-to-dataurl-worker-expected.txt:

Source/WebCore:

Covered by rebased and existing tests.

Ensuring non-HTTP redirection URLs are not followed at DocumentThreadableLoader level for fetch API only.
This should be applied to all clients at some point, but there is still some uncertainty for data URLs.

Did some refactoring to better separate the case of security checks in case of regular request or redirected request.
This allows in particular to handle more clearly the case of data URLs which are allowed in all modes for regular requests.
But they are not allowed for same-origin redirected requests.

* WebCore.xcodeproj/project.pbxproj:
* loader/DocumentThreadableLoader.cpp:
(WebCore::reportRedirectionWithBadScheme): Reporting bad scheme redirection error.
(WebCore::DocumentThreadableLoader::redirectReceived): Checking that redirection URLs are HTTP(s) in case of Fetch API.
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::willSendRequestInternal):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestImage):
(WebCore::CachedResourceLoader::checkInsecureContent):
(WebCore::CachedResourceLoader::allowedByContentSecurityPolicy):
(WebCore::isSameOriginDataURL):
(WebCore::CachedResourceLoader::canRequest):
(WebCore::CachedResourceLoader::canRequestAfterRedirection):
(WebCore::CachedResourceLoader::canRequestInContentDispositionAttachmentSandbox):
(WebCore::CachedResourceLoader::requestResource):
* loader/cache/CachedResourceLoader.h:

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