WebKit-https.git
2 years agoProvide a viewport parameter to disable clipping to the safe area
timothy_horton@apple.com [Mon, 17 Apr 2017 20:24:14 +0000 (20:24 +0000)]
Provide a viewport parameter to disable clipping to the safe area
https://bugs.webkit.org/show_bug.cgi?id=170766
<rdar://problem/31564634>

Reviewed by Beth Dakin.

Tests: tiled-drawing/ios/viewport-clip-to-safe-area-no-gets-margin-tiles.html,
       tiled-drawing/ios/viewport-clip-to-safe-area-yes-gets-no-margin-tiles.html,

* dom/ViewportArguments.cpp:
(WebCore::ViewportArguments::resolve):
(WebCore::setViewportFeature):
* dom/ViewportArguments.h:
(WebCore::ViewportArguments::operator==):
* page/ViewportConfiguration.cpp:
(WebCore::ViewportConfiguration::updateConfiguration):
(WebCore::operator<<):
(WebCore::ViewportConfiguration::description):
* page/ViewportConfiguration.h:
(WebCore::ViewportConfiguration::Parameters::Parameters):
(WebCore::ViewportConfiguration::clipToSafeArea):
Add viewport parameter.

* page/ChromeClient.h:
* page/FrameView.h:
* page/FrameView.cpp:
(WebCore::FrameView::enableSpeculativeTilingIfNeeded):
If not clipping to the safe area, enable "speculative" tiling immediately,
because the margin tiles can be visible immediately.

(WebCore::FrameView::hasExtendedBackgroundRectForPainting):
(WebCore::FrameView::updateTilesForExtendedBackgroundMode):
Don't check the setting here; just respect the mode that is computed
by calculateExtendedBackgroundMode.

(WebCore::FrameView::calculateExtendedBackgroundMode):
If the viewport parameter was set, add margin tiles on both axes.

(WebCore::FrameView::setClipToSafeArea):
Notify ChromeClient of the change, and re-compute the margin tile mode.

* rendering/RenderLayerCompositor.h:
* rendering/RenderLayerCompositor.cpp:
Factor out code that decides whether the content layer clips to bounds,
and make it take the new viewport parameter into account.

* rendering/RenderObject.cpp:
Don't clip RenderView repaints to RenderView's GraphicsLayer bounds if
clip-to-safe-area is off, just like we do for slow-repaint objects in
extended background mode.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::resetState):
(WebKit::WebPageProxy::setClipToSafeArea):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::clipToSafeArea):
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::didChangeClipToSafeArea):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* UIProcess/API/gtk/PageClientImpl.h:
* UIProcess/PageClient.h:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::didChangeClipToSafeArea):
* UIProcess/mac/PageClientImpl.h:
Forward clip-to-safe-area changes from ChromeClient to WKWebView.
Update visible content rects when it changes, which will
result in a call to updateFixedClippingView, as below.
Keep track of the current state in the UI process.

* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _contentMayDrawInObscuredInsets]):
Expose the current state of the clip-to-safe-area bit as SPI.

* UIProcess/ios/WKContentView.mm:
(-[WKContentView updateFixedClippingView:]):
Disable fixed clipping when clip-to-safe-area is disabled.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::viewportConfigurationChanged):
Push the viewport's clip-to-safe-area bit onto the main frame's FrameView.

* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::setObscuredInsets):
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::setObscuredInsets):
* TestRunnerShared/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::setObscuredInsets):
Add a UIScriptController mechanism to install obscured insets
on the web view.

* tiled-drawing/ios/viewport-clip-to-safe-area-no-gets-margin-tiles-expected.txt: Added.
* tiled-drawing/ios/viewport-clip-to-safe-area-no-gets-margin-tiles.html: Added.
* tiled-drawing/ios/viewport-clip-to-safe-area-yes-gets-no-margin-tiles-expected.txt: Added.
* tiled-drawing/ios/viewport-clip-to-safe-area-yes-gets-no-margin-tiles.html: Added.

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

2 years ago[Cocoa] Move isNullFunctionPointer down into WTF
mitz@apple.com [Mon, 17 Apr 2017 20:22:24 +0000 (20:22 +0000)]
[Cocoa] Move isNullFunctionPointer down into WTF
https://bugs.webkit.org/show_bug.cgi?id=170892

Reviewed by Sam Weinig.

Source/WebCore:

* platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
(WebCore::LibWebRTCProvider::webRTCAvailable): Changed to use WTF::isNullFunctionPointer,
  and removed the static variable, so instead of loading from the initialization guard,
  branching, then loading from the variable itself, we just load from the function pointer.
(WebCore::isNullFunctionPointer): Deleted.

Source/WebKit2:

* Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp:
(WebKit::ResourceLoadStatisticsClassifierCocoa::canUseCorePrediction): Changed to use
  WTF::isNullFunctionPointer.
(WebKit::isNullFunctionPointer): Deleted.

Source/WTF:

Test: TestWebKitAPI/Tests/WTF/darwin/WeakLinking.cpp

* WTF.xcodeproj/project.pbxproj: Added reference to new file.
* wtf/darwin: Added.
* wtf/darwin/WeakLinking.h: Added.
(WTF::isNullFunctionPointer): Copied from ResourceLoadStatisticsClassifierCocoa.cpp in
  WebKit2 and changed into a function template that works with any function pointer.

Tools:

* TestWebKitAPI/Configurations/TestWTF.xcconfig:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/darwin/WeakLinking.cpp: Added.
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WTF/darwin/libTestWTFAlwaysMissing-iOS-v2.tbd: Added.
* TestWebKitAPI/Tests/WTF/darwin/libTestWTFAlwaysMissing-iOS.tbd: Added.
* TestWebKitAPI/Tests/WTF/darwin/libTestWTFAlwaysMissing-macOS-v2.tbd: Added.
* TestWebKitAPI/Tests/WTF/darwin/libTestWTFAlwaysMissing-macOS.tbd: Added.

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

2 years ago[WebCrypto] Add support for ECDSA
jiewen_tan@apple.com [Mon, 17 Apr 2017 20:07:56 +0000 (20:07 +0000)]
[WebCrypto] Add support for ECDSA
https://bugs.webkit.org/show_bug.cgi?id=170789
<rdar://problem/31588604>

Reviewed by Brent Fulgham.

LayoutTests/imported/w3c:

* web-platform-tests/WebCryptoAPI/generateKey/failures_ECDSA.worker-expected.txt:
* web-platform-tests/WebCryptoAPI/generateKey/successes_ECDSA.worker-expected.txt:
* web-platform-tests/WebCryptoAPI/generateKey/test_failures_ECDSA-expected.txt:
* web-platform-tests/WebCryptoAPI/generateKey/test_successes_ECDSA-expected.txt:
* web-platform-tests/WebCryptoAPI/import_export/ec_importKey.worker-expected.txt:
* web-platform-tests/WebCryptoAPI/import_export/test_ec_importKey-expected.txt:
* web-platform-tests/WebCryptoAPI/sign_verify/ecdsa.worker-expected.txt:
* web-platform-tests/WebCryptoAPI/sign_verify/hmac.worker-expected.txt:
* web-platform-tests/WebCryptoAPI/sign_verify/test_ecdsa-expected.txt:
* web-platform-tests/WebCryptoAPI/sign_verify/test_hmac-expected.txt:

Source/WebCore:

This patch implements ECDSA according to the spec: https://www.w3.org/TR/WebCryptoAPI/#ecdsa.
Supported operations include sign, verify, generateKey, importKey and exportKey.

Tests: crypto/subtle/ecdh-generate-export-key-pkcs8-p256.html
       crypto/subtle/ecdh-generate-export-key-pkcs8-p384.html
       crypto/subtle/ecdsa-generate-export-jwk-key.html
       crypto/subtle/ecdsa-generate-export-key-pkcs8.html
       crypto/subtle/ecdsa-generate-export-key-raw.html
       crypto/subtle/ecdsa-generate-export-key-spki.html
       crypto/subtle/ecdsa-generate-key-sign-verify-p256.html
       crypto/subtle/ecdsa-generate-key-sign-verify-p384.html
       crypto/subtle/ecdsa-generate-key.html
       crypto/subtle/ecdsa-import-jwk-private-key.html
       crypto/subtle/ecdsa-import-jwk-public-key-alg-256.html
       crypto/subtle/ecdsa-import-jwk-public-key-alg-384.html
       crypto/subtle/ecdsa-import-jwk-public-key.html
       crypto/subtle/ecdsa-import-key-sign-p256.html
       crypto/subtle/ecdsa-import-key-sign-p384.html
       crypto/subtle/ecdsa-import-key-verify-p256.html
       crypto/subtle/ecdsa-import-key-verify-p384.html
       crypto/subtle/ecdsa-import-pkcs8-key.html
       crypto/subtle/ecdsa-import-raw-key.html
       crypto/subtle/ecdsa-import-spki-key.html
       crypto/subtle/ecdsa-verify-malformed-parameters.html
       crypto/workers/subtle/ecdsa-import-key-sign.html
       crypto/workers/subtle/ecdsa-import-key-verify.html

* CMakeLists.txt:
* DerivedSources.make:
* PlatformGTK.cmake:
* PlatformMac.cmake:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSSubtleCryptoCustom.cpp:
(WebCore::normalizeCryptoAlgorithmParameters):
(WebCore::jsSubtleCryptoFunctionSignPromise):
(WebCore::jsSubtleCryptoFunctionVerifyPromise):
Add missing parameters.
* crypto/CommonCryptoUtilities.h:
* crypto/CryptoAlgorithm.cpp:
(WebCore::CryptoAlgorithm::sign):
(WebCore::CryptoAlgorithm::verify):
* crypto/CryptoAlgorithm.h:
Add missing parameters.
* crypto/CryptoAlgorithmParameters.h:
* crypto/algorithms/CryptoAlgorithmECDSA.cpp: Added.
(WebCore::CryptoAlgorithmECDSA::create):
(WebCore::CryptoAlgorithmECDSA::identifier):
(WebCore::CryptoAlgorithmECDSA::sign):
(WebCore::CryptoAlgorithmECDSA::verify):
(WebCore::CryptoAlgorithmECDSA::generateKey):
(WebCore::CryptoAlgorithmECDSA::importKey):
(WebCore::CryptoAlgorithmECDSA::exportKey):
* crypto/algorithms/CryptoAlgorithmECDSA.h: Added.
* crypto/algorithms/CryptoAlgorithmHMAC.cpp:
(WebCore::CryptoAlgorithmHMAC::sign):
(WebCore::CryptoAlgorithmHMAC::verify):
* crypto/algorithms/CryptoAlgorithmHMAC.h:
Add missing parameters.
* crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
* crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
Add missing parameters.
* crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp: Added.
(WebCore::CryptoAlgorithmECDSA::platformSign):
(WebCore::CryptoAlgorithmECDSA::platformVerify):
* crypto/mac/CommonCryptoDERUtilities.cpp: Added.
(WebCore::bytesUsedToEncodedLength):
(WebCore::extraBytesNeededForEncodedLength):
(WebCore::addEncodedASN1Length):
(WebCore::bytesNeededForEncodedLength):
* crypto/mac/CommonCryptoDERUtilities.h:
(WebCore::bytesUsedToEncodedLength): Deleted.
(WebCore::extraBytesNeededForEncodedLength): Deleted.
(WebCore::addEncodedASN1Length): Deleted.
(WebCore::bytesNeededForEncodedLength): Deleted.
Move implementations to a .cpp file.
* crypto/mac/CryptoAlgorithmECDSAMac.cpp: Added.
(WebCore::cryptoDigestAlgorithm):
(WebCore::signECDSA):
(WebCore::verifyECDSA):
(WebCore::CryptoAlgorithmECDSA::platformSign):
(WebCore::CryptoAlgorithmECDSA::platformVerify):
* crypto/mac/CryptoAlgorithmRegistryMac.cpp:
(WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
* crypto/parameters/CryptoAlgorithmEcdsaParams.h: Added.
* crypto/parameters/EcdsaParams.idl: Added.

LayoutTests:

* crypto/subtle/ec-generate-key-malformed-parameters-expected.txt:
* crypto/subtle/ec-generate-key-malformed-parameters.html:
* crypto/subtle/ec-import-key-malformed-parameters-expected.txt:
* crypto/subtle/ec-import-key-malformed-parameters.html:
* crypto/subtle/ecdh-generate-export-key-pkcs8-p256-expected.txt: Renamed from LayoutTests/crypto/subtle/ecdh-generate-export-pkcs8-p256-expected.txt.
* crypto/subtle/ecdh-generate-export-key-pkcs8-p256.html: Renamed from LayoutTests/crypto/subtle/ecdh-generate-export-pkcs8-p256.html.
* crypto/subtle/ecdh-generate-export-key-pkcs8-p384-expected.txt: Renamed from LayoutTests/crypto/subtle/ecdh-generate-export-pkcs8-p384-expected.txt.
* crypto/subtle/ecdh-generate-export-key-pkcs8-p384.html: Renamed from LayoutTests/crypto/subtle/ecdh-generate-export-pkcs8-p384.html.
* crypto/subtle/ecdsa-generate-export-jwk-key-expected.txt: Added.
* crypto/subtle/ecdsa-generate-export-jwk-key.html: Added.
* crypto/subtle/ecdsa-generate-export-key-pkcs8-expected.txt: Added.
* crypto/subtle/ecdsa-generate-export-key-pkcs8.html: Added.
* crypto/subtle/ecdsa-generate-export-key-raw-expected.txt: Added.
* crypto/subtle/ecdsa-generate-export-key-raw.html: Added.
* crypto/subtle/ecdsa-generate-export-key-spki-expected.txt: Added.
* crypto/subtle/ecdsa-generate-export-key-spki.html: Added.
* crypto/subtle/ecdsa-generate-key-expected.txt: Added.
* crypto/subtle/ecdsa-generate-key-sign-verify-p256-expected.txt: Added.
* crypto/subtle/ecdsa-generate-key-sign-verify-p256.html: Added.
* crypto/subtle/ecdsa-generate-key-sign-verify-p384-expected.txt: Added.
* crypto/subtle/ecdsa-generate-key-sign-verify-p384.html: Added.
* crypto/subtle/ecdsa-generate-key.html: Added.
* crypto/subtle/ecdsa-import-jwk-private-key-expected.txt: Added.
* crypto/subtle/ecdsa-import-jwk-private-key.html: Added.
* crypto/subtle/ecdsa-import-jwk-public-key-alg-256-expected.txt: Added.
* crypto/subtle/ecdsa-import-jwk-public-key-alg-256.html: Added.
* crypto/subtle/ecdsa-import-jwk-public-key-alg-384-expected.txt: Added.
* crypto/subtle/ecdsa-import-jwk-public-key-alg-384.html: Added.
* crypto/subtle/ecdsa-import-jwk-public-key-expected.txt: Added.
* crypto/subtle/ecdsa-import-jwk-public-key.html: Added.
* crypto/subtle/ecdsa-import-key-sign-p256-expected.txt: Added.
* crypto/subtle/ecdsa-import-key-sign-p256.html: Added.
* crypto/subtle/ecdsa-import-key-sign-p384-expected.txt: Added.
* crypto/subtle/ecdsa-import-key-sign-p384.html: Added.
* crypto/subtle/ecdsa-import-key-verify-p256-expected.txt: Added.
* crypto/subtle/ecdsa-import-key-verify-p256.html: Added.
* crypto/subtle/ecdsa-import-key-verify-p384-expected.txt: Added.
* crypto/subtle/ecdsa-import-key-verify-p384.html: Added.
* crypto/subtle/ecdsa-import-pkcs8-key-expected.txt: Added.
* crypto/subtle/ecdsa-import-pkcs8-key.html: Added.
* crypto/subtle/ecdsa-import-raw-key-expected.txt: Added.
* crypto/subtle/ecdsa-import-raw-key.html: Added.
* crypto/subtle/ecdsa-import-spki-key-expected.txt: Added.
* crypto/subtle/ecdsa-import-spki-key.html: Added.
* crypto/subtle/ecdsa-verify-malformed-parameters-expected.txt: Added.
* crypto/subtle/ecdsa-verify-malformed-parameters.html: Added.
* crypto/workers/subtle/ecdsa-import-key-sign-expected.txt: Added.
* crypto/workers/subtle/ecdsa-import-key-sign.html: Added.
* crypto/workers/subtle/ecdsa-import-key-verify-expected.txt: Added.
* crypto/workers/subtle/ecdsa-import-key-verify.html: Added.
* crypto/workers/subtle/resources/ecdsa-import-key-sign.js: Added.
* crypto/workers/subtle/resources/ecdsa-import-key-verify.js: Added.

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

2 years agoWeb Inspector: XHR breakpoints restored from settings do not appear in the sidebar
mattbaker@apple.com [Mon, 17 Apr 2017 19:30:55 +0000 (19:30 +0000)]
Web Inspector: XHR breakpoints restored from settings do not appear in the sidebar
https://bugs.webkit.org/show_bug.cgi?id=170890

Reviewed by Joseph Pecoraro.

Need to check for existing breakpoints when XHRBreakpointTreeController
is constructed, instead of just listening for added breakpoints.

* UserInterface/Controllers/XHRBreakpointTreeController.js:
(WebInspector.XHRBreakpointTreeController):
(WebInspector.XHRBreakpointTreeController.prototype._xhrBreakpointAdded):
(WebInspector.XHRBreakpointTreeController.prototype._addTreeElement):

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

2 years ago[WK2] Respect a new internal setting for defaulting to character selection granularity
wenson_hsieh@apple.com [Mon, 17 Apr 2017 19:26:29 +0000 (19:26 +0000)]
[WK2] Respect a new internal setting for defaulting to character selection granularity
https://bugs.webkit.org/show_bug.cgi?id=170904
<rdar://problem/31364280>

Reviewed by Dan Bernstein.

Respect a new WebKitDebugDefaultSelectionGranularityCharacter user default by initializing
WKWebViewConfiguration with WKSelectionGranularityCharacter, but only when linked on or after the first iOS to
use WKSelectionGranularityCharacter by default.

* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):
* UIProcess/Cocoa/VersionChecks.h:

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

2 years agoProvide a way for clients to unmute a media stream.
eric.carlson@apple.com [Mon, 17 Apr 2017 18:26:17 +0000 (18:26 +0000)]
Provide a way for clients to unmute a media stream.
https://bugs.webkit.org/show_bug.cgi?id=170855
<rdar://problem/31656855>

Reviewed by Jon Lee.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _setPageMuted:]): New.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:

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

2 years agoRemove some accidentally-added .orig files
timothy_horton@apple.com [Mon, 17 Apr 2017 17:58:32 +0000 (17:58 +0000)]
Remove some accidentally-added .orig files
https://bugs.webkit.org/show_bug.cgi?id=170908

Reviewed by Youenn Fablet.

* web-platform-tests/resources/docs/api.md.orig: Removed.
* web-platform-tests/resources/examples/apisample12.html.orig: Removed.
* web-platform-tests/resources/webidl2/test/widlproc/doc/htmltodtd.xsl.orig: Removed.
* web-platform-tests/resources/webidl2/test/widlproc/doc/widlproc.html.orig: Removed.
* web-platform-tests/resources/webidl2/test/widlproc/examples/spectowidl.xsl.orig: Removed.
* web-platform-tests/resources/webidl2/test/widlproc/src/widlprocxmltohtml.xsl.orig: Removed.

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

2 years agoRefactor enumerateDevices to allow separate CaptureDeviceManagers for audio and video.
commit-queue@webkit.org [Mon, 17 Apr 2017 17:00:52 +0000 (17:00 +0000)]
Refactor enumerateDevices to allow separate CaptureDeviceManagers for audio and video.
https://bugs.webkit.org/show_bug.cgi?id=170778

Patch by Jeremy Jones <jeremyj@apple.com> on 2017-04-17
Source/WebCore:

Reviewed by Eric Carlson.

Add CoreAudioCaptureDeviceManager to enumerate CoreAudio devices.

Refactor RealtimeMediaSourceCenter and RealtimeMediaSourceCenterMac to provide independent audio and video capture device managers
and the abiliity to override the capture device managers.

CoreAudioCaptureSource now uses CoreAudioCaptureDeviceManager to use the specified device instead of the default one.

* WebCore.xcodeproj/project.pbxproj:
* platform/mediastream/CaptureDeviceManager.cpp:
(CaptureDeviceManager::getAudioSourcesInfo):
(CaptureDeviceManager::getVideoSourcesInfo):
(CaptureDeviceManager::getSourcesInfo): Deleted.
* platform/mediastream/CaptureDeviceManager.h:
* platform/mediastream/RealtimeMediaSourceCenter.cpp:
(WebCore::RealtimeMediaSourceCenter::setAudioCaptureDeviceManager):
(WebCore::RealtimeMediaSourceCenter::unsetAudioCaptureDeviceManager):
(WebCore::RealtimeMediaSourceCenter::setVideoCaptureDeviceManager):
(WebCore::RealtimeMediaSourceCenter::unsetVideoCaptureDeviceManager):
* platform/mediastream/RealtimeMediaSourceCenter.h:
(WebCore::RealtimeMediaSourceCenter::defaultAudioCaptureDeviceManager):
(WebCore::RealtimeMediaSourceCenter::defaultVideoCaptureDeviceManager):
(WebCore::RealtimeMediaSourceCenter::audioCaptureDeviceManager):
(WebCore::RealtimeMediaSourceCenter::videoCaptureDeviceManager):
* platform/mediastream/mac/AVCaptureDeviceManager.h:
* platform/mediastream/mac/AVCaptureDeviceManager.mm:
(WebCore::AVCaptureDeviceManager::refreshAVCaptureDevicesOfType):
(WebCore::AVCaptureDeviceManager::refreshCaptureDevices):
(WebCore::AVCaptureDeviceManager::getAudioSourcesInfo):
(WebCore::AVCaptureDeviceManager::getVideoSourcesInfo):
(WebCore::AVCaptureDeviceManager::setUseAVFoundationAudioCapture): Deleted.
(WebCore::AVCaptureDeviceManager::getSourcesInfo): Deleted.
* platform/mediastream/mac/CoreAudioCaptureDevice.cpp: Added.
(WebCore::getDeviceInfo):
(WebCore::CoreAudioCaptureDevice::create):
(WebCore::CoreAudioCaptureDevice::CoreAudioCaptureDevice):
(WebCore::CoreAudioCaptureDevice::deviceID):
(WebCore::CoreAudioCaptureDevice::deviceClock):
(WebCore::CoreAudioCaptureDevice::isAlive):
* platform/mediastream/mac/CoreAudioCaptureDevice.h: Copied from Source/WebCore/platform/mediastream/CaptureDeviceManager.h.
* platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp: Added.
(WebCore::CoreAudioCaptureDeviceManager::singleton):
(WebCore::CoreAudioCaptureDeviceManager::captureDevices):
(WebCore::deviceHasInputStreams):
(WebCore::CoreAudioCaptureDeviceManager::coreAudioCaptureDevices):
(WebCore::CoreAudioCaptureDeviceManager::refreshAudioCaptureDevices):
(WebCore::CoreAudioCaptureDeviceManager::devicesChanged):
* platform/mediastream/mac/CoreAudioCaptureDeviceManager.h: Copied from Source/WebCore/platform/mediastream/CaptureDeviceManager.h.
* platform/mediastream/mac/CoreAudioCaptureSource.cpp:
(WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
(WebCore::CoreAudioCaptureSource::startProducingData):
(WebCore::CoreAudioCaptureSource::stopProducingData):
* platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
(WebCore::RealtimeMediaSourceCenterMac::setUseAVFoundationAudioCapture):
(WebCore::RealtimeMediaSourceCenterMac::RealtimeMediaSourceCenterMac):
(WebCore::RealtimeMediaSourceCenterMac::createMediaStream):
(WebCore::RealtimeMediaSourceCenterMac::getMediaStreamDevices):
* platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:

Source/WebKit2:

Reviewed by Tim Horton.

setUseAVFoundationAudioCapture is moved from AVCaptureDeviceManager to RealtimeMediaSourceCenterMac.

* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::syncWithWebCorePrefs):

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

2 years agoUnreviewed, rolling out r215366.
ryanhaddad@apple.com [Mon, 17 Apr 2017 16:37:26 +0000 (16:37 +0000)]
Unreviewed, rolling out r215366.

This test is failing on performance bots.

Reverted changeset:

"Add performance test for asking the platform for a font for
U+2060 WORD JOINER"
https://bugs.webkit.org/show_bug.cgi?id=170842
http://trac.webkit.org/changeset/215366

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

2 years agowebkitpy: Correct poll when killing ServerProcess
jbedard@apple.com [Mon, 17 Apr 2017 16:15:56 +0000 (16:15 +0000)]
webkitpy: Correct poll when killing ServerProcess

Unreviewed infrastructure fix.

* Scripts/webkitpy/port/server_process.py:
(ServerProcess._kill): A polled process equaling 'None' means the process is running.

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

2 years agoLayoutTestwebrtc/audio-replace-track.html is a flaky failure
commit-queue@webkit.org [Mon, 17 Apr 2017 15:44:39 +0000 (15:44 +0000)]
LayoutTestwebrtc/audio-replace-track.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=170837

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

* webrtc/audio-replace-track.html: Updating the test to be less flaky.

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

2 years ago[MediaStream] Enable getUserMedia API test
eric.carlson@apple.com [Mon, 17 Apr 2017 15:34:17 +0000 (15:34 +0000)]
[MediaStream] Enable getUserMedia API test
https://bugs.webkit.org/show_bug.cgi?id=170901
<rdar://problem/31656594>

Reviewed by Youenn Fablet.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Add test.

* TestWebKitAPI/Tests/WebKit2/UserMedia.cpp:
(TestWebKitAPI::decidePolicyForUserMediaPermissionRequestCallBack):
(TestWebKitAPI::TEST): Enable capture with mock devices.
* TestWebKitAPI/Tests/WebKit2/getUserMedia.html: Update to mediaDevices.getUserMedia

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

2 years agoRTCPeerConnection addTrack does not require a stream parameter
commit-queue@webkit.org [Mon, 17 Apr 2017 15:27:40 +0000 (15:27 +0000)]
RTCPeerConnection addTrack does not require a stream parameter
https://bugs.webkit.org/show_bug.cgi?id=170894

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

Source/WebCore:

Test: webrtc/video-addTrack.html

* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::addTrack): Removing obsolete error throwing.

LayoutTests:

* webrtc/video-addTrack-expected.txt: Added.
* webrtc/video-addTrack.html: Added.

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

2 years agoAdd an external libwebrtc encoder factory in WebCore
commit-queue@webkit.org [Mon, 17 Apr 2017 15:01:32 +0000 (15:01 +0000)]
Add an external libwebrtc encoder factory in WebCore
https://bugs.webkit.org/show_bug.cgi?id=170883

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

Source/ThirdParty/libwebrtc:

Exporting some symbols.
Allowing to customize the creation of the H264 encoder.

* Source/webrtc/media/base/codec.h:
* Source/webrtc/media/engine/webrtcvideoencoderfactory.h
* Source/webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.cc:
* Source/webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.h:
* Source/webrtc/video_decoder.h
* Source/webrtc/video_encoder.h

Source/WebCore:

No change of behavior, WebCore factory instantiating the default libwebrtc H264 encoder.

* WebCore.xcodeproj/project.pbxproj:
* platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
(WebCore::staticFactoryAndThreads):
* platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.cpp: Added.
(WebCore::VideoToolboxVideoEncoderFactory::CreateVideoEncoder):
(WebCore::VideoToolboxVideoEncoderFactory::DestroyVideoEncoder):
* platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.h: Added.

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

2 years agoGraphicsLayerCA::recursiveCommitChanges should not descend into subtrees without...
antti@apple.com [Mon, 17 Apr 2017 15:00:33 +0000 (15:00 +0000)]
GraphicsLayerCA::recursiveCommitChanges should not descend into subtrees without changes
https://bugs.webkit.org/show_bug.cgi?id=170851

Reviewed by Simon Fraser.

With lots of layers this can be very slow as it always traverses the entire layer tree.
For example GIF animations on tumblr.com trigger expensive commits where almost nothing changes.

This patch adds m_hasDescendantsWithUncommittedChanges bit to GraphicsLayerCA. With this
we can avoid descending to branches without changes when committing.

This patch enabled the optimization on Mac.

* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::GraphicsLayerCA::syncPosition):

    Set PositionChanged flag when syncing layer position. This flag does nothing except makes
    next commit to update the coverage rect (so tiling gets updated).

(WebCore::GraphicsLayerCA::setVisibleAndCoverageRects):

    Do all setting of m_uncommittedChanges bits via addUncommittedChanges function.

(WebCore::GraphicsLayerCA::recursiveCommitChanges):

    Bail out if neither the current layer nor any of its descendants have any uncommited changes
    and none of the ancestors had changes.

(WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
(WebCore::GraphicsLayerCA::ensureStructuralLayer):
(WebCore::GraphicsLayerCA::changeLayerTypeTo):
(WebCore::GraphicsLayerCA::addUncommittedChanges):

    Set m_hasDescendantsWithUncommittedChanges bit in ancestors when mutating m_uncommittedChanges.

(WebCore::GraphicsLayerCA::noteLayerPropertyChanged):
* platform/graphics/ca/GraphicsLayerCA.h:
(WebCore::RenderLayerCompositor::frameViewDidScroll):

    Tell the scrolling layer that it needs to recompute coverage.
    This also schedules a layer flush so no need to do that separately.

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

2 years ago[GTK] Update the Fedora dependencies for WebKitGTK+
commit-queue@webkit.org [Mon, 17 Apr 2017 14:47:04 +0000 (14:47 +0000)]
[GTK] Update the Fedora dependencies for WebKitGTK+
https://bugs.webkit.org/show_bug.cgi?id=170590

Patch by Xan Lopez <xan@igalia.com> on 2017-04-17
Reviewed by Carlos Alberto Lopez Perez.

* gtk/install-dependencies: add a bunch of modules necessary to
get a proper set of GStreamer codecs for WebRTC.

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

2 years ago[JSCOnly] Fix build failures in macOS
utatane.tea@gmail.com [Mon, 17 Apr 2017 13:51:21 +0000 (13:51 +0000)]
[JSCOnly] Fix build failures in macOS
https://bugs.webkit.org/show_bug.cgi?id=170887

Reviewed by Alex Christensen.

.:

Align ICU header configuration to MacCMake port.

* Source/cmake/OptionsJSCOnly.cmake:

Source/JavaScriptCore:

Align ICU header configuration to MacCMake port.

* PlatformJSCOnly.cmake:

Source/WTF:

JSCOnly port does not use mac/MainThread.cpp.
We change the ifdef gurard to use generic implementaion in JSCOnly on macOS.

* wtf/MainThread.cpp:
* wtf/PlatformJSCOnly.cmake:

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

2 years agoB3: don't allow unsigned offsets in Value
jfbastien@apple.com [Mon, 17 Apr 2017 08:24:48 +0000 (08:24 +0000)]
B3: don't allow unsigned offsets in Value
https://bugs.webkit.org/show_bug.cgi?id=170692

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

MemoryValue and similar B3 opcode classes always expects a signed
offset. Giving it an out-of-bounds unsigned offset causes
implementation-defined behavior, which can cause badness as I just
fixed in WebAssembly.  This patch makes it impossible to create a
Value opcodes with an unsigned value, or with an overly-large
value.

* b3/B3AtomicValue.cpp:
(JSC::B3::AtomicValue::AtomicValue):
* b3/B3AtomicValue.h:
* b3/B3Common.h:
(JSC::B3::isRepresentableAs):
* b3/B3EliminateCommonSubexpressions.cpp:
* b3/B3LowerToAir.cpp:
(JSC::B3::Air::LowerToAir::scaleForShl):
(JSC::B3::Air::LowerToAir::effectiveAddr):
(JSC::B3::Air::LowerToAir::addr):
(JSC::B3::Air::LowerToAir::tryAppendLea):
* b3/B3MemoryValue.cpp:
(JSC::B3::MemoryValue::isLegalOffsetImpl):
(JSC::B3::MemoryValue::MemoryValue):
* b3/B3MemoryValue.h:
* b3/B3MemoryValueInlines.h:
(JSC::B3::MemoryValue::isLegalOffsetImpl):
* b3/B3MoveConstants.cpp:
* b3/B3ReduceStrength.cpp:
* b3/B3StackmapSpecial.cpp:
(JSC::B3::StackmapSpecial::repForArg):
* b3/B3Value.h:
* b3/air/AirArg.cpp:
(JSC::B3::Air::Arg::stackAddrImpl):
* b3/air/AirArg.h:
(JSC::B3::Air::Arg::addr):
(JSC::B3::Air::Arg::stack):
(JSC::B3::Air::Arg::callArg):
(JSC::B3::Air::Arg::stackAddr):
(JSC::B3::Air::Arg::index):
(JSC::B3::Air::Arg::offset):
(JSC::B3::Air::Arg::isValidAddrForm):
(JSC::B3::Air::Arg::isValidIndexForm):
(JSC::B3::Air::Arg::asTrustedImm32):
(JSC::B3::Air::Arg::asAddress):
(JSC::B3::Air::Arg::asBaseIndex):
* b3/air/AirLowerStackArgs.cpp:
(JSC::B3::Air::lowerStackArgs):
* b3/testb3.cpp:
(JSC::B3::testMulArgStore):
(JSC::B3::testStore32):
(JSC::B3::testStoreConstant):
(JSC::B3::testStoreConstantPtr):
(JSC::B3::testStoreAddLoad32):
(JSC::B3::testStoreAddLoadImm32):
(JSC::B3::testStoreAddLoad8):
(JSC::B3::testStoreAddLoadImm8):
(JSC::B3::testStoreAddLoad16):
(JSC::B3::testStoreAddLoadImm16):
(JSC::B3::testStoreAddLoad64):
(JSC::B3::testStoreAddLoadImm64):
(JSC::B3::testStoreAddLoad32Index):
(JSC::B3::testStoreAddLoadImm32Index):
(JSC::B3::testStoreAddLoad64Index):
(JSC::B3::testStoreAddLoadImm64Index):
(JSC::B3::testStoreSubLoad):
(JSC::B3::testStoreAddLoadInterference):
(JSC::B3::testStoreAddAndLoad):
(JSC::B3::testStoreNegLoad32):
(JSC::B3::testStoreNegLoadPtr):
(JSC::B3::testLoadOffset):
(JSC::B3::testLoadOffsetNotConstant):
(JSC::B3::testLoadOffsetUsingAdd):
(JSC::B3::testLoadOffsetUsingAddInterference):
(JSC::B3::testLoadOffsetUsingAddNotConstant):
(JSC::B3::testStoreLoadStackSlot):
(JSC::B3::testLoad):
(JSC::B3::testInterpreter):
(JSC::B3::testTrappingStore):
(JSC::B3::testTrappingLoadAddStore):
(JSC::B3::testWasmAddress):
* wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::fixupPointerPlusOffset):
(JSC::Wasm::B3IRGenerator::emitCheckAndPreparePointer):
(JSC::Wasm::B3IRGenerator::emitLoadOp):
(JSC::Wasm::B3IRGenerator::emitStoreOp):

Source/WTF:

Add C++17's std::conjunction type trait, except for Microsoft VS
2015 update 2 and later because it adds the logical operator type
traits, event when C++ is pre-2017:
https://blogs.msdn.microsoft.com/vcblog/2016/01/22/vs-2015-update-2s-stl-is-c17-so-far-feature-complete/

* wtf/StdLibExtras.h:

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

2 years agotest262: test262/test/built-ins/Object/prototype/toLocaleString/primitive_this_value.js
commit-queue@webkit.org [Mon, 17 Apr 2017 02:59:40 +0000 (02:59 +0000)]
test262: test262/test/built-ins/Object/prototype/toLocaleString/primitive_this_value.js
https://bugs.webkit.org/show_bug.cgi?id=170882

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

JSTests:

* test262.yaml:

Source/JavaScriptCore:

* runtime/ObjectPrototype.cpp:
(JSC::objectProtoFuncToLocaleString):
We should be using the this value without ToObject conversion both when
getting the potential accessor and calling it. In strict mode, the this
value will remain its simple value, in non-strict it is still converted.

LayoutTests:

* js/dom/object-prototype-toLocaleString-expected.txt:
* js/dom/script-tests/object-prototype-toLocaleString.js:
Test the case of toLocaleString where toString does not exist.

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

2 years agoCMD+R / CMD+Q is considered as user interaction and beforeunload alert is shown
cdumez@apple.com [Mon, 17 Apr 2017 00:56:47 +0000 (00:56 +0000)]
CMD+R / CMD+Q is considered as user interaction and beforeunload alert is shown
https://bugs.webkit.org/show_bug.cgi?id=169995
<rdar://problem/23798897>

Reviewed by Sam Weinig.

Source/WebCore:

Any key event was considered as user interaction with the page, which meant that they
would allow beforeunload alerts to be shown even when they do not represent actual
user interaction (e.g CMD+R / CMD+Q / CMD+T keyboard shortcuts).

To address the issue, we now only treat as user interaction with the page key events
that are actually handled by the page (i.e. handled by JS, typed into a field, ...).

Tests: fast/events/beforeunload-alert-handled-keydown.html
       fast/events/beforeunload-alert-unhandled-keydown.html

* dom/Document.h:
(WebCore::Document::setUserDidInteractWithPage):
(WebCore::Document::userDidInteractWithPage):
* dom/UserGestureIndicator.cpp:
(WebCore::UserGestureIndicator::UserGestureIndicator):
* loader/FrameLoader.cpp:
(WebCore::shouldAskForNavigationConfirmation):
* page/EventHandler.cpp:
(WebCore::EventHandler::keyEvent):
(WebCore::EventHandler::internalKeyEvent):
* page/EventHandler.h:

LayoutTests:

Add layout test coverage.

* fast/events/beforeunload-alert-handled-keydown-expected.txt: Added.
* fast/events/beforeunload-alert-handled-keydown.html: Added.
* fast/events/beforeunload-alert-unhandled-keydown-expected.txt: Added.
* fast/events/beforeunload-alert-unhandled-keydown.html: Added.

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

2 years ago[WebIDL] Switch IDLAttributes.txt over to a more structured format so that more infor...
commit-queue@webkit.org [Mon, 17 Apr 2017 00:50:16 +0000 (00:50 +0000)]
[WebIDL] Switch IDLAttributes.txt over to a more structured format so that more information can be added for each attribute
https://bugs.webkit.org/show_bug.cgi?id=170843

Patch by Sam Weinig <sam@webkit.org> on 2017-04-16
Reviewed by Chris Dumez.

.:

* Source/cmake/WebKitMacros.cmake:
Update extension of IDLAttributes to .json

Source/WebCore:

- Converts IDLAttributes.txt to IDLAttributes.json, and adds additional
  information for each attribute about what contexts they are valid in
  which is checked by the parser.
- Removes CustomSetPrototype which was unused, and Immutable which did
  nothing.

* DerivedSources.make:
Update extension of IDLAttributes to .json

* WebCore.xcodeproj/project.pbxproj:
Update project file for new file name and add some missing IDL files.

* bindings/scripts/CodeGenerator.pm:
Store the processed IDLAttributes in the code generator, so it can
be used for any additional Parser instantiations.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):
Remove support for CustomSetPrototype. Nobody is using it.

* bindings/scripts/IDLAttributes.json: Copied from Source/WebCore/bindings/scripts/IDLAttributes.txt.
* bindings/scripts/IDLAttributes.txt: Removed.
Rename IDLAttributes.txt -> IDLAttributes.json and move the data
into a more structured format. For now each extended attribute can
have the following fields:
    Required:
        'contextsAllowed' -> Non-empty array of strings from the contexts array.

    Optional:
        'values' -> Non-empty array of strings allowed after the equal (=) sign in
           the extended attribute. Like before, an empty string indicates it is
           ok to not have a value and a star (*) indicates any string is allowed.
           Not providing a values property at all indicates that no value is
           allowed.

        'standard' -> An object with information about the standard this attribute
           comes from. Should only be added to attributes that come from standards.

        'unsupported' -> A boolean with value true, indicating this property is not
           yet supported. Should only be used for standard attributes.

        'notes' -> A string with notes explaining something about this attribute.

* bindings/scripts/IDLParser.pm:
Pass and store the processed extended attribute map to the parser, and use it
validate that extended attributes being added to things are appropriate for the
context. Fix FIXME in isExtendedAttributeApplicableToTypes by using the map to
implement the predicate, rather than hard coding the list.

* bindings/scripts/generate-bindings.pl:
(generateEmptyHeaderAndCpp):
(loadIDLAttributes): Deleted.
(checkIDLAttributes): Deleted.
(checkIfIDLAttributesExists): Deleted.
Make specifying an IDL attributes file required. Switch to processing it
as a JSON file, and having the parser validate attributes.

* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
* bindings/scripts/test/TestImplements.idl:
* bindings/scripts/test/TestObj.idl:
* bindings/scripts/test/TestSupplemental.idl:
* bindings/scripts/test/TestTypedefs.idl:
- Remove use of Immutable extended attribute in the tests, as it does nothing.
- Remove use of the made up ReadOnly attribute, as the tests now use the IDLAttributes
  file to validate that the attributes are supported, so this would otherwise fail.

* css/WebKitCSSMatrix.idl:
* svg/SVGZoomEvent.idl:
- Remove use of the Immutable extended attribute, as it does nothing.

* page/NavigatorID.idl:
* page/NavigatorLanguage.idl:
- Remove use of the Nondeterministic extended attribute, as it does nothing.

* Modules/mediasource/SourceBufferList.idl:
Remove use of CallWith on the interface. It is illegal, and does nothing.

* animation/KeyframeEffect.idl:
* animation/WebAnimation.idl:
Remove use of [Default=Undefined]. This construct does nothing and now
correctly fails to parse.

Tools:

* DumpRenderTree/DerivedSources.make:
* WebKitTestRunner/DerivedSources.make:
* Scripts/webkitpy/bindings/main.py:
(BindingsTests.generate_from_idl):
Pass IDLAttributes.json, as it is now mandatory to have one.

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

2 years agotest262: test262/test/built-ins/isNaN/toprimitive-not-callable-throws.js
commit-queue@webkit.org [Sun, 16 Apr 2017 20:20:11 +0000 (20:20 +0000)]
test262: test262/test/built-ins/isNaN/toprimitive-not-callable-throws.js
https://bugs.webkit.org/show_bug.cgi?id=170888

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

JSTests:

* stress/computed-accessor.js:
* stress/eval-in-arrow-function.js:
* stress/rest-elements.js:
* stress/string-object-define-own-property.js:
Remove unused shouldThrow.

* stress/symbol-toprimitive-errors.js: Added.
Check for ToPrimitive TypeErrors.

* test262.yaml:

Source/JavaScriptCore:

* runtime/ExceptionHelpers.h:
* runtime/ExceptionHelpers.cpp:
(JSC::createInvalidInstanceofParameterErrorHasInstanceValueNotFunction):
Fix up this function name.

* runtime/JSObject.cpp:
(JSC::callToPrimitiveFunction):
When called with @@isPrimitive, bail on undefined or null and
throw a type error if the value is not callable.

(JSC::JSObject::toPrimitive):
Use throw scope to check for exception.

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

2 years agotest262: test262/test/language/expressions/tagged-template/template-object.js
commit-queue@webkit.org [Sun, 16 Apr 2017 20:01:25 +0000 (20:01 +0000)]
test262: test262/test/language/expressions/tagged-template/template-object.js
https://bugs.webkit.org/show_bug.cgi?id=170878

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

JSTests:

* stress/array-length-not-writable.js: Added.
(assert):
* test262.yaml:

Source/JavaScriptCore:

* runtime/JSArray.cpp:
(JSC::JSArray::put):
The fast path for setting an Array's length should check if length is
writable before checking for and possibly throwing a RangeError.

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

2 years agotest262: test262/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-44.js
commit-queue@webkit.org [Sun, 16 Apr 2017 17:37:43 +0000 (17:37 +0000)]
test262: test262/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-44.js
https://bugs.webkit.org/show_bug.cgi?id=170879

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

JSTests:

* ChakraCore/test/es5/enumerable.baseline-jsc:
* test262.yaml:

Source/JavaScriptCore:

* runtime/StringObject.h:
* runtime/StringObject.cpp:
(JSC::StringObject::getOwnPropertyNames):
(JSC::StringObject::getOwnNonIndexPropertyNames):
Ensure 'length' comes after all indexed properties by moving
it out to the getOwnNonIndexPropertyNames method which is called
inside of getOwnPropertyNames after JSObject handles indices.

LayoutTests:

* js/Object-getOwnPropertyNames-expected.txt:
* js/script-tests/Object-getOwnPropertyNames.js:

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

2 years agotest262: test262/test/built-ins/Date/prototype/Symbol.toPrimitive/name.js
commit-queue@webkit.org [Sun, 16 Apr 2017 11:13:46 +0000 (11:13 +0000)]
test262: test262/test/built-ins/Date/prototype/Symbol.toPrimitive/name.js
https://bugs.webkit.org/show_bug.cgi?id=170884

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-04-16
Reviewed by Yusuke Suzuki.

JSTests:

* test262.yaml:

Source/JavaScriptCore:

* runtime/DatePrototype.cpp:
(JSC::DatePrototype::finishCreation):
* runtime/FunctionPrototype.cpp:
(JSC::FunctionPrototype::addFunctionProperties):
* runtime/RegExpPrototype.cpp:
(JSC::RegExpPrototype::finishCreation):
* runtime/SymbolPrototype.cpp:
(JSC::SymbolPrototype::finishCreation):
Give symbol property functions proper function names.
This addresses function.name but not function.toString().

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

2 years agoFix Windows build after r215396.
achristensen@apple.com [Sun, 16 Apr 2017 06:24:39 +0000 (06:24 +0000)]
Fix Windows build after r215396.
https://bugs.webkit.org/show_bug.cgi?id=170828

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

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

2 years agoInclude resource size in some existing logging
krollin@apple.com [Sun, 16 Apr 2017 02:40:10 +0000 (02:40 +0000)]
Include resource size in some existing logging
https://bugs.webkit.org/show_bug.cgi?id=170866

Reviewed by Alex Christensen.

In order to correlate resource load times with resource size, we log
when the resource is starting to be loaded and when the resource is
finished loading. In NetworkResourceLoader::didReceiveResponse, we
also log the expected resource length. However, we can only log the
length if it is provided in Content-Length, which is not always the
case. If it's not provided, we end up logging "length = -1". To make
up for this, change NetworkResourceLoader::didFinishLoading and
WebResourceLoader:: didFinishLoading to log the length once we know
it.

* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::didReceiveBuffer):
(WebKit::NetworkResourceLoader::didFinishLoading):
* NetworkProcess/NetworkResourceLoader.h:
* WebProcess/Network/WebResourceLoader.cpp:
(WebKit::WebResourceLoader::didReceiveData):
(WebKit::WebResourceLoader::didFinishResourceLoad):
* WebProcess/Network/WebResourceLoader.h:

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

2 years agoRemove unused SharedBuffer constructor
achristensen@apple.com [Sun, 16 Apr 2017 00:09:50 +0000 (00:09 +0000)]
Remove unused SharedBuffer constructor
https://bugs.webkit.org/show_bug.cgi?id=170828

Reviewed by Brady Eidson.

* platform/SharedBuffer.cpp:
(WebCore::SharedBuffer::append):
* platform/SharedBuffer.h:
(WebCore::SharedBuffer::create):
* platform/graphics/freetype/FontPlatformDataFreeType.cpp:
(WebCore::FontPlatformData::openTypeTable):
* platform/graphics/win/FontPlatformDataWin.cpp:
(WebCore::FontPlatformData::openTypeTable):

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

2 years agotest262: test262/test/language/global-code/new.target-arrow.js
commit-queue@webkit.org [Sat, 15 Apr 2017 22:44:02 +0000 (22:44 +0000)]
test262: test262/test/language/global-code/new.target-arrow.js
https://bugs.webkit.org/show_bug.cgi?id=170872

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

JSTests:

* stress/async-arrow-functions-lexical-new.target-binding.js:
(shouldThrowAsync): Deleted.
(shouldThrowAsync.async): Deleted.
This code should have thrown a SyntaxError. Instead it was throwing
a ReferenceError for the internal @newTargetLocal variable.

* stress/new-target-syntax-errors.js:
Cover the arrow function in global code cases.

* ChakraCore.yaml:
* ChakraCore/test/es6/globalLambdaNewTargetSyntaxError.baseline-jsc:
We now pass with an expected SyntaxError. Our error message is different.

* test262.yaml:

Source/JavaScriptCore:

* parser/Parser.cpp:
(JSC::Parser<LexerType>::Parser):
Mark the global code scope.

(JSC::Parser<LexerType>::parseMemberExpression):
If new.target is detected in an arrow function defined in global scope
throw a SyntaxError.

* parser/Parser.h:
(JSC::Scope::Scope):
(JSC::Scope::setIsGlobalCodeScope):
(JSC::Scope::isGlobalCodeScope):
Marker for a global code scope.

* parser/ParserModes.h:
(JSC::isModuleParseMode):
(JSC::isProgramParseMode):
(JSC::isProgramOrModuleParseMode):
Helper for detecting global code based on parse mode.

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

2 years agoUnreviewed, rolling out r215393.
commit-queue@webkit.org [Sat, 15 Apr 2017 18:15:48 +0000 (18:15 +0000)]
Unreviewed, rolling out r215393.
https://bugs.webkit.org/show_bug.cgi?id=170876

breaks scrollable iframes on ios (Requested by anttik on
#webkit).

Reverted changeset:

"GraphicsLayerCA::recursiveCommitChanges should not descend
into subtrees without changes"
https://bugs.webkit.org/show_bug.cgi?id=170851
http://trac.webkit.org/changeset/215393

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

2 years agoGraphicsLayerCA::recursiveCommitChanges should not descend into subtrees without...
antti@apple.com [Sat, 15 Apr 2017 13:15:37 +0000 (13:15 +0000)]
GraphicsLayerCA::recursiveCommitChanges should not descend into subtrees without changes
https://bugs.webkit.org/show_bug.cgi?id=170851

Reviewed by Simon Fraser.

With lots of layers this can be very slow as it always traverses the entire layer tree.
For example GIF animations on tumblr.com trigger expensive commits where almost nothing changes.

This patch adds m_hasDescendantsWithUncommittedChanges bit to GraphicsLayerCA. With this
we can avoid descending to branches without changes when committing.

* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setVisibleAndCoverageRects):

    Do all setting of m_uncommittedChanges bits via addUncommittedChanges function.

(WebCore::GraphicsLayerCA::recursiveCommitChanges):

    Bail out if neither the current layer nor any of its descendants have any uncommited changes
    and none of the ancestors had changes.

(WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
(WebCore::GraphicsLayerCA::ensureStructuralLayer):
(WebCore::GraphicsLayerCA::changeLayerTypeTo):
(WebCore::GraphicsLayerCA::addUncommittedChanges):

    Set m_hasDescendantsWithUncommittedChanges bit in ancestors when mutating m_uncommittedChanges.

(WebCore::GraphicsLayerCA::noteLayerPropertyChanged):
* platform/graphics/ca/GraphicsLayerCA.h:
(WebCore::RenderLayerCompositor::frameViewDidScroll):

    Tell the scrolling layer that it needs to recompute coverage.
    This also schedules a layer flush so no need to do that separately.

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

2 years ago[WK2] Support data interaction of files into file inputs
wenson_hsieh@apple.com [Sat, 15 Apr 2017 09:37:01 +0000 (09:37 +0000)]
[WK2] Support data interaction of files into file inputs
https://bugs.webkit.org/show_bug.cgi?id=170803
<rdar://problem/31286130>

Reviewed by Tim Horton.

Source/WebCore:

Adds remaining support to allow data interaction of files onto inputs of type file. See per-change annotations
for more details. Unit tests to be added in the next patch.

* platform/PasteboardStrategy.h:
* platform/PlatformPasteboard.h:
* platform/ios/AbstractPasteboard.h:
* platform/ios/PlatformPasteboardIOS.mm:
(WebCore::PlatformPasteboard::numberOfFiles):
* platform/ios/WebItemProviderPasteboard.mm:

Implements numberOfFiles by counting the number of item providers that may be represented as a file, which
includes all item providers that contain at least one content UTI type.

(-[WebItemProviderPasteboard numberOfFiles]):

Adds boilerplate plumbing to fetch the number of files available on the pasteboard. On Mac, logic that
previously existed in DragData::numberOfFiles to query the number of files available in the pasteboard is now
on PlatformPasteboard instead, which both makes the implementation of DragData::numberOfFiles platform-invariant,
and also saves us one synchronous IPC call to the UI process in the WebKit2 implementation.

* platform/mac/DragDataMac.mm:
(WebCore::DragData::containsFiles):
(WebCore::DragData::numberOfFiles):
(WebCore::DragData::asFilenames):

Add support for recognizing objects in the pasteboard that may be represented by files, and therefore may be
uploaded via file input. Following suit with behavior elsewhere on the platform, we consider item providers able
to be represented by a file if they contain at least one content UTI type.

* platform/mac/PlatformPasteboardMac.mm:

Logic previously in DragData::numberOfFiles to get and then count all file path names in the pasteboard has been
moved here instead, and no longer needs to go through the pasteboard proxy.

(WebCore::PlatformPasteboard::numberOfFiles):

Source/WebKit/mac:

Add boilerplate plumbing for fetching the number of files in the pasteboard.

* WebCoreSupport/WebPlatformStrategies.h:
* WebCoreSupport/WebPlatformStrategies.mm:
(WebPlatformStrategies::getNumberOfFiles):

Source/WebKit2:

Implements remaining support for performing data interaction onto file inputs. There are two main changes at
this layer: plumbing the number of files in the pasteboard to the web process, and pulling the implementation of
createSandboxExtensionsIfNeeded out of Mac-specific WebViewImpl::createSandboxExtensionsIfNeeded and into
WebPageProxy::createSandboxExtensionsIfNeeded.

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<DragData>::encode):
(IPC::ArgumentCoder<DragData>::decode):

Relax special-casing of encoding and decoding filenames to be PLATFORM(COCOA) rather than PLATFORM(MAC).

* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::createSandboxExtensionsIfNeeded):
* UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
(WebKit::WebPasteboardProxy::getNumberOfFiles):

More boilerplate plumbing to deliver the number of files in the pasteboard to the web process.

* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::performDragOperation):
(WebKit::WebViewImpl::createSandboxExtensionsIfNeeded): Deleted.

Move the logic in WebViewImpl::createSandboxExtensionsIfNeeded over to WebPageProxy::createSandboxExtensionsIfNeeded.

* UIProcess/WebPageProxy.h:
* UIProcess/WebPasteboardProxy.h:
* UIProcess/WebPasteboardProxy.messages.in:
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::getNumberOfFiles):
* WebProcess/WebCoreSupport/WebPlatformStrategies.h:

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

2 years agoUnreviewed, fix the Windows build after r215385
wenson_hsieh@apple.com [Sat, 15 Apr 2017 09:06:52 +0000 (09:06 +0000)]
Unreviewed, fix the Windows build after r215385

r215385 introduced a new virtual method on ChromeClient that needs to be implemented in WebChromeClient for
Windows in WebKit1.

* WebCoreSupport/WebChromeClient.cpp:
(WebChromeClient::createIconForFiles):
* WebCoreSupport/WebChromeClient.h:

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

2 years agoUnreviewed, fix the build after r215389
wenson_hsieh@apple.com [Sat, 15 Apr 2017 08:47:38 +0000 (08:47 +0000)]
Unreviewed, fix the build after r215389

Use WebCore::createTemporaryDirectory instead of -_webkit_createTemporaryDirectoryWithTemplatePrefix:.

* platform/ios/WebItemProviderPasteboard.mm:
(temporaryFileURLForDataInteractionContent):

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

2 years agoImplement a way in WebItemProviderPasteboard to perform actions after file loading...
wenson_hsieh@apple.com [Sat, 15 Apr 2017 06:48:05 +0000 (06:48 +0000)]
Implement a way in WebItemProviderPasteboard to perform actions after file loading completes
https://bugs.webkit.org/show_bug.cgi?id=170839
<rdar://problem/31286130>

Reviewed by Tim Horton, Andy Estes, and Dan Bernstein.

Introduces -[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:], which performs an action
after all item providers which are able to provide content are done loading their content into temporary file
URLs. If no item providers have available data, we will immediately invoke the action with an empty URL array.

For each item provider with data, we save the local URL returned in the load completion block to a randomly
generated path in the container's temporary directory. When all files are finished loading, we then invoke the
action with all file URLs that successfully loaded.

No new tests, since there is no change in behavior.

* platform/ios/WebItemProviderPasteboard.h:
* platform/ios/WebItemProviderPasteboard.mm:
(temporaryFileURLForDataInteractionContent):
(-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:]):

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

2 years agoWeb Inspector: WebSockets: messages with non-latin letters are displayed incorrectly
nvasilyev@apple.com [Sat, 15 Apr 2017 03:12:18 +0000 (03:12 +0000)]
Web Inspector: WebSockets: messages with non-latin letters are displayed incorrectly
https://bugs.webkit.org/show_bug.cgi?id=170760

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

Add payloadLength property, which is used to display size. When payloadLength is unavailable,
it is calculated from payloadData by Web Inspector frontend.

This fixes <webkit.org/b/170609> Web Inspector: WebSockets: Transferred size is incorrect.

* inspector/protocol/Network.json:

Source/WebCore:

Add payloadLength property, which is used to display size. When payloadLength is unavailable,
it is calculated from payloadData by Web Inspector frontend.

This fixes <webkit.org/b/170609> Web Inspector: WebSockets: Transferred size is incorrect.

Tests: http/tests/websocket/tests/hybi/inspector/binary.html
       http/tests/websocket/tests/hybi/inspector/send-and-receive.html

* inspector/InspectorNetworkAgent.cpp:
(WebCore::InspectorNetworkAgent::didReceiveWebSocketFrame):
(WebCore::InspectorNetworkAgent::didSendWebSocketFrame):

Source/WebInspectorUI:

Add payloadLength property, which is used to display size. When payloadLength is unavailable,
it is calculated from payloadData by Web Inspector frontend.

This fixes <webkit.org/b/170609> Web Inspector: WebSockets: Transferred size is incorrect.

* UserInterface/Controllers/FrameResourceManager.js:
(WebInspector.FrameResourceManager.prototype._webSocketFrameReceivedOrSent):
* UserInterface/Models/WebSocketResource.js:
(WebInspector.WebSocketResource.prototype.addFrame):

LayoutTests:

Test sending and receiving text and binary (blob and array buffer) data.

* http/tests/websocket/tests/hybi/inspector/binary-expected.txt: Added.
* http/tests/websocket/tests/hybi/inspector/binary.html: Added.
* http/tests/websocket/tests/hybi/inspector/binary_wsh.py: Added.
(web_socket_do_extra_handshake):
(web_socket_transfer_data):
(all_distinct_bytes):
* http/tests/websocket/tests/hybi/inspector/send-and-receive-expected.txt: Added.
* http/tests/websocket/tests/hybi/inspector/send-and-receive.html: Added.
* http/tests/websocket/tests/hybi/inspector/send-and-receive_wsh.py: Added.
(web_socket_do_extra_handshake):
(web_socket_transfer_data):

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

2 years agoParseInt intrinsic in DFG backend doesn't properly flush its operands
sbarati@apple.com [Sat, 15 Apr 2017 02:13:11 +0000 (02:13 +0000)]
ParseInt intrinsic in DFG backend doesn't properly flush its operands
https://bugs.webkit.org/show_bug.cgi?id=170865

Reviewed by Mark Lam and Geoffrey Garen.

JSTests:

* stress/parse-int-intrinsic-dfg-backend-flush.js: Added.
(assert):
(foo):

Source/JavaScriptCore:

The DFG backend code needed to first call .gpr()/.jsValueRegs()
before calling flushRegisters(), or the input JSValueOperand would
not be flushed.

* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileParseInt):

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

2 years agoUpdate architectures in xcconfig files.
mark.lam@apple.com [Sat, 15 Apr 2017 01:52:38 +0000 (01:52 +0000)]
Update architectures in xcconfig files.
https://bugs.webkit.org/show_bug.cgi?id=170867
<rdar://problem/31628104>

Reviewed by Joseph Pecoraro.

Source/bmalloc:

* Configurations/Base.xcconfig:

Source/JavaScriptCore:

* Configurations/Base.xcconfig:
* Configurations/FeatureDefines.xcconfig:
* Configurations/JavaScriptCore.xcconfig:
* Configurations/ToolExecutable.xcconfig:

Source/ThirdParty/libwebrtc:

* Configurations/opus.xcconfig:

Source/WebCore:

No new tests needed.  Only updating xcconfig files.

* Configurations/Base.xcconfig:
* Configurations/FeatureDefines.xcconfig:

Source/WebCore/PAL:

No new tests needed.  Only updating xcconfig files.

* Configurations/Base.xcconfig:
* Configurations/FeatureDefines.xcconfig:

Source/WebKit/mac:

* Configurations/FeatureDefines.xcconfig:

Source/WebKit2:

* Configurations/FeatureDefines.xcconfig:

Source/WTF:

* Configurations/Base.xcconfig:

Tools:

* DumpRenderTree/mac/Configurations/Base.xcconfig:
* MobileMiniBrowser/Configurations/Base.xcconfig:
* TestWebKitAPI/Configurations/Base.xcconfig:
* TestWebKitAPI/Configurations/FeatureDefines.xcconfig:
* WebKitTestRunner/Configurations/Base.xcconfig:

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

2 years ago[WK2] Support Icon creation from file URLs on iOS
wenson_hsieh@apple.com [Sat, 15 Apr 2017 01:14:15 +0000 (01:14 +0000)]
[WK2] Support Icon creation from file URLs on iOS
https://bugs.webkit.org/show_bug.cgi?id=170809
<rdar://problem/31286130>

Reviewed by Tim Horton.

Source/WebCore:

Minor tweaks and refactoring to support displaying a WebCore::Icon from a list of filepaths on iOS. Please see
below annotations for more details. No new tests yet, as behavior on Mac should not have changed, and behavior
on iOS will not change until later patches land. Tests will be added in a later patch.

Most of the changes here remove platform special-casing in FileInputType for iOS and Mac, refactoring the code
such that it works for both platforms while preserving behavior.

* html/FileInputType.cpp:
(WebCore::FileInputType::~FileInputType):
(WebCore::FileInputType::setFiles):
(WebCore::FileInputType::filesChosen):
* html/FileInputType.h:

Un-guard m_fileIconLoader on iOS, and un-guard m_displayString for Mac. Consolidate logic in both version of
filesChosen and remove the iOS-specific version. Behavior when passing in an empty display string and null Icon
will be the same as that of the existing filesChosen method on Mac. Also, introduce a version of setFiles that
takes an additional RequestIcon enum that indicates whether or not to additionally use the new filepaths to
request an Icon update. filesChosen invokes this with RequestIcon::No if a non-null Icon was specified, as is
the case when uploading a file via the image picker on iOS.

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::displayString):
* html/HTMLInputElement.h:
* html/InputType.cpp:
* html/InputType.h:
* loader/EmptyClients.h:
* page/ChromeClient.h:

Introduce ChromeClient::createIconForFiles, which generates an icon representing the content at a list of file
paths. See WebKit and WebKit2 ChangeLogs for more details.

* platform/FileChooser.h:
(WebCore::FileChooserClient::filesChosen):
* rendering/RenderFileUploadControl.cpp:
(WebCore::RenderFileUploadControl::fileTextValue):

Remove platform special-casing when generating the text to display when uploading a file. If a displayString
is specified, then we use the contents of the displayString; otherwise, fall back to using the input element's
FileList to compute the display string.

Source/WebKit/ios:

Adjust for changes in the ChromeClient in WebCore.

* WebCoreSupport/WebChromeClientIOS.h:
* WebCoreSupport/WebChromeClientIOS.mm:
(WebChromeClientIOS::createIconForFiles):

Source/WebKit/mac:

Adjust for changes in the ChromeClient in WebCore.

* WebCoreSupport/WebChromeClient.h:
* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::loadIconForFiles):
(WebChromeClient::createIconForFiles):

Source/WebKit2:

Refactors file icon generation logic to support showing an Icon representing the content at a list of file paths
on iOS. Pulls out logic in WKFileUploadPanel responsible for generating the thumbnail image for a file input into
separate helpers in WebIconUtilities, and then uses these utilities in both WKFileUploadPanel and
WebChromeClientIOS.

* Shared/ios/WebIconUtilities.h: Added.
* Shared/ios/WebIconUtilities.mm: Added.
(WebKit::squareCropRectForSize):
(WebKit::squareImage):
(WebKit::thumbnailSizedImageForImage):
(WebKit::fallbackIconForFile):
(WebKit::iconForImageFile):
(WebKit::iconForVideoFile):
(WebKit::iconForFile):

Add logic for generating thumbnail icons, moved from WKFileUploadPanel.mm.

* UIProcess/ios/forms/WKFileUploadPanel.mm:
(squareCropRectForSize): Deleted.
(squareImage): Deleted.
(thumbnailSizedImageForImage): Deleted.
(fallbackIconForFile): Deleted.
(iconForImageFile): Deleted.
(iconForVideoFile): Deleted.
(iconForFile): Deleted.

Remove logic for generating thumbnail icons.

* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::loadIconForFiles):
(WebKit::WebChromeClient::createIconForFiles):

Rather than call Icon::createIconForFiles directly, loadIconForFiles now consults ChromeClient::createIconForFiles
instead. On other platforms, this just turns around and calls Icon::createIconForFiles, but on iOS, we use the
utilities introduced in WebIconUtilities to generate a file icon.

* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
(WebKit::WebChromeClient::createIconForFiles):

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

2 years agoFix basic WKURLSchemeHandler bugs.
beidson@apple.com [Sat, 15 Apr 2017 00:52:10 +0000 (00:52 +0000)]
Fix basic WKURLSchemeHandler bugs.
<rdar://problem/30647559> and https://bugs.webkit.org/show_bug.cgi?id=170862

Reviewed by Andy Estes.

Source/WebCore:

Covered by new API tests.

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

Source/WebKit2:

* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):

* UIProcess/WebURLSchemeHandlerTask.cpp:
(WebKit::WebURLSchemeHandlerTask::didReceiveResponse):

* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::addURLSchemeHandlerTaskProxy):
(WebKit::WebLoaderStrategy::removeURLSchemeHandlerTaskProxy):
(WebKit::WebLoaderStrategy::remove):
* WebProcess/Network/WebLoaderStrategy.h:

* WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp:
(WebKit::WebURLSchemeHandlerProxy::startNewTask):
(WebKit::WebURLSchemeHandlerProxy::taskDidComplete):
(WebKit::WebURLSchemeHandlerProxy::taskDidStopLoading):
* WebProcess/WebPage/WebURLSchemeHandlerProxy.h:

* WebProcess/WebPage/WebURLSchemeHandlerTaskProxy.cpp:
(WebKit::WebURLSchemeHandlerTaskProxy::WebURLSchemeHandlerTaskProxy):
(WebKit::WebURLSchemeHandlerTaskProxy::stopLoading):
(WebKit::WebURLSchemeHandlerTaskProxy::didReceiveResponse):
(WebKit::WebURLSchemeHandlerTaskProxy::didReceiveData):
(WebKit::WebURLSchemeHandlerTaskProxy::didComplete):
(WebKit::WebURLSchemeHandlerTaskProxy::hasLoader):
* WebProcess/WebPage/WebURLSchemeHandlerTaskProxy.h:
(WebKit::WebURLSchemeHandlerTaskProxy::identifier):

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/WKURLSchemeHandler-1.mm: Added.
(-[SchemeHandler initWithData:mimeType:]):
(-[SchemeHandler dealloc]):
(-[SchemeHandler webView:startTask:]):
(-[SchemeHandler webView:stopTask:]):
(TEST):

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

2 years ago[WebCrypto] Support HKDF
jiewen_tan@apple.com [Sat, 15 Apr 2017 00:17:09 +0000 (00:17 +0000)]
[WebCrypto] Support HKDF
https://bugs.webkit.org/show_bug.cgi?id=170636
<rdar://problem/23539827>

Reviewed by Brent Fulgham.

LayoutTests/imported/w3c:

* web-platform-tests/WebCryptoAPI/derive_bits_keys/hkdf.worker-expected.txt:
* web-platform-tests/WebCryptoAPI/derive_bits_keys/test_hkdf-expected.txt:
* web-platform-tests/WebCryptoAPI/import_export/symmetric_importKey.worker-expected.txt:
* web-platform-tests/WebCryptoAPI/import_export/test_symmetric_importKey-expected.txt:

Source/WebCore:

This patch implements HKDF according to the spec: https://www.w3.org/TR/WebCryptoAPI/#hkdf.
Supported operations include deriveKey, deriveBits, importKey and getKeyLength.

Tests: crypto/subtle/ecdh-import-key-derive-hkdf-key.html
       crypto/subtle/hkdf-derive-bits-malformed-parametrs.html
       crypto/subtle/hkdf-import-key-derive-bits.html
       crypto/subtle/hkdf-import-key-derive-hmac-key.html
       crypto/subtle/hkdf-import-key-malformed-parameters.html
       crypto/subtle/hkdf-import-key.html
       crypto/workers/subtle/hkdf-import-key-derive-bits.html
       crypto/workers/subtle/hkdf-import-key-derive-hmac-key.html
       crypto/workers/subtle/hkdf-import-key.html

* CMakeLists.txt:
* DerivedSources.make:
* PlatformGTK.cmake:
* PlatformMac.cmake:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSCryptoAlgorithmDictionary.cpp:
(WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt):
(WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt):
(WebCore::JSCryptoAlgorithmDictionary::createParametersForSign):
(WebCore::JSCryptoAlgorithmDictionary::createParametersForVerify):
(WebCore::JSCryptoAlgorithmDictionary::createParametersForDigest):
(WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey):
(WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveKey):
(WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveBits):
(WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey):
(WebCore::JSCryptoAlgorithmDictionary::createParametersForExportKey):
Rename HKDF_CTR to HKDF.
* bindings/js/JSSubtleCryptoCustom.cpp:
(WebCore::normalizeCryptoAlgorithmParameters):
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::write):
(WebCore::CloneDeserializer::read):
Rename HKDF_CTR to HKDF.
* crypto/CommonCryptoUtilities.h:
* crypto/CryptoAlgorithmIdentifier.h:
* crypto/CryptoAlgorithmParameters.h:
* crypto/algorithms/CryptoAlgorithmHKDF.cpp: Added.
(WebCore::CryptoAlgorithmHKDF::create):
(WebCore::CryptoAlgorithmHKDF::identifier):
(WebCore::CryptoAlgorithmHKDF::deriveBits):
(WebCore::CryptoAlgorithmHKDF::importKey):
(WebCore::CryptoAlgorithmHKDF::getKeyLength):
* crypto/algorithms/CryptoAlgorithmHKDF.h: Added.
* crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp: Added.
(WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
* crypto/mac/CryptoAlgorithmHKDFMac.cpp: Added.
(WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
* crypto/mac/CryptoAlgorithmRegistryMac.cpp:
(WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
* crypto/parameters/CryptoAlgorithmHkdfParams.h: Added.
* crypto/parameters/HkdfParams.idl: Added.

LayoutTests:

* TestExpectations:
* crypto/subtle/ecdh-import-key-derive-hkdf-key-expected.txt: Added.
* crypto/subtle/ecdh-import-key-derive-hkdf-key.html: Added.
* crypto/subtle/hkdf-derive-bits-malformed-parametrs-expected.txt: Added.
* crypto/subtle/hkdf-derive-bits-malformed-parametrs.html: Added.
* crypto/subtle/hkdf-import-key-derive-bits-expected.txt: Added.
* crypto/subtle/hkdf-import-key-derive-bits.html: Added.
* crypto/subtle/hkdf-import-key-derive-hmac-key-expected.txt: Added.
* crypto/subtle/hkdf-import-key-derive-hmac-key.html: Added.
* crypto/subtle/hkdf-import-key-expected.txt: Added.
* crypto/subtle/hkdf-import-key-malformed-parameters-expected.txt: Added.
* crypto/subtle/hkdf-import-key-malformed-parameters.html: Added.
* crypto/subtle/hkdf-import-key.html: Added.
* crypto/workers/subtle/hkdf-import-key-derive-bits-expected.txt: Added.
* crypto/workers/subtle/hkdf-import-key-derive-bits.html: Added.
* crypto/workers/subtle/hkdf-import-key-derive-hmac-key-expected.txt: Added.
* crypto/workers/subtle/hkdf-import-key-derive-hmac-key.html: Added.
* crypto/workers/subtle/hkdf-import-key-expected.txt: Added.
* crypto/workers/subtle/hkdf-import-key.html: Added.
* crypto/workers/subtle/resources/hkdf-import-key-derive-bits.js: Added.
* crypto/workers/subtle/resources/hkdf-import-key-derive-hmac-key.js: Added.
* crypto/workers/subtle/resources/hkdf-import-key.js: Added.

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

2 years agowebkit-patch failed to detect git repository
commit-queue@webkit.org [Sat, 15 Apr 2017 00:09:35 +0000 (00:09 +0000)]
webkit-patch failed to detect git repository
https://bugs.webkit.org/show_bug.cgi?id=170859

Patch by Bill Ming <mbbill@gmail.com> on 2017-04-14
Reviewed by Daniel Bates.

Windows cmd does not accept single quoted path. So, using
double quotes here will provide better platform compatibility.

* Scripts/VCSUtils.pm:
(isGitDirectory):
(isGitSVNDirectory):
(svnRevisionForDirectory):
(svnInfoForPath):

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

2 years agoUnreviewed, rolling out r215374.
ryanhaddad@apple.com [Fri, 14 Apr 2017 23:26:52 +0000 (23:26 +0000)]
Unreviewed, rolling out r215374.

This change causes LayoutTests to exit early with crashes on
Sierra.

Reverted changeset:

"webkitpy: Ignore previously launched pid when system is under
stress"
https://bugs.webkit.org/show_bug.cgi?id=170741
http://trac.webkit.org/changeset/215374

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

2 years agoWebAssembly: B3IRGenerator should use phis for result types
keith_miller@apple.com [Fri, 14 Apr 2017 23:20:19 +0000 (23:20 +0000)]
WebAssembly: B3IRGenerator should use phis for result types
https://bugs.webkit.org/show_bug.cgi?id=170863

Reviewed by Filip Pizlo.

Currently, we use variables for the result types of control flow in
Wasm. We did this originally since we weren't sure that the phis we
generated would be optimal. Since then, we have verified that the edges
in wasm control flow ensure that each upsilon will dominate its phi
so we don't need to use variables.

* wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::ControlData::ControlData):
(JSC::Wasm::B3IRGenerator::addTopLevel):
(JSC::Wasm::B3IRGenerator::addBlock):
(JSC::Wasm::B3IRGenerator::addLoop):
(JSC::Wasm::B3IRGenerator::unify):

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

2 years agoAdd sub-commit UI in commit log viewer.
dewei_zhu@apple.com [Fri, 14 Apr 2017 23:03:19 +0000 (23:03 +0000)]
Add sub-commit UI in commit log viewer.
https://bugs.webkit.org/show_bug.cgi?id=170379

Reviewed by Ryosuke Niwa.

Add an API to return sub-commits for a given commit.
Add sub-commit difference viewer into commit log viewer to show changed sub-commits between two commits.
Add 'ownsSubCommits' info in 'api/commits' return values.
Extend 'api/manifest' to include whether a repositories owns other repositories.
Only show this sub-commit difference viewer when a repository owns other repositories and both commits owns sub-commits.
Add unit tests for those new features.

* browser-tests/commit-log-viewer-tests.js: Updated test cases.
* public/api/commits.php: Added 'sub-commits' to provide sub-commit for a given commit.
* public/include/commit-log-fetcher.php: Added function to query sub-commit from database. Added 'repository' and 'ownsSubCommits' fields in returning commits.
* public/v3/components/expand-collapse-button.js: Added.
(ExpandCollapseButton):
(ExpandCollapseButton.prototype.didConstructShadowTree): Changes state on click and dispatches 'toggle' event.
(ExpandCollapseButton.sizeFactor):
(ExpandCollapseButton.buttonContent):
(ExpandCollapseButton.cssTemplate):
* public/v3/components/commit-log-viewer.js:
(CommitLogViewer.prototype._renderCommitList): Added sub-commit viewer if two adjacent commits both have sub-commits.
(CommitLogViewer.cssTemplate):
* public/v3/components/sub-commit-viewer.js: Added.
(SubCommitViewer): Added 'SubCommitViewer' class to represent the sub-commit differences between two given commits.`
(SubCommitViewer.prototype.didConstructShadowTree): Makes 'expand-collapse' button listen to 'toggle' event.
(SubCommitViewer.prototype._toggleVisibility): Updates UI once 'expand-collapse' button is clicked.
(SubCommitViewer.prototype.render): Render sub-commit view based on the state.
(SubCommitViewer.prototype._renderSubcommitTable): Generates sub-commits difference table entries.
(SubCommitViewer.htmlTemplate):
(SubCommitViewer.cssTemplate):
* public/v3/index.html: Added 'sub-commit-viewer.js' and 'expand-collapse-button.js'.
* public/v3/models/commit-log.js:
(CommitLog): Added '_subCommits'.
(CommitLog.prototype.updateSingleton): Updates 'rawData.ownsSubCommits' as well.
(CommitLog.prototype.ownsSubCommits):
(CommitLog.prototype.subCommits): Added. Returns sub-commits.
(CommitLog.prototype.fetchSubCommits): Added. Fetches sub-commits if haven't fetched them before.
(CommitLog.prototype._buildSubCommitMap): Added. Creates a map which maps repositories to commits.
(CommitLog.diffSubCommits): Added. Finds difference between two given commits.
(CommitLog.fetchBetweenRevisions): Updated due to '_constructFromRawData' change.
(CommitLog.fetchForSingleRevision): Updated due to '_constructFromRawData' change.
(CommitLog._constructFromRawData): Removed first argument 'repository' as it can be determined by calling 'Repository.findById'.
* public/v3/models/repository.js:
(Repository):
(Repository.prototype.owner): Returns the owner id.
(Repository.prototype.ownedRepositories): Returns a list of repositories owned by this repository.
* server-tests/api-commits-tests.js: Added tests for 'sub-commits' filter.
* server-tests/api-manifest-tests.js: Added a test.
* unit-tests/commit-log-tests.js: Added tests for 'fetchSubCommits' and 'diffSubCommits'.
* unit-tests/resources/mock-v3-models.js: Added 'ownerRepository' and 'ownedRepository'.

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

2 years ago[ios-simulator] API test WebKit2.AdditionalReadAccessAllowedURLs is failing
mitz@apple.com [Fri, 14 Apr 2017 22:17:36 +0000 (22:17 +0000)]
[ios-simulator] API test WebKit2.AdditionalReadAccessAllowedURLs is failing
https://bugs.webkit.org/show_bug.cgi?id=170856

Disabled the newly-added test in the Simulator, which doesn’t enforce sandboxing.

* TestWebKitAPI/Tests/WebKit2Cocoa/AdditionalReadAccessAllowedURLs.mm:

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

2 years agoSkip workers/wasm-* LayoutTests on ios-simulator.
ryanhaddad@apple.com [Fri, 14 Apr 2017 21:03:45 +0000 (21:03 +0000)]
Skip workers/wasm-* LayoutTests on ios-simulator.

Unreviewed test gardening.

* platform/ios/TestExpectations:

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

2 years agotext-align start / end failure in table cells
zalan@apple.com [Fri, 14 Apr 2017 20:59:36 +0000 (20:59 +0000)]
text-align start / end failure in table cells
https://bugs.webkit.org/show_bug.cgi?id=141417
<rdar://problem/31051672>

Reviewed by Antti Koivisto.

Source/WebCore:

Apply "text-align: center" on th elements when parent's computed value for the 'text-align' property
is its initial value, unless it is explicitly set.

Test: fast/table/center-th-when-parent-has-initial-text-align.html

* css/CSSProperties.json:
* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderCustom::applyInitialTextAlign):
(WebCore::StyleBuilderCustom::applyValueTextAlign):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::adjustRenderStyle):
(WebCore::StyleResolver::applyProperty):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::hasExplicitlySetTextAlign):
(WebCore::RenderStyle::setHasExplicitlySetTextAlign):
(WebCore::RenderStyle::NonInheritedFlags::hasExplicitlySetTextAlign):
(WebCore::RenderStyle::NonInheritedFlags::setHasExplicitlySetTextAlign):

LayoutTests:

* fast/table/center-th-when-parent-has-initial-text-align-expected.html: Added.
* fast/table/center-th-when-parent-has-initial-text-align.html: Added.

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

2 years agowebkitpy: Ignore previously launched pid when system is under stress
jbedard@apple.com [Fri, 14 Apr 2017 20:52:36 +0000 (20:52 +0000)]
webkitpy: Ignore previously launched pid when system is under stress
https://bugs.webkit.org/show_bug.cgi?id=170741

Unreviewed infrastructure fix.

Drivers are destroyed between failing layout tests, which is not necessary and
prevents the work-around implemented in https://bugs.webkit.org/show_bug.cgi?id=170741.

* Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py:
(Worker._kill_driver): Do not destroy drivers when they are stopped.
* Scripts/webkitpy/port/driver.py:
(Driver.stop): Reset driver values set in initializer.

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

2 years agoFix Windows build after r215368.
achristensen@apple.com [Fri, 14 Apr 2017 20:52:29 +0000 (20:52 +0000)]
Fix Windows build after r215368.
https://bugs.webkit.org/show_bug.cgi?id=170641

* CMakeLists.txt:
Add new directory containing files needed in WebCore.

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

2 years ago[ios-simulator] API test WebKit2.WKWebProcessPlugInRangeHandle timing out
aestes@apple.com [Fri, 14 Apr 2017 20:34:43 +0000 (20:34 +0000)]
[ios-simulator] API test WebKit2.WKWebProcessPlugInRangeHandle timing out
https://bugs.webkit.org/show_bug.cgi?id=167594

Re-enabled this API test now that webkit.org/b/161967 is fixed.

* TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandle.mm:
(TEST):

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

2 years ago[ios-simulator] API test WebKit2.DataDetectionReferenceDate timing out
aestes@apple.com [Fri, 14 Apr 2017 20:29:25 +0000 (20:29 +0000)]
[ios-simulator] API test WebKit2.DataDetectionReferenceDate timing out
https://bugs.webkit.org/show_bug.cgi?id=161967

Reviewed by Alexey Proskuryakov.

Source/WebCore:

DataDetectorsCoreSPI.h defined DDQueryOffset as a struct of two CFIndexes, which is 16 bytes
on LP64, but the struct is actually defined as two CFIndex-typed 32-bit bitfields, which is
8 bytes on LP64. This breaks the ABI on Public SDK builds when calling functions that take
or return DDQueryOffsets.

* platform/spi/cocoa/DataDetectorsCoreSPI.h: Updated the DDQueryOffset definition for
Public SDK builds, and added a static_assert to detect future size changes at compile time.

Tools:

* TestWebKitAPI/Tests/WebKit2Cocoa/DataDetection.mm:
(TEST): Re-enabled WebKit2.DataDetectionReferenceDate.

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

2 years ago[JSC] use ExpressionErrorClassifier for AwaitExpression operand
caitp@igalia.com [Fri, 14 Apr 2017 19:50:24 +0000 (19:50 +0000)]
[JSC] use ExpressionErrorClassifier for AwaitExpression operand
https://bugs.webkit.org/show_bug.cgi?id=170844

Reviewed by Saam Barati.

JSTests:

* stress/regress-170732.js: Added.

Source/JavaScriptCore:

In parseAssignmentExpression(), several cover grammars are handled, and
use ExpressionErrorClassifier to record hints about which grammars to
try.

In parseAwaitExpression(), the hints recorded during parsing of the
operand need to be discarded, because if they propagate to the outer
parseAssignmentExpression(), the hints will lead the parser down invalid
branches that should be skipped.

This change adds an additional ExpressionErrorClassifier to
parseAwaitExpression(), in order to discard hints recorded trying to
parse the operand.

* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseAwaitExpression):

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

2 years agoRemoved unused and unimplemented methods from MediaPlayer
annulen@yandex.ru [Fri, 14 Apr 2017 18:48:11 +0000 (18:48 +0000)]
Removed unused and unimplemented methods from MediaPlayer
https://bugs.webkit.org/show_bug.cgi?id=170848

Reviewed by Jer Noble.

No new tests needed.

* platform/graphics/MediaPlayer.h:

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

2 years agoWebAssembly: There is a short window of time where a CodeBlock could be destroyed...
sbarati@apple.com [Fri, 14 Apr 2017 18:09:35 +0000 (18:09 +0000)]
WebAssembly: There is a short window of time where a CodeBlock could be destroyed before all of its async compilation callbacks are called
https://bugs.webkit.org/show_bug.cgi?id=170641

Reviewed by Keith Miller.

There is an unlikely race when a CodeBlock compilation fails,
the module compiles a new CodeBlock for that memory mode, all while
the CodeBlock is notifying its callbacks that it has finished.
There is a chance that the Module could deref its failed CodeBlock
at that point, destroying it, before the callbacks were able to
grab a Ref to the CodeBlock. This patch fixes the race by having the
callbacks ref the CodeBlock.

This patch also has the Plan clear out all of its callbacks
once it gets completed. This adds an extra defense to anybody
that grabs refs to the Plan in the callback.

* wasm/WasmCodeBlock.cpp:
(JSC::Wasm::CodeBlock::CodeBlock):
(JSC::Wasm::CodeBlock::compileAsync):
* wasm/WasmPlan.cpp:
(JSC::Wasm::Plan::complete):

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

2 years agoUnreviewed, rolling out r215363.
ryanhaddad@apple.com [Fri, 14 Apr 2017 17:57:40 +0000 (17:57 +0000)]
Unreviewed, rolling out r215363.

This change causes LayoutTests to exit early with crashes.

Reverted changeset:

"webkitpy: Ignore previously launched pid when system is under
stress"
https://bugs.webkit.org/show_bug.cgi?id=170741
http://trac.webkit.org/changeset/215363

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

2 years agoAdd performance test for asking the platform for a font for U+2060 WORD JOINER
mmaxfield@apple.com [Fri, 14 Apr 2017 17:57:26 +0000 (17:57 +0000)]
Add performance test for asking the platform for a font for U+2060 WORD JOINER
https://bugs.webkit.org/show_bug.cgi?id=170842

Reviewed by Tim Horton.

PerformanceTests:

* Layout/word-joiner.html: Added.

Source/WebCore:

No new tests because there is no behavior change.

* platform/graphics/WidthCache.h:
(WebCore::WidthCache::add):
(WebCore::WidthCache::addSlowCase):

Source/WTF:

* wtf/unicode/CharacterNames.h:

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

2 years agoAir::RegLiveness should be constraint-based
fpizlo@apple.com [Fri, 14 Apr 2017 17:43:42 +0000 (17:43 +0000)]
Air::RegLiveness should be constraint-based
https://bugs.webkit.org/show_bug.cgi?id=170817

Reviewed by Saam Barati.

Previously, I changed the Air liveness analyses based on Air::Liveness<> to be
constraint-based and this was a significant speed-up. Now I'm adding the same
functionality to RegLiveness.

This is a 1% speed-up on wasm B3 -O1 compile times.

* b3/air/AirAllocateRegistersAndStackByLinearScan.cpp:
* b3/air/AirLivenessAdapter.h:
(JSC::B3::Air::LivenessAdapter::LivenessAdapter):
(JSC::B3::Air::LivenessAdapter::prepareToCompute):
(JSC::B3::Air::LivenessAdapter::actionsAt):
* b3/air/AirRegLiveness.cpp:
(JSC::B3::Air::RegLiveness::RegLiveness):
(JSC::B3::Air::RegLiveness::LocalCalcForUnifiedTmpLiveness::LocalCalcForUnifiedTmpLiveness):
(JSC::B3::Air::RegLiveness::LocalCalcForUnifiedTmpLiveness::execute):
(JSC::B3::Air::RegLiveness::LocalCalc::execute): Deleted.
* b3/air/AirRegLiveness.h:
(JSC::B3::Air::RegLiveness::Actions::Actions):
(JSC::B3::Air::RegLiveness::LocalCalcBase::LocalCalcBase):
(JSC::B3::Air::RegLiveness::LocalCalcBase::live):
(JSC::B3::Air::RegLiveness::LocalCalcBase::isLive):
(JSC::B3::Air::RegLiveness::LocalCalc::LocalCalc):
(JSC::B3::Air::RegLiveness::LocalCalc::execute):
(JSC::B3::Air::RegLiveness::LocalCalc::live): Deleted.
(JSC::B3::Air::RegLiveness::LocalCalc::isLive): Deleted.

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

2 years agoUnreviewed, rolling out r215350.
ryanhaddad@apple.com [Fri, 14 Apr 2017 17:31:50 +0000 (17:31 +0000)]
Unreviewed, rolling out r215350.

This change broke the Windows build.

Reverted changeset:

"Remove unused SharedBuffer constructor"
https://bugs.webkit.org/show_bug.cgi?id=170828
http://trac.webkit.org/changeset/215350

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

2 years agowebkitpy: Ignore previously launched pid when system is under stress
jbedard@apple.com [Fri, 14 Apr 2017 17:08:32 +0000 (17:08 +0000)]
webkitpy: Ignore previously launched pid when system is under stress
https://bugs.webkit.org/show_bug.cgi?id=170741

Unreviewed infrastructure fix.

Drivers are destroyed between failing layout tests, which is not necessary and
prevents the work-around implemented in https://bugs.webkit.org/show_bug.cgi?id=170741.

* Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py:
(Worker._kill_driver): Do not destroy drivers when they are stopped.

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

2 years ago[MediaSource] Push capabilities across process boundary during UIProcess capture.
jer.noble@apple.com [Fri, 14 Apr 2017 16:04:52 +0000 (16:04 +0000)]
[MediaSource] Push capabilities across process boundary during UIProcess capture.
https://bugs.webkit.org/show_bug.cgi?id=170814

Reviewed by Eric Carlson.

Source/WebCore:

There's no real reason for RealtimeMediaSourceCapabilities to be RefCounted nor to keep them from
being created on the stack. So in addition to making that class coder-compliant, change all the
classes that vend capabilities to use a unique_ptr<> instead of a RefPtr<>.

* Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
* Modules/webaudio/MediaStreamAudioSource.cpp:
(WebCore::MediaStreamAudioSource::capabilities):
* Modules/webaudio/MediaStreamAudioSource.h:
* platform/mediastream/MediaEndpoint.cpp:
* platform/mediastream/MediaStreamTrackPrivate.cpp:
(WebCore::MediaStreamTrackPrivate::capabilities):
* platform/mediastream/MediaStreamTrackPrivate.h:
* platform/mediastream/RealtimeMediaSource.h:
* platform/mediastream/RealtimeMediaSourceCapabilities.h:
(WebCore::CapabilityValueOrRange::encode):
(WebCore::CapabilityValueOrRange::decode):
(WebCore::RealtimeMediaSourceCapabilities::RealtimeMediaSourceCapabilities):
(WebCore::RealtimeMediaSourceCapabilities::supportedConstraints):
(WebCore::RealtimeMediaSourceCapabilities::setSupportedConstraints):
(WebCore::RealtimeMediaSourceCapabilities::encode):
(WebCore::RealtimeMediaSourceCapabilities::decode):
(WebCore::RealtimeMediaSourceCapabilities::create): Deleted.
* platform/mediastream/RealtimeMediaSourceSettings.h:
* platform/mediastream/mac/AVMediaCaptureSource.h:
* platform/mediastream/mac/AVMediaCaptureSource.mm:
(WebCore::AVMediaCaptureSource::initializeCapabilities):
(WebCore::AVMediaCaptureSource::capabilities):
* platform/mediastream/mac/CoreAudioCaptureSource.cpp:
(WebCore::CoreAudioCaptureSource::capabilities):
* platform/mediastream/mac/CoreAudioCaptureSource.h:
* platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
(WebCore::RealtimeIncomingAudioSource::capabilities):
* platform/mediastream/mac/RealtimeIncomingAudioSource.h:
* platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
(WebCore::RealtimeIncomingVideoSource::capabilities):
* platform/mediastream/mac/RealtimeIncomingVideoSource.h:
* platform/mock/MockRealtimeMediaSource.cpp:
(WebCore::MockRealtimeMediaSource::initializeCapabilities):
(WebCore::MockRealtimeMediaSource::capabilities):
* platform/mock/MockRealtimeMediaSource.h:
* platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h:

Source/WebKit2:

Make a new synchronous getter for capabilities(), moderated by only requesting the capabilities() cross-process
the first time called.

* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
(WebKit::UserMediaCaptureManagerProxy::capabilities):
(WebKit::UserMediaCaptureManagerProxy::supportedConstraints):
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
* WebProcess/cocoa/UserMediaCaptureManager.cpp:
(WebKit::UserMediaCaptureManager::Source::setCapabilities):
(WebKit::UserMediaCaptureManager::capabilities):
* WebProcess/cocoa/UserMediaCaptureManager.h:

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

2 years agowebkitpy: Ignore previously launched pid when system is under stress
jbedard@apple.com [Fri, 14 Apr 2017 15:13:09 +0000 (15:13 +0000)]
webkitpy: Ignore previously launched pid when system is under stress
https://bugs.webkit.org/show_bug.cgi?id=170741

Unreviewed infrastructure fix.

Server processes are destroyed in the driver, which is not necessary and prevents
the work-around implemented in https://bugs.webkit.org/show_bug.cgi?id=170741.

* Scripts/webkitpy/port/driver.py:
(Driver.run_test): Do not destroy server process.
(Driver._start): Only create the server process if it is None.
(Driver.stop): Do not destroy server process.

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

2 years agoSafari 10.1 JSON.parse returns incorrect object for numeric keys with decimal values
gskachkov@gmail.com [Fri, 14 Apr 2017 09:08:51 +0000 (09:08 +0000)]
Safari 10.1 JSON.parse returns incorrect object for numeric keys with decimal values
https://bugs.webkit.org/show_bug.cgi?id=170442

Reviewed by Yusuke Suzuki.

* stress/object-number-properties.js:

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

2 years ago[JSC] Date.parse should accept wider range of representation
utatane.tea@gmail.com [Fri, 14 Apr 2017 07:59:55 +0000 (07:59 +0000)]
[JSC] Date.parse should accept wider range of representation
https://bugs.webkit.org/show_bug.cgi?id=170720

Reviewed by Darin Adler.

JSTests:

* stress/date-relaxed.js: Added.
(shouldBe):
(throw.new.Error):

Source/WTF:

We would like to relax Date.parse to accept the representation "May 8".
At that time, we choose `2000` as a default year. This is because of
the following reason.

1. According to the V8, this default value is compatible to the old KJS. While current V8 uses 2001,
   SpiderMonkey does not have such a fallback path. So this reason is not big deal.

2. It is a leap year. When using `new Date("Feb 29")`, we assume that people want to save month and day.
   Leap year can save user inputs if they is valid. If we use the current year instead, the current year
   may not be a leap year. In that case, `new Date("Feb 29").getMonth()` becomes 2 (March).

* wtf/DateMath.cpp:
(WTF::parseDateFromNullTerminatedCharacters):

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

2 years agoWeb Inspector: Implement autocompletion for CSS variables
webkit@devinrousso.com [Fri, 14 Apr 2017 06:51:51 +0000 (06:51 +0000)]
Web Inspector: Implement autocompletion for CSS variables
https://bugs.webkit.org/show_bug.cgi?id=154441

Reviewed by Joseph Pecoraro.

* UserInterface/Views/CSSStyleDeclarationTextEditor.js:
(WebInspector.CSSStyleDeclarationTextEditor.prototype.completionControllerCompletionsNeeded):
Add CSS variables to the list of matching completions based on those defined in the current
node's computed style.

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

2 years agoWeb Inspector: No context menu available via ENABLE_INSPECTOR_SERVER
commit-queue@webkit.org [Fri, 14 Apr 2017 04:47:19 +0000 (04:47 +0000)]
Web Inspector: No context menu available via ENABLE_INSPECTOR_SERVER
https://bugs.webkit.org/show_bug.cgi?id=170705

Patch by Ross Kirsling <ross.kirsling@sony.com> on 2017-04-13
Reviewed by Joseph Pecoraro.

Reintroduce old SoftContextMenu class (removed in r157278) and apply various fixes:
- Remove legacy globals and prototype extensions.
- Align JS/CSS style with current front-end code.
- Update UI and fix UX to replicate the macOS native context menu.

* Scripts/copy-user-interface-resources.pl:
Add copyright line for Sony Interactive Entertainment.

* UserInterface/Base/InspectorFrontendHostStub.js:
(WebInspector.InspectorFrontendHostStub.prototype.showContextMenu):
Use SoftContextMenu.

* UserInterface/Main.html:
Include SoftContextMenu.

* UserInterface/Views/SoftContextMenu.css: Added.
(.soft-context-menu-glass-pane):
(.soft-context-menu):
(.soft-context-menu > .item):
(.soft-context-menu > .item.disabled):
(.soft-context-menu > .item.highlighted):
(.soft-context-menu > .item > .checkmark):
(.soft-context-menu > .item > .label):
(.soft-context-menu > .item > .submenu-arrow):
(.soft-context-menu > .separator):
(.soft-context-menu > .separator > .line):

* UserInterface/Views/SoftContextMenu.js: Added.
(WebInspector.SoftContextMenu):
(WebInspector.SoftContextMenu.prototype.show):
(WebInspector.SoftContextMenu.prototype._consumeEvent):
(WebInspector.SoftContextMenu.prototype._parentGlassPaneElement):
(WebInspector.SoftContextMenu.prototype._createMenuItem):
(WebInspector.SoftContextMenu.prototype._createSeparator):
(WebInspector.SoftContextMenu.prototype._repositionMenuOnScreen):
(WebInspector.SoftContextMenu.prototype._showSubMenu):
(WebInspector.SoftContextMenu.prototype._hideSubMenu):
(WebInspector.SoftContextMenu.prototype._menuItemContextMenu):
(WebInspector.SoftContextMenu.prototype._menuItemMouseDown):
(WebInspector.SoftContextMenu.prototype._menuItemMouseUp):
(WebInspector.SoftContextMenu.prototype._menuItemMouseOver):
(WebInspector.SoftContextMenu.prototype._menuItemMouseOut):
(WebInspector.SoftContextMenu.prototype._menuKeyDown):
(WebInspector.SoftContextMenu.prototype._glassPaneMouseDown):
(WebInspector.SoftContextMenu.prototype._focus):
(WebInspector.SoftContextMenu.prototype._triggerAction):
(WebInspector.SoftContextMenu.prototype._highlightMenuItem):
(WebInspector.SoftContextMenu.prototype._highlightPrevious):
(WebInspector.SoftContextMenu.prototype._highlightNext):
(WebInspector.SoftContextMenu.prototype._discardMenu):
(WebInspector.SoftContextMenu.prototype._discardSubMenus):

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

2 years agoWebAssembly: fix windows build
jfbastien@apple.com [Fri, 14 Apr 2017 04:46:56 +0000 (04:46 +0000)]
WebAssembly: fix windows build
https://bugs.webkit.org/show_bug.cgi?id=170832

Reviewed by Mark Lam.

My previous patch re-declared isIOS which AssemblerCommon.h
already provided, and which was already included by Options.cpp.

* runtime/Options.cpp:

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

2 years ago[Cocoa] Allow clients to specify in _WKProcessPoolConfiguration additional directory...
mitz@apple.com [Fri, 14 Apr 2017 04:33:07 +0000 (04:33 +0000)]
[Cocoa] Allow clients to specify in _WKProcessPoolConfiguration additional directory sandbox extensions
https://bugs.webkit.org/show_bug.cgi?id=170387

Reviewed by Sam Weinig.

Source/WebKit2:

Test: TestWebKitAPI/Tests/WebKit2Cocoa/AdditionalReadAccessAllowedURLs.mm

Added an additionalReadAccessAllowedURLs property to _WKProcessPoolConfiguration.

* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode): Encode the new
  additionalSandboxExtensionHandles member.
(WebKit::WebProcessCreationParameters::decode): Decode it.
* Shared/WebProcessCreationParameters.h: Added additionalSandboxExtensionHandles member.

* UIProcess/API/APIProcessPoolConfiguration.cpp:
(API::ProcessPoolConfiguration::copy): Copy new m_additionalReadAccessAllowedPaths member.
* UIProcess/API/APIProcessPoolConfiguration.h: Added m_additionalReadAccessAllowedPaths
  member and accessor functions.

* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: Declared new
  additionalReadAccessAllowedURLs property whose value is an array of URLs to which the Web
  Content process will be given read access.
* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
(-[_WKProcessPoolConfiguration additionalReadAccessAllowedURLs]): New getter that returns
  an array of file URLs from the ProcessPoolConfiguration's additionalReadAccessAllowedPaths().
(-[_WKProcessPoolConfiguration setAdditionalReadAccessAllowedURLs:]): New setter that checks
  that the given URLs are file URLs and populates the ProcessPoolConfiguration's
  additionalReadAccessAllowedPaths with their paths.

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::resolvePathsForSandboxExtensions): Populate the new
  m_resolvedPaths.additionalWebProcessSandboxExtensionPaths with resolved paths from the
  ProcessPoolConfiguration's additionalReadAccessAllowedPaths.
(WebKit::WebProcessPool::createNewWebProcess): Populate the WebProcessCreationParameters's
  additionalSandboxExtensionHandles member with read-only sandbox extensions created from
  the resolved paths.
* UIProcess/WebProcessPool.h: Added additionalWebProcessSandboxExtensionPaths member to
  the Paths struct.

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess): Consume the additional sandbox extensions.

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/AdditionalReadAccessAllowedURLs.mm: Added.
(TEST):
* TestWebKitAPI/Tests/WebKit2Cocoa/AdditionalReadAccessAllowedURLsPlugin.mm: Added.
(-[AdditionalReadAccessAllowedURLsPlugIn webProcessPlugIn:didCreateBrowserContextController:]):
(-[AdditionalReadAccessAllowedURLsPlugIn dealloc]):
(-[AdditionalReadAccessAllowedURLsPlugIn readStringFromURL:completionHandler:]):
* TestWebKitAPI/Tests/WebKit2Cocoa/AdditionalReadAccessAllowedURLsProtocol.h: Added.

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

2 years agoWTF installs an extra copy of a header outside /usr/local/include/wtf
mitz@apple.com [Fri, 14 Apr 2017 04:25:01 +0000 (04:25 +0000)]
WTF installs an extra copy of a header outside /usr/local/include/wtf

* WTF.xcodeproj/project.pbxproj: Demoted PriorityQueue.h from Private to Project.

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

2 years agoWebAssembly: We should be able to postMessage a JSWebAssemblyModule
sbarati@apple.com [Fri, 14 Apr 2017 02:10:17 +0000 (02:10 +0000)]
WebAssembly: We should be able to postMessage a JSWebAssemblyModule
https://bugs.webkit.org/show_bug.cgi?id=170573

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

This patch adds a callback to JSRunLoopTimer to notify
clients that a timer has been set. This is used inside
WorkerRunLoop in WebCore so that its RunLoop can perform
an iteration when it sees that a timer got set.

* JavaScriptCore.xcodeproj/project.pbxproj:
* runtime/JSRunLoopTimer.cpp:
(JSC::JSRunLoopTimer::scheduleTimer):
(JSC::JSRunLoopTimer::addTimerSetNotification):
(JSC::JSRunLoopTimer::removeTimerSetNotification):
* runtime/JSRunLoopTimer.h:
* wasm/WasmCodeBlock.cpp:
(JSC::Wasm::CodeBlock::~CodeBlock):
* wasm/WasmCodeBlock.h:
* wasm/WasmModule.cpp:
(JSC::Wasm::Module::~Module):
(JSC::Wasm::Module::signatureIndexFromFunctionIndexSpace):
(JSC::Wasm::makeValidationCallback):
(JSC::Wasm::Module::validateSync):
(JSC::Wasm::Module::validateAsync):
(JSC::Wasm::Module::validateSyncImpl): Deleted.
(JSC::Wasm::Module::makeValidationCallback): Deleted.
* wasm/WasmModule.h:
(JSC::Wasm::Module::validateSync): Deleted.
(JSC::Wasm::Module::validateAsync): Deleted.
(JSC::Wasm::Module::signatureIndexFromFunctionIndexSpace): Deleted.
(JSC::Wasm::Module::nonNullCodeBlock): Deleted.
* wasm/js/JSWebAssemblyCodeBlock.cpp:
(JSC::JSWebAssemblyCodeBlock::create):
* wasm/js/JSWebAssemblyCodeBlock.h:
(JSC::JSWebAssemblyCodeBlock::create): Deleted.
* wasm/js/JSWebAssemblyModule.cpp:
(JSC::JSWebAssemblyModule::source):
* wasm/js/JSWebAssemblyModule.h:
(JSC::JSWebAssemblyModule::source): Deleted.
* wasm/js/WebAssemblyFunction.cpp:
(JSC::callWebAssemblyFunction):
* wasm/js/WebAssemblyModulePrototype.cpp:

Source/WebCore:

This patch's main purpose is to implement postMessage of JSWebAssemblyModule.
The spec text describing the behavior is: https://github.com/WebAssembly/design/blob/master/JS.md#structured-clone-of-a-webassemblymodule
We only allow for JSWebAssemblyModule to be serialized in the postMessage
context. More work needs to be done to make it valid to store a module in
IndexDB.

All that is needed to serialize a JSWebAssemblyModule is grab a Ref
to its underlying Wasm::Module. So, when doing a postMessage, all we
do is grab this Ref, and then re-create the JSWebAssemblyModule from
the Wasm::Module in the new VM/global object. Because the code for
Wasm::Module is VM-independent, this is all that's needed. This turned
out nicely, because it requires little knowledge from WebCore about
what it means to clone a JSWebAssemblyModule.

The second significant part of this patch is teaching WorkerRunLoop about
the various timers inside JSC. Before, the WorkerRunLoop wouldn't always
wake up to address JSC timers. I noticed this bug when I was writing
tests to make sure that Wasm was running concurrently in different
workers. The bug is that the WorkerRunLoop's message queue has no insight
into a timer being scheduled. This effected the PromiseDeferredTimer that
Wasm uses, as well as the various GC timers that Heap uses. Now, WorkerRunLoop
will set itself up to be notified when timers are set. When a timer is
set, the WorkerRunLoop will perform an iteration to to reset its top
level MessageQueue timeout to be no longer than the next timer fire date.

Tests: storage/indexeddb/wasm-exceptions.html
       workers/wasm-hashset-many.html
       workers/wasm-hashset.html
       workers/wasm-long-compile-many.html
       workers/wasm-long-compile.html

* ForwardingHeaders/heap/GCActivityCallback.h: Added.
* ForwardingHeaders/runtime/JSRunLoopTimer.h: Added.
* ForwardingHeaders/runtime/PromiseDeferredTimer.h: Added.
* ForwardingHeaders/wasm: Added.
* ForwardingHeaders/wasm/js: Added.
* ForwardingHeaders/wasm/js/JSWebAssemblyModule.h: Added.
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::serialize):
(WebCore::CloneSerializer::CloneSerializer):
(WebCore::CloneSerializer::dumpIfTerminal):
(WebCore::CloneDeserializer::deserialize):
(WebCore::CloneDeserializer::CloneDeserializer):
(WebCore::CloneDeserializer::readTerminal):
(WebCore::SerializedScriptValue::SerializedScriptValue):
(WebCore::SerializedScriptValue::create):
(WebCore::SerializedScriptValue::deserialize):
* bindings/js/SerializedScriptValue.h:
* bindings/js/WorkerScriptController.cpp:
(WebCore::WorkerScriptController::addTimerSetNotification):
(WebCore::WorkerScriptController::removeTimerSetNotification):
* bindings/js/WorkerScriptController.h:
* workers/WorkerRunLoop.cpp:
(WebCore::WorkerRunLoop::runInMode):

LayoutTests:

* storage/indexeddb/resources/wasm-exceptions.js: Added.
(const._fail):
(const.isNotA.assert.isNotA):
(const):
(switch.typeof):
(Builder):
(Builder.prototype.setChecked):
(Builder.prototype.setPreamble):
(Builder.prototype._functionIndexSpaceKeyHash):
(Builder.prototype._registerFunctionToIndexSpace):
(Builder.prototype._getFunctionFromIndexSpace):
(Builder.prototype._registerSectionBuilders.const.section.in.WASM.description.section.switch.section.case.string_appeared_here.this.section):
(Builder.prototype._registerSectionBuilders.const.section.in.WASM.description.section.switch.section.const.codeBuilder.End.switch.case.string_appeared_here.e):
(Builder.prototype._registerSectionBuilders.this.Unknown):
(prepareDatabase):
(testDatabase):
* storage/indexeddb/wasm-exceptions-expected.txt: Added.
* storage/indexeddb/wasm-exceptions.html: Added.
* workers/wasm-hashset: Added.
* workers/wasm-hashset-expected.txt: Added.
* workers/wasm-hashset-many-expected.txt: Added.
* workers/wasm-hashset-many.html: Added.
* workers/wasm-hashset.html: Added.
* workers/wasm-hashset/many-test.js: Added.
(reallyDone):
(console.log):
(console.error):
(console.assert):
(i.worker.onmessage):
(Module.print):
(Module.printErr):
(Module.canvas):
(Module.setStatus):
(Module):
(setValue):
(getValue):
(allocate):
(getMemory):
(Pointer_stringify):
(AsciiToString):
(stringToAscii):
(UTF8ArrayToString):
(UTF8ToString):
(stringToUTF8Array):
(stringToUTF8):
(lengthBytesUTF8):
(demangle):
(demangleAll):
(stackTrace):
(alignUp):
(updateGlobalBuffer):
(updateGlobalBufferViews):
(abortOnCannotGrowMemory):
(enlargeMemory):
(getTotalMemory):
(callRuntimeCallbacks):
(preRun):
(ensureInitRuntime):
(preMain):
(exitRuntime):
(postRun):
(addOnPreRun):
(addOnInit):
(addOnPreMain):
(addOnExit):
(addOnPostRun):
(intArrayFromString):
(intArrayToString):
(writeStringToMemory):
(writeArrayToMemory):
(writeAsciiToMemory):
(Math.string_appeared_here):
(addRunDependency):
(removeRunDependency):
(integrateWasmJS.asm2wasmImports.string_appeared_here):
(integrateWasmJS.lookupImport):
(integrateWasmJS.mergeMemory):
(integrateWasmJS.fixImports):
(integrateWasmJS.getBinary):
(integrateWasmJS.doJustAsm):
(integrateWasmJS.receiveInstance):
(integrateWasmJS.):
(integrateWasmJS.doNativeWasm):
(integrateWasmJS.doWasmPolyfill):
(integrateWasmJS.Module.string_appeared_here):
(integrateWasmJS):
(___setErrNo):
(__ZSt18uncaught_exceptionv):
(EXCEPTIONS.deAdjust):
(EXCEPTIONS.addRef):
(EXCEPTIONS.decRef):
(EXCEPTIONS.clearRef):
(___cxa_find_matching_catch):
(___gxx_personality_v0):
(___lock):
(_emscripten_memcpy_big):
(_gettimeofday):
(_abort):
(SYSCALLS):
(SYSCALLS.get getStr):
(SYSCALLS.get64):
(SYSCALLS.getZero):
(try.___syscall146.printChar):
(___syscall146):
(___syscall54):
(___unlock):
(___syscall6):
(invoke_ii):
(invoke_iiii):
(invoke_v):
(_malloc.Module.string_appeared_here):
(getTempRet0.Module.string_appeared_here):
(_free.Module.string_appeared_here):
(_main.Module.string_appeared_here):
(setTempRet0.Module.string_appeared_here):
(establishStackSpace.Module.string_appeared_here):
(stackSave.Module.string_appeared_here):
(_memset.Module.string_appeared_here):
(_sbrk.Module.string_appeared_here):
(_emscripten_get_global_libc.Module.string_appeared_here):
(_memcpy.Module.string_appeared_here):
(___errno_location.Module.string_appeared_here):
(setThrew.Module.string_appeared_here):
(_fflush.Module.string_appeared_here):
(stackAlloc.Module.string_appeared_here):
(stackRestore.Module.string_appeared_here):
(_llvm_bswap_i32.Module.string_appeared_here):
(runPostSets.Module.string_appeared_here):
(dynCall_ii.Module.string_appeared_here):
(dynCall_iiii.Module.string_appeared_here):
(dynCall_v.Module.string_appeared_here):
(else.applyMemoryInitializer):
(else):
(else.useRequest):
(ExitStatus):
(dependenciesFulfilled):
(Module.string_appeared_here.Module.callMain.callMain.pad):
(Module.string_appeared_here.Module.callMain):
(run.doRun):
(run):
(exit):
* workers/wasm-hashset/many-worker.js: Added.
(console.log):
(console.error):
(console.assert):
(Module.print):
(Module.printErr):
(Module.canvas):
(Module.setStatus):
(Module):
(setValue):
(getValue):
(allocate):
(getMemory):
(Pointer_stringify):
(AsciiToString):
(stringToAscii):
(UTF8ArrayToString):
(UTF8ToString):
(stringToUTF8Array):
(stringToUTF8):
(lengthBytesUTF8):
(demangle):
(demangleAll):
(stackTrace):
(alignUp):
(updateGlobalBuffer):
(updateGlobalBufferViews):
(abortOnCannotGrowMemory):
(enlargeMemory):
(getTotalMemory):
(callRuntimeCallbacks):
(preRun):
(ensureInitRuntime):
(preMain):
(exitRuntime):
(postRun):
(addOnPreRun):
(addOnInit):
(addOnPreMain):
(addOnExit):
(addOnPostRun):
(intArrayFromString):
(intArrayToString):
(writeStringToMemory):
(writeArrayToMemory):
(writeAsciiToMemory):
(Math.string_appeared_here):
(addRunDependency):
(removeRunDependency):
(integrateWasmJS.asm2wasmImports.string_appeared_here):
(integrateWasmJS.lookupImport):
(integrateWasmJS.mergeMemory):
(integrateWasmJS.fixImports):
(integrateWasmJS.getBinary):
(integrateWasmJS.doJustAsm):
(integrateWasmJS.receiveInstance):
(integrateWasmJS.doNativeWasm):
(integrateWasmJS.doWasmPolyfill):
(integrateWasmJS.Module.string_appeared_here):
(integrateWasmJS):
(___setErrNo):
(__ZSt18uncaught_exceptionv):
(EXCEPTIONS.deAdjust):
(EXCEPTIONS.addRef):
(EXCEPTIONS.decRef):
(EXCEPTIONS.clearRef):
(___cxa_find_matching_catch):
(___gxx_personality_v0):
(___lock):
(_emscripten_memcpy_big):
(_gettimeofday):
(_abort):
(SYSCALLS):
(SYSCALLS.get getStr):
(SYSCALLS.get64):
(SYSCALLS.getZero):
(try.___syscall146.printChar):
(___syscall146):
(___syscall54):
(___unlock):
(___syscall6):
(invoke_ii):
(invoke_iiii):
(invoke_v):
(_malloc.Module.string_appeared_here):
(getTempRet0.Module.string_appeared_here):
(_free.Module.string_appeared_here):
(_main.Module.string_appeared_here):
(setTempRet0.Module.string_appeared_here):
(establishStackSpace.Module.string_appeared_here):
(stackSave.Module.string_appeared_here):
(_memset.Module.string_appeared_here):
(_sbrk.Module.string_appeared_here):
(_emscripten_get_global_libc.Module.string_appeared_here):
(_memcpy.Module.string_appeared_here):
(___errno_location.Module.string_appeared_here):
(setThrew.Module.string_appeared_here):
(_fflush.Module.string_appeared_here):
(stackAlloc.Module.string_appeared_here):
(stackRestore.Module.string_appeared_here):
(_llvm_bswap_i32.Module.string_appeared_here):
(runPostSets.Module.string_appeared_here):
(dynCall_ii.Module.string_appeared_here):
(dynCall_iiii.Module.string_appeared_here):
(dynCall_v.Module.string_appeared_here):
(else.applyMemoryInitializer):
(else):
(else.useRequest):
(ExitStatus):
(dependenciesFulfilled):
(Module.string_appeared_here.Module.callMain.callMain.pad):
(Module.string_appeared_here.Module.callMain):
(run.doRun):
(run):
(exit):
* workers/wasm-hashset/test.js: Added.
(reallyDone):
(console.log):
(console.error):
(console.assert):
(Module.print):
(Module.printErr):
(Module.canvas):
(Module.setStatus):
(Module):
(setValue):
(getValue):
(allocate):
(getMemory):
(Pointer_stringify):
(AsciiToString):
(stringToAscii):
(UTF8ArrayToString):
(UTF8ToString):
(stringToUTF8Array):
(stringToUTF8):
(lengthBytesUTF8):
(demangle):
(demangleAll):
(stackTrace):
(alignUp):
(updateGlobalBuffer):
(updateGlobalBufferViews):
(abortOnCannotGrowMemory):
(enlargeMemory):
(getTotalMemory):
(callRuntimeCallbacks):
(preRun):
(ensureInitRuntime):
(preMain):
(exitRuntime):
(postRun):
(addOnPreRun):
(addOnInit):
(addOnPreMain):
(addOnExit):
(addOnPostRun):
(intArrayFromString):
(intArrayToString):
(writeStringToMemory):
(writeArrayToMemory):
(writeAsciiToMemory):
(Math.string_appeared_here):
(addRunDependency):
(removeRunDependency):
(integrateWasmJS.asm2wasmImports.string_appeared_here):
(integrateWasmJS.lookupImport):
(integrateWasmJS.mergeMemory):
(integrateWasmJS.fixImports):
(integrateWasmJS.getBinary):
(integrateWasmJS.doJustAsm):
(integrateWasmJS.receiveInstance):
(integrateWasmJS.doNativeWasm):
(integrateWasmJS.doWasmPolyfill):
(integrateWasmJS.Module.string_appeared_here):
(integrateWasmJS):
(___setErrNo):
(__ZSt18uncaught_exceptionv):
(EXCEPTIONS.deAdjust):
(EXCEPTIONS.addRef):
(EXCEPTIONS.decRef):
(EXCEPTIONS.clearRef):
(___cxa_find_matching_catch):
(___gxx_personality_v0):
(___lock):
(_emscripten_memcpy_big):
(_gettimeofday):
(_abort):
(SYSCALLS):
(SYSCALLS.get getStr):
(SYSCALLS.get64):
(SYSCALLS.getZero):
(try.___syscall146.printChar):
(___syscall146):
(___syscall54):
(___unlock):
(___syscall6):
(invoke_ii):
(invoke_iiii):
(invoke_v):
(_malloc.Module.string_appeared_here):
(getTempRet0.Module.string_appeared_here):
(_free.Module.string_appeared_here):
(_main.Module.string_appeared_here):
(setTempRet0.Module.string_appeared_here):
(establishStackSpace.Module.string_appeared_here):
(stackSave.Module.string_appeared_here):
(_memset.Module.string_appeared_here):
(_sbrk.Module.string_appeared_here):
(_emscripten_get_global_libc.Module.string_appeared_here):
(_memcpy.Module.string_appeared_here):
(___errno_location.Module.string_appeared_here):
(setThrew.Module.string_appeared_here):
(_fflush.Module.string_appeared_here):
(stackAlloc.Module.string_appeared_here):
(stackRestore.Module.string_appeared_here):
(_llvm_bswap_i32.Module.string_appeared_here):
(runPostSets.Module.string_appeared_here):
(dynCall_ii.Module.string_appeared_here):
(dynCall_iiii.Module.string_appeared_here):
(dynCall_v.Module.string_appeared_here):
(else.applyMemoryInitializer):
(else):
(else.useRequest):
(ExitStatus):
(dependenciesFulfilled):
(Module.string_appeared_here.Module.callMain.callMain.pad):
(Module.string_appeared_here.Module.callMain):
(run.doRun):
(run):
(exit):
* workers/wasm-hashset/worker.js: Added.
(console.log):
(console.error):
(console.assert):
(Module.print):
(Module.printErr):
(Module.canvas):
(Module.setStatus):
(Module):
(setValue):
(getValue):
(allocate):
(getMemory):
(Pointer_stringify):
(AsciiToString):
(stringToAscii):
(UTF8ArrayToString):
(UTF8ToString):
(stringToUTF8Array):
(stringToUTF8):
(lengthBytesUTF8):
(demangle):
(demangleAll):
(stackTrace):
(alignUp):
(updateGlobalBuffer):
(updateGlobalBufferViews):
(abortOnCannotGrowMemory):
(enlargeMemory):
(getTotalMemory):
(callRuntimeCallbacks):
(preRun):
(ensureInitRuntime):
(preMain):
(exitRuntime):
(postRun):
(addOnPreRun):
(addOnInit):
(addOnPreMain):
(addOnExit):
(addOnPostRun):
(intArrayFromString):
(intArrayToString):
(writeStringToMemory):
(writeArrayToMemory):
(writeAsciiToMemory):
(Math.string_appeared_here):
(addRunDependency):
(removeRunDependency):
(integrateWasmJS.asm2wasmImports.string_appeared_here):
(integrateWasmJS.lookupImport):
(integrateWasmJS.mergeMemory):
(integrateWasmJS.fixImports):
(integrateWasmJS.getBinary):
(integrateWasmJS.doJustAsm):
(integrateWasmJS.receiveInstance):
(integrateWasmJS.):
(integrateWasmJS.doNativeWasm):
(integrateWasmJS.doWasmPolyfill):
(integrateWasmJS.Module.string_appeared_here):
(integrateWasmJS):
(___setErrNo):
(__ZSt18uncaught_exceptionv):
(EXCEPTIONS.deAdjust):
(EXCEPTIONS.addRef):
(EXCEPTIONS.decRef):
(EXCEPTIONS.clearRef):
(___cxa_find_matching_catch):
(___gxx_personality_v0):
(___lock):
(_emscripten_memcpy_big):
(_gettimeofday):
(_abort):
(SYSCALLS):
(SYSCALLS.get getStr):
(SYSCALLS.get64):
(SYSCALLS.getZero):
(try.___syscall146.printChar):
(___syscall146):
(___syscall54):
(___unlock):
(___syscall6):
(invoke_ii):
(invoke_iiii):
(invoke_v):
(_malloc.Module.string_appeared_here):
(getTempRet0.Module.string_appeared_here):
(_free.Module.string_appeared_here):
(_main.Module.string_appeared_here):
(setTempRet0.Module.string_appeared_here):
(establishStackSpace.Module.string_appeared_here):
(stackSave.Module.string_appeared_here):
(_memset.Module.string_appeared_here):
(_sbrk.Module.string_appeared_here):
(_emscripten_get_global_libc.Module.string_appeared_here):
(_memcpy.Module.string_appeared_here):
(___errno_location.Module.string_appeared_here):
(setThrew.Module.string_appeared_here):
(_fflush.Module.string_appeared_here):
(stackAlloc.Module.string_appeared_here):
(stackRestore.Module.string_appeared_here):
(_llvm_bswap_i32.Module.string_appeared_here):
(runPostSets.Module.string_appeared_here):
(dynCall_ii.Module.string_appeared_here):
(dynCall_iiii.Module.string_appeared_here):
(dynCall_v.Module.string_appeared_here):
(else.applyMemoryInitializer):
(else):
(else.useRequest):
(ExitStatus):
(dependenciesFulfilled):
(Module.string_appeared_here.Module.callMain.callMain.pad):
(Module.string_appeared_here.Module.callMain):
(run.doRun):
(run):
(exit):
* workers/wasm-long-compile-expected.txt: Added.
* workers/wasm-long-compile-many-expected.txt: Added.
* workers/wasm-long-compile-many.html: Added.
* workers/wasm-long-compile.html: Added.
* workers/wasm-resources: Added.
* workers/wasm-resources/long-compile-many.js: Added.
(done):
(i.async.run):
(i.worker.onmessage):
* workers/wasm-resources/long-compile-worker.js: Added.
(const._fail):
(const.isNotA.assert.isNotA):
(const):
(switch.typeof):
(Builder):
(Builder.prototype.setChecked):
(Builder.prototype.setPreamble):
(Builder.prototype._functionIndexSpaceKeyHash):
(Builder.prototype._registerFunctionToIndexSpace):
(Builder.prototype._getFunctionFromIndexSpace):
(Builder.prototype._registerSectionBuilders.const.section.in.WASM.description.section.switch.section.case.string_appeared_here.this.section):
(Builder.prototype._registerSectionBuilders.const.section.in.WASM.description.section.switch.section.const.codeBuilder.End.switch.case.string_appeared_here.e):
(Builder.prototype._registerSectionBuilders.this.Unknown):
* workers/wasm-resources/long-compile.js: Added.
(done):
(async.run):
(worker.onmessage):

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

2 years agoLarge negative animation-delays may not work depending on machine uptime
dino@apple.com [Fri, 14 Apr 2017 01:56:35 +0000 (01:56 +0000)]
Large negative animation-delays may not work depending on machine uptime
https://bugs.webkit.org/show_bug.cgi?id=166962
<rdar://problem/30091526>

Reviewed by Tim Horton.

Source/WebCore:

If you set a really negative animation delay, it would cause
AnimationBase::m_startTime to become negative, because the delay
value was "bigger" than monotonicallyIncreasingTime.

However, the state machine was using -1 to mean that the start time
hadn't yet been set. Classic cmarrin!

Replace all the special values with std::optional, and use nullopt
to mean the value doesn't exist yet.

Test: animations/large-negative-delay.html

* page/animation/AnimationBase.cpp:
(WebCore::AnimationBase::updateStateMachine):
(WebCore::AnimationBase::fireAnimationEventsIfNeeded):
(WebCore::AnimationBase::getTimeToNextEvent):
(WebCore::AnimationBase::freezeAtTime):
(WebCore::AnimationBase::getElapsedTime):
* page/animation/AnimationBase.h: Use std::optional.
(WebCore::AnimationBase::paused):

LayoutTests:

* animations/large-negative-delay-expected.txt: Added.
* animations/large-negative-delay.html: Added.

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

2 years agoShould use flushDirect() when flushing the scopeRegister due to needsScopeRegister().
mark.lam@apple.com [Fri, 14 Apr 2017 00:09:08 +0000 (00:09 +0000)]
Should use flushDirect() when flushing the scopeRegister due to needsScopeRegister().
https://bugs.webkit.org/show_bug.cgi?id=170661
<rdar://problem/31579046>

Reviewed by Filip Pizlo.

JSTests:

* stress/regress-170661.js: Added.

Source/JavaScriptCore:

Previously, we were using flush() to flush the outermost frame's scopeRegister.
This is incorrect because flush() expects the VirtualRegister value passed to
it to be that of the top most inlined frame.  In the event that we reach a
terminal condition while inside an inlined frame, flush() will end up flushing
the wrong register.  The fix is simply to use flushDirect() instead.

* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::flush):

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

2 years agoRemove unused SharedBuffer constructor
achristensen@apple.com [Thu, 13 Apr 2017 23:54:04 +0000 (23:54 +0000)]
Remove unused SharedBuffer constructor
https://bugs.webkit.org/show_bug.cgi?id=170828

Reviewed by Brady Eidson.

* platform/SharedBuffer.cpp:
(WebCore::SharedBuffer::append):
* platform/SharedBuffer.h:
(WebCore::SharedBuffer::create):

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

2 years agoChange Intl prototypes to plain objects
commit-queue@webkit.org [Thu, 13 Apr 2017 23:51:41 +0000 (23:51 +0000)]
Change Intl prototypes to plain objects
https://bugs.webkit.org/show_bug.cgi?id=168178

Patch by Andy VanWagoner <thetalecrafter@gmail.com> on 2017-04-13
Reviewed by JF Bastien.

Source/JavaScriptCore:

* builtins/StringPrototype.js:
(localeCompare): Create default Collator once instead of using prototype.
* runtime/IntlCollatorPrototype.cpp:
(JSC::IntlCollatorPrototype::IntlCollatorPrototype):
* runtime/IntlCollatorPrototype.h:
* runtime/IntlDateTimeFormatPrototype.cpp:
(JSC::IntlDateTimeFormatPrototype::IntlDateTimeFormatPrototype):
* runtime/IntlDateTimeFormatPrototype.h:
* runtime/IntlNumberFormatPrototype.cpp:
(JSC::IntlNumberFormatPrototype::IntlNumberFormatPrototype):
* runtime/IntlNumberFormatPrototype.h:
* runtime/IntlObject.cpp:
(JSC::IntlObject::finishCreation): Don't set constructor on each prototype.

LayoutTests:

* js/intl-collator-expected.txt:
* js/intl-datetimeformat-expected.txt:
* js/intl-numberformat-expected.txt:
* js/script-tests/intl-collator.js:
* js/script-tests/intl-datetimeformat.js:
* js/script-tests/intl-numberformat.js:

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

2 years agoMark fast/mediacapturefromelement/CanvasCaptureMediaStream-request-frame-events.html...
ryanhaddad@apple.com [Thu, 13 Apr 2017 23:44:48 +0000 (23:44 +0000)]
Mark fast/mediacapturefromelement/CanvasCaptureMediaStream-request-frame-events.html as flaky on iOS.
https://bugs.webkit.org/show_bug.cgi?id=169719

Unreviewed test gardening.

* platform/ios-wk2/TestExpectations:

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

2 years agoDon't invalidate composition for style changes in non-composited layers
antti@apple.com [Thu, 13 Apr 2017 23:20:50 +0000 (23:20 +0000)]
Don't invalidate composition for style changes in non-composited layers
https://bugs.webkit.org/show_bug.cgi?id=170805
<rdar://problem/31606185>

Reviewed by Simon Fraser.

Source/WebCore:

Test: compositing/updates/animation-non-composited.html

In most cases they can't affect composition. Composition updates are expensive, this can
save a lot of work (tumblr.com animations hit this at the moment).

* rendering/RenderElement.h:
(WebCore::RenderElement::createsGroup):
(WebCore::RenderElement::createsGroupForStyle):

    Factor to a static function so we can test style directly.

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::layerStyleChanged):
(WebCore::RenderLayerCompositor::styleChangeMayAffectIndirectCompositingReasons):

    Test if style change might cause compositing change that can't be determined without compositing update.

* rendering/RenderLayerCompositor.h:

LayoutTests:

* compositing/updates/animation-non-composited-expected.txt: Added.
* compositing/updates/animation-non-composited.html: Added.

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

2 years agowebkitpy: Ignore previously launched pid when system is under stress
jbedard@apple.com [Thu, 13 Apr 2017 23:20:03 +0000 (23:20 +0000)]
webkitpy: Ignore previously launched pid when system is under stress
https://bugs.webkit.org/show_bug.cgi?id=170741

Reviewed by David Kilzer.

We have seen cases where xcrun simctl launch will return a pid of a previous
process and the process will appear to be running even though it is crashing.
Ensure that the PID that simulator_process is receiving is not the pid of the
previously run process.

* Scripts/webkitpy/port/simulator_process.py:
(SimulatorProcess._start): Check to make sure we aren't receiving an old PID.

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

2 years agoallocationSize should use safe arithmetic by default
oliver@apple.com [Thu, 13 Apr 2017 23:13:41 +0000 (23:13 +0000)]
allocationSize should use safe arithmetic by default
https://bugs.webkit.org/show_bug.cgi?id=170804

Reviewed by JF Bastien.

Make all allocationSize() functions work in terms
of Checked<size_t>

Source/JavaScriptCore:

* runtime/DirectArguments.h:
(JSC::DirectArguments::offsetOfSlot):
(JSC::DirectArguments::allocationSize):
* runtime/HashMapImpl.h:
(JSC::HashMapBuffer::allocationSize):
* runtime/JSArray.h:
(JSC::JSArray::allocationSize):
* runtime/JSArrayBufferView.h:
(JSC::JSArrayBufferView::allocationSize):
* runtime/JSAsyncFunction.h:
(JSC::JSAsyncFunction::allocationSize):
* runtime/JSFixedArray.h:
(JSC::JSFixedArray::allocationSize):
* runtime/JSFunction.h:
(JSC::JSFunction::allocationSize):
* runtime/JSGeneratorFunction.h:
(JSC::JSGeneratorFunction::allocationSize):
* runtime/JSModuleNamespaceObject.h:
* runtime/JSObject.h:
(JSC::JSFinalObject::allocationSize):
* runtime/JSWrapperObject.h:
(JSC::JSWrapperObject::allocationSize):
* runtime/ScopedArguments.h:
(JSC::ScopedArguments::allocationSize):
* runtime/VM.h:
(JSC::ScratchBuffer::allocationSize):
* wasm/js/JSWebAssemblyCodeBlock.h:
(JSC::JSWebAssemblyCodeBlock::offsetOfImportStubs):
(JSC::JSWebAssemblyCodeBlock::allocationSize):
* wasm/js/JSWebAssemblyInstance.h:
(JSC::JSWebAssemblyInstance::allocationSize):

Source/WTF:

* wtf/text/StringImpl.h:
(WTF::StringImpl::allocationSize):
(WTF::StringImpl::tailOffset):

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

2 years agoMark webrtc/video-mute.html as flaky.
ryanhaddad@apple.com [Thu, 13 Apr 2017 22:48:13 +0000 (22:48 +0000)]
Mark webrtc/video-mute.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=170704

Unreviewed test gardening.

* TestExpectations:

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

2 years agoMark media/media-controls-timeline-updates-when-hovered.html as flaky.
ryanhaddad@apple.com [Thu, 13 Apr 2017 22:24:34 +0000 (22:24 +0000)]
Mark media/media-controls-timeline-updates-when-hovered.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=165553

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

2 years agoMark media/track/track-cue-rendering-rtl.html as flaky.
ryanhaddad@apple.com [Thu, 13 Apr 2017 22:15:17 +0000 (22:15 +0000)]
Mark media/track/track-cue-rendering-rtl.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=170831

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

2 years agoMark inspector/sampling-profiler/named-function-expression.html as flaky.
ryanhaddad@apple.com [Thu, 13 Apr 2017 22:11:02 +0000 (22:11 +0000)]
Mark inspector/sampling-profiler/named-function-expression.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=170830

Unreviewed test gardening.

* platform/mac-wk1/TestExpectations:

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

2 years agoWebAssembly: manage memory better
jfbastien@apple.com [Thu, 13 Apr 2017 21:48:42 +0000 (21:48 +0000)]
WebAssembly: manage memory better
https://bugs.webkit.org/show_bug.cgi?id=170628

Reviewed by Keith Miller, Michael Saboff.

JSTests:

* wasm/Builder.js: move a helper out so tests can use it
(export.default.Builder.prototype._registerSectionBuilders.const.section.in.WASM.description.section.switch.section.case.string_appeared_here.this.section):
* wasm/WASM.js: add utilities to classify opcodes
(export.opcodes):
(export.const.memoryAccessInfo.op.const.sign):
* wasm/function-tests/memory-access-past-4gib.js: Added. This test
fails before this patch.
(const.op.of.WASM.opcodes):
* wasm/function-tests/memory-many.js: Added. This simple tests
just shouldn't crash. In verbose mode it's useful at determining
if the GC falls behind or not.
* wasm/function-tests/memory-multiagent.js: Added. Emulate postMessage.
(const.startAgents.numAgentsToStart.a.agent.receiveBroadcast):
(const.startAgents.numAgentsToStart.a.write.const.idx.Math.random):
(const.broadcastToAgents):
* wasm/js-api/extension-MemoryMode.js: verbose logging.
(testMemoryNoMax):
(testMemory):
(testInstanceNoMemory):
(testInstanceNoMax):
(testInstance):
* wasm/utilities.js: move a utility here.

Source/JavaScriptCore:

WebAssembly fast memories weren't managed very well. This patch
refactors it and puts us in a good position to further improve our
fast memory handling in the future.

We now cache fast memories at a process granularity, but make sure
that they don't consume dirty pages. We add a cap to the total
number of allocated fast memories to avoid ASLR degradation.

We teach the GC about memories as a kind of resource it should
care about because it didn't have visibility into the amount of
memory each represented. This allows benchmarks which allocate
memories back-to-back to reliably get fast memories 100% of the
time, even on a system under load, which wasn't the case
before. This reliability yields roughly 8% perf bump on x86-64
WasmBench.

The GC heuristic is as follows: each time we allocate a fast
memory we notify the GC, which then keeps track of the total
number of fast memories allocated since it last GC'd. We
separately keep track of the total number of fast memories which
have ever existed at any point in time (cached + allocated). This
is a monotonically-increasing high watermark. The GC will force a
full collection if, since it last ran, half or more of the high
watermark of fast memories was allocated.

At the same time, if we fail obtaining a fast memory from the
cache we do a GC to try to find one. If that fails we'll allocate
a new one (this can also fail, then we go to slow memory). This
can also be improved, but it's a good start.

This currently disables fast memories on iOS because getting fast
memories isn't a guaranteed thing. Rather, we get quite a few of
them and achieve significant speedups, but benchmarks which
allocate memories back-to-back end up falling behind because the
GC can conservatively hold onto memories, which then yields a perf
cliff. That cliff isn't reliable, WasmBench gets roughly 10 of 18
fast memories when in theory it should get all of them fast (as
MacOS does). The patch significantly improves the state of iOS
though, and in a follow-up we could re-enable fast memories.

Part of this good positioning is a facility to pre-allocate fast
memories very early at startup, before any fragmentation
occurs. This is currently disabled but worked extremely reliably
on iOS. Once we fix the above issues we'll want to re-visit and
turn on pre-allocation.

We also avoid locking for fast memory identification when
performing signal handling. I'm very nervous about acquiring locks
in a signal handler because in general signals can happen when
we've messed up. This isn't the case with fast memories: we're
raising a signal on purpose and handling it. However this doesn't
mean we won't mess up elsewhere! This will get more complicated
once we add support for multiple threads sharing memories and
being able to grow their memories. One example: the code calls
CRASH(), which executes the following code in release:

    *(int *)(uintptr_t)0xbbadbeef = 0;

This is a segfault, which our fast memory signal handler tries to
handle. It does so by first figuring out whether 0xbbadbeef is in
a fast memory region, reqiring a lock. If we CRASH() while holding
the lock then our thread self-deadlocks, giving us no crash report
and a bad user experience.

Avoiding a lock therefore it's not about speed or reduced
contention. In fact, I'd use something else than a FIFO if these
were a concern. We're also doing syscalls, which dwarf any locking
cost.

We now only allocate 4GiB + redzone of 64k * 128 for fast memories
instead of 8GiB. This patch reuses the logic from
B3::WasmBoundsCheck to perform bounds checks when accesses could
exceed the redzone. We'll therefore benefit from CSE goodness when
it reaches WasmBoundsCheck. See bug #163469.

* b3/B3LowerToAir.cpp: fix a baaaaddd bug where unsigned->signed
conversion allowed out-of-bounds reads by -2GiB. I'll follow-up in
bug #170692 to prevent this type of bug once and for all.
(JSC::B3::Air::LowerToAir::lower):
* b3/B3Validate.cpp: update WasmBoundsCheck validation.
* b3/B3Value.cpp:
(JSC::B3::Value::effects): update WasmBoundsCheck effects.
* b3/B3WasmBoundsCheckValue.cpp:
(JSC::B3::WasmBoundsCheckValue::WasmBoundsCheckValue):
(JSC::B3::WasmBoundsCheckValue::redzoneLimit):
(JSC::B3::WasmBoundsCheckValue::dumpMeta):
* b3/B3WasmBoundsCheckValue.h:
(JSC::B3::WasmBoundsCheckValue::maximum):
* b3/air/AirCustom.cpp:
(JSC::B3::Air::WasmBoundsCheckCustom::isValidForm):
* b3/testb3.cpp:
(JSC::B3::testWasmBoundsCheck):
* heap/Heap.cpp:
(JSC::Heap::Heap):
(JSC::Heap::reportWebAssemblyFastMemoriesAllocated):
(JSC::Heap::webAssemblyFastMemoriesThisCycleAtThreshold):
(JSC::Heap::updateAllocationLimits):
(JSC::Heap::didAllocateWebAssemblyFastMemories):
(JSC::Heap::shouldDoFullCollection):
(JSC::Heap::collectIfNecessaryOrDefer):
* heap/Heap.h:
* runtime/InitializeThreading.cpp:
(JSC::initializeThreading):
* runtime/Options.cpp:
* runtime/Options.h:
* wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::fixupPointerPlusOffset):
(JSC::Wasm::B3IRGenerator::B3IRGenerator):
(JSC::Wasm::B3IRGenerator::emitCheckAndPreparePointer):
(JSC::Wasm::B3IRGenerator::emitLoadOp):
(JSC::Wasm::B3IRGenerator::emitStoreOp):
(JSC::Wasm::createJSToWasmWrapper):
* wasm/WasmFaultSignalHandler.cpp:
(JSC::Wasm::trapHandler):
* wasm/WasmMemory.cpp: Rewrite.
(JSC::Wasm::makeString):
(JSC::Wasm::Memory::initializePreallocations):
(JSC::Wasm::Memory::createImpl):
(JSC::Wasm::Memory::create):
(JSC::Wasm::Memory::~Memory):
(JSC::Wasm::Memory::fastMappedRedzoneBytes):
(JSC::Wasm::Memory::fastMappedBytes):
(JSC::Wasm::Memory::maxFastMemoryCount):
(JSC::Wasm::Memory::addressIsInActiveFastMemory):
(JSC::Wasm::Memory::grow):
* wasm/WasmMemory.h:
(Memory::maxFastMemoryCount):
(Memory::addressIsInActiveFastMemory):
* wasm/js/JSWebAssemblyInstance.cpp:
(JSC::JSWebAssemblyInstance::finishCreation):
(JSC::JSWebAssemblyInstance::visitChildren):
(JSC::JSWebAssemblyInstance::globalMemoryByteSize):
* wasm/js/JSWebAssemblyInstance.h:
* wasm/js/JSWebAssemblyMemory.cpp:
(JSC::JSWebAssemblyMemory::grow):
(JSC::JSWebAssemblyMemory::finishCreation):
(JSC::JSWebAssemblyMemory::visitChildren):

Source/WebCore:

Re-use a VM tag which was intended for JavaScript core, was then
used by our GC, and is now unused. If I don't do this then
WebAssembly fast memories will make vmmap look super weird because
it'll look like multi-gigabyte of virtual memory are allocated as
part of our process' regular memory!

Separately I need to update vmmap and other tools to print the
right name. Right now this tag gets identified as "JS garbage
collector".

* page/ResourceUsageData.cpp:
(WebCore::ResourceUsageData::ResourceUsageData):
* page/ResourceUsageData.h:
* page/cocoa/ResourceUsageOverlayCocoa.mm:
(WebCore::HistoricResourceUsageData::HistoricResourceUsageData):
* page/cocoa/ResourceUsageThreadCocoa.mm:
(WebCore::displayNameForVMTag):
(WebCore::categoryForVMTag):

Source/WTF:

Re-use a VM tag which was intended for JavaScript core, was then
used by our GC, and is now unused. If I don't do this then
WebAssembly fast memories will make vmmap look super weird because
it'll look like multi-gigabyte of virtual memory are allocated as
part of our process' regular memory!

Separately I need to update vmmap and other tools to print the
right name. Right now this tag gets identified as "JS garbage
collector".

* wtf/OSAllocator.h:
* wtf/VMTags.h:

Websites/webkit.org:

* docs/b3/intermediate-representation.html: typos

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

2 years agoAdd ios-simulator baseline for imported/w3c/web-platform-tests/fetch/api/request...
ryanhaddad@apple.com [Thu, 13 Apr 2017 21:41:25 +0000 (21:41 +0000)]
Add ios-simulator baseline for imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached.html.

Unreviewed test gardening.

* platform/ios-simulator/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached-expected.txt: Added.

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

2 years agoMark http/tests/inspector/network/resource-request-headers.html as flaky.
ryanhaddad@apple.com [Thu, 13 Apr 2017 21:39:07 +0000 (21:39 +0000)]
Mark http/tests/inspector/network/resource-request-headers.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=170702

Unreviewed test gardening.

* platform/mac-wk2/TestExpectations:

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

2 years agoUpdate the comments for the number of bits in RenderStyle::InheritedFlags.
rniwa@webkit.org [Thu, 13 Apr 2017 21:26:08 +0000 (21:26 +0000)]
Update the comments for the number of bits in RenderStyle::InheritedFlags.

Rubber-stamped by Zalan Bujtas

* rendering/style/RenderStyle.h:

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

2 years agoMark media/modern-media-controls/volume-support/volume-support-click.html as flaky.
ryanhaddad@apple.com [Thu, 13 Apr 2017 21:00:43 +0000 (21:00 +0000)]
Mark media/modern-media-controls/volume-support/volume-support-click.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=164229

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

2 years agoBuild ImageDiff with host SDK
jbedard@apple.com [Thu, 13 Apr 2017 20:08:35 +0000 (20:08 +0000)]
Build ImageDiff with host SDK
https://bugs.webkit.org/show_bug.cgi?id=168531

Reviewed by David Kilzer.

ImageDiff should be built and run with the host SDK, not the target SDK.
Build ImageDiff twice, once for the target SDK and once for the host
as an intermediate step towards building for only the host SDK.

* ImageDiff/Makefile: Added.
* Makefile: Add ImageDiff to list of targets.
* Scripts/build-imagediff: Build bmalloc and WTF for the host.
* Scripts/build-webkit: Build ImageDiff for host.
* Scripts/webkitdirs.pm: Export extractNonMacOSHostConfiguration.
(extractNonMacOSHostConfiguration): Remove non-host configuration data from the array.
* Scripts/webkitperl/webkitdirs_unittest/extractNonMacOSHostConfiguration.pl: Added.
* Scripts/webkitpy/port/base.py:
(Port.check_build): Attempt to build image diff if not found.
(Port.check_image_diff): Enable logging flag.
(Port._build_image_diff): Allow webkitpy to build image-diff during testing.

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

2 years agoWeb Inspector: RTL: goto arrow is floated to the wrong side
bburg@apple.com [Thu, 13 Apr 2017 19:54:53 +0000 (19:54 +0000)]
Web Inspector: RTL: goto arrow is floated to the wrong side
https://bugs.webkit.org/show_bug.cgi?id=170816

Reviewed by Matt Baker.

Float it to the other side if necessary.

* UserInterface/Views/Main.css:
(.go-to-link):
(body[dir=ltr] .go-to-link:not(.dont-float)):
(body[dir=rtl] .go-to-link:not(.dont-float)):

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

2 years agoLayoutTest svg/animations/animated-svg-image-outside-viewport-paused.html is a flaky...
cdumez@apple.com [Thu, 13 Apr 2017 19:42:35 +0000 (19:42 +0000)]
LayoutTest svg/animations/animated-svg-image-outside-viewport-paused.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=170745

Reviewed by Tim Horton.

Test was relying on a setTimeout(30) and was flaky. Now use shouldBecomeEqual() to make the
test more robust.

* svg/animations/animated-svg-image-outside-viewport-paused-expected.txt:
* svg/animations/animated-svg-image-outside-viewport-paused.html:

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

2 years agoAddressing post-review comment after r215314.
mmaxfield@apple.com [Thu, 13 Apr 2017 19:34:21 +0000 (19:34 +0000)]
Addressing post-review comment after r215314.
https://bugs.webkit.org/show_bug.cgi?id=169015

Reviewed by Alexey Proskuryakov.

* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::FontDatabase::fontForPostScriptName):

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

2 years ago[WebIDL] Add support for extended attributes on types in WebIDL
weinig@apple.com [Thu, 13 Apr 2017 19:19:49 +0000 (19:19 +0000)]
[WebIDL] Add support for extended attributes on types in WebIDL
https://bugs.webkit.org/show_bug.cgi?id=170759

Reviewed by Alex Christensen.

- Update parsing for WebIDL grammar changes.
- Adds an extended attributes hash to IDLType that is filled according
  to the WebIDL annotated type rules.
- Updates code generation to take advantage of IDLType's extended attribute
  simplifying some existing code.
- Update IDLs in the project to adhere to the new grammar.

* Modules/indexeddb/IDBFactory.idl:
* Modules/indexeddb/IDBIndex.idl:
* Modules/indexeddb/IDBKeyRange.idl:
* Modules/indexeddb/IDBObjectStore.idl:
* Modules/websockets/WebSocket.idl:
* crypto/parameters/AesCtrParams.idl:
* crypto/parameters/AesKeyParams.idl:
* crypto/parameters/Pbkdf2Params.idl:
* crypto/parameters/RsaKeyGenParams.idl:
* testing/TypeConversions.idl:
Update for grammar change.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateDefaultValue):
(GetBaseIDLType):
(GetIDLType):
(GetIntegerConversionConfiguration):
(GetStringConversionConfiguration):
(JSValueToNative):
(UnsafeToNative):
(NativeToJSValueDOMConvertNeedsState):
(NativeToJSValueDOMConvertNeedsGlobalObject):
(NativeToJSValue):
Remove the need for the type's context in many places since type
associated extended attributes are now on the type itself.

* bindings/scripts/IDLParser.pm:
(copyExtendedAttributes):
Move up so it can be reused.

(isExtendedAttributeApplicableToTypes):
Add temporary predicated to indicate which attributes should be moved to types. This
logic should be moved to IDLAttributes.txt.

(moveExtendedAttributesApplicableToTypes):
Add helper to move attributes to the type's extended attributes hash if applicable.

(makeSimpleType):
Use initializer syntax to simplify.

(cloneType):
Support cloning types with extended attributes.

(typeByApplyingTypedefs):
When constructing the clone for a typedef application, move any applicable attributes
to the clone from the original type.

(parseDictionaryMember):
(parseTypedef):
(parseAttributeOrOperationRest):
(parseAttributeRest):
(parseOperationOrIterator):
(parseSpecialOperation):
(parseOptionalIterableInterface):
(parseMapLikeProperties):
(parseOptionalOrRequiredArgument):
(parseType):
(parseTypeWithExtendedAttributes):
(parseUnionMemberType):
(parseNonAnyType):
Update for new grammar, moving applicable attributes eagerly.

(assertNoExtendedAttributesInTypedef): Deleted.
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionClassMethodWithClampOnOptional):
(WebCore::jsTestObjPrototypeFunctionClassMethodWithClampOnOptionalCaller):
(WebCore::jsTestObjPrototypeFunctionClassMethodWithEnforceRangeOnOptional):
(WebCore::jsTestObjPrototypeFunctionClassMethodWithEnforceRangeOnOptionalCaller):
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
(WebCore::jsTestTypedefsAttributeWithClamp):
(WebCore::jsTestTypedefsAttributeWithClampGetter):
(WebCore::jsTestTypedefsAttributeWithClampInTypedef):
(WebCore::jsTestTypedefsAttributeWithClampInTypedefGetter):
(WebCore::setJSTestTypedefsAttributeWithClamp):
(WebCore::setJSTestTypedefsAttributeWithClampFunction):
(WebCore::setJSTestTypedefsAttributeWithClampInTypedef):
(WebCore::setJSTestTypedefsAttributeWithClampInTypedefFunction):
(WebCore::jsTestTypedefsPrototypeFunctionFuncWithClampInTypedef):
(WebCore::jsTestTypedefsPrototypeFunctionFuncWithClampInTypedefCaller):
* bindings/scripts/test/TestObj.idl:
* bindings/scripts/test/TestTypedefs.idl:
Update for new grammar. Add some new tests for uncovered cases.

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

2 years agoFix CMake build
achristensen@apple.com [Thu, 13 Apr 2017 18:53:23 +0000 (18:53 +0000)]
Fix CMake build
https://bugs.webkit.org/show_bug.cgi?id=170815

Reviewed by Beth Dakin.

Source/WebCore:

* platform/spi/cocoa/AVKitSPI.h:

Source/WebKit2:

* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration _setShouldCaptureAudioInUIProcess:]):

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

2 years agocmake-build-fix
jfbastien@apple.com [Thu, 13 Apr 2017 18:44:25 +0000 (18:44 +0000)]
cmake-build-fix

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

2 years agoRemove RTCSignalingState::Closed
commit-queue@webkit.org [Thu, 13 Apr 2017 18:28:29 +0000 (18:28 +0000)]
Remove RTCSignalingState::Closed
https://bugs.webkit.org/show_bug.cgi?id=170811

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

Source/WebCore:

Covered by existing and rebased tests.

Adding RTCPeerConnection::isClosed to better match the isClosed internal slot in webrtc specification.
Using isClosed instead of checking signalingState value.
Implementing isClosed in terms of m_connectionState which has a Closed value.

* Modules/mediastream/MediaEndpointPeerConnection.cpp:
(WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask):
(WebCore::MediaEndpointPeerConnection::replaceTrackTask):
* Modules/mediastream/PeerConnectionBackend.cpp:
(WebCore::PeerConnectionBackend::createOffer):
(WebCore::PeerConnectionBackend::createOfferSucceeded):
(WebCore::PeerConnectionBackend::createOfferFailed):
(WebCore::PeerConnectionBackend::createAnswer):
(WebCore::PeerConnectionBackend::createAnswerSucceeded):
(WebCore::PeerConnectionBackend::createAnswerFailed):
(WebCore::PeerConnectionBackend::setLocalDescription):
(WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded):
(WebCore::PeerConnectionBackend::setLocalDescriptionFailed):
(WebCore::PeerConnectionBackend::setRemoteDescription):
(WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded):
(WebCore::PeerConnectionBackend::setRemoteDescriptionFailed):
(WebCore::PeerConnectionBackend::addIceCandidate):
(WebCore::PeerConnectionBackend::addIceCandidateSucceeded):
(WebCore::PeerConnectionBackend::addIceCandidateFailed):
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::create):
(WebCore::RTCPeerConnection::RTCPeerConnection):
(WebCore::RTCPeerConnection::addTrack):
(WebCore::RTCPeerConnection::removeTrack):
(WebCore::RTCPeerConnection::queuedCreateOffer):
(WebCore::RTCPeerConnection::queuedCreateAnswer):
(WebCore::RTCPeerConnection::queuedSetLocalDescription):
(WebCore::RTCPeerConnection::queuedSetRemoteDescription):
(WebCore::RTCPeerConnection::queuedAddIceCandidate):
(WebCore::RTCPeerConnection::setConfiguration):
(WebCore::RTCPeerConnection::createDataChannel):
(WebCore::RTCPeerConnection::doClose):
(WebCore::RTCPeerConnection::updateIceGatheringState):
(WebCore::RTCPeerConnection::updateIceConnectionState):
(WebCore::RTCPeerConnection::scheduleNegotiationNeededEvent):
* Modules/mediastream/RTCPeerConnection.h:
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::signalingState):
* platform/mediastream/RTCSignalingState.h:

LayoutTests:

* webrtc/connection-state.html:

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

2 years ago[WinCairo] Assign WEBKIT_LIBRARIES_DIR to CMAKE_PREFIX_PATH
commit-queue@webkit.org [Thu, 13 Apr 2017 17:54:20 +0000 (17:54 +0000)]
[WinCairo] Assign WEBKIT_LIBRARIES_DIR to CMAKE_PREFIX_PATH
https://bugs.webkit.org/show_bug.cgi?id=170797

Patch by Don Olmstead <don.olmstead@am.sony.com> on 2017-04-13
Reviewed by Alex Christensen.

* Source/cmake/FindCairo.cmake:
* Source/cmake/OptionsWin.cmake:

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

2 years agoBreakingContext::WordTrailingSpace cleanup.
zalan@apple.com [Thu, 13 Apr 2017 17:39:03 +0000 (17:39 +0000)]
BreakingContext::WordTrailingSpace cleanup.
https://bugs.webkit.org/show_bug.cgi?id=170750

Reviewed by Myles C. Maxfield.

No change in functionality.

* rendering/RenderText.cpp:
(WebCore::RenderText::computePreferredLogicalWidths):
* rendering/line/BreakingContext.h:
(WebCore::WordTrailingSpace::WordTrailingSpace):
(WebCore::WordTrailingSpace::width):
(WebCore::BreakingContext::handleText):

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

2 years agoRemove compositing/masks/solid-color-masked.html expectation
jbedard@apple.com [Thu, 13 Apr 2017 17:29:43 +0000 (17:29 +0000)]
Remove compositing/masks/solid-color-masked.html expectation
https://bugs.webkit.org/show_bug.cgi?id=168054

Unreviewed test gardening.

* platform/ios/TestExpectations: Remove compositing/masks/solid-color-masked.html.

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

2 years agoAdd some more WebRTC tests
commit-queue@webkit.org [Thu, 13 Apr 2017 16:54:32 +0000 (16:54 +0000)]
Add some more WebRTC tests
https://bugs.webkit.org/show_bug.cgi?id=170796

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

* webrtc/multi-video-expected.txt: Added.
* webrtc/multi-video.html: Added.
* webrtc/video-with-data-channel-expected.txt: Added.
* webrtc/video-with-data-channel.html: Added.

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

2 years ago[Readable Streams API] Implement cloneArrayBuffer in WebCore
commit-queue@webkit.org [Thu, 13 Apr 2017 16:40:25 +0000 (16:40 +0000)]
[Readable Streams API] Implement cloneArrayBuffer in WebCore
https://bugs.webkit.org/show_bug.cgi?id=170008

Patch by Romain Bellessort <romain.bellessort@crf.canon.fr> on 2017-04-13
Reviewed by Youenn Fablet.

Source/WebCore:

Implemented cloneArrayBuffer based on existing structuredCloneArrayBuffer
implementation. The code has been factorized so that both cloneArrayBuffer
and structuredCloneArrayBuffer rely on the same code (which is basically
the previous implementation of structuredCloneArrayBuffer + the ability
to clone only a part of considered buffer).

Test: streams/clone-array-buffer.html

* Modules/streams/ReadableByteStreamInternals.js: Deleted cloneArrayBuffer JS implementation.
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::addBuiltinGlobals): Add cloneArrayBuffer private declaration.
* bindings/js/StructuredClone.cpp:
(WebCore::cloneArrayBufferImpl): Added (mostly based on previous structuredCloneArrayBuffer).
(WebCore::cloneArrayBuffer): Added.
(WebCore::structuredCloneArrayBuffer): Updated.
* bindings/js/StructuredClone.h: Added cloneArrayBuffer declaration.
* bindings/js/WebCoreBuiltinNames.h: Added cloneArrayBuffer declaration.
* testing/Internals.cpp: Added support for testing cloneArrayBuffer.
* testing/Internals.h: Added support for testing cloneArrayBuffer.
* testing/Internals.idl: Added support for testing cloneArrayBuffer.

LayoutTests:

Added test to check cloneArrayBuffer behaviour.

* streams/clone-array-buffer-expected.txt: Added.
* streams/clone-array-buffer.html: Added.

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