WebKit-https.git
20 months agoWebAssembly: poison JS object's secrets
jfbastien@apple.com [Sat, 6 Jan 2018 07:01:21 +0000 (07:01 +0000)]
WebAssembly: poison JS object's secrets
https://bugs.webkit.org/show_bug.cgi?id=181339
<rdar://problem/36325001>

Reviewed by Mark Lam.

Source/JavaScriptCore:

Separating WebAssembly's JS objects from their non-JS
implementation means that all interesting information lives
outside of the JS object itself. This patch poisons each JS
object's pointer to non-JS implementation using the poisoning
mechanism and a unique key per JS object type origin.

* runtime/JSCPoison.h:
* wasm/js/JSToWasm.cpp:
(JSC::Wasm::createJSToWasmWrapper): JS -> wasm stores the JS
object in a stack slot when fast TLS is disabled. This requires
that we unpoison the Wasm::Instance.
* wasm/js/JSWebAssemblyCodeBlock.h:
* wasm/js/JSWebAssemblyInstance.h:
(JSC::JSWebAssemblyInstance::offsetOfPoisonedInstance): renamed to
be explicit that the pointer is poisoned.
* wasm/js/JSWebAssemblyMemory.h:
* wasm/js/JSWebAssemblyModule.h:
* wasm/js/JSWebAssemblyTable.h:

Source/WTF:

swapping a poisoned pointer with a non-poisoned one (as is done in
JSWebAssembyMemory::adopt) was missing.

* wtf/Poisoned.h:
(WTF::PoisonedImpl::swap):
(WTF::ConstExprPoisonedPtrTraits::swap):

Tools:

Update tests for swap(Poisoned<k, T>, T*)

* TestWebKitAPI/Tests/WTF/ConstExprPoisoned.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WTF/Poisoned.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WTF/PoisonedRef.cpp:
(TestWebKitAPI::TEST):

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

20 months agoREGRESSION(r226396) DataInteractionTests: ContentEditableToContentEditable and Conten...
wenson_hsieh@apple.com [Sat, 6 Jan 2018 03:48:05 +0000 (03:48 +0000)]
REGRESSION(r226396) DataInteractionTests: ContentEditableToContentEditable and ContentEditableToTextarea are failing
https://bugs.webkit.org/show_bug.cgi?id=181359

Reviewed by Tim Horton.

Ensure that these tests still pass using older SDKs.

* TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
(TestWebKitAPI::TEST):

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

20 months agoRe-enable -Wcast-qual in WebCore for Apple ports
ddkilzer@apple.com [Sat, 6 Jan 2018 03:19:57 +0000 (03:19 +0000)]
Re-enable -Wcast-qual in WebCore for Apple ports
<https://webkit.org/b/177895>
<rdar://problem/34960830>

Reviewed by Joseph Pecoraro.

Source/WebCore:

* Configurations/Base.xcconfig:
(WARNING_CFLAGS): Remove FIXME and add -Wcast-qual back to
arguments.

* crypto/mac/SerializedCryptoKeyWrapMac.mm:
(WebCore::createAndStoreMasterKey):
- Use checked_cf_cast<SecACLRef>().

* editing/cocoa/DataDetection.mm:
(WebCore::detectItemAtPositionWithRange):
- Manually cast CFTypeRef to DDResultRef until
  DDResultGetTypeID() is available as SPI.

* platform/gamepad/mac/HIDGamepad.cpp:
(WebCore::HIDGamepad::initElementsFromArray):
- Use checked_cf_cast<IOHIDElementRef>().

* platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
(WebCore::MediaSampleAVFObjC::createImageSample):
(WebCore::CMSampleBufferIsRandomAccess):
(WebCore::CMSampleBufferIsNonDisplaying):
(WebCore::MediaSampleAVFObjC::createNonDisplayingCopy const):
- Use checked_cf_cast<CFMutableDictionaryRef>() and
  checked_cf_cast<CFDictionaryRef>().

* platform/graphics/cocoa/IOSurface.h:
(WebCore::IOSurface::asLayerContents):
- Use reinterpret_cast<id>() to cast from IOSurfaceRef to id.

* platform/graphics/cocoa/WebCoreDecompressionSession.mm:
(WebCore::WebCoreDecompressionSession::getFirstVideoFrame):
(WebCore::WebCoreDecompressionSession::automaticDequeue):
(WebCore::WebCoreDecompressionSession::imageForTime):
(WebCore::WebCoreDecompressionSession::getDecodeTime):
(WebCore::WebCoreDecompressionSession::getPresentationTime):
(WebCore::WebCoreDecompressionSession::getDuration):
- Use checked_cf_cast<CMSampleBufferRef>().

* platform/graphics/Font.h:
(WebCore::Font::m_kernedCFStringAttributes):
(WebCore::Font::m_nonKernedCFStringAttributes):
- Change type from RetainPtr<CFDictionaryRef> to
  RetainPtr<CFMutableDictionaryRef> since that's what they are.
* platform/graphics/mac/SimpleFontDataCoreText.cpp:
(WebCore::Font::getCFStringAttributes const):
- Replace local `mutableAttributes` variable with
  `attributesDictionary.get()` since it returns the correct type
  now.

* platform/ios/wak/WAKView.mm:
(-[WAKView _initWithViewRef:]):
(_WAKCopyWrapper):
* platform/ios/wak/WKView.mm:
(_WKViewClearSuperview):
(WKViewFirstChild):
(WKViewNextSibling):
- Use static_cast<WKViewRef>(const_cast<void*>()) to convert
  const void* variable to WKViewRef.

* platform/mac/PasteboardMac.mm:
(WebCore::flipImageSpec):
(WebCore::setDragImageImpl):
- Use const_cast<> to remove 'const' modifier from
  unsigned char pointers.  This regressed while -Wcast-qual was
  disabled for WebCore.

* platform/mac/SSLKeyGeneratorMac.mm:
(WebCore::signedPublicKeyAndChallengeString):
- Use checked_cf_cast<SecACLRef>().

* platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp:
(WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
- Use checked_cf_cast<CFMutableDictionaryRef>().

* platform/network/cf/SocketStreamHandleImplCFNet.cpp:
(WebCore::copyCONNECTProxyResponse):
- Use checked_cf_cast<CFHTTPMessageRef>().

* platform/network/cocoa/ResourceResponseCocoa.mm:
(WebCore::ResourceResponse::platformCertificateInfo const):
- Use checked_cf_cast<SecTrustRef>().

* platform/network/mac/CertificateInfoMac.mm:
(WebCore::CertificateInfo::containsNonRootSHA1SignedCertificate const):
(WebCore::CertificateInfo::dump const):
- Use checked_cf_cast<SecCertificateRef>().

* testing/cocoa/WebArchiveDumpSupport.mm:
(WebCoreTestSupport::createCFURLResponseFromResponseData):
- Use checked_cf_cast<>() for CFMutable* types.

Source/WTF:

* wtf/RetainPtr.h:
(WTF::RetainPtr::fromStorageTypeHelper const): Add const_cast<>
operator here since some CFTypes are not defined as const
pointers, which triggers a warning in C++ source with
-Wcast-qual when casting from CFTypeRef back to the original
type.  Note that we use const_cast<CF_BRIDGED_TYPE(id) void*>()
here (and in TypeCastsCF.h below) since this is what CFTypeRef
is defined as in CFBase.h, but without the 'const' modifier.
(WTF::RetainPtr::fromStorageType const): Ditto.

* wtf/cf/TypeCastsCF.h: Use #pragma once.
(WTF_DECLARE_CF_TYPE_TRAIT): Rename from DECLARE_CF_TYPE_TRAIT.
Don't #undef it so that it can be used in other source files.
(WTF_DECLARE_CF_MUTABLE_TYPE_TRAIT): Add new macro that is used
for declaring CFMutable types.  The CFTypeID for CF_Foo_ and
CFMutable_Foo_ are the same, so we have to use a different macro
to declare type traits for those types.
(WTF::dynamic_cf_cast): Add assertion to catch issues in Debug
builds.
(WTF::checked_cf_cast): Inline code from WTF::dynamic_cf_cast
and change behavior to be more consistent between Debug and
Release builds, as well as other "checked" functions.
Previously this function would return nullptr in Release builds
if nullptr or the wrong type of object was passed in, but crash
in both cases on Debug builds.  The new behavior always returns
nullptr if nullptr was passed in (but never crashes), and always
crashes if the wrong type of object is passed in.

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

20 months agoStorage Access API: Refactor to make naming accurate and explicit, simplify access...
wilander@apple.com [Sat, 6 Jan 2018 02:16:51 +0000 (02:16 +0000)]
Storage Access API: Refactor to make naming accurate and explicit, simplify access table, and prepare for access removal for page
https://bugs.webkit.org/show_bug.cgi?id=181357
<rdar://problem/36331031>

Reviewed by Alex Christensen.

Source/WebCore:

No new tests. The only changed functionality that isn't covered
by existing tests is cross-origin iframes in the same partition
should be handled as already having access. This cannot be
tested in layout tests since they don't support subdomains.

This change does the following:
- Changes function and message names to reflect how this feature
  was eventually implemented, i.e. access per frame.
- Makes it explicit that the UI process is only involved in
  granting storage access and not removing storage access.
  The latter is done directly by the web process.
- Simplifies the network process' entry map since only needs to
  be able to give access to one domain in one frame at a time.
  Access goes away on frame navigation so there can only be one
  domain at a time per frame. Also, the map now uses pageIDs as
  main keys to prepare for efficient access removal for all
  frames under a page.
- Fixes a bug in so that a cross-origin iframe with the same
  partition as the top frame correctly is handled as already
  having access.

* platform/network/NetworkStorageSession.h:
* platform/network/cf/NetworkStorageSessionCFNet.cpp:
(WebCore::NetworkStorageSession::cookieStoragePartition const):
    The only change here is the changed named of the call to
    NetworkStorageSession::hasStorageAccessForFrame().
(WebCore::NetworkStorageSession::hasStorageAccessForFrame const):
(WebCore::NetworkStorageSession::grantStorageAccessForFrame):
(WebCore::NetworkStorageSession::removeStorageAccessForFrame):
(WebCore::NetworkStorageSession::isStorageAccessGranted const): Deleted.
(WebCore::NetworkStorageSession::setStorageAccessGranted): Deleted.
(WebCore::NetworkStorageSession::removeStorageAccess): Deleted.

Source/WebKit:

This change does the following:
- Changes function and message names to reflect how this feature
  was eventually implemented, i.e. access per frame.
- Makes it explicit that the UI process is only involved in
  granting storage access and not removing storage access.
  The latter is done directly by the web process.
- Simplifies the network process' entry map since only needs to
  be able to give access to one domain in one frame at a time.
  Access goes away on frame navigation so there can only be one
  domain at a time per frame. Also, the map now uses pageIDs as
  main keys to prepare for efficient access removal for all
  frames under a page.
- Fixes a bug in so that a cross-origin iframe with the same
  partition as the top frame correctly is handled as already
  having access.

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::removeStorageAccessForFrame):
(WebKit::NetworkConnectionToWebProcess::removeStorageAccess): Deleted.
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::hasStorageAccessForFrame):
(WebKit::NetworkProcess::grantStorageAccessForFrame):
(WebKit::NetworkProcess::hasStorageAccessForPrevalentDomains): Deleted.
(WebKit::NetworkProcess::updateStorageAccessForPrevalentDomains): Deleted.
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::hasStorageAccessForFrame):
(WebKit::NetworkProcessProxy::grantStorageAccessForFrame):
(WebKit::NetworkProcessProxy::hasStorageAccessForPrevalentDomains): Deleted.
(WebKit::NetworkProcessProxy::updateStorageAccessForPrevalentDomains): Deleted.
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
(WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
(WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
* UIProcess/WebResourceLoadStatisticsStore.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::hasStorageAccessForFrameHandler):
(WebKit::WebsiteDataStore::grantStorageAccessForFrameHandler):
(WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
(WebKit::WebsiteDataStore::hasStorageAccessForPrevalentDomainsHandler): Deleted.
(WebKit::WebsiteDataStore::updateStorageAccessForPrevalentDomainsHandler): Deleted.
* UIProcess/WebsiteData/WebsiteDataStore.h:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::detachedFromParent2):
(WebKit::WebFrameLoaderClient::dispatchWillChangeDocument):

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

20 months agoImplement Cache API partitioning based on ClientOrigin
commit-queue@webkit.org [Sat, 6 Jan 2018 01:56:23 +0000 (01:56 +0000)]
Implement Cache API partitioning based on ClientOrigin
https://bugs.webkit.org/show_bug.cgi?id=181240

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

Source/WebCore:

Covered by updated tests.

Previously, cache storage was partitioned according the origin of the client, represented as a String.
We now partition according both client and top origins, represented as a ClientOrigin

Minor refactoring to use more makePendingActivity.
Added support for IPC serialization of ClientOrigin.
Added SecurityOriginData::toString which is used by WebKit2 Cache Storage implementation.

* Modules/cache/CacheStorageConnection.cpp:
(WebCore::CacheStorageConnection::open):
(WebCore::CacheStorageConnection::retrieveCaches):
* Modules/cache/CacheStorageConnection.h:
(WebCore::CacheStorageConnection::clearMemoryRepresentation):
(WebCore::CacheStorageConnection::doOpen):
(WebCore::CacheStorageConnection::doRetrieveCaches):
* Modules/cache/DOMCacheStorage.cpp:
(WebCore::DOMCacheStorage::origin const):
(WebCore::DOMCacheStorage::retrieveCaches):
(WebCore::DOMCacheStorage::open):
(WebCore::DOMCacheStorage::remove):
* Modules/cache/DOMCacheStorage.h:
* Modules/cache/WorkerCacheStorageConnection.cpp:
(WebCore::WorkerCacheStorageConnection::doOpen):
(WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
* Modules/cache/WorkerCacheStorageConnection.h:
* page/ClientOrigin.h:
(WebCore::ClientOrigin::isolatedCopy const):
(WebCore::ClientOrigin::encode const):
(WebCore::ClientOrigin::decode):
* page/SecurityOriginData.cpp:
(WebCore::SecurityOriginData::toString const):
(WebCore::SecurityOriginData::debugString const): Deleted.
* page/SecurityOriginData.h:
(WebCore::SecurityOriginData::debugString const):
* testing/Internals.cpp:
(WebCore::Internals::clearCacheStorageMemoryRepresentation):

Source/WebKit:

open and retrieveCaches now take a ClientOrigin instead of a String.
Updated cache filesystem path computation to take both client origin and top origin.

When clearing an origin, caches whose client origin or top origin matches the origin are cleared.
Caches are added to the web site data of their client origin with their corresponding cache size.
Caches are added to the web site data of their top origin with a size equal to 0.

Updated memory representation dumping used for test to include both top and client origins.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::cachesRootPath):
(WebKit::CacheStorage::Engine::open):
(WebKit::CacheStorage::Engine::remove):
(WebKit::CacheStorage::Engine::retrieveCaches):
(WebKit::CacheStorage::Engine::readCachesFromDisk):
(WebKit::CacheStorage::Engine::removeCaches):
(WebKit::CacheStorage::Engine::fetchEntries):
(WebKit::CacheStorage::Engine::clearCachesForOrigin):
(WebKit::CacheStorage::Engine::clearMemoryRepresentation):
(WebKit::CacheStorage::Engine::representation):
* NetworkProcess/cache/CacheStorageEngine.h:
* NetworkProcess/cache/CacheStorageEngineCache.cpp:
(WebKit::CacheStorage::Cache::Cache):
* NetworkProcess/cache/CacheStorageEngineCaches.cpp:
(WebKit::CacheStorage::Caches::retrieveOriginFromDirectory):
(WebKit::CacheStorage::Caches::Caches):
(WebKit::CacheStorage::Caches::storeOrigin):
(WebKit::CacheStorage::Caches::readOrigin):
(WebKit::CacheStorage::Caches::open):
* NetworkProcess/cache/CacheStorageEngineCaches.h:
(WebKit::CacheStorage::Caches::create):
(WebKit::CacheStorage::Caches::origin const):
* NetworkProcess/cache/CacheStorageEngineConnection.cpp:
(WebKit::CacheStorageEngineConnection::open):
(WebKit::CacheStorageEngineConnection::caches):
(WebKit::CacheStorageEngineConnection::clearMemoryRepresentation):
* NetworkProcess/cache/CacheStorageEngineConnection.h:
* NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
* WebProcess/Cache/WebCacheStorageConnection.cpp:
(WebKit::WebCacheStorageConnection::doOpen):
(WebKit::WebCacheStorageConnection::doRetrieveCaches):
(WebKit::WebCacheStorageConnection::clearMemoryRepresentation):
* WebProcess/Cache/WebCacheStorageConnection.h:

LayoutTests:

Beefing up test to ensure that client and top origins are taken into consideration.

* http/tests/cache-storage/cache-origins.https-expected.txt:
* http/tests/cache-storage/cache-origins.https.html:
* http/tests/cache-storage/cache-clearing-origin.https-expected.txt:
* http/tests/cache-storage/cache-clearing-origin.https.html:

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

20 months agoShow Keyboard when re-launching WKWebView with a previously focused element
megan_gardner@apple.com [Sat, 6 Jan 2018 01:53:44 +0000 (01:53 +0000)]
Show Keyboard when re-launching WKWebView with a previously focused element
https://bugs.webkit.org/show_bug.cgi?id=181353

Reviewed by Tim Horton.

When relaunching an app with a WKWebView, restore the keyboard if there was a previously
focused element that was being assisted. The element was already being tracked, we just
needed to not bail on showing the keyboard for instances where it was a state change that
caused the element to be refocused.

* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::startAssistingNode):
* UIProcess/ios/WKContentView.h:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
(-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:]): Deleted.
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::startAutoscrollAtPosition):
(WebKit::WebPageProxy::startAssistingNode):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setActivityState):
(WebKit::WebPage::elementDidFocus):
* WebProcess/WebPage/WebPage.h:

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

20 months agoRebase API test after r226469
achristensen@apple.com [Sat, 6 Jan 2018 01:49:47 +0000 (01:49 +0000)]
Rebase API test after r226469
https://bugs.webkit.org/show_bug.cgi?id=181308

* TestWebKitAPI/Tests/WebKitCocoa/LoadInvalidURLRequest.mm:
(-[LoadInvalidURLNavigationActionDelegate webView:didFailProvisionalNavigation:withError:]):
A URL with < or > in it is now recognized as invalid by WebKit.  This is intentional, and matches our behavior before enabling the new URLParser.

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

20 months agoWeb Inspector: Add another Protocol Version
commit-queue@webkit.org [Sat, 6 Jan 2018 01:29:12 +0000 (01:29 +0000)]
Web Inspector: Add another Protocol Version
https://bugs.webkit.org/show_bug.cgi?id=181354
<rdar://problem/35432817>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2018-01-05
Reviewed by Matt Baker.

* UserInterface/Protocol/Legacy/11.3/InspectorBackendCommands.js: Added.
* Versions/Inspector-iOS-11.3.json: Added.

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

20 months agoUnreviewed, attempt to fix test262 after r226386.
ryanhaddad@apple.com [Sat, 6 Jan 2018 01:27:05 +0000 (01:27 +0000)]
Unreviewed, attempt to fix test262 after r226386.

* test262.yaml:

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

20 months agoMark fast/workers/worker-terminate.html as flaky.
ryanhaddad@apple.com [Sat, 6 Jan 2018 01:27:02 +0000 (01:27 +0000)]
Mark fast/workers/worker-terminate.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=181098

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

20 months agoClose WebRTC sockets when marked as defunct
commit-queue@webkit.org [Sat, 6 Jan 2018 01:19:30 +0000 (01:19 +0000)]
Close WebRTC sockets when marked as defunct
https://bugs.webkit.org/show_bug.cgi?id=177324
rdar://problem/35244931

Patch by Youenn Fablet <youenn@apple.com> on 2018-01-05
Reviewed by Eric Carlson.

In case selected sockets return an error when trying to accept an incoming socket,
check whether the socket is defunct or not.
If so, close it properly.

* Source/webrtc/base/asynctcpsocket.cc:
* Source/webrtc/base/physicalsocketserver.cc:
* Source/webrtc/base/socket.h:

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

20 months agoAdd ability to disable indexed property masking for testing
msaboff@apple.com [Sat, 6 Jan 2018 00:37:08 +0000 (00:37 +0000)]
Add ability to disable indexed property masking for testing
https://bugs.webkit.org/show_bug.cgi?id=181350

Reviewed by Keith Miller.

Made the masking of indexed properties runtime controllable via a new JSC::Option
named disableSpectreMitigations.  This is done to test the efficacy of that mitigation.

The new option has a generic name as it will probably be used to disable future mitigations.

* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::SpeculativeJIT):
(JSC::DFG::SpeculativeJIT::loadFromIntTypedArray):
(JSC::DFG::SpeculativeJIT::compileGetByValOnFloatTypedArray):
* dfg/DFGSpeculativeJIT.h:
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::LowerDFGToB3):
(JSC::FTL::DFG::LowerDFGToB3::maskedIndex):
(JSC::FTL::DFG::LowerDFGToB3::pointerIntoTypedArray):
* jit/JIT.cpp:
(JSC::JIT::JIT):
* jit/JIT.h:
* jit/JITPropertyAccess.cpp:
(JSC::JIT::emitDoubleLoad):
(JSC::JIT::emitContiguousLoad):
(JSC::JIT::emitArrayStorageLoad):
* runtime/Options.h:
* wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::emitCheckAndPreparePointer):

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

20 months agoAllow JSC Config Files to set Restricted Options
msaboff@apple.com [Sat, 6 Jan 2018 00:27:12 +0000 (00:27 +0000)]
Allow JSC Config Files to set Restricted Options
https://bugs.webkit.org/show_bug.cgi?id=181352

Reviewed by Mark Lam.

* runtime/ConfigFile.cpp:
(JSC::ConfigFile::parse):

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

20 months agoRestrict navigation-time WKWebsiteDataStore swapping to main frame navigations
achristensen@apple.com [Sat, 6 Jan 2018 00:08:05 +0000 (00:08 +0000)]
Restrict navigation-time WKWebsiteDataStore swapping to main frame navigations
https://bugs.webkit.org/show_bug.cgi?id=181217

Reviewed by Tim Horton.

Source/WebKit:

If we swap during an iframe navigation, then we get a page in a strange state.
The intent of the main frame navigation WKWebsiteDataStore swap is that
that is a time when we can change storages without a page in an inconsistent state.

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

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm:
(-[WebsitePoliciesWebsiteDataStoreDelegate _webView:decidePolicyForNavigationAction:decisionHandler:]):
(TEST):

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

20 months agoAdd WKBundleFrameCreateFrameHandle
achristensen@apple.com [Sat, 6 Jan 2018 00:05:00 +0000 (00:05 +0000)]
Add WKBundleFrameCreateFrameHandle
https://bugs.webkit.org/show_bug.cgi?id=181232
<rdar://problem/35926696>

Reviewed by Tim Horton.

Source/WebKit:

InjectedBundle clients wanting to sent a _WKFrameHandle cannot without this function.
Before, they would just send the WKBundleFrameRef which would be changed into a WKFrameRef
in the UIProcess by WebProcessProxy::transformHandlesToObjects, but there is no ObjC equivalent
of WKFrameRef, so we were just getting a WKObject when we wanted a _WKFrameHandle.
We can't change WebProcessProxy::transformHandlesToObjects without being incompatible with the
existing C API, so let's add a way for clients to say "I want a _WKFrameHandle".

* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundleFrameCreateFrameHandle):
* WebProcess/InjectedBundle/API/c/WKBundlePage.h:

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/FrameHandleSerialization.mm: Added.
(mouseDidMoveOverElement):
(-[FrameHandleSerialization webProcessPlugIn:didCreateBrowserContextController:]):
* TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm:
(-[MouseMoveOverElementDelegate _webView:mouseDidMoveOverElement:withFlags:userInfo:]):
(TEST):

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

20 months ago[Attachment Support] Add a way to write blob data to a file URL from the UI process
wenson_hsieh@apple.com [Fri, 5 Jan 2018 23:48:35 +0000 (23:48 +0000)]
[Attachment Support] Add a way to write blob data to a file URL from the UI process
https://bugs.webkit.org/show_bug.cgi?id=181236

Reviewed by Brady Eidson.

Source/WebCore:

Add support for writing a blob to a designated file path. See comments below for more detail. No new tests, as
there change in behavior yet. See part 2: https://bugs.webkit.org/show_bug.cgi?id=181199.

* page/DragController.cpp:
(WebCore::DragController::dragAttachmentElement):
* platform/PromisedBlobInfo.h:

Remove PromisedBlobData entirely. This was added with the premise of having the web process deliver blob data to
the UI process. However, the new approach I'm taking just has the UI process tell the network process to write
a blob to a given location, so a data structure to deliver blob data over IPC is no longer necessary.

(WebCore::PromisedBlobData::hasData const): Deleted.
(WebCore::PromisedBlobData::hasFile const): Deleted.
(WebCore::PromisedBlobData::operator bool const): Deleted.
(WebCore::PromisedBlobData::fulfills const): Deleted.
* platform/network/BlobRegistryImpl.cpp:
(WebCore::BlobRegistryImpl::populateBlobsForFileWriting):

Introduce a new helper to build a list of blob data for file writing.

(WebCore::writeFilePathsOrDataBuffersToFile):

Introduce a new static helper to write blob data (a list of file paths and data buffers) to a given file handle.
Automatically closes the given file handle upon exit.

(WebCore::BlobRegistryImpl::writeBlobsToTemporaryFiles):
(WebCore::BlobRegistryImpl::writeBlobToFilePath):

Pull out common logic in writeBlobsToTemporaryFiles and writeBlobToFilePath into helper methods (see above), and
refactor both methods to use the helpers.

* platform/network/BlobRegistryImpl.h:

Source/WebKit:

Add support for writing a blob to a designated file path. In WebKit, this is mainly plumbing writeBlobToFilePath
through WebPageProxy to the network process.

* NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
(WebKit::NetworkBlobRegistry::writeBlobToFilePath):

Call out to the BlobRegistryImpl to write blobs to the file path. Additionally grant sandbox extensions for any
file-backed blob parts corresponding to the given blob URL.

(WebKit::NetworkBlobRegistry::filesInBlob):

Introduce a version of filesInBlob that doesn't check against the NetworkConnectionToWebProcess. This is used
when the UI process is the driver for writing a blob.

* NetworkProcess/FileAPI/NetworkBlobRegistry.h:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::writeBlobToFilePath):

Temporarily grant sandbox access to the given file path.

* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<PromisedBlobInfo>::encode):
(IPC::ArgumentCoder<PromisedBlobInfo>::decode):
(IPC::ArgumentCoder<PromisedBlobData>::encode): Deleted.
(IPC::ArgumentCoder<PromisedBlobData>::decode): Deleted.

Remove PromisedBlobData (see WebCore/ChangeLog for more information).

* Shared/WebCoreArgumentCoders.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::didClose):

If the network process is terminated, flush any pending callbacks in m_writeBlobToFilePathCallbackMap, passing
in a failure result (success := false) and clearing the callback map.

(WebKit::NetworkProcessProxy::writeBlobToFilePath):
(WebKit::NetworkProcessProxy::didWriteBlobToFilePath):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.messages.in:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::writeBlobToFilePath):
* UIProcess/WebPageProxy.h:

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

20 months agoForbid < and > in URL hosts
achristensen@apple.com [Fri, 5 Jan 2018 23:38:26 +0000 (23:38 +0000)]
Forbid < and > in URL hosts
https://bugs.webkit.org/show_bug.cgi?id=181308
<rdar://problem/36012757>

Reviewed by Tim Horton.

LayoutTests/imported/w3c:

* web-platform-tests/url/a-element-expected.txt:
* web-platform-tests/url/a-element-origin-expected.txt:
* web-platform-tests/url/a-element-origin-xhtml-expected.txt:
* web-platform-tests/url/a-element-xhtml-expected.txt:
* web-platform-tests/url/url-constructor-expected.txt:
* web-platform-tests/url/url-origin-expected.txt:

Source/WebCore:

https://url.spec.whatwg.org/#forbidden-host-code-point does not include these characters yet, but I think it should.
Firefox fails to parse URLs with < or > in the host.  Chrome percent encodes them.  Safari needs to do something.
The web platform tests are unclear on this case, and they will need to be updated with the specification.
They do show a change in behavior, though.

* platform/URLParser.cpp:
Add < and > to the list of forbidden host code points.

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

20 months ago[MediaStream] Add Mac screen capture source
eric.carlson@apple.com [Fri, 5 Jan 2018 23:34:30 +0000 (23:34 +0000)]
[MediaStream] Add Mac screen capture source
https://bugs.webkit.org/show_bug.cgi?id=181333
<rdar://problem/36323219>

Reviewed by Dean Jackson.

Source/WebCore:

* SourcesCocoa.txt: Add ScreenDisplayCaptureSourceMac.mm.

* WebCore.xcodeproj/project.pbxproj: Ditto.

* platform/cocoa/CoreVideoSoftLink.cpp: Declare new constants used.
* platform/cocoa/CoreVideoSoftLink.h:

* platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:
(WebCore::displayReconfigurationCallBack): Call refreshCaptureDevices.
(WebCore::DisplayCaptureManagerCocoa::~DisplayCaptureManagerCocoa): Unregister for display
reconfiguration callbacks.
(WebCore::DisplayCaptureManagerCocoa::captureDevices): Register for display reconfigrations.
(WebCore::DisplayCaptureManagerCocoa::refreshCaptureDevices): Use CGActiveDisplayList to
get list of active screens.
(WebCore::DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID): Validate screen
ID, return CaptureDevice.
* platform/mediastream/mac/DisplayCaptureManagerCocoa.h:

* platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
(WebCore::VideoCaptureSourceFactoryMac::createVideoCaptureSource): Deal with screen capture
on macOS.

Implement Mac screen capture with CGDisplayStream.
* platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h: Added.
(WebCore::ScreenDisplayCaptureSourceMac::DisplaySurface::~DisplaySurface):
(WebCore::ScreenDisplayCaptureSourceMac::DisplaySurface::operator=):
(WebCore::ScreenDisplayCaptureSourceMac::DisplaySurface::ioSurface const):
* platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm: Added.
(WebCore::roundUpToMacroblockMultiple):
(WebCore::ScreenDisplayCaptureSourceMac::updateDisplayID):
(WebCore::ScreenDisplayCaptureSourceMac::create):
(WebCore::ScreenDisplayCaptureSourceMac::ScreenDisplayCaptureSourceMac):
(WebCore::ScreenDisplayCaptureSourceMac::~ScreenDisplayCaptureSourceMac):
(WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream):
(WebCore::ScreenDisplayCaptureSourceMac::startProducingData):
(WebCore::ScreenDisplayCaptureSourceMac::stopProducingData):
(WebCore::ScreenDisplayCaptureSourceMac::sampleBufferFromPixelBuffer):
(WebCore::ScreenDisplayCaptureSourceMac::pixelBufferFromIOSurface):
(WebCore::ScreenDisplayCaptureSourceMac::generateFrame):
(WebCore::ScreenDisplayCaptureSourceMac::startDisplayStream):
(WebCore::ScreenDisplayCaptureSourceMac::applySize):
(WebCore::ScreenDisplayCaptureSourceMac::applyFrameRate):
(WebCore::ScreenDisplayCaptureSourceMac::commitConfiguration):
(WebCore::ScreenDisplayCaptureSourceMac::displayWasReconfigured):
(WebCore::ScreenDisplayCaptureSourceMac::displayReconfigurationCallBack):
(WebCore::ScreenDisplayCaptureSourceMac::frameAvailable):

Source/WebCore/PAL:

* pal/spi/cg/CoreGraphicsSPI.h: Declare some CGDisplayMode SPI.

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

20 months agoAdd injected bundle equivalents of DOMHTMLDocument (DOMHTMLDocumentExtensions)
mitz@apple.com [Fri, 5 Jan 2018 23:27:53 +0000 (23:27 +0000)]
Add injected bundle equivalents of DOMHTMLDocument (DOMHTMLDocumentExtensions)
https://bugs.webkit.org/show_bug.cgi?id=181345

Reviewed by Tim Horton.

* WebProcess/InjectedBundle/API/mac/WKDOMDocument.h: Declared new methods.
* WebProcess/InjectedBundle/API/mac/WKDOMDocument.mm:
(-[WKDOMDocument createDocumentFragmentWithMarkupString:baseURL:]): Added. Calls WebCore’s
  createFragmentFromMarkup.
(-[WKDOMDocument createDocumentFragmentWithText:]): Added. Calls WebCore’s
  createFragmentFromText.

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

20 months ago[curl] Can't load file:// URL with a URL fragment identifier
don.olmstead@sony.com [Fri, 5 Jan 2018 23:13:35 +0000 (23:13 +0000)]
[curl] Can't load file:// URL with a URL fragment identifier
https://bugs.webkit.org/show_bug.cgi?id=181170

Reviewed by Alex Christensen.

No new tests. No change in behavior.

* platform/network/curl/CurlRequest.cpp:
(WebCore::CurlRequest::invokeDidReceiveResponseForFile):

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

20 months ago[Curl] Add implementation stubs for Network Cache
don.olmstead@sony.com [Fri, 5 Jan 2018 22:52:11 +0000 (22:52 +0000)]
[Curl] Add implementation stubs for Network Cache
https://bugs.webkit.org/show_bug.cgi?id=181343

Reviewed by Alex Christensen.

* NetworkProcess/cache/NetworkCacheCodersCurl.cpp: Added.
(WTF::Persistence::Coder<WebCore::CertificateInfo>::encode):
(WTF::Persistence::Coder<WebCore::CertificateInfo>::decode):
* NetworkProcess/cache/NetworkCacheDataCurl.cpp: Added.
(WebKit::NetworkCache::Data::Data):
(WebKit::NetworkCache::Data::empty):
(WebKit::NetworkCache::Data::data const):
(WebKit::NetworkCache::Data::isNull const):
(WebKit::NetworkCache::Data::apply const):
(WebKit::NetworkCache::Data::subrange const):
(WebKit::NetworkCache::concatenate):
(WebKit::NetworkCache::Data::adoptMap):
* NetworkProcess/cache/NetworkCacheIOChannelCurl.cpp: Added.
(WebKit::NetworkCache::IOChannel::IOChannel):
(WebKit::NetworkCache::IOChannel::~IOChannel):
(WebKit::NetworkCache::IOChannel::open):
(WebKit::NetworkCache::IOChannel::read):
(WebKit::NetworkCache::IOChannel::write):
* PlatformWin.cmake:

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

20 months ago[Curl] Update method declarations in WebKit
don.olmstead@sony.com [Fri, 5 Jan 2018 22:42:40 +0000 (22:42 +0000)]
[Curl] Update method declarations in WebKit
https://bugs.webkit.org/show_bug.cgi?id=181342

Reviewed by Alex Christensen.

* NetworkProcess/Downloads/curl/DownloadCurl.cpp:
(WebKit::Download::resume):
* NetworkProcess/curl/RemoteNetworkingContextCurl.cpp:
(WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession): Deleted.
(WebKit::RemoteNetworkingContext::blockedError const): Deleted.

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

20 months agoTextCodec uses std::array but does not include it
don.olmstead@sony.com [Fri, 5 Jan 2018 22:42:32 +0000 (22:42 +0000)]
TextCodec uses std::array but does not include it
https://bugs.webkit.org/show_bug.cgi?id=181340

Reviewed by Alex Christensen.

No new tests. No change in behavior.

* platform/text/TextCodec.h:

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

20 months agoMark mathml/opentype/horizontal-munderover.html as failure on Windows.
pvollan@apple.com [Fri, 5 Jan 2018 22:34:49 +0000 (22:34 +0000)]
Mark mathml/opentype/horizontal-munderover.html as failure on Windows.
https://bugs.webkit.org/show_bug.cgi?id=181346

Unreviewed test gardening.

* platform/win/TestExpectations:

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

20 months agoTypedArrays and Wasm should use index masking.
keith_miller@apple.com [Fri, 5 Jan 2018 22:02:31 +0000 (22:02 +0000)]
TypedArrays and Wasm should use index masking.
https://bugs.webkit.org/show_bug.cgi?id=181313

Reviewed by Michael Saboff.

Source/JavaScriptCore:

We should have index masking for our TypedArray code in the
DFG/FTL and for Wasm when doing bounds checking. Index masking for
Wasm is added to the WasmBoundsCheckValue. Since we don't CSE any
WasmBoundsCheckValues we don't need to worry about combining a
bounds check for a load and a store. I went with fusing the
pointer masking in the WasmBoundsCheckValue since it should reduce
additional compiler overhead.

* b3/B3LowerToAir.cpp:
* b3/B3Validate.cpp:
* b3/B3WasmBoundsCheckValue.cpp:
(JSC::B3::WasmBoundsCheckValue::WasmBoundsCheckValue):
(JSC::B3::WasmBoundsCheckValue::dumpMeta const):
* b3/B3WasmBoundsCheckValue.h:
(JSC::B3::WasmBoundsCheckValue::pinnedIndexingMask const):
* b3/air/AirCustom.h:
(JSC::B3::Air::WasmBoundsCheckCustom::generate):
* b3/testb3.cpp:
(JSC::B3::testWasmBoundsCheck):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::emitAllocateRawObject):
(JSC::DFG::SpeculativeJIT::loadFromIntTypedArray):
(JSC::DFG::SpeculativeJIT::compileGetByValOnIntTypedArray):
(JSC::DFG::SpeculativeJIT::compileGetByValOnFloatTypedArray):
(JSC::DFG::SpeculativeJIT::compileNewTypedArrayWithSize):
* dfg/DFGSpeculativeJIT.h:
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileAtomicsReadModifyWrite):
(JSC::FTL::DFG::LowerDFGToB3::compileGetByVal):
(JSC::FTL::DFG::LowerDFGToB3::compileNewTypedArray):
(JSC::FTL::DFG::LowerDFGToB3::pointerIntoTypedArray):
* jit/JITPropertyAccess.cpp:
(JSC::JIT::emitIntTypedArrayGetByVal):
* runtime/Butterfly.h:
(JSC::Butterfly::computeIndexingMask const):
(JSC::Butterfly::computeIndexingMaskForVectorLength): Deleted.
* runtime/JSArrayBufferView.cpp:
(JSC::JSArrayBufferView::JSArrayBufferView):
* wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::B3IRGenerator):
(JSC::Wasm::B3IRGenerator::restoreWebAssemblyGlobalState):
(JSC::Wasm::B3IRGenerator::emitCheckAndPreparePointer):
(JSC::Wasm::B3IRGenerator::load):
(JSC::Wasm::B3IRGenerator::store):
(JSC::Wasm::B3IRGenerator::addCallIndirect):
* wasm/WasmBinding.cpp:
(JSC::Wasm::wasmToWasm):
* wasm/WasmMemory.cpp:
(JSC::Wasm::Memory::Memory):
(JSC::Wasm::Memory::grow):
* wasm/WasmMemory.h:
(JSC::Wasm::Memory::offsetOfIndexingMask):
* wasm/WasmMemoryInformation.cpp:
(JSC::Wasm::PinnedRegisterInfo::get):
(JSC::Wasm::PinnedRegisterInfo::PinnedRegisterInfo):
* wasm/WasmMemoryInformation.h:
(JSC::Wasm::PinnedRegisterInfo::toSave const):
* wasm/js/JSToWasm.cpp:
(JSC::Wasm::createJSToWasmWrapper):

Source/WTF:

* wtf/MathExtras.h:
(WTF::computeIndexingMask):

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

20 months agoWebFullScreenManager should compile when ENABLE(VIDEO) is off
don.olmstead@sony.com [Fri, 5 Jan 2018 21:50:39 +0000 (21:50 +0000)]
WebFullScreenManager should compile when ENABLE(VIDEO) is off
https://bugs.webkit.org/show_bug.cgi?id=181338

Reviewed by Alex Christensen.

* WebProcess/FullScreen/WebFullScreenManager.cpp:
(WebKit::WebFullScreenManager::didEnterFullScreen):
(WebKit::WebFullScreenManager::willExitFullScreen):
* WebProcess/FullScreen/WebFullScreenManager.h:

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

20 months ago[Apple Pay] Disable Apple Pay on platforms that don't have PassKit.framework
aestes@apple.com [Fri, 5 Jan 2018 21:28:05 +0000 (21:28 +0000)]
[Apple Pay] Disable Apple Pay on platforms that don't have PassKit.framework
https://bugs.webkit.org/show_bug.cgi?id=181335
<rdar://problem/36311296>

Reviewed by Brady Eidson.

When Safari is running in the macOS Base System, PassKit.framework is not available.
If we fail to dlopen PassKit, we should disable Apple Pay.

* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetApplePayEnabled):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
* UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
* UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
(WebKit::WebPaymentCoordinatorProxy::availablePaymentNetworks):
(WebKit::WebPaymentCoordinatorProxy::platformSupportsPayments):

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

20 months agoSVGAnimatedListPropertyTearOff::synchronizeWrappersIfNeeded() should do nothing if...
commit-queue@webkit.org [Fri, 5 Jan 2018 20:10:44 +0000 (20:10 +0000)]
SVGAnimatedListPropertyTearOff::synchronizeWrappersIfNeeded() should do nothing if the property is not animating
https://bugs.webkit.org/show_bug.cgi?id=181316
<rdar://problem/36147545>

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2018-01-05
Reviewed by Simon Fraser.

This is a speculative change to fix a crash which appeared after r226065.
The crash is very intermittent and sometimes very hard to reproduce. The
basic code analysis did not show how this crash can even happen.

* svg/SVGAnimatedTypeAnimator.h:
(WebCore::SVGAnimatedTypeAnimator::resetFromBaseValues): For SVG property
with two values, e.g. <SVGAngleValue, SVGMarkerOrientType>,  we need to
detach the wrappers of the animated property if the animated values are
going to change. This is similar to what we did in resetFromBaseValue().

* svg/properties/SVGAnimatedListPropertyTearOff.h:
(WebCore::SVGAnimatedListPropertyTearOff::synchronizeWrappersIfNeeded):

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

20 months agoSkip LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim...
commit-queue@webkit.org [Fri, 5 Jan 2018 19:51:49 +0000 (19:51 +0000)]
Skip LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-shared-worker-fetch.https.html
https://bugs.webkit.org/show_bug.cgi?id=181329

Unreviewed.
LayoutTests/imported/w3c:

Patch by Youenn Fablet <youenn@apple.com> on 2018-01-05

* web-platform-tests/service-workers/service-worker/claim-shared-worker-fetch.https-expected.txt: Removed.

LayoutTests:

SharedWorker is not supported.

Patch by Youenn Fablet <youenn@apple.com> on 2018-01-05

* TestExpectations:

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

20 months agoMarked fast/mediastream/MediaStream-MediaElement-setObject-null.html as flaky.
jlewis3@apple.com [Fri, 5 Jan 2018 19:34:24 +0000 (19:34 +0000)]
Marked fast/mediastream/MediaStream-MediaElement-setObject-null.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=181069

Unreviewed test gardening.

* platform/mac-wk2/TestExpectations:

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

20 months agoFixed the build following AppKit API deprecations in a recent SDKs
mitz@apple.com [Fri, 5 Jan 2018 19:09:47 +0000 (19:09 +0000)]
Fixed the build following AppKit API deprecations in a recent SDKs

* UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController enterFullScreen:]): Suppressed deprecation warnings.
(-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]): Ditto.
(-[WKFullScreenWindowController exitFullScreen]): Ditto.
(-[WKFullScreenWindowController finishedExitFullScreenAnimation:]): Ditto.
(-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]): Ditto.
(-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]): Ditto.
(-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]): Ditto.
* UIProcess/mac/WKPrintingView.mm:
(-[WKPrintingView _setAutodisplay:]): Ditto.

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

20 months agoUnreviewed, rolling out r226401.
jlewis3@apple.com [Fri, 5 Jan 2018 19:01:48 +0000 (19:01 +0000)]
Unreviewed, rolling out r226401.

This caused timeouts on multiple platforms.

Reverted changeset:

"Implement Cache API partitioning based on ClientOrigin"
https://bugs.webkit.org/show_bug.cgi?id=181240
https://trac.webkit.org/changeset/226401

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

20 months agoFixed the build following AppKit API deprecations in a recent SDKs
mitz@apple.com [Fri, 5 Jan 2018 18:43:41 +0000 (18:43 +0000)]
Fixed the build following AppKit API deprecations in a recent SDKs

Source/WebCore:

* platform/mac/PasteboardMac.mm:
(WebCore::setDragImageImpl): Suppressed deprecation warnings.
* platform/mac/WidgetMac.mm:
(WebCore::Widget::paint): Ditto.

Source/WebKitLegacy/mac:

* WebView/WebFullScreenController.mm:
(-[WebFullScreenController enterFullScreen:]): Suppressed deprecation warnings.
(-[WebFullScreenController exitFullScreen]): Ditto.
(-[WebFullScreenController _startEnterFullScreenAnimationWithDuration:]): Ditto.
(-[WebFullScreenController _startExitFullScreenAnimationWithDuration:]): Ditto.
* WebView/WebHTMLView.mm:
(-[WebHTMLView drawRect:]): Ditto.
(-[WebHTMLView _endPrintModeAndRestoreWindowAutodisplay]): Ditto.
(-[WebHTMLView knowsPageRange:]): Ditto.
* WebView/WebView.mm:
(LayerFlushController::flushLayers): Ditto.

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

20 months agoServiceWorkers: Enable UserTiming / ResourceTiming
commit-queue@webkit.org [Fri, 5 Jan 2018 18:14:15 +0000 (18:14 +0000)]
ServiceWorkers: Enable UserTiming / ResourceTiming
https://bugs.webkit.org/show_bug.cgi?id=181297
<rdar://problem/36307306>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2018-01-05
Reviewed by Youenn Fablet.

Source/WebCore:

Tests: http/tests/workers/service/service-worker-resource-timing.https.html
       http/tests/workers/service/service-worker-user-timing.https.html

* loader/ResourceTiming.cpp:
(WebCore::ResourceTiming::ResourceTiming):
We used to clear extra NetworkLoadMetrics data early on. However,
for Workers we want to pass the complete NetworkLoadMetrics to
the Worker so that a Worker inspector has access to it.

* page/PerformanceResourceTiming.cpp:
(WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
Instead move the clearing of extra data to here, when the NetworkLoadMetrics
have finally settled into being used only for a performance entry.

Source/WebKit:

* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::updatePreferencesStore):
Enable Resource Timing / User Timing for the ServiceWorker process.

LayoutTests:

* http/tests/workers/service/resources/data1.txt: Added.
* http/tests/workers/service/resources/data2.txt: Added.
Resources to load from a service-worker.

* http/tests/workers/service/resources/service-worker-resource-timing.js: Added.
* http/tests/workers/service/service-worker-resource-timing.https-expected.txt: Added.
* http/tests/workers/service/service-worker-resource-timing.https.html: Added.
Test that a ServiceWorker can produce resource entries for a few
different kinds of loads (CacheStorage load, and a fetch).

* http/tests/workers/service/resources/service-worker-user-timing.js: Added.
* http/tests/workers/service/service-worker-user-timing.https-expected.txt: Added.
* http/tests/workers/service/service-worker-user-timing.https.html: Added.
Test that a ServiceWorker can produce a mark/measure entries.

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

20 months agoiOS: Build fix after r226432.
cfleizach@apple.com [Fri, 5 Jan 2018 17:59:50 +0000 (17:59 +0000)]
iOS: Build fix after r226432.

Unreviewed. Stop duplicating speakAs symbols for iOS.

* DumpRenderTree/AccessibilityUIElement.cpp:
(AccessibilityUIElement::speakAs):

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

20 months agoLayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch...
commit-queue@webkit.org [Fri, 5 Jan 2018 17:10:05 +0000 (17:10 +0000)]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event.https.html should not expect Upgrade-Insecure Requests header
https://bugs.webkit.org/show_bug.cgi?id=181286

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

Test previously expected upgrade-insecure-requests header to be inserted in a HTTP request.
Given the request URL is HTTPS, there is no need for that header.

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

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

20 months agoUnreviewed, added myself as WebKit reviewer
jfernandez@igalia.com [Fri, 5 Jan 2018 15:34:42 +0000 (15:34 +0000)]
Unreviewed, added myself as WebKit reviewer

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

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

20 months ago[WPE][GTK] Unreviewed gardening
csaavedra@igalia.com [Fri, 5 Jan 2018 14:39:31 +0000 (14:39 +0000)]
[WPE][GTK] Unreviewed gardening

Unskip svg/hittest/svg-shapes-non-scale-stroke.html, passing after
r226443.
* platform/gtk/TestExpectations:
* platform/wpe/TestExpectations:

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

20 months ago[EME][GStreamer] Fix wrong ifdef
philn@webkit.org [Fri, 5 Jan 2018 14:01:15 +0000 (14:01 +0000)]
[EME][GStreamer] Fix wrong ifdef
https://bugs.webkit.org/show_bug.cgi?id=181289

Reviewed by Alex Christensen.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::handleMessage): Remove the
ENCRYPTED_MEDIA ifdef from the VIDEO_TRACK ifdef block. Both have
nothing to do together.

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

20 months ago[WPE] Unreviewed gardening
csaavedra@igalia.com [Fri, 5 Jan 2018 13:50:57 +0000 (13:50 +0000)]
[WPE] Unreviewed gardening

* platform/wpe/TestExpectations: Unskip two tests passing after r226404.

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

20 months ago[WPE] Rebaseline test expectations after r226404
csaavedra@igalia.com [Fri, 5 Jan 2018 11:45:21 +0000 (11:45 +0000)]
[WPE] Rebaseline test expectations after r226404

Unreviewed gardening.

* platform/wpe/css1/font_properties/font_size-expected.txt:
* platform/wpe/css1/text_properties/letter_spacing-expected.txt:
* platform/wpe/css1/text_properties/line_height-expected.txt:
* platform/wpe/css1/text_properties/text_indent-expected.txt:
* platform/wpe/css1/text_properties/word_spacing-expected.txt:
* platform/wpe/css1/units/length_units-expected.txt:
* platform/wpe/css2.1/t040302-c61-ex-len-00-b-a-expected.txt:
* platform/wpe/css2.1/t040302-c61-rel-len-00-b-ag-expected.txt:
* platform/wpe/css2.1/t1008-c44-ln-box-02-d-ag-expected.txt:
* platform/wpe/css2.1/t100801-c544-valgn-01-d-ag-expected.txt:
* platform/wpe/css2.1/t100801-c544-valgn-03-d-agi-expected.txt:
* platform/wpe/css2.1/t100801-c548-ln-ht-02-b-ag-expected.txt:
* platform/wpe/css2.1/t1507-c526-font-sz-02-b-a-expected.txt:
* platform/wpe/css2.1/t1601-c547-indent-00-b-a-expected.txt:
* platform/wpe/css2.1/t1604-c542-letter-sp-00-b-a-expected.txt:
* platform/wpe/svg/W3C-SVG-1.1-SE/coords-units-03-b-expected.txt:
* platform/wpe/svg/W3C-SVG-1.1/coords-units-03-b-expected.txt:
* platform/wpe/svg/custom/alignment-baseline-modes-expected.txt:
* platform/wpe/svg/custom/dominant-baseline-modes-expected.txt:
* platform/wpe/tables/mozilla/bugs/bug55527-expected.txt:

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

20 months ago[Cairo] Canvas: Path::clear should clear its transform
commit-queue@webkit.org [Fri, 5 Jan 2018 11:41:18 +0000 (11:41 +0000)]
[Cairo] Canvas: Path::clear should clear its transform
https://bugs.webkit.org/show_bug.cgi?id=181320

Patch by Fujii Hironori <Hironori.Fujii@sony.com> on 2018-01-05
Reviewed by Carlos Garcia Campos.

Source/WebCore:

Path of Cairo port has its cairo context. Path::clear() didn't
clear the transform matrix of the context.

Test: fast/canvas/reset-scaling-by-height-change.html

* platform/graphics/cairo/PathCairo.cpp:
(WebCore::Path::clear): Reset the transform matrix of Path.

LayoutTests:

* fast/canvas/reset-scaling-by-height-change-expected.txt: Added.
* fast/canvas/reset-scaling-by-height-change.html: Added.

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

20 months agoREGRESSION(r226306)[Win][CMake] Unnecessary recompilations triggered by unconditional...
commit-queue@webkit.org [Fri, 5 Jan 2018 11:11:44 +0000 (11:11 +0000)]
REGRESSION(r226306)[Win][CMake] Unnecessary recompilations triggered by unconditionally copied header files of DerivedSources
https://bugs.webkit.org/show_bug.cgi?id=181324

Patch by Fujii Hironori <Hironori.Fujii@sony.com> on 2018-01-05
Reviewed by Konstantin Tokarev.

r226306 changed to use cmake -E copy to copy header files of
DerivedSources. This command copies files unconditionally, then
introduced unnecessary recompilations.

* Source/cmake/WebKitMacros.cmake: Use copy_if_different instead of copy.

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

20 months agoWPE: Build fix after r226432.
csaavedra@igalia.com [Fri, 5 Jan 2018 10:10:39 +0000 (10:10 +0000)]
WPE: Build fix after r226432.

Unreviewed. Rename ::speak() to ::speakAs().
* WebKitTestRunner/InjectedBundle/wpe/AccessibilityUIElementWPE.cpp:
(WTR::AccessibilityUIElement::speakAs):
(WTR::AccessibilityUIElement::speak): Deleted.

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

20 months agoUnreviewed, rolling out r226434.
commit-queue@webkit.org [Fri, 5 Jan 2018 08:26:02 +0000 (08:26 +0000)]
Unreviewed, rolling out r226434.
https://bugs.webkit.org/show_bug.cgi?id=181322

32bit JSC failure in x86 (Requested by yusukesuzuki on
#webkit).

Reverted changeset:

"[DFG] Unify ToNumber implementation in 32bit and 64bit by
changing 32bit Int32Tag and LowestTag"
https://bugs.webkit.org/show_bug.cgi?id=181134
https://trac.webkit.org/changeset/226434

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

20 months agoWeb Inspector: replace HTMLCanvasElement with CanvasRenderingContext for instrumentat...
webkit@devinrousso.com [Fri, 5 Jan 2018 06:40:30 +0000 (06:40 +0000)]
Web Inspector: replace HTMLCanvasElement with CanvasRenderingContext for instrumentation logic
https://bugs.webkit.org/show_bug.cgi?id=180770

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

* inspector/protocol/Canvas.json:

Source/WebCore:

No change in functionality.

* html/HTMLCanvasElement.h:
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::createContext2d):
(WebCore::HTMLCanvasElement::createContextWebGL):
(WebCore::HTMLCanvasElement::createContextWebGPU):
(WebCore::HTMLCanvasElement::createContextBitmapRenderer):
(WebCore::HTMLCanvasElement::reset):
(WebCore::HTMLCanvasElement::paint):
(WebCore::HTMLCanvasElement::setImageBuffer const):
(WebCore::HTMLCanvasElement::addObserver): Deleted.
(WebCore::HTMLCanvasElement::removeObserver): Deleted.
(WebCore::HTMLCanvasElement::cssCanvasClients): Deleted.
(WebCore::HTMLCanvasElement::notifyObserversCanvasChanged): Deleted.
* html/OffscreenCanvas.h:
* html/canvas/CanvasRenderingContext.h:
* html/canvas/CanvasRenderingContext.cpp:
* html/canvas/CanvasRenderingContext2D.h:
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::create):
* html/canvas/CanvasRenderingContext2DBase.h:
* html/canvas/ImageBitmapRenderingContext.h:
* html/canvas/ImageBitmapRenderingContext.cpp:
(WebCore::ImageBitmapRenderingContext::create):
* html/canvas/WebGL2RenderingContext.h:
* html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::create):
* html/canvas/WebGLRenderingContext.h:
* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::create):
* html/canvas/WebGLRenderingContextBase.h:
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::create):
* html/canvas/WebGPURenderingContext.cpp:
(WebCore::WebGPURenderingContext::create):
Instead of adding didCreateCanvasRenderingContext calls at the construction sites of each
context, we can make the constructors private and force the usage of static `create` functions.
This way, we have access to the fully constructed object and have a guaranteed path for creation.

* html/CanvasBase.h:
* html/CanvasBase.cpp:
(WebCore::CanvasBase::~CanvasBase):
(WebCore::CanvasBase::renderingContext const):
(WebCore::CanvasBase::addObserver):
(WebCore::CanvasBase::removeObserver):
(WebCore::CanvasBase::notifyObserversCanvasChanged):
(WebCore::CanvasBase::notifyObserversCanvasResized):
(WebCore::CanvasBase::notifyObserversCanvasDestroyed):
(WebCore::CanvasBase::cssCanvasClients const):
* Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
* Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
(WebCore::CanvasCaptureMediaStreamTrack::Source::canvasDestroyed):
(WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized):
(WebCore::CanvasCaptureMediaStreamTrack::Source::canvasChanged):
* css/CSSCanvasValue.h:
Move the CanvasObserver class to CanvasBase so that it can also be used for OffscreenCanvas.

* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodes):
(WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext):
(WebCore::InspectorInstrumentation::didChangeCanvasMemory):
(WebCore::InspectorInstrumentation::recordCanvasAction):
(WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrame):
(WebCore::InspectorInstrumentation::didEnableExtension):
(WebCore::InspectorInstrumentation::didCreateProgram):
(WebCore::InspectorInstrumentation::willDeleteProgram):
(WebCore::InspectorInstrumentation::isShaderProgramDisabled):
(WebCore::InspectorInstrumentation::consoleStartRecordingCanvas):
(WebCore::InspectorInstrumentation::didCreateCSSCanvas): Deleted.
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::consoleStartRecordingCanvasImpl):
(WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodesImpl):
(WebCore::InspectorInstrumentation::didCreateCanvasRenderingContextImpl):
(WebCore::InspectorInstrumentation::didChangeCanvasMemoryImpl):
(WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrameImpl):
(WebCore::InspectorInstrumentation::didEnableExtensionImpl):
(WebCore::InspectorInstrumentation::didCreateProgramImpl):
(WebCore::InspectorInstrumentation::didCreateCSSCanvasImpl): Deleted.

* inspector/agents/InspectorCanvasAgent.h:
* inspector/agents/InspectorCanvasAgent.cpp:
(WebCore::InspectorCanvasAgent::enable):
(WebCore::InspectorCanvasAgent::requestNode):
(WebCore::InspectorCanvasAgent::requestContent):
(WebCore::InspectorCanvasAgent::requestCSSCanvasClientNodes):
(WebCore::contextAsScriptValue):
(WebCore::InspectorCanvasAgent::resolveCanvasContext):
(WebCore::InspectorCanvasAgent::startRecording):
(WebCore::InspectorCanvasAgent::stopRecording):
(WebCore::InspectorCanvasAgent::updateShader):
(WebCore::InspectorCanvasAgent::frameNavigated):
(WebCore::InspectorCanvasAgent::didChangeCSSCanvasClientNodes):
(WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
(WebCore::InspectorCanvasAgent::didChangeCanvasMemory):
(WebCore::InspectorCanvasAgent::recordCanvasAction):
(WebCore::InspectorCanvasAgent::canvasDestroyed):
(WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
(WebCore::InspectorCanvasAgent::consoleStartRecordingCanvas):
(WebCore::InspectorCanvasAgent::didEnableExtension):
(WebCore::InspectorCanvasAgent::didCreateProgram):
(WebCore::InspectorCanvasAgent::canvasRecordingTimerFired):
(WebCore::InspectorCanvasAgent::clearCanvasData):
(WebCore::InspectorCanvasAgent::unbindCanvas):
(WebCore::InspectorCanvasAgent::findInspectorCanvas):
(WebCore::InspectorCanvasAgent::unbindProgram):
(WebCore::InspectorCanvasAgent::didCreateCSSCanvas): Deleted.

* inspector/InspectorCanvas.h:
* inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::create):
(WebCore::InspectorCanvas::InspectorCanvas):
(WebCore::InspectorCanvas::canvasElement):
(WebCore::InspectorCanvas::resetRecordingData):
(WebCore::InspectorCanvas::recordAction):
(WebCore::InspectorCanvas::buildObjectForCanvas):
(WebCore::InspectorCanvas::getCanvasContentAsDataURL):
(WebCore::InspectorCanvas::buildInitialState):
(WebCore::InspectorCanvas::~InspectorCanvas): Deleted.

* inspector/InspectorShaderProgram.h:
* inspector/InspectorShaderProgram.cpp:
(WebCore::InspectorShaderProgram::context const):

* page/PageConsoleClient.cpp:
(WebCore::PageConsoleClient::record):
(WebCore::PageConsoleClient::recordEnd):

* dom/Document.h:
* dom/Document.cpp:
(WebCore::Document::getCSSCanvasElement):
(WebCore::Document::nameForCSSCanvasElement const):
We have no reason to save the CSS canvas name for each InspectorCanvas object, so instead we
can just query for the name based on the CanvasRenderingContext's HTMLCanvasElement (assuming
it is not an OffscreenCanvas) when we need it.

Source/WebInspectorUI:

* UserInterface/Models/Canvas.js:
(WI.Canvas.fromPayload):
(WI.Canvas.prototype.get contextType):
(WI.Canvas.prototype.saveIdentityToCookie):
(WI.Canvas.prototype.get frame): Deleted.

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

20 months agoUnreviewed GTK+ build fix.
zandobersek@gmail.com [Fri, 5 Jan 2018 06:34:33 +0000 (06:34 +0000)]
Unreviewed GTK+ build fix.

* UIProcess/API/glib/WebKitUserMediaPermissionRequest.cpp:
(webkit_user_media_permission_is_for_audio_device):
Call UserMediaPermissionRequestProxy::requiresAudioCapture().
(webkit_user_media_permission_is_for_video_device):
Call UserMediaPermissionRequestProxy::requiresVideoCapture().

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

20 months agoUnreviewed, rolling out r226405.
commit-queue@webkit.org [Fri, 5 Jan 2018 05:39:11 +0000 (05:39 +0000)]
Unreviewed, rolling out r226405.
https://bugs.webkit.org/show_bug.cgi?id=181318

Speculative rollout due to Octane/SplayLatency,Octane/Splay
regressions (Requested by yusukesuzuki on #webkit).

Reverted changeset:

"[JSC] Create parallel SlotVisitors apriori"
https://bugs.webkit.org/show_bug.cgi?id=180907
https://trac.webkit.org/changeset/226405

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

20 months agoDo value profiling in to_this
sbarati@apple.com [Fri, 5 Jan 2018 05:12:51 +0000 (05:12 +0000)]
Do value profiling in to_this
https://bugs.webkit.org/show_bug.cgi?id=181299

Reviewed by Filip Pizlo.

This patch adds value profiling to to_this. We use the result of the value
profiling only for strict mode code when we don't predict that the input is
of a specific type. This helps when the input is SpecCellOther. Such cells
might implement a custom ToThis, which can produce an arbitrary result. Before
this patch, in prediction propagation, we were saying that a ToThis with a
SpecCellOther input also produced SpecCellOther. However, this is incorrect,
given that the input may implement ToThis that produces an arbitrary result.
This is seen inside Speedometer. This patch fixes an OSR exit loop in Speedometer.

Interestingly, this patch only does value profiling on the slow path. The fast
path of to_this in the LLInt/baseline just perform a structure check. If it
passes, the result is the same as the input. Therefore, doing value profiling
from the fast path wouldn't actually produce new information for the ValueProfile.

* bytecode/BytecodeDumper.cpp:
(JSC::BytecodeDumper<Block>::dumpBytecode):
* bytecode/BytecodeList.json:
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::finishCreation):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::emitToThis):
* bytecompiler/BytecodeGenerator.h:
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGNode.h:
(JSC::DFG::Node::hasHeapPrediction):
* dfg/DFGPredictionPropagationPhase.cpp:
* runtime/CommonSlowPaths.cpp:
(JSC::SLOW_PATH_DECL):

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

20 months agoREGRESSION (r225709): Web Inspector: CSS Source maps not loading
commit-queue@webkit.org [Fri, 5 Jan 2018 04:34:07 +0000 (04:34 +0000)]
REGRESSION (r225709): Web Inspector: CSS Source maps not loading
https://bugs.webkit.org/show_bug.cgi?id=181314
<rdar://problem/36177620>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2018-01-04
Reviewed by Brian Burg.

Source/WebInspectorUI:

* UserInterface/Controllers/SourceMapManager.js:
(WI.SourceMapManager.prototype._loadAndParseSourceMap):
* UserInterface/Models/SourceMapResource.js:
(WI.SourceMapResource.prototype.requestContentFromBackend):
Correct this so that we only fall back to a reasonable frame id
if we couldn't determine a frame id from earlier. Previously this
was incorrectly clearing the frame id if we had gotten it earlier.

* UserInterface/Test.html:
* UserInterface/Test/Test.js:
(WI.loaded):
Add SourceMap related files for tests.

LayoutTests:

* http/tests/inspector/network/resources/script-with-sourcemap.js: Added.
* http/tests/inspector/network/resources/script-with-sourcemap.js.map: Added.
* http/tests/inspector/network/resources/stylesheet-with-sourcemap.css: Added.
* http/tests/inspector/network/resources/stylesheet-with-sourcemap.css.map: Added.
* http/tests/inspector/network/resources/stylesheet-with-sourcemap.scss: Added.
Add a real script minified with a source map.
Add a real scss stylesheet compiled to css with a source map.

* http/tests/inspector/network/source-map-loads-expected.txt: Added.
* http/tests/inspector/network/source-map-loads.html: Added.
Test that we load source maps for resources with sourceMappingURL directives.

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

20 months ago[DFG] Unify ToNumber implementation in 32bit and 64bit by changing 32bit Int32Tag...
utatane.tea@gmail.com [Fri, 5 Jan 2018 04:15:49 +0000 (04:15 +0000)]
[DFG] Unify ToNumber implementation in 32bit and 64bit by changing 32bit Int32Tag and LowestTag
https://bugs.webkit.org/show_bug.cgi?id=181134

Reviewed by Mark Lam.

We would like to unify DFG ToNumber implementation in 32bit and 64bit. One problem is that
branchIfNumber signature is different between 32bit and 64bit. 32bit implementation requires
an additional scratch register. We do not want to allocate an unnecessary register in 64bit
implementation.

This patch removes the additional register in branchIfNumber/branchIfNotNumber in both 32bit
and 64bit implementation. To achieve this goal, we change Int32Tag and LowestTag order. By
setting Int32Tag as LowestTag, we can query whether the given tag is a number by checking
`<= LowestTag(Int32Tag)`.

We also change the order of UndefinedTag, NullTag, and BooleanTag to keep `(UndefinedTag | 1) == NullTag`.

We also clean up speculateMisc implementation by adding branchIfMisc/branchIfNotMisc.

* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileValueToInt32):
(JSC::DFG::SpeculativeJIT::compileDoubleRep):
(JSC::DFG::SpeculativeJIT::speculateNumber):
(JSC::DFG::SpeculativeJIT::speculateMisc):
(JSC::DFG::SpeculativeJIT::compileNormalizeMapKey):
(JSC::DFG::SpeculativeJIT::compileToNumber):
* dfg/DFGSpeculativeJIT.h:
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompareNullOrUndefined):
(JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranchNullOrUndefined):
(JSC::DFG::SpeculativeJIT::compileObjectOrOtherLogicalNot):
(JSC::DFG::SpeculativeJIT::emitObjectOrOtherBranch):
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* jit/AssemblyHelpers.cpp:
(JSC::AssemblyHelpers::branchIfNotType):
(JSC::AssemblyHelpers::jitAssertIsJSNumber):
(JSC::AssemblyHelpers::emitConvertValueToBoolean):
* jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::branchIfMisc):
(JSC::AssemblyHelpers::branchIfNotMisc):
(JSC::AssemblyHelpers::branchIfNumber):
(JSC::AssemblyHelpers::branchIfNotNumber):
(JSC::AssemblyHelpers::branchIfNotDoubleKnownNotInt32):
(JSC::AssemblyHelpers::emitTypeOf):
* jit/JITAddGenerator.cpp:
(JSC::JITAddGenerator::generateFastPath):
* jit/JITArithmetic32_64.cpp:
(JSC::JIT::emitBinaryDoubleOp):
* jit/JITDivGenerator.cpp:
(JSC::JITDivGenerator::loadOperand):
* jit/JITMulGenerator.cpp:
(JSC::JITMulGenerator::generateInline):
(JSC::JITMulGenerator::generateFastPath):
* jit/JITNegGenerator.cpp:
(JSC::JITNegGenerator::generateInline):
(JSC::JITNegGenerator::generateFastPath):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::emit_op_is_number):
(JSC::JIT::emit_op_jeq_null):
(JSC::JIT::emit_op_jneq_null):
(JSC::JIT::emit_op_to_number):
(JSC::JIT::emit_op_profile_type):
* jit/JITRightShiftGenerator.cpp:
(JSC::JITRightShiftGenerator::generateFastPath):
* jit/JITSubGenerator.cpp:
(JSC::JITSubGenerator::generateInline):
(JSC::JITSubGenerator::generateFastPath):
* llint/LLIntData.cpp:
(JSC::LLInt::Data::performAssertions):
* llint/LowLevelInterpreter.asm:
* llint/LowLevelInterpreter32_64.asm:
* runtime/JSCJSValue.h:

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

20 months ago[Curl] Fix compilation error in WebFrameNetworkingContext
don.olmstead@sony.com [Fri, 5 Jan 2018 02:17:27 +0000 (02:17 +0000)]
[Curl] Fix compilation error in WebFrameNetworkingContext
https://bugs.webkit.org/show_bug.cgi?id=181312

Reviewed by Alex Christensen.

* WebProcess/WebCoreSupport/curl/WebFrameNetworkingContext.cpp:
(WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):

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

20 months agoAX: Implement updated CSS3 Speech for 'speak' and 'speak-as' properties
cfleizach@apple.com [Fri, 5 Jan 2018 00:32:53 +0000 (00:32 +0000)]
AX: Implement updated CSS3 Speech for 'speak' and 'speak-as' properties
https://bugs.webkit.org/show_bug.cgi?id=180361

Reviewed by Zalan Bujtas.

Source/WebCore:

Change speak -> speakAs, and allow a combination of properties.

Tests: Updated accessibility/mac/css-speech-speak.html

* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::speakAsProperty const):
(WebCore::AccessibilityObject::speakProperty const): Deleted.
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::speakAsProperty const):
(WebCore::AccessibilityRenderObject::speakProperty const): Deleted.
* accessibility/AccessibilityRenderObject.h:
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilitySpeechHint]):
* accessibility/mac/WebAccessibilityObjectWrapperBase.h:
* accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
(-[WebAccessibilityObjectWrapperBase baseAccessibilitySpeechHint]):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::speakAsToCSSValue):
(WebCore::ComputedStyleExtractor::propertyValue):
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator ESpeakAs const):
(WebCore::CSSPrimitiveValue::operator ESpeak const): Deleted.
* css/CSSProperties.json:
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertSpeakAs):
* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
(WebCore::CSSParserFastPaths::isKeywordPropertyID):
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeSpeakAs):
(WebCore::CSSPropertyParser::parseSingleValue):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::speakAs const):
(WebCore::RenderStyle::setSpeakAs):
(WebCore::RenderStyle::initialSpeakAs):
(WebCore::RenderStyle::speak const): Deleted.
(WebCore::RenderStyle::setSpeak): Deleted.
(WebCore::RenderStyle::initialSpeak): Deleted.
* rendering/style/RenderStyleConstants.h:
(WebCore::operator| ):
(WebCore::operator|= ):
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator== const):
* rendering/style/StyleRareInheritedData.h:

Tools:

* DumpRenderTree/AccessibilityUIElement.cpp:
(speakAsCallback):
(AccessibilityUIElement::speakAs):
(AccessibilityUIElement::getJSClass):
(speakCallback): Deleted.
(AccessibilityUIElement::speak): Deleted.
* DumpRenderTree/AccessibilityUIElement.h:
* DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
(AccessibilityUIElement::speakAs):
* DumpRenderTree/mac/AccessibilityUIElementMac.mm:
(AccessibilityUIElement::speakAs):
(AccessibilityUIElement::speak): Deleted.
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::speakAs):
(WTR::AccessibilityUIElement::speak): Deleted.
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::speakAs):
(WTR::AccessibilityUIElement::speak): Deleted.

LayoutTests:

* accessibility/mac/css-speech-speak-expected.txt:
* accessibility/mac/css-speech-speak.html:
* fast/css/getComputedStyle/computed-style-expected.txt:
* fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* platform/ios/fast/css/getComputedStyle/computed-style-expected.txt:
* platform/ios/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* platform/mac-sierra/fast/css/getComputedStyle/computed-style-expected.txt:
* platform/mac-sierra/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* platform/mac-sierra/svg/css/getComputedStyle-basic-expected.txt:
* platform/mac/fast/css/getComputedStyle/computed-style-expected.txt:
* platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* platform/mac/svg/css/getComputedStyle-basic-expected.txt:
* svg/css/getComputedStyle-basic-expected.txt:

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

20 months agoAdd assembler support for x86 lfence and sfence
jfbastien@apple.com [Fri, 5 Jan 2018 00:17:06 +0000 (00:17 +0000)]
Add assembler support for x86 lfence and sfence
https://bugs.webkit.org/show_bug.cgi?id=181311
<rdar://problem/36301780>

Reviewed by Michael Saboff.

Useful for testing performance of serializing instructions (hint:
it's not good).

* assembler/MacroAssemblerX86Common.h:
(JSC::MacroAssemblerX86Common::lfence):
(JSC::MacroAssemblerX86Common::sfence):
* assembler/X86Assembler.h:
(JSC::X86Assembler::lfence):
(JSC::X86Assembler::sfence):

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

20 months agoREGRESSION (r226395): test-webkitperl test expectations incorrect
jbedard@apple.com [Fri, 5 Jan 2018 00:16:26 +0000 (00:16 +0000)]
REGRESSION (r226395): test-webkitperl test expectations incorrect
https://bugs.webkit.org/show_bug.cgi?id=181307
<rdar://problem/36306558>

Rubber-stamped by Aakash Jain.

r226395 added two lines towards the beginning of
Scripts/webkitperl/prepare-ChangeLog_unittest/resources/perl_unittests.pl, the line
numbers in the test expectations need to update.

* Scripts/webkitperl/prepare-ChangeLog_unittest/resources/perl_unittests-expected.txt:

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

20 months agoAdd a new pattern matching rule to Graph::methodOfGettingAValueProfileFor for SetLoca...
sbarati@apple.com [Fri, 5 Jan 2018 00:01:32 +0000 (00:01 +0000)]
Add a new pattern matching rule to Graph::methodOfGettingAValueProfileFor for SetLocal(@nodeWithHeapPrediction)
https://bugs.webkit.org/show_bug.cgi?id=181296

Reviewed by Filip Pizlo.

Inside Speedometer's Ember test, there is a recompile loop like:
a: GetByVal(..., semanticOriginX)
b: SetLocal(Cell:@a, semanticOriginX)

where the cell check always fails. For reasons I didn't investigate, the
baseline JIT's value profiling doesn't accurately capture the GetByVal's
result.

However, when compiling this cell speculation check in the DFG, we get a null
MethodOfGettingAValueProfile inside Graph::methodOfGettingAValueProfileFor for
this IR pattern because both @a and @b have the same semantic origin. We
should not follow the same semantic origin heuristic when dealing with
SetLocal since SetLocal(@nodeWithHeapPrediction) is such a common IR pattern.
For patterns like this, we introduce a new heuristic: @NodeThatDoesNotProduceAValue(@nodeWithHeapPrediction).
For this IR pattern, we will update the value profile for the semantic origin
for @nodeWithHeapPrediction. So, for the Speedometer example above, we
will correctly update the GetByVal's value profile, which will prevent
an OSR exit loop.

* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::methodOfGettingAValueProfileFor):

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

20 months agoWeb Inspector: Capture Element Screenshot looks fuzzy
bburg@apple.com [Fri, 5 Jan 2018 00:00:25 +0000 (00:00 +0000)]
Web Inspector: Capture Element Screenshot looks fuzzy
https://bugs.webkit.org/show_bug.cgi?id=175734
<rdar://problem/33803377>

Reviewed by Joseph Pecoraro and Simon Fraser.

Source/WebCore:

Screenshots taken by Web Inspector were being downscaled from the
internal size to the logical size, causing them to be blurry when
later upscaled to the internal size.

Replace ScaleBehavior { Scaled, Unscaled } with PreserveResolution { No, Yes }.
This is a lot less confusing to read both inside ImageBuffer and at its use sites.

Remove unused CoordinateSystem argument for ImageBuffer::toDataURL,
and replace it with PreserveResolution. Plumb PreserveResolution into toCFData
so that PreserveResolution::Yes will preserve the internal size of
the image buffer, just as it does in other methods that take PreserveResolution.

At the use site in InspectorPageAgent, always request PreserveResolution::Yes snapshots
when taking an element screenshot. For now, keep using downscaled (smaller)
snapshots when capturing canvas previews, as the previews are not full-size.

Test: inspector/page/hidpi-snapshot-size.html

* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::makePresentationCopy):
(WebCore::HTMLCanvasElement::copiedImage const):
* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::createPattern):
* inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::snapshotNode):
(WebCore::InspectorPageAgent::snapshotRect):
* page/TextIndicator.cpp:
(WebCore::takeSnapshot):
* platform/DragImage.cpp:
(WebCore::createDragImageFromSnapshot):
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::drawPattern):
* platform/graphics/ImageBuffer.h:
* platform/graphics/cairo/ImageBufferCairo.cpp:
(WebCore::ImageBuffer::sinkIntoImage):
(WebCore::ImageBuffer::copyImage const):
(WebCore::ImageBuffer::toDataURL const):
* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::createBitmapImageAfterScalingIfNeeded):
(WebCore::ImageBuffer::copyImage const):
(WebCore::ImageBuffer::sinkIntoImage):
(WebCore::ImageBuffer::toDataURL const):
(WebCore::ImageBuffer::toData const):
(WebCore::ImageBuffer::toCFData const):
* platform/graphics/gtk/ImageBufferGtk.cpp:
(WebCore::ImageBuffer::toDataURL const):
* platform/graphics/win/ImageBufferDirect2D.cpp:
(WebCore::ImageBuffer::copyImage const):
(WebCore::ImageBuffer::sinkIntoImage):
(WebCore::ImageBuffer::toDataURL const):
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::drawPatternForContainer):

Source/WebInspectorUI:

Spruce up these functions a bit. They now optionally return a promise
if no callback is supplied. They now can take either a WI.DOMNode or a node id.

* UserInterface/Controllers/DOMTreeManager.js:
(WI.DOMTreeManager.prototype.querySelector):
(WI.DOMTreeManager.prototype.querySelectorAll):

LayoutTests:

* inspector/page/hidpi-snapshot-size-expected.txt: Added.
* inspector/page/hidpi-snapshot-size.html: Added.

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

20 months agoWKWebView loses minimum layout size overrides that happen while the process is terminated
timothy_horton@apple.com [Thu, 4 Jan 2018 22:54:09 +0000 (22:54 +0000)]
WKWebView loses minimum layout size overrides that happen while the process is terminated
https://bugs.webkit.org/show_bug.cgi?id=181306
<rdar://problem/34398288>

Reviewed by Dan Bernstein.

Source/WebKit:

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _didRelaunchProcess]): Deleted.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::didRelaunchProcess):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::setViewportConfigurationMinimumLayoutSize):
(WebKit::WebPageProxy::setForceAlwaysUserScalable):
(WebKit::WebPageProxy::setMaximumUnobscuredSize):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
Pass the current viewport minimum layout size and maximum unobscured size
in the WebPageCreationParameters instead of re-sending them in _didRelaunchProcess.

The previous approach was problematic when _dispatchSetMinimumLayoutSize:
was changed to not re-send identical updates, because if the client calls
_overrideLayoutParametersWithMinimumLayoutSize before the Web Content process
is re-launched (after terminating), we would cache the size, attempt to send it,
fail silently (because the process is not launched), and then in _didRelaunchProcess
we would choose not to re-send (after the process is successfully relaunched)
because we think we already sent the new value.

Add isValid() checks to our message sends. Ideally send() would assert
if the process is not alive to avoid problems like this, but it doesn't (yet).

Get rid of WKWebView's _didRelaunchProcess, because it does nothing now.

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/AnimatedResize.mm:
(TEST):
Add a test that calling _overrideLayoutParametersWithMinimumLayoutSize
while the process is terminated results in the page getting the correct
minimum layout size.

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

20 months agoNetworkProcess cache files use functions from unistd.h without explicitly including it
commit-queue@webkit.org [Thu, 4 Jan 2018 22:33:01 +0000 (22:33 +0000)]
NetworkProcess cache files use functions from unistd.h without explicitly including it
https://bugs.webkit.org/show_bug.cgi?id=181261

Patch by Stephan Szabo <stephan.szabo@sony.com> on 2018-01-04
Reviewed by Alex Christensen.

* NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
* NetworkProcess/cache/NetworkCacheData.cpp:

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

20 months agoAdd commas
krollin@apple.com [Thu, 4 Jan 2018 21:47:55 +0000 (21:47 +0000)]
Add commas
https://bugs.webkit.org/show_bug.cgi?id=181295
<rdar://problem/35802295>

Reviewed by Brent Fulgham.

Fix a problem introduced in r226226 where the emitted JSON didn't
include some required commas.

* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::logCookieInformation const):

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

20 months agoStorage Access API: Turn feature on by default in Settings.yaml
wilander@apple.com [Thu, 4 Jan 2018 21:31:35 +0000 (21:31 +0000)]
Storage Access API: Turn feature on by default in Settings.yaml
https://bugs.webkit.org/show_bug.cgi?id=181298
<rdar://problem/36302506>

Reviewed by Brent Fulgham.

No new tests. This is just a feature settings change.

* page/Settings.yaml:

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

20 months agoWeb Inspector: add RemoteObject.fetchProperties and some basic tests for RemoteObject API
bburg@apple.com [Thu, 4 Jan 2018 21:29:13 +0000 (21:29 +0000)]
Web Inspector: add RemoteObject.fetchProperties and some basic tests for RemoteObject API
https://bugs.webkit.org/show_bug.cgi?id=180945

Reviewed by Joseph Pecoraro.

Source/WebInspectorUI:

Add a new method, fetchProperties, which async fetches an arbitrary list of properties
from a RemoteObject. This is intended for writing tests and other quick evaluations,
so it has some behaviors that are suitable in these situations:
- If the evaluation throws an exception, the result will reject with that exception.
- If there is a protocol error for some reason, the result will reject with an exception.
- Non-string and non-number keys cause an exception, as this is probably not intended.
- Does not accept a callback, returns a promise only. New code should use async.

For full fidelity introspection of property descriptors, clients should use the existing
getOwnPropertyDescriptor[s] class of methods.

* UserInterface/Protocol/RemoteObject.js:
(WI.RemoteObject.prototype.async.fetchProperties): Added.
- Validate specified keys and remove duplicates.
- Request properties one-by-one to avoid fetching all descriptors and dealing with previews.
- Unwrap returned primitive values to avoid unnecessary munging in tests.

(WI.RemoteObject.prototype.getProperty):
- Rework this to return a promise if no callback was supplied.
- Introduce stricter property type checking to avoid unintended mistakes.

(WI.RemoteObject.prototype.callFunction):
- Rework this to return a promise if no callback was supplied.
- Turn thrown exceptions and protocol errors into rejected promises.

LayoutTests:

Add new test coverage for existing RemoteObject.prototype.getProperty.
Add new test coverage for new method RemoteObject.prototype.fetchProperties.
I didn't add test coverage for callFunction, as I had to stop somewhere.

* inspector/model/remote-object-api-expected.txt: Added.
* inspector/model/remote-object-api.html: Added.

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

20 months agoArray Storage operations sometimes did not update the indexing mask correctly.
keith_miller@apple.com [Thu, 4 Jan 2018 20:58:31 +0000 (20:58 +0000)]
Array Storage operations sometimes did not update the indexing mask correctly.
https://bugs.webkit.org/show_bug.cgi?id=181301

Reviewed by Mark Lam.

I will add tests in a follow up patch. See: https://bugs.webkit.org/show_bug.cgi?id=181303

* runtime/JSArray.cpp:
(JSC::JSArray::shiftCountWithArrayStorage):
* runtime/JSObject.cpp:
(JSC::JSObject::increaseVectorLength):

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

20 months agoWeb Inspector: ⌘G / ⇧⌘G text search does not working after closing find banner
commit-queue@webkit.org [Thu, 4 Jan 2018 20:56:43 +0000 (20:56 +0000)]
Web Inspector: ⌘G / ⇧⌘G text search does not working after closing find banner
https://bugs.webkit.org/show_bug.cgi?id=181280
<rdar://problem/36291175>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2018-01-04
Reviewed by Matt Baker.

* UserInterface/Views/ContentBrowser.js:
(WI.ContentBrowser.prototype._findBannerDidHide):
When the find banner is hidden trigger a new ContentView method,
searchHidden instead of the destructive searchCleared. This allows
most content views (text editors, DOM tree, Network Headers view)
to keep their populated search results.

* UserInterface/Views/ContentView.js:
(WI.ContentView.prototype.searchHidden):
* UserInterface/Views/LogContentView.js:
(WI.LogContentView.prototype.searchHidden):
By default searchHidden does nothing. The Console's LogContentView
treats the find banner differently and clears its search results.

* UserInterface/Views/TextEditor.js:
(WI.TextEditor.prototype.searchCleared):
Modernize some code while working in this area.

* UserInterface/Views/Main.css:
(.bouncy-highlight):
Ensure black text on yellow background in the bouncy highlight. In the
DOM Tree it could have been white if the find banner was closed.

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

20 months agoWeb Inspector: add TestPage.debug() to inspect evaluations being sent to Inspector...
bburg@apple.com [Thu, 4 Jan 2018 20:38:05 +0000 (20:38 +0000)]
Web Inspector: add TestPage.debug() to inspect evaluations being sent to Inspector page
https://bugs.webkit.org/show_bug.cgi?id=181005

Rubber-stamped by Joseph Pecoraro.

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

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

* http/tests/inspector/network/har/har-page-expected.txt:
Rebaseline, as this depends on the size of inspector-test.js. Removing this
fragile test expectation behavior is tracked by https://bugs.webkit.org/show_bug.cgi?id=181300.

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

20 months agoWebContent process crashes while loading https://www.classicspecs.com
zalan@apple.com [Thu, 4 Jan 2018 20:14:54 +0000 (20:14 +0000)]
WebContent process crashes while loading https://classicspecs.com
https://bugs.webkit.org/show_bug.cgi?id=181290
<rdar://problem/36225906>

Reviewed by Simon Fraser.

Source/WebCore:

Floats can overhang multiple blocks (they are called intruding floats).
Each block keeps track of such intruding floats. When an overhanging float box is destroyed,
we need to deregister it from all those blocks. We do it by walking up the ancestor block chain
and check if the parent (grandparent etc) block still contains this float. Once we find the topmost block,
we start deregistering it by traversing back on the descendant blocks.
Normally we do it in RenderElement::takeChildInternal right before the box is getting detached.
However in certain cases (like when the float's parent happens to be an anonymous wrapper)
by the time we get to ::takeChildInternal the subtree is already detached and we can't access all the
ancestors.
This patch ensure that the floating box is still attached during de-registration.

Test: fast/block/float/crash-when-intruding-float-has-anonymous-parent-and-detach.html

* rendering/RenderObject.cpp:
(WebCore::RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers):

LayoutTests:

* fast/block/float/crash-when-intruding-float-has-anonymous-parent-and-detach-expected.txt: Added.
* fast/block/float/crash-when-intruding-float-has-anonymous-parent-and-detach.html: Added.

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

20 months ago[MediaStream] Add Mock screen capture source
eric.carlson@apple.com [Thu, 4 Jan 2018 20:12:27 +0000 (20:12 +0000)]
[MediaStream] Add Mock screen capture source
https://bugs.webkit.org/show_bug.cgi?id=181291
<rdar://problem/36298164>

Reviewed by Dean Jackson.

Source/WebCore:

Tests:  http/tests/media/media-stream/get-display-media-prompt.html
        GetDisplayMediaTest.BasicPrompt
        GetDisplayMediaTest.Constraints

* Modules/mediastream/MediaDevices.cpp:
(WebCore::MediaDevices::MediaDevices): Add static_assert to ensure MediaDevices::DisplayCaptureSurfaceType
and RealtimeMediaSourceSettings::DisplaySurfaceType values are equivalent.
(WebCore::MediaDevices::getSupportedConstraints): Remove bogus code.
* Modules/mediastream/MediaDevices.h: Add DisplayCaptureSurfaceType.
* Modules/mediastream/MediaDevices.idl: Ditto.

* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::getSettings const): Add a FIXME.
* Modules/mediastream/MediaStreamTrack.h: Add displaySurface and logicalSurface.

* Modules/mediastream/MediaTrackSupportedConstraints.h: Remove displaySurface and logicalSurface.
* Modules/mediastream/MediaTrackSupportedConstraints.idl:

* SourcesCocoa.txt: Add DisplayCaptureManagerCocoa.cpp and DisplayCaptureSourceCocoa.cpp.

* WebCore.xcodeproj/project.pbxproj: Ditto.

* platform/mediastream/CaptureDevice.h:
(WebCore::CaptureDevice::encode const): Add.
(WebCore::CaptureDevice::decode):

* platform/mediastream/RealtimeMediaSourceCenter.cpp:
(WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices): Include display capture "devices".
(WebCore::RealtimeMediaSourceCenter::validateRequestConstraints): Deal with display capture devices.
(WebCore::RealtimeMediaSourceCenter::captureDeviceWithPersistentID): Ditto.
* platform/mediastream/RealtimeMediaSourceCenter.h:

* platform/mediastream/RealtimeMediaSourceSettings.h:
(WebCore::RealtimeMediaSourceSettings::displaySurface const): Return a DisplaySurfaceType.
(WebCore::RealtimeMediaSourceSettings::setDisplaySurface): Take a DisplaySurfaceType.

* platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:
(WebCore::DisplayCaptureManagerCocoa::singleton):
(WebCore::DisplayCaptureManagerCocoa::~DisplayCaptureManagerCocoa):
(WebCore::DisplayCaptureManagerCocoa::captureDevices):
(WebCore::DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID):
(WebCore::DisplayCaptureManagerCocoa::captureDeviceWithPersistentID):
* platform/mediastream/mac/DisplayCaptureManagerCocoa.h:

* platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp: Added.
(WebCore::DisplayCaptureSourceCocoa::DisplayCaptureSourceCocoa):
(WebCore::DisplayCaptureSourceCocoa::~DisplayCaptureSourceCocoa):
(WebCore::DisplayCaptureSourceCocoa::capabilities const):
(WebCore::DisplayCaptureSourceCocoa::settings const):
(WebCore::DisplayCaptureSourceCocoa::settingsDidChange):
(WebCore::DisplayCaptureSourceCocoa::startProducingData):
(WebCore::DisplayCaptureSourceCocoa::stopProducingData):
(WebCore::DisplayCaptureSourceCocoa::elapsedTime):
(WebCore::DisplayCaptureSourceCocoa::applyFrameRate):
(WebCore::DisplayCaptureSourceCocoa::emitFrame):
* platform/mediastream/mac/DisplayCaptureSourceCocoa.h:

* platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
(WebCore::RealtimeMediaSourceCenterMac::displayCaptureDeviceManager): New.
* platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:

* platform/mock/MockRealtimeMediaSource.cpp:
(WebCore::deviceMap): Add screen capture "devices".
(WebCore::MockRealtimeMediaSource::displayDevices): New.
* platform/mock/MockRealtimeMediaSource.h:

* platform/mock/MockRealtimeMediaSourceCenter.cpp: Clean up includes.
* platform/mock/MockRealtimeMediaSourceCenter.h:

* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource): Mock two screen devices.
(WebCore::MockRealtimeVideoSource::updateSettings): Deal with mock screens.
(WebCore::MockRealtimeVideoSource::initializeCapabilities): Ditto.
(WebCore::MockRealtimeVideoSource::initializeSupportedConstraints): Ditto.
(WebCore::MockRealtimeVideoSource::drawText): Ditto.
(WebCore::MockRealtimeVideoSource::generateFrame): Ditto.
* platform/mock/MockRealtimeVideoSource.h:
(WebCore::MockRealtimeVideoSource::mockCamera const):
(WebCore::MockRealtimeVideoSource::mockScreen const):

Source/WebKit:

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<MediaConstraints>::decode):
(IPC::ArgumentCoder<CaptureDevice>::encode): Deleted, moved to CaptureDevice.h
(IPC::ArgumentCoder<CaptureDevice>::decode): Ditto.
* Shared/WebCoreArgumentCoders.h:

* UIProcess/API/Cocoa/WKWebViewPrivate.h: Add _WKCaptureDeviceDisplay.
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::requestUserMediaAuthorizationForDevices): Deal with display capture.
(WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): Ditto.

* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied): requiresAudio -> requiresAudioCapture.
(WebKit::UserMediaPermissionRequestManagerProxy::searchForGrantedRequest const): Never reuse
a previously granted display capture request.

* UIProcess/UserMediaPermissionRequestProxy.cpp:
(WebKit::UserMediaPermissionRequestProxy::allow): Search the eligible devices instead of asking
the source center to find devices.
* UIProcess/UserMediaPermissionRequestProxy.h:
(WebKit::UserMediaPermissionRequestProxy::requiresAudioCapture const): Renamed.
(WebKit::UserMediaPermissionRequestProxy::requiresVideoCapture const): Ditto.
(WebKit::UserMediaPermissionRequestProxy::requiresDisplayCapture const): New.
(WebKit::UserMediaPermissionRequestProxy::requiresAudio const): Deleted.
(WebKit::UserMediaPermissionRequestProxy::requiresVideo const): Deleted.

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Add new test.
* TestWebKitAPI/Tests/WebKitCocoa/GetDisplayMedia.mm:
* TestWebKitAPI/Tests/WebKit/getDisplayMedia.html:

LayoutTests:

* http/tests/media/media-stream/get-display-media-prompt-expected.txt: Added.
* http/tests/media/media-stream/get-display-media-prompt.html: Added.

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

20 months ago<rdar://problem/36300930> Change proxy server setting on master config to reach s3...
lforschler@apple.com [Thu, 4 Jan 2018 18:58:56 +0000 (18:58 +0000)]
<rdar://problem/36300930> Change proxy server setting on master config to reach s3 servers

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

20 months agoFetchResponse should set its internal response text encoding name
commit-queue@webkit.org [Thu, 4 Jan 2018 18:49:07 +0000 (18:49 +0000)]
FetchResponse should set its internal response text encoding name
https://bugs.webkit.org/show_bug.cgi?id=181284

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

LayoutTests/imported/w3c:

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

Source/WebCore:

Covered by rebased test.

* Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::create): Set response text encoding based on content type charset.

Source/WebKit:

* WebProcess/Storage/ServiceWorkerClientFetch.cpp:
(WebKit::ServiceWorkerClientFetch::didReceiveResponse): Set default encoding to UTF-8.

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

20 months agoStorage Access API: Remove JavaScript confirm() prompt from Document::requestStorageA...
wilander@apple.com [Thu, 4 Jan 2018 17:56:55 +0000 (17:56 +0000)]
Storage Access API: Remove JavaScript confirm() prompt from Document::requestStorageAccess()
https://bugs.webkit.org/show_bug.cgi?id=181276
<rdar://problem/36290463>

Reviewed by Alex Christensen.

Source/WebCore:

No new tests. Existing test expectations updated.

* dom/Document.cpp:
(WebCore::Document::requestStorageAccess):

LayoutTests:

Two test cases are deleted since the user has no way
to deny access through a prompt anymore. The rest
are updated to not expect a "CONFIRM:..." text output.

* http/tests/storageAccess/request-and-deny-storage-access-cross-origin-iframe-expected.txt: Removed.
* http/tests/storageAccess/request-and-deny-storage-access-cross-origin-iframe.html: Removed.
* http/tests/storageAccess/request-and-deny-storage-access-cross-origin-sandboxed-iframe-expected.txt: Removed.
* http/tests/storageAccess/request-and-deny-storage-access-cross-origin-sandboxed-iframe.html: Removed.
* http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access-expected.txt:
* http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access-expected.txt:
* http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe-expected.txt:
* http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-expected.txt:
* http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-and-try-access-from-right-frame-expected.txt:
* http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-but-try-access-from-wrong-frame-expected.txt:
* http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-recent-user-interaction-expected.txt:
* http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction-expected.txt:
* platform/mac-wk2/TestExpectations:
    Removed entries for the deleted test cases.

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

20 months ago[DFG] Define defs for MapSet/SetAdd to participate in CSE
utatane.tea@gmail.com [Thu, 4 Jan 2018 15:57:04 +0000 (15:57 +0000)]
[DFG] Define defs for MapSet/SetAdd to participate in CSE
https://bugs.webkit.org/show_bug.cgi?id=179911

Reviewed by Saam Barati.

JSTests:

In addition to these tests, map-set-cse.js and set-add-cse.js work.

* stress/map-set-change-get.js: Added.
(shouldBe):
(test):
* stress/map-set-create-bucket.js: Added.
(shouldBe):
(test):
* stress/set-add-create-bucket.js: Added.
(shouldBe):

Source/JavaScriptCore:

With this patch, our MapSet and SetAdd DFG nodes participate in CSE.
To handle a bit tricky DFG Map operation nodes, MapSet and SetAdd
produce added bucket as its result. Subsequent GetMapBucket will
be removed by CSE.

* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGNodeType.h:
* dfg/DFGOperations.cpp:
* dfg/DFGOperations.h:
* dfg/DFGPredictionPropagationPhase.cpp:
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileSetAdd):
(JSC::DFG::SpeculativeJIT::compileMapSet):
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::callOperation):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileSetAdd):
(JSC::FTL::DFG::LowerDFGToB3::compileMapSet):
* jit/JITOperations.h:
* runtime/HashMapImpl.h:
(JSC::HashMapImpl::addNormalized):
(JSC::HashMapImpl::addNormalizedInternal):

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

20 months ago[JSC] Remove LocalScope
utatane.tea@gmail.com [Thu, 4 Jan 2018 15:54:40 +0000 (15:54 +0000)]
[JSC] Remove LocalScope
https://bugs.webkit.org/show_bug.cgi?id=181206

Reviewed by Geoffrey Garen.

The last user of HandleStack and LocalScope is JSON. But MarkedArgumentBuffer is enough for their use.
This patch changes JSON parsing and stringifying to using MarkedArgumentBuffer. And remove HandleStack
and LocalScope.

We make Stringifier and Walker WTF_FORBID_HEAP_ALLOCATION to place them on the stack. So they can hold
JSObject* directly in their fields.

* JavaScriptCore.xcodeproj/project.pbxproj:
* Sources.txt:
* heap/HandleStack.cpp: Removed.
* heap/HandleStack.h: Removed.
* heap/Heap.cpp:
(JSC::Heap::addCoreConstraints):
* heap/Heap.h:
(JSC::Heap::handleSet):
(JSC::Heap::handleStack): Deleted.
* heap/Local.h: Removed.
* heap/LocalScope.h: Removed.
* runtime/JSONObject.cpp:
(JSC::Stringifier::Holder::object const):
(JSC::gap):
(JSC::Stringifier::Stringifier):
(JSC::Stringifier::stringify):
(JSC::Stringifier::appendStringifiedValue):
(JSC::Stringifier::Holder::Holder):
(JSC::Stringifier::Holder::appendNextProperty):
(JSC::Walker::Walker):
(JSC::Walker::callReviver):
(JSC::Walker::walk):
(JSC::JSONProtoFuncParse):
(JSC::JSONProtoFuncStringify):
(JSC::JSONParse):
(JSC::JSONStringify):

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

20 months ago[FTL] Optimize ObjectAllocationSinking mergePointerSets by using removeIf
utatane.tea@gmail.com [Thu, 4 Jan 2018 15:51:49 +0000 (15:51 +0000)]
[FTL] Optimize ObjectAllocationSinking mergePointerSets by using removeIf
https://bugs.webkit.org/show_bug.cgi?id=180238

Reviewed by Saam Barati.

We can optimize ObjectAllocationSinking a bit by using removeIf.

* dfg/DFGObjectAllocationSinkingPhase.cpp:

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

20 months ago[JSC] Create parallel SlotVisitors apriori
utatane.tea@gmail.com [Thu, 4 Jan 2018 15:42:06 +0000 (15:42 +0000)]
[JSC] Create parallel SlotVisitors apriori
https://bugs.webkit.org/show_bug.cgi?id=180907

Reviewed by Saam Barati.

The number of SlotVisitors are capped with the number of HeapHelperPool's threads + 2.
If we create these SlotVisitors apriori, we do not need to create SlotVisitors dynamically.
Then we do not need to grab locks while iterating all the SlotVisitors.

In addition, we do not need to consider the case that the number of SlotVisitors increases
after setting up VisitCounters in MarkingConstraintSolver since the number of SlotVisitors
does not increase any more.

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

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

20 months ago[GTK] Issues with Ahem's ex / x-height
carlosgc@webkit.org [Thu, 4 Jan 2018 10:04:31 +0000 (10:04 +0000)]
[GTK] Issues with Ahem's ex / x-height
https://bugs.webkit.org/show_bug.cgi?id=180581

Reviewed by Michael Catanzaro.

Source/WebCore:

Get the x-height value from the TT_OS2 table if available.

Fixes: fast/text/break-word-pre-wrap.html
       imported/w3c/web-platform-tests/css/css-shapes-1/shape-outside/values/shape-outside-shape-arguments-000.html

* platform/graphics/freetype/SimpleFontDataFreeType.cpp:
(WebCore::Font::platformInit):

LayoutTests:

Unskip two tests that are now passing and rebaseline others.

* platform/gtk/TestExpectations:
* platform/gtk/css1/font_properties/font_size-expected.png:
* platform/gtk/css1/font_properties/font_size-expected.txt:
* platform/gtk/css1/text_properties/letter_spacing-expected.png:
* platform/gtk/css1/text_properties/letter_spacing-expected.txt:
* platform/gtk/css1/text_properties/line_height-expected.png:
* platform/gtk/css1/text_properties/line_height-expected.txt:
* platform/gtk/css1/text_properties/text_indent-expected.png:
* platform/gtk/css1/text_properties/text_indent-expected.txt:
* platform/gtk/css1/text_properties/word_spacing-expected.png:
* platform/gtk/css1/text_properties/word_spacing-expected.txt:
* platform/gtk/css1/units/length_units-expected.png:
* platform/gtk/css1/units/length_units-expected.txt:
* platform/gtk/css2.1/t040302-c61-ex-len-00-b-a-expected.png:
* platform/gtk/css2.1/t040302-c61-ex-len-00-b-a-expected.txt:
* platform/gtk/css2.1/t040302-c61-rel-len-00-b-ag-expected.png:
* platform/gtk/css2.1/t040302-c61-rel-len-00-b-ag-expected.txt:
* platform/gtk/css2.1/t1008-c44-ln-box-02-d-ag-expected.png:
* platform/gtk/css2.1/t1008-c44-ln-box-02-d-ag-expected.txt:
* platform/gtk/css2.1/t100801-c544-valgn-01-d-ag-expected.png:
* platform/gtk/css2.1/t100801-c544-valgn-01-d-ag-expected.txt:
* platform/gtk/css2.1/t100801-c544-valgn-03-d-agi-expected.png:
* platform/gtk/css2.1/t100801-c544-valgn-03-d-agi-expected.txt:
* platform/gtk/css2.1/t100801-c548-ln-ht-02-b-ag-expected.png:
* platform/gtk/css2.1/t100801-c548-ln-ht-02-b-ag-expected.txt:
* platform/gtk/css2.1/t1507-c526-font-sz-02-b-a-expected.png:
* platform/gtk/css2.1/t1507-c526-font-sz-02-b-a-expected.txt:
* platform/gtk/css2.1/t1601-c547-indent-00-b-a-expected.png:
* platform/gtk/css2.1/t1601-c547-indent-00-b-a-expected.txt:
* platform/gtk/css2.1/t1604-c542-letter-sp-00-b-a-expected.png:
* platform/gtk/css2.1/t1604-c542-letter-sp-00-b-a-expected.txt:
* platform/gtk/editing/selection/caret-ltr-2-expected.png:
* platform/gtk/editing/selection/caret-ltr-2-expected.txt:
* platform/gtk/editing/selection/caret-ltr-2-left-expected.png:
* platform/gtk/editing/selection/caret-ltr-2-left-expected.txt:
* platform/gtk/editing/selection/caret-ltr-expected.png:
* platform/gtk/editing/selection/caret-ltr-expected.txt:
* platform/gtk/editing/selection/caret-ltr-right-expected.png:
* platform/gtk/editing/selection/caret-ltr-right-expected.txt:
* platform/gtk/editing/selection/caret-rtl-2-expected.png:
* platform/gtk/editing/selection/caret-rtl-2-expected.txt:
* platform/gtk/editing/selection/caret-rtl-2-left-expected.png:
* platform/gtk/editing/selection/caret-rtl-2-left-expected.txt:
* platform/gtk/editing/selection/caret-rtl-expected.png:
* platform/gtk/editing/selection/caret-rtl-expected.txt:
* platform/gtk/editing/selection/caret-rtl-right-expected.png:
* platform/gtk/editing/selection/caret-rtl-right-expected.txt:
* platform/gtk/editing/selection/select-across-readonly-input-1-expected.png:
* platform/gtk/editing/selection/select-across-readonly-input-1-expected.txt:
* platform/gtk/editing/selection/select-across-readonly-input-2-expected.png:
* platform/gtk/editing/selection/select-across-readonly-input-2-expected.txt:
* platform/gtk/editing/selection/select-across-readonly-input-3-expected.png:
* platform/gtk/editing/selection/select-across-readonly-input-3-expected.txt:
* platform/gtk/editing/selection/select-across-readonly-input-4-expected.png:
* platform/gtk/editing/selection/select-across-readonly-input-4-expected.txt:
* platform/gtk/editing/selection/select-across-readonly-input-5-expected.png:
* platform/gtk/editing/selection/select-across-readonly-input-5-expected.txt:
* platform/gtk/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png:
* platform/gtk/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.txt:
* platform/gtk/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png:
* platform/gtk/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.txt:
* platform/gtk/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png:
* platform/gtk/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.txt:
* platform/gtk/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png:
* platform/gtk/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.txt:
* platform/gtk/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png:
* platform/gtk/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.txt:
* platform/gtk/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png:
* platform/gtk/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.txt:
* platform/gtk/editing/selection/vertical-rl-rtl-extend-line-backward-br-expected.png:
* platform/gtk/editing/selection/vertical-rl-rtl-extend-line-backward-br-expected.txt:
* platform/gtk/editing/selection/vertical-rl-rtl-extend-line-backward-p-expected.png:
* platform/gtk/editing/selection/vertical-rl-rtl-extend-line-backward-p-expected.txt:
* platform/gtk/editing/selection/vertical-rl-rtl-extend-line-forward-br-expected.png:
* platform/gtk/editing/selection/vertical-rl-rtl-extend-line-forward-br-expected.txt:
* platform/gtk/editing/selection/vertical-rl-rtl-extend-line-forward-p-expected.png:
* platform/gtk/editing/selection/vertical-rl-rtl-extend-line-forward-p-expected.txt:
* platform/gtk/fast/css/bidi-override-in-anonymous-block-expected.png:
* platform/gtk/fast/css/bidi-override-in-anonymous-block-expected.txt:
* platform/gtk/fast/css/ex-after-font-variant-expected.png:
* platform/gtk/fast/css/ex-after-font-variant-expected.txt:
* platform/gtk/fast/forms/auto-fill-button/input-strong-confirmation-password-auto-fill-button-expected.txt:
* platform/gtk/fast/forms/auto-fill-button/input-strong-password-auto-fill-button-expected.txt:
* platform/gtk/fast/forms/minWidthPercent-expected.png:
* platform/gtk/fast/forms/minWidthPercent-expected.txt:
* platform/gtk/fast/lists/008-expected.png:
* platform/gtk/fast/lists/008-expected.txt:
* platform/gtk/fast/lists/008-vertical-expected.png:
* platform/gtk/fast/lists/008-vertical-expected.txt:
* platform/gtk/fast/overflow/overflow-rtl-expected.png:
* platform/gtk/fast/overflow/overflow-rtl-expected.txt:
* platform/gtk/fast/overflow/overflow-rtl-vertical-expected.png:
* platform/gtk/fast/overflow/overflow-rtl-vertical-expected.txt:
* platform/gtk/fast/text/vertical-rl-rtl-linebreak-expected.png:
* platform/gtk/fast/text/vertical-rl-rtl-linebreak-expected.txt:
* platform/gtk/svg/W3C-SVG-1.1-SE/coords-units-03-b-expected.png:
* platform/gtk/svg/W3C-SVG-1.1-SE/coords-units-03-b-expected.txt:
* platform/gtk/svg/W3C-SVG-1.1/coords-units-03-b-expected.png:
* platform/gtk/svg/W3C-SVG-1.1/coords-units-03-b-expected.txt: Added.
* platform/gtk/svg/custom/alignment-baseline-modes-expected.png:
* platform/gtk/svg/custom/alignment-baseline-modes-expected.txt:
* platform/gtk/svg/custom/dominant-baseline-modes-expected.png:
* platform/gtk/svg/custom/dominant-baseline-modes-expected.txt:
* platform/gtk/tables/mozilla/bugs/bug55527-expected.png:
* platform/gtk/tables/mozilla/bugs/bug55527-expected.txt:

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

20 months agoAdd a test to ensure <mo> paints its leading and trailing space as specified in its...
commit-queue@webkit.org [Thu, 4 Jan 2018 09:48:50 +0000 (09:48 +0000)]
Add a test to ensure <mo> paints its leading and trailing space as specified in its attributes.
https://bugs.webkit.org/show_bug.cgi?id=170272

Patch by Minsheng Liu <lambda@liu.ms> on 2018-01-04
Reviewed by Frédéric Wang.

A reference test is added to ensure <mo> paints its leading and trailing space as specified in its attributes.

The bug itself is fixed as a part of 179682.
https://bugs.webkit.org/show_bug.cgi?id=179682

* mathml/presentation/mo-paint-lspace-rspace-expected.html: Added.
* mathml/presentation/mo-paint-lspace-rspace.html: Added.

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

20 months agoUnreviewed, GTK build fix attempt after r226357
philn@webkit.org [Thu, 4 Jan 2018 09:41:10 +0000 (09:41 +0000)]
Unreviewed, GTK build fix attempt after r226357

* platform/graphics/gstreamer/GStreamerUtilities.h: The
GST_BUFFER_DTS_OR_PTS macro was added in GStreamer 1.8 but old
versions of Debian might not have this release yet.

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

20 months agoImplement Cache API partitioning based on ClientOrigin
commit-queue@webkit.org [Thu, 4 Jan 2018 08:49:12 +0000 (08:49 +0000)]
Implement Cache API partitioning based on ClientOrigin
https://bugs.webkit.org/show_bug.cgi?id=181240

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

Source/WebCore:

Covered by updated tests.

Previously, cache storage was partitioned according the origin of the client, represented as a String.
We now partition according both client and top origins, represented as a ClientOrigin

Minor refactoring to use more makePendingActivity.
Added support for IPC serialization of ClientOrigin.
Added SecurityOriginData::toString which is used by WebKit2 Cache Storage implementation.

* Modules/cache/CacheStorageConnection.cpp:
(WebCore::CacheStorageConnection::open):
(WebCore::CacheStorageConnection::retrieveCaches):
* Modules/cache/CacheStorageConnection.h:
(WebCore::CacheStorageConnection::clearMemoryRepresentation):
(WebCore::CacheStorageConnection::doOpen):
(WebCore::CacheStorageConnection::doRetrieveCaches):
* Modules/cache/DOMCacheStorage.cpp:
(WebCore::DOMCacheStorage::origin const):
(WebCore::DOMCacheStorage::retrieveCaches):
(WebCore::DOMCacheStorage::open):
(WebCore::DOMCacheStorage::remove):
* Modules/cache/DOMCacheStorage.h:
* Modules/cache/WorkerCacheStorageConnection.cpp:
(WebCore::WorkerCacheStorageConnection::doOpen):
(WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
* Modules/cache/WorkerCacheStorageConnection.h:
* page/ClientOrigin.h:
(WebCore::ClientOrigin::isolatedCopy const):
(WebCore::ClientOrigin::encode const):
(WebCore::ClientOrigin::decode):
* page/SecurityOriginData.cpp:
(WebCore::SecurityOriginData::toString const):
(WebCore::SecurityOriginData::debugString const): Deleted.
* page/SecurityOriginData.h:
(WebCore::SecurityOriginData::debugString const):
* testing/Internals.cpp:
(WebCore::Internals::clearCacheStorageMemoryRepresentation):

Source/WebKit:

open and retrieveCaches now take a ClientOrigin instead of a String.
Updated cache filesystem path computation to take both client origin and top origin.

When clearing an origin, caches whose client origin or top origin matches the origin are cleared.
Caches are added to the web site data of their client origin with their corresponding cache size.
Caches are added to the web site data of their top origin with a size equal to 0.

Updated memory representation dumping used for test to include both top and client origins.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::cachesRootPath):
(WebKit::CacheStorage::Engine::open):
(WebKit::CacheStorage::Engine::remove):
(WebKit::CacheStorage::Engine::retrieveCaches):
(WebKit::CacheStorage::Engine::readCachesFromDisk):
(WebKit::CacheStorage::Engine::removeCaches):
(WebKit::CacheStorage::Engine::fetchEntries):
(WebKit::CacheStorage::Engine::clearCachesForOrigin):
(WebKit::CacheStorage::Engine::clearMemoryRepresentation):
(WebKit::CacheStorage::Engine::representation):
* NetworkProcess/cache/CacheStorageEngine.h:
* NetworkProcess/cache/CacheStorageEngineCache.cpp:
(WebKit::CacheStorage::Cache::Cache):
* NetworkProcess/cache/CacheStorageEngineCaches.cpp:
(WebKit::CacheStorage::Caches::retrieveOriginFromDirectory):
(WebKit::CacheStorage::Caches::Caches):
(WebKit::CacheStorage::Caches::storeOrigin):
(WebKit::CacheStorage::Caches::readOrigin):
(WebKit::CacheStorage::Caches::open):
* NetworkProcess/cache/CacheStorageEngineCaches.h:
(WebKit::CacheStorage::Caches::create):
(WebKit::CacheStorage::Caches::origin const):
* NetworkProcess/cache/CacheStorageEngineConnection.cpp:
(WebKit::CacheStorageEngineConnection::open):
(WebKit::CacheStorageEngineConnection::caches):
(WebKit::CacheStorageEngineConnection::clearMemoryRepresentation):
* NetworkProcess/cache/CacheStorageEngineConnection.h:
* NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
* WebProcess/Cache/WebCacheStorageConnection.cpp:
(WebKit::WebCacheStorageConnection::doOpen):
(WebKit::WebCacheStorageConnection::doRetrieveCaches):
(WebKit::WebCacheStorageConnection::clearMemoryRepresentation):
* WebProcess/Cache/WebCacheStorageConnection.h:

LayoutTests:

Beefing up test to ensure that client and top origins are taken into consideration.

* http/tests/cache-storage/cache-origins.https-expected.txt:
* http/tests/cache-storage/cache-origins.https.html:
* http/tests/cache-storage/cache-clearing-origin.https-expected.txt:
* http/tests/cache-storage/cache-clearing-origin.https.html:

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

20 months agoService Worker should expose redirect mode for navigation loads as manual
commit-queue@webkit.org [Thu, 4 Jan 2018 08:39:55 +0000 (08:39 +0000)]
Service Worker should expose redirect mode for navigation loads as manual
https://bugs.webkit.org/show_bug.cgi?id=181067

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

LayoutTests/imported/w3c:

Updating test to match the latest fetch spec.

* web-platform-tests/service-workers/service-worker/navigation-redirect-to-http.https-expected.txt:
* web-platform-tests/service-workers/service-worker/request-end-to-end.https-expected.txt:
* web-platform-tests/service-workers/service-worker/request-end-to-end.https.html:

Source/WebCore:

Covered by rebased tests.

* loader/CrossOriginAccessControl.cpp: Removing ContentType header only if affecting CORS checks.
This allows extending header filtering in service worker to all modes, including Navigate.
* workers/service/context/ServiceWorkerFetch.cpp:
(WebCore::ServiceWorkerFetch::dispatchFetchEvent): Ideally, document loading code should set redirect to manual.
Since it is not the case yet and that would require changes to various places, manual is set before exposing the corresponding fetch event.

Source/WebKit:

* WebProcess/Storage/ServiceWorkerClientFetch.cpp:
(WebKit::ServiceWorkerClientFetch::didReceiveResponse):

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

20 months agoServiceWorkerThreadProxy::postTaskForModeToWorkerGlobalScope should be a no-op if...
commit-queue@webkit.org [Thu, 4 Jan 2018 08:26:17 +0000 (08:26 +0000)]
ServiceWorkerThreadProxy::postTaskForModeToWorkerGlobalScope should be a no-op if worker is being terminated
https://bugs.webkit.org/show_bug.cgi?id=181245

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

Stop appending tasks to a terminating worker and returning false in that case.
This mirrors what is done for regular workers.

* workers/service/context/SWContextManager.cpp:
(WebCore::SWContextManager::terminateWorker):
* workers/service/context/ServiceWorkerThreadProxy.cpp:
(WebCore::ServiceWorkerThreadProxy::postTaskForModeToWorkerGlobalScope):
* workers/service/context/ServiceWorkerThreadProxy.h:

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

20 months agoCancel pending script loads when service worker is being terminated
commit-queue@webkit.org [Thu, 4 Jan 2018 08:26:01 +0000 (08:26 +0000)]
Cancel pending script loads when service worker is being terminated
https://bugs.webkit.org/show_bug.cgi?id=181250

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

Covered by service worker tests no longer crashing in ASAN builds.

* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::notifyFinished): Clearing loader when finished.
(WebCore::WorkerScriptLoader::cancel): Implementing cancel of a script loader by cancelling the underlying threadable loader.
* workers/WorkerScriptLoader.h:
* workers/service/ServiceWorkerContainer.cpp: Canceling loads of all pending jobs.
(WebCore::ServiceWorkerContainer::stop):
* workers/service/ServiceWorkerJob.cpp:
(WebCore::ServiceWorkerJob::cancelPendingLoad):
* workers/service/ServiceWorkerJob.h:

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

20 months agoImplement https://fetch.spec.whatwg.org/#main-fetch default referrer policy setting
commit-queue@webkit.org [Thu, 4 Jan 2018 08:24:54 +0000 (08:24 +0000)]
Implement  https://fetch.spec.whatwg.org/#main-fetch default referrer policy setting
https://bugs.webkit.org/show_bug.cgi?id=181239

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

LayoutTests/imported/w3c:

Updated test to output more tests for better error reporting.
Also updated to relax the settings so that HTTP loads are done even though the page is HTTPS.
Updated referrer computation since it should be done based on the fetch context and not its parent context.

* web-platform-tests/service-workers/service-worker/fetch-event-referrer-policy.https-expected.txt:
* web-platform-tests/service-workers/service-worker/fetch-event-referrer-policy.https.html:

Source/WebCore:

Covered by updated and rebased test.

Setting the request referrer policy to the Document referrer policy if no one is set.
If Document has no referrer policy, use no-referrer-when-downgrade as per the spec.

* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::updateHTTPRequestHeaders):
(WebCore::CachedResourceLoader::requestResource):
* loader/cache/CachedResourceLoader.h:
* loader/cache/CachedResourceRequest.cpp:
(WebCore::CachedResourceRequest::updateReferrerPolicy):
(WebCore::CachedResourceRequest::updateReferrerOriginAndUserAgentHeaders):
* loader/cache/CachedResourceRequest.h:

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

20 months ago[Attachment Support] Create attachment elements when dropping files on iOS
wenson_hsieh@apple.com [Thu, 4 Jan 2018 07:44:55 +0000 (07:44 +0000)]
[Attachment Support] Create attachment elements when dropping files on iOS
https://bugs.webkit.org/show_bug.cgi?id=181192
<rdar://problem/36280945>

Reviewed by Tim Horton.

Source/WebCore:

Implements support for dropping data as attachment elements on iOS. See comments below for more detail.

Tests:  WKAttachmentTests.InsertDroppedRichAndPlainTextFilesAsAttachments
        WKAttachmentTests.InsertDroppedZipArchiveAsAttachment
        WKAttachmentTests.InsertDroppedItemProvidersInOrder

* WebCore.xcodeproj/project.pbxproj:
* editing/WebContentReader.cpp:
(WebCore::WebContentReader::ensureFragment):

Add a new helper to create the WebContentReader's fragment, if it hasn't already been created.

* editing/WebContentReader.h:
* editing/cocoa/WebContentReaderCocoa.mm:
(WebCore::WebContentReader::readFilePaths):

Rename readFilenames to readFilePaths (which better reflects its parameters, which are file paths). Also, move
the implementation of readFilePaths to shared iOS/macOS code in WebContentReaderCocoa, and remove the stub
implementation on iOS.

There's a bit of code here that I kept macOS-only which deals with inserting file paths as plain text in
editable areas, but it's unclear to me why and if WebKit clients currently find this useful, so I left a FIXME
to investigate removing this altogether. Code for handling this plain text insertion of file paths on Mac was
introduced in r67403.

* editing/ios/WebContentReaderIOS.mm:
(WebCore::WebContentReader::readFilenames): Deleted.
* editing/mac/WebContentReaderMac.mm:
(WebCore::WebContentReader::readFilenames): Deleted.
* page/mac/DragControllerMac.mm:
(WebCore::DragController::updateSupportedTypeIdentifiersForDragHandlingMethod const):

Teach DragController to accept all types conforming to "public.item" and "public.content" on iOS, only when
attachment elements are enabled. This allows us to load content from item providers that we otherwise would not
have loaded, since we now have the ability to fall back to attachment element insertion if the type is not have
a default representation using standard web content.

* platform/Pasteboard.h:
* platform/PasteboardItemInfo.h: Added.
(WebCore::PasteboardItemInfo::encode const):
(WebCore::PasteboardItemInfo::decode):

Add PasteboardItemInfo, a struct that describes an item on the pasteboard. Also, implement encoding and decoding
support for PasteboardItemInfo. So far, the item info only describes file information about the pasteboard item,
and flags indicating whether the item prefers attachment or inline presentation.

* platform/PasteboardStrategy.h:

Replace getFilenamesForDataInteraction with informationForItemAtIndex. Instead of returning all of the file
paths associated with any item on the pasteboard, fetch a PasteboardItemInfo at a given item index, which
includes information about the file path as well as some other metadata we'll need when deciding how to read
pasteboard contents as a document fragment.

* platform/PlatformPasteboard.h:
* platform/cocoa/PasteboardCocoa.mm:
(WebCore::Pasteboard::read):
* platform/ios/AbstractPasteboard.h:
* platform/ios/PasteboardIOS.mm:
(WebCore::Pasteboard::read):
(WebCore::Pasteboard::readRespectingUTIFidelities):

Teach the iOS Pasteboard to read web content using attachment elements, if enabled. There are two scenarios in
which we would want to insert an attachment element:
(1) The item provider uses a preferred presentation style of attachment, in which case we bail out of trying to
    handle the drop using the default mechanisms, and simply insert it as an attachment. We need this to deal
    with the case where we drop text or HTML files from the Files app, so that we don't try and insert the
    contents of the text or HTML as inline web content.
(2) The item provider doesn't have a preferred attachment presentation style, but there's nothing WebKit would
    otherwise do with the dropped content, so insert an attachment element as a fallback. Examples where this is
    relevant are dropping a PDF or ZIP archive without attachment presentation style explicitly set.
We first check if we fall into case (1). If so, we can bail early by inserting an attachment; otherwise, we
proceed normally and see if we can read the contents of the drop as web content. If, at the end of default drop
handling, we don't still have a way to represent the dropped content, enter case (2).

(WebCore::Pasteboard::readFilePaths):
(WebCore::Pasteboard::readFilenames): Deleted.

Rename readFilenames to readFilePaths, and reimplement it using informationForItemAtIndex.

* platform/ios/PlatformPasteboardIOS.mm:
(WebCore::pasteboardItemPresentationStyle):
(WebCore::PlatformPasteboard::informationForItemAtIndex):
(WebCore::PlatformPasteboard::filenamesForDataInteraction): Deleted.

Implement informationForItemAtIndex and remove filenamesForDataInteraction. As before, we ask the pasteboard
(i.e. WebItemProviderPasteboard) for information about dropped file URLs. This time, we limit this to a single
file, so we don't end up creating multiple attachment elements for each representation of a single item
provider. See below for -preferredFileUploadURLAtIndex:fileType: for more detail.

* platform/ios/WebItemProviderPasteboard.h:
* platform/ios/WebItemProviderPasteboard.mm:
(-[WebItemProviderLoadResult initWithItemProvider:typesToLoad:]):
(-[WebItemProviderLoadResult canBeRepresentedAsFileUpload]):

Remove this synthesized instance variable and instead just check the item provider's preferredPresentationStyle.

(-[WebItemProviderLoadResult description]):

Add a verbose -description to the load result object. Useful for debugging what was content was loaded from an
item provider on drop.

(-[WebItemProviderPasteboard preferredFileUploadURLAtIndex:fileType:]):

Return the highest fidelity loaded type identifier for a given item.

(-[WebItemProviderPasteboard allDroppedFileURLs]):
(-[WebItemProviderPasteboard typeIdentifiersToLoadForRegisteredTypeIdentfiers:]):

Prefer flat RTFD to RTFD. In the case where attachments are enabled and we're accepting all types of content
using attachment elements as a fallback representation, if the source writes attributed strings to the
pasteboard with com.apple.rtfd at a higher fidelity than com.apple.flat-rtfd, we'll end up loading only
com.apple.rtfd and dropping the text as an attachment element because we cannot convert the dropped content to
markup. Instead, if flat RTFD is present in the item provider, always prefer that over RTFD so that dropping as
regular web content isn't overridden when attachment elements are enabled.

(-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout:]):
(-[WebItemProviderPasteboard droppedFileURLs]): Deleted.
* platform/mac/DragDataMac.mm:
(WebCore::DragData::containsCompatibleContent const):

DragData::containsCompatibleContent should be true when attachment elements are enabled, and there are files we
can drop as attachment elements.

* platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::read):
(WebCore::Pasteboard::readFilePaths):
(WebCore::Pasteboard::readFilenames): Deleted.

Source/WebKit:

Make some minor adjustments for changes to the pasteboard in WebCore. See WebCore/ChangeLog for more detail.
Teaches WebPasteboardProxy et. al. to plumb PasteboardItemInfo from the UI process to the web process via the
new `InformationForItemAtIndex` codepath.

* UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
(WebKit::WebPasteboardProxy::informationForItemAtIndex):
(WebKit::WebPasteboardProxy::getFilenamesForDataInteraction): Deleted.
* UIProcess/WebPasteboardProxy.h:
* UIProcess/WebPasteboardProxy.messages.in:
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::informationForItemAtIndex):
(WebKit::WebPlatformStrategies::getFilenamesForDataInteraction): Deleted.
* WebProcess/WebCoreSupport/WebPlatformStrategies.h:

Source/WebKitLegacy/mac:

Make some minor adjustments for changes to the pasteboard in WebCore. See WebCore/ChangeLog for more detail.

* WebCoreSupport/WebPlatformStrategies.h:
* WebCoreSupport/WebPlatformStrategies.mm:
(WebPlatformStrategies::informationForItemAtIndex):
(WebPlatformStrategies::getFilenamesForDataInteraction): Deleted.

Tools:

Adds 3 new API tests to exercise different use cases of dropping content as attachment elements when the runtime
switch is enabled. See below for more details.

* TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:
(-[NSItemProvider registerData:type:]):
(platformCopyPNG):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/ios/DataInteractionTests.mm:

Fix some currently failing iOS drag and drop tests. In this case, there's no reason RTFD should appear in the
source item provider when dragging rich text *without* attachments, so this should have been a check for just
kUTTypeRTF instead.

(TestWebKitAPI::TEST):

Tests a few cases of inserting attachment elements via drop:
1.  We should distinguish between drops containing rich/plain text files from just dropping rich/plain text.
    Instead of inserting the contents as inline web content, this should generate attachment elements.
2.  Test the fallback mechanism for inserting attachment elements. If the preferred presentation style is not
    explicitly set, but there's nothing WebKit would otherwise do with the dropped content, then we should fall
    back to inserting the content as an attachment.
3.  Test that if multiple attachments and inline item providers are present, WebKit will respect the order in
    which they were inserted by the source (as opposed to, for instance, putting all of the attachments in front
    or at the end).

* TestWebKitAPI/cocoa/TestWKWebView.h:
* TestWebKitAPI/cocoa/TestWKWebView.mm:
(-[TestWKWebView objectByEvaluatingJavaScript:]):

Add a helper method to return an object that represents the result of evaluating some given script, and rewrite
-stringByEvaluatingJavaScript to just turn around and call this.

(-[TestWKWebView stringByEvaluatingJavaScript:]):

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

20 months agoReplace hard-coded paths in shebangs with #!/usr/bin/env
commit-queue@webkit.org [Thu, 4 Jan 2018 07:18:18 +0000 (07:18 +0000)]
Replace hard-coded paths in shebangs with #!/usr/bin/env
https://bugs.webkit.org/show_bug.cgi?id=181040

Patch by Ting-Wei Lan <lantw44@gmail.com> on 2018-01-03
Reviewed by Alex Christensen.

.:

* Source/cmake/tools/scripts/auto-version.pl:
* Source/cmake/tools/scripts/feature-defines.pl:
* Source/cmake/tools/scripts/version-stamp.pl:

Source/JavaScriptCore:

* Scripts/UpdateContents.py:
* Scripts/cssmin.py:
* Scripts/generate-combined-inspector-json.py:
* Scripts/xxd.pl:
* create_hash_table:
* generate-bytecode-files:
* wasm/generateWasm.py:
* wasm/generateWasmOpsHeader.py:
* yarr/generateYarrCanonicalizeUnicode:

Source/WebCore:

* bindings/scripts/InFilesCompiler.pm:
* bindings/scripts/InFilesParser.pm:
* bindings/scripts/generate-bindings-all.pl:
* bindings/scripts/generate-bindings.pl:
* bindings/scripts/preprocess-idls.pl:
* css/make-css-file-arrays.pl:
* css/makeprop.pl:
* css/makevalues.pl:
* dom/make_event_factory.pl:
* dom/make_names.pl:
* extract-localizable-strings.pl:
* make-hash-tools.pl:

Source/WebCore/PAL:

* AVFoundationSupport.py:

Source/WebInspectorUI:

* Scripts/combine-resources.pl:
* Scripts/copy-user-interface-resources-dryrun.rb:
* Scripts/copy-user-interface-resources.pl:
* Scripts/fix-worker-imports-for-optimized-builds.pl:
* Scripts/remove-console-asserts-dryrun.rb:
* Scripts/remove-console-asserts.pl:
* Scripts/update-LegacyInspectorBackendCommands.rb:
* Scripts/update-codemirror-resources.rb:
* WebInspectorUI.vcxproj/build-webinspectorui.pl:

Source/WebKit:

* Scripts/generate-forwarding-headers.pl:

Source/WebKitLegacy:

* scripts/generate-webkitversion.pl:

Tools:

* BuildSlaveSupport/build-launcher-app:
* BuildSlaveSupport/build-launcher-dmg:
* BuildSlaveSupport/build.webkit.org-config/steps_unittest.py:
* BuildSlaveSupport/built-product-archive:
* BuildSlaveSupport/clean-build:
* BuildSlaveSupport/delete-stale-build-files:
* BuildSlaveSupport/download-built-product:
* BuildSlaveSupport/gtk/buildbot/log/run:
* BuildSlaveSupport/gtk/buildbot/run:
* BuildSlaveSupport/gtk/pulseaudio/run:
* BuildSlaveSupport/kill-old-processes:
* BuildSlaveSupport/test-result-archive:
* BuildSlaveSupport/win/kill-old-processes:
* Scripts/SpacingHeuristics.pm:
* Scripts/add-include:
* Scripts/build-api-tests:
* Scripts/build-dumprendertree:
* Scripts/build-imagediff:
* Scripts/build-jsc:
* Scripts/build-webkit:
* Scripts/build-webkittestrunner:
* Scripts/check-Xcode-source-file-types:
* Scripts/check-dom-results:
* Scripts/check-for-exit-time-destructors:
* Scripts/check-for-global-initializers:
* Scripts/check-for-inappropriate-objc-class-names:
* Scripts/check-for-weak-vtables-and-externals:
* Scripts/clean-header-guards:
* Scripts/compare-timing-files:
* Scripts/configure-xcode-for-ios-development:
* Scripts/copy-webkitlibraries-to-product-directory:
* Scripts/create-exports:
* Scripts/debug-minibrowser:
* Scripts/debug-safari:
* Scripts/debug-test-runner:
* Scripts/do-file-rename:
* Scripts/do-webcore-rename:
* Scripts/dump-webkit-tests-run:
* Scripts/ensure-valid-python:
* Scripts/execAppWithEnv:
* Scripts/extract-localizable-js-strings:
* Scripts/filter-build-webkit:
* Scripts/find-extra-includes:
* Scripts/fix-blink-patch:
* Scripts/generate-coverage-data:
* Scripts/git-add-reviewer:
* Scripts/jsc-stress-test-helpers/js-exception-fuzz:
* Scripts/jsc-stress-test-helpers/js-executable-allocation-fuzz:
* Scripts/jsc-stress-test-helpers/js-osr-exit-fuzz:
* Scripts/make-new-script-test:
* Scripts/make-script-test-wrappers:
* Scripts/package-root:
* Scripts/parse-malloc-history:
* Scripts/report-include-statistics:
* Scripts/resolve-ChangeLogs:
* Scripts/run-api-tests:
* Scripts/run-bindings-tests:
* Scripts/run-content-extension-tester:
* Scripts/run-iexploder-tests:
* Scripts/run-javascriptcore-tests:
* Scripts/run-jsc:
* Scripts/run-leaks:
* Scripts/run-mangleme-tests:
* Scripts/run-minibrowser:
* Scripts/run-pageloadtest:
* Scripts/run-regexp-tests:
* Scripts/run-safari:
* Scripts/run-sunspider:
* Scripts/run-test-runner:
* Scripts/run-webkit-app:
* Scripts/run-webkit-httpd:
* Scripts/run-webkit-websocketserver:
* Scripts/set-webkit-configuration:
* Scripts/show-pretty-diff:
* Scripts/sort-Xcode-project-file:
* Scripts/split-file-by-class:
* Scripts/sunspider-compare-results:
* Scripts/svn-apply:
* Scripts/svn-unapply:
* Scripts/test-webkit-scripts:
* Scripts/test-webkitperl:
* Scripts/update-iexploder-cssproperties:
* Scripts/update-javascriptcore-test-results:
* Scripts/update-webkit:
* Scripts/update-webkit-auxiliary-libs:
* Scripts/update-webkit-dependency:
* Scripts/update-webkit-libs-jhbuild:
* Scripts/update-webkit-localizable-strings:
* Scripts/update-webkit-support-libs:
* Scripts/update-webkitgtk-libs:
* Scripts/update-webkitwpe-libs:
* Scripts/webkit-build-directory:
* Scripts/webkitperl/LoadAsModule.pm:
* Scripts/webkitperl/VCSUtils_unittest/decodeGitBinaryPatch.pl:
* Scripts/webkitperl/VCSUtils_unittest/fixChangeLogPatch.pl:
* Scripts/webkitperl/VCSUtils_unittest/fixChangeLogPatchThenSetChangeLogDateAndReviewer.pl:
* Scripts/webkitperl/VCSUtils_unittest/fixSVNPatchForAdditionWithHistory.pl:
* Scripts/webkitperl/VCSUtils_unittest/generatePatchCommand.pl:
* Scripts/webkitperl/VCSUtils_unittest/mergeChangeLogs.pl:
* Scripts/webkitperl/VCSUtils_unittest/parseChunkRange.pl:
* Scripts/webkitperl/VCSUtils_unittest/parseDiff.pl:
* Scripts/webkitperl/VCSUtils_unittest/parseDiffHeader.pl:
* Scripts/webkitperl/VCSUtils_unittest/parseDiffWithMockFiles.pl:
* Scripts/webkitperl/VCSUtils_unittest/parseFirstEOL.pl:
* Scripts/webkitperl/VCSUtils_unittest/parseGitDiffHeader.pl:
* Scripts/webkitperl/VCSUtils_unittest/parsePatch.pl:
* Scripts/webkitperl/VCSUtils_unittest/parseSvnDiffFooter.pl:
* Scripts/webkitperl/VCSUtils_unittest/parseSvnDiffHeader.pl:
* Scripts/webkitperl/VCSUtils_unittest/parseSvnProperty.pl:
* Scripts/webkitperl/VCSUtils_unittest/parseSvnPropertyValue.pl:
* Scripts/webkitperl/VCSUtils_unittest/parseUnifiedDiffHeader.pl:
* Scripts/webkitperl/VCSUtils_unittest/prepareParsedPatch.pl:
* Scripts/webkitperl/VCSUtils_unittest/removeEOL.pl:
* Scripts/webkitperl/VCSUtils_unittest/runCommand.pl:
* Scripts/webkitperl/VCSUtils_unittest/runPatchCommand.pl:
* Scripts/webkitperl/VCSUtils_unittest/setChangeLogDateAndReviewer.pl:
* Scripts/webkitperl/auto-version_unittest/autoVersionTests.pl:
* Scripts/webkitperl/auto-version_unittest/versionStampTests.pl:
* Scripts/webkitperl/filter-build-webkit_unittest/shouldIgnoreLine_unittests.pl:
* Scripts/webkitperl/prepare-ChangeLog_unittest/extractLineRangeBeforeAndAfterChange.pl:
* Scripts/webkitperl/prepare-ChangeLog_unittest/fetchRadarURLFromBugXMLData.pl:
* Scripts/webkitperl/prepare-ChangeLog_unittest/generateFunctionLists.pl:
* Scripts/webkitperl/prepare-ChangeLog_unittest/parser_unittests.pl:
* Scripts/webkitperl/prepare-ChangeLog_unittest/resources/perl_unittests.pl:
* Scripts/webkitperl/run-leaks_unittest/run-leaks-report-v1.0.pl:
* Scripts/webkitperl/run-leaks_unittest/run-leaks-report-v2.0-new.pl:
* Scripts/webkitperl/run-leaks_unittest/run-leaks-report-v2.0-old.pl:
* Scripts/webkitperl/webkitdirs_unittest/appendToEnvironmentVariableList.pl:
* Scripts/webkitperl/webkitdirs_unittest/checkForArgumentAndRemoveFromArrayRef.pl:
* Scripts/webkitperl/webkitdirs_unittest/checkForArgumentAndRemoveFromArrayRefGettingValue.pl:
* Scripts/webkitperl/webkitdirs_unittest/extractNonMacOSHostConfiguration.pl:
* Scripts/webkitperl/webkitdirs_unittest/prependToEnvironmentVariableList.pl:
* Scripts/webkitpy/layout_tests/servers/run_webkit_httpd.py:
* ccache/ccache-clang:
* ccache/ccache-clang++:
* ccache/ccache-wrapper:
* gtk/install-dependencies:
* iExploder/iexploder-1.3.2/htdocs/iexploder.cgi:
* iExploder/iexploder-1.3.2/htdocs/webserver.rb:
* iExploder/iexploder-1.3.2/tools/lasthit.rb:
* iExploder/iexploder-1.3.2/tools/osx_last_crash.rb:
* iExploder/iexploder-1.3.2/tools/showtest.rb:
* iExploder/iexploder-1.7.2/src/browser_harness.rb:
* iExploder/iexploder-1.7.2/src/iexploder.cgi:
* iExploder/iexploder-1.7.2/src/webserver.rb:
* iExploder/iexploder-1.7.2/tools/lasthit.rb:
* iExploder/iexploder-1.7.2/tools/osx_last_crash.rb:
* wpe/install-dependencies:

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

20 months agoWeb Inspector: "Log Value" context menu is sometimes unavailable
commit-queue@webkit.org [Thu, 4 Jan 2018 05:58:24 +0000 (05:58 +0000)]
Web Inspector: "Log Value" context menu is sometimes unavailable
https://bugs.webkit.org/show_bug.cgi?id=181278
<rdar://problem/36281649>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2018-01-03
Reviewed by Devin Rousso.

* UserInterface/Views/ObjectPreviewView.css:
(.object-preview > .title):
* UserInterface/Views/ObjectTreeView.css:
(.object-tree.expanded > .title):
Make the expanded object title information 16px tall to match ObjectTree
tree element row heights. This eliminates the floating console message
location from overlapping the first ObjectTree's TreeElement and causing
truncation and other behavior issues (like Context Menu identification).

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

20 months ago[Attachment Support] Add plumbing for starting a drag with promised blob data
wenson_hsieh@apple.com [Thu, 4 Jan 2018 05:58:03 +0000 (05:58 +0000)]
[Attachment Support] Add plumbing for starting a drag with promised blob data
https://bugs.webkit.org/show_bug.cgi?id=181201

Reviewed by Tim Horton.

Source/WebCore:

Adds logic to allow dragging an attachment element as a file by sending promised blob information to the UI
process. See comments below for more detail.

The only change in behavior is that dragging an attachment element will no longer write web content and injected
bundle data to the pasteboard if the attachment element's file attribute is nonnull. This will cause one
existing WK1 layout test to fail, but will otherwise not affect any attachment editing clients. On iOS,
attachment elements in the Mail viewer can be dragged, but each attachment's file is null, so we fall back to
current behavior; on macOS, Mail currently overrides the drag completely, beginning at -mouseDown:, so this
doesn't make a difference to macOS Mail either.

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

Add a helper method to retrieve an attachment element as web archive data, for moving attachments within the
same document. Also gives the injected editor bundle a chance to supply custom pasteboard types.

* loader/EmptyClients.cpp:
* page/DragClient.h:
(WebCore::DragClient::prepareToDragPromisedBlob):

Add new DragClient methods to send information about a promised blob to the UI process.

* page/DragController.cpp:
(WebCore::DragController::startDrag):

Call dragAttachmentElement when starting a drag on an attachment element.

(WebCore::DragController::dragAttachmentElement):

Try to begin dragging a given attachment element, propagating promised blob information to the client layers.
Returns true iff the attachment is backed by blob data (i.e. the file is nonnull).

* platform/PromisedBlobInfo.h:

Add a list of additional types and data to PromisedBlobInfo. In addition to the promised blob info, this would
allow injected bundle data and other private types alongside the main attachment data on the pasteboard.

Source/WebKit:

Add boilerplate plumbing for PrepareToDragPromisedBlob, which delivers blob promises to the UI process when
dragging, respectively.

* Scripts/webkit/messages.py:
(headers_for_type):
* Shared/WebCoreArgumentCoders.cpp:
(IPC::encodeTypesAndData):
(IPC::decodeTypesAndData):
(IPC::ArgumentCoder<PasteboardWebContent>::encode):
(IPC::ArgumentCoder<PasteboardWebContent>::decode):
(IPC::ArgumentCoder<PasteboardImage>::encode):
(IPC::ArgumentCoder<PasteboardImage>::decode):
(IPC::ArgumentCoder<PromisedBlobInfo>::encode):
(IPC::ArgumentCoder<PromisedBlobInfo>::decode):

Add IPC support PromisedBlobInfo's additionalTypes and additionalData.

(IPC::encodeClientTypesAndData): Deleted.
(IPC::decodeClientTypesAndData): Deleted.

Rename these helper functions and move them to the top of the file.

* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::prepareToDragPromisedBlob):
* UIProcess/PageClient.h:
(WebKit::PageClient::prepareToDragPromisedBlob):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::prepareToDragPromisedBlob):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::prepareToDragPromisedBlob):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _prepareToDragPromisedBlob:]):
* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::prepareToDragPromisedBlob):
* WebProcess/WebCoreSupport/WebDragClient.cpp:
(WebKit::WebDragClient::prepareToDragPromisedBlob):
* WebProcess/WebCoreSupport/WebDragClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::prepareToDragPromisedBlob):
* WebProcess/WebPage/WebPage.h:

Source/WebKitLegacy/mac:

Minor adjustment to account for a DragClient interface change. See WebCore ChangeLog for more details.

* WebCoreSupport/WebDragClient.h:

LayoutTests:

Remove a WK1 LayoutTest testing drag and drop of an attachment element into a contenteditable. This test no
longer passes because the implementation of attachment dragging on macOS is not yet implemented. Subsequent
patches will test this scenario once again, but as a WK2 macOS drag and drop API test.

* editing/pasteboard/drag-and-drop-attachment-contenteditable-expected.txt: Removed.
* editing/pasteboard/drag-and-drop-attachment-contenteditable.html: Removed.
* platform/gtk/TestExpectations:
* platform/ios/TestExpectations:
* platform/mac-wk2/TestExpectations:
* platform/win/TestExpectations:

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

20 months agoWeb Inspector: RTL - DOM Tree Element selection doesn't work
commit-queue@webkit.org [Thu, 4 Jan 2018 05:57:23 +0000 (05:57 +0000)]
Web Inspector: RTL - DOM Tree Element selection doesn't work
https://bugs.webkit.org/show_bug.cgi?id=181275
<rdar://problem/36290450>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2018-01-03
Reviewed by Devin Rousso.

* UserInterface/Views/TreeOutline.js:
(WI.TreeOutline.prototype.treeElementFromEvent):
Provide a better explanation for why we are making the `x` adjustment here,
to detect the inner most tree element along the horizontal. Fix the algorithm
for RTL, since the intent is to adjust to the trailing edge of the container
which is on the opposite side in RTL.

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

20 months agoREGRESSION (r212929): WKSnapshotConfiguration may leak an NSNumber when deallocated
ddkilzer@apple.com [Thu, 4 Jan 2018 05:23:54 +0000 (05:23 +0000)]
REGRESSION (r212929): WKSnapshotConfiguration may leak an NSNumber when deallocated
<https://webkit.org/b/181274>

Reviewed by Joseph Pecoraro.

* UIProcess/API/Cocoa/WKSnapshotConfiguration.mm:
(-[WKSnapshotConfiguration dealloc]): Implement method and
release _snapshotWidth.

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

20 months agoRemove the 'resolutionScale' parameter from ImageBufferDataCG get/putBytes
simon.fraser@apple.com [Thu, 4 Jan 2018 04:39:33 +0000 (04:39 +0000)]
Remove the 'resolutionScale' parameter from ImageBufferDataCG get/putBytes
https://bugs.webkit.org/show_bug.cgi?id=181268

Reviewed by Alex Christensen.

These functions were always called with resolutionScale=1.

* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::ImageBuffer::getUnmultipliedImageData const):
(WebCore::ImageBuffer::getPremultipliedImageData const):
(WebCore::ImageBuffer::putByteArray):
* platform/graphics/cg/ImageBufferDataCG.cpp:
(WebCore::ImageBufferData::getData const):
(WebCore::ImageBufferData::putData):
(WebCore::affineWarpBufferData): Deleted.
* platform/graphics/cg/ImageBufferDataCG.h:

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

20 months agoStorage Access API: Refactor XPC for access removal to go straight from the web proce...
wilander@apple.com [Thu, 4 Jan 2018 04:21:58 +0000 (04:21 +0000)]
Storage Access API: Refactor XPC for access removal to go straight from the web process to the network process
https://bugs.webkit.org/show_bug.cgi?id=181270
<rdar://problem/36289544>

Reviewed by Alex Christensen.

Source/WebCore:

No new tests. Existing test re-enabled.

This change refactors how the web process tells the network process
to remove storage access. Previously, this was done over the UI process
just like requests for storage access. But since no further reasoning
is needed, the message should go straight from the web process to the
network process for performance reasons and to minimize the risk of a
race.

As a consequence, the XPC code for storage access removal in the UI
process is deleted.

* platform/network/cf/NetworkStorageSessionCFNet.cpp:
(WebCore::NetworkStorageSession::cookieStoragePartition const):
    Removes the storageAccessAPIEnabled check since the flag
    doesn't get propagated when the network process is created.
    Figuring this out will take some work which is unnecessary
    when we already gate access to the feature in Document.idl.

Source/WebKit:

This change refactors how the web process tells the network process
to remove storage access. Previously, this was done over the UI process
just like requests for storage access. But since no further reasoning
is needed, the message should go straight from the web process to the
network process for performance reasons and to minimize the risk of a
race.

As a consequence, the XPC code for storage access removal in the UI
process is deleted.

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::removeStorageAccess):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::removeStorageAccess): Deleted.
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::removeStorageAccess): Deleted.
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::requestStorageAccess):
(WebKit::WebPageProxy::removeStorageAccess): Deleted.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::requestStorageAccess):
(WebKit::WebsiteDataStore::removeStorageAccess): Deleted.
* UIProcess/WebsiteData/WebsiteDataStore.h:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::detachedFromParent2):
(WebKit::WebFrameLoaderClient::dispatchWillChangeDocument):

LayoutTests:

This change refactors how the web process tells the network process
to remove storage access. Previously, this was done over the UI process
just like requests for storage access. But since no further reasoning
is needed, the message should go straight from the web process to the
network process for performance reasons and to minimize the risk of a
race.

As a consequence, the XPC code for storage access removal in the UI
process is deleted.

* platform/mac-wk2/TestExpectations:
    Re-enables the test for this code path.

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

20 months ago[Win] WebKitLegacy compile error.
pvollan@apple.com [Thu, 4 Jan 2018 04:21:29 +0000 (04:21 +0000)]
[Win] WebKitLegacy compile error.
https://bugs.webkit.org/show_bug.cgi?id=181257
rdar://problem/36273774

Reviewed by Alex Christensen.

The include file 'pal/text/UnencodableHandling.h' is not found. Add folder to list of forwarding
headers directories.

* pal/PlatformWin.cmake:

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

20 months agocom.apple.WebKit.Networking crash in com.apple.Foundation: -[__NSOperationInternal...
ddkilzer@apple.com [Thu, 4 Jan 2018 04:18:53 +0000 (04:18 +0000)]
com.apple.WebKit.Networking crash in com.apple.Foundation: -[__NSOperationInternal _start:]
<https://webkit.org/b/181272>
<rdar://problem/35657310>

Reviewed by Alex Christensen.

* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(downgradeRequest): Remove unnecessary -autorelease.

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

20 months agoDisable SharedArrayBuffers from Web API
msaboff@apple.com [Thu, 4 Jan 2018 01:53:41 +0000 (01:53 +0000)]
Disable SharedArrayBuffers from Web API
https://bugs.webkit.org/show_bug.cgi?id=181266

Reviewed by Saam Barati.

JSTests:

Disabled SharedArrayBuffer tests.

* stress/SharedArrayBuffer-opt.js:
* stress/SharedArrayBuffer.js:
* stress/array-buffer-byte-length.js:
* stress/atomics-add-uint32.js:
* stress/atomics-known-int-use.js:
* stress/atomics-neg-zero.js:
* stress/atomics-store-return.js:
* stress/lars-sab-workers.js:
* stress/regress-159779-1.js:
* stress/regress-159779-2.js:
* stress/regress-170473.js:
* test262.yaml:

Source/JavaScriptCore:

Removed SharedArrayBuffer prototype and structure from GlobalObject creation
to disable.

* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::visitChildren):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::arrayBufferPrototype const):
(JSC::JSGlobalObject::arrayBufferStructure const):

Source/WTF:

Turn off SharedArrayBuffers using a compile time flag ENABLE_SHARED_ARRAY_BUFFER.

* wtf/Platform.h:

LayoutTests:

Disabled SharedArrayBuffer tests.

* TestExpectations:

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

20 months ago2018-01-03 James Craig <jcraig@apple.com>
jcraig@apple.com [Thu, 4 Jan 2018 01:44:15 +0000 (01:44 +0000)]
2018-01-03  James Craig  <jcraig@apple.com>

        AX: when invert colors is on, double-invert certain media elements in UserAgentStyleSheet
        https://bugs.webkit.org/show_bug.cgi?id=168447
        <rdar://problem/30559874>

        Reviewed by Simon Fraser.

        Double-invert video when platform 'invert colors' setting is enabled. Behavior matches
        current 'Smart Invert' feature of Safari Reader on macOS/iOS and other iOS native apps.

        Tests: accessibility/smart-invert-reference.html
               accessibility/smart-invert.html

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

20 months agoAdd "noInline" to $vm
msaboff@apple.com [Thu, 4 Jan 2018 00:55:41 +0000 (00:55 +0000)]
Add "noInline" to $vm
https://bugs.webkit.org/show_bug.cgi?id=181265

Reviewed by Mark Lam.

This would be useful for web based tests.

* tools/JSDollarVM.cpp:
(JSC::getExecutableForFunction):
(JSC::functionNoInline):
(JSC::JSDollarVM::finishCreation):

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

20 months agoLayoutTest http/tests/media/media-stream/disconnected-frame.html to consistently...
commit-queue@webkit.org [Thu, 4 Jan 2018 00:51:00 +0000 (00:51 +0000)]
LayoutTest http/tests/media/media-stream/disconnected-frame.html to consistently fail an assertion: !m_adoptionIsRequired
https://bugs.webkit.org/show_bug.cgi?id=181264

Patch by Youenn Fablet <youenn@apple.com> on 2018-01-03
Reviewed by Eric Carlson.

Covered by http/tests/media/media-stream/disconnected-frame.html not crashing anymore in Debug builds.
Calling suspendIfNeeded in create method instead of constructor.

* Modules/mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::create):
(WebCore::UserMediaRequest::UserMediaRequest):

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

20 months agoRemove DeprecatedCSSOMValue::equals
antti@apple.com [Thu, 4 Jan 2018 00:49:48 +0000 (00:49 +0000)]
Remove DeprecatedCSSOMValue::equals
https://bugs.webkit.org/show_bug.cgi?id=181241

Reviewed by Zalan Bujtas.

This is dead code.

* css/DeprecatedCSSOMValue.cpp:
(WebCore::compareCSSOMValues): Deleted.
(WebCore::DeprecatedCSSOMValue::equals const): Deleted.
* css/DeprecatedCSSOMValue.h:
(WebCore::DeprecatedCSSOMValue::operator== const): Deleted.
(WebCore::DeprecatedCSSOMComplexValue::equals const): Deleted.
* css/DeprecatedCSSOMValueList.cpp:
(WebCore::DeprecatedCSSOMValueList::equals const): Deleted.
* css/DeprecatedCSSOMValueList.h:

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

20 months agoRemove unnecessary flushing of Butterfly pointer in functionCpuClflush()
msaboff@apple.com [Thu, 4 Jan 2018 00:47:15 +0000 (00:47 +0000)]
Remove unnecessary flushing of Butterfly pointer in functionCpuClflush()
https://bugs.webkit.org/show_bug.cgi?id=181263

Reviewed by Mark Lam.

Flushing the butterfly pointer provides no benefit and slows this function.

* tools/JSDollarVM.cpp:
(JSC::functionCpuClflush):

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

20 months agoWeb Inspector: Find banner sometimes does not work (when already populated and shown...
commit-queue@webkit.org [Thu, 4 Jan 2018 00:46:52 +0000 (00:46 +0000)]
Web Inspector: Find banner sometimes does not work (when already populated and shown for first time on resource)
https://bugs.webkit.org/show_bug.cgi?id=181255
<rdar://problem/36248855>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2018-01-03
Reviewed by Matt Baker.

* UserInterface/Views/TextEditor.js:
(WI.TextEditor.prototype.set string):
Defer any early searches until the initial content of a TextEditor has been set.
Such searches can happen when the FindBanner already has content when a
ContentView is first opened and needs to load its content from the backend.
Further, even though the content may be loaded from the backend before the
search results, microtask hops might cause the content to get to the TextEditor
after the search results.

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

20 months agoFix BytecodeParser op_catch assert to work with useProfiler=1
sbarati@apple.com [Thu, 4 Jan 2018 00:44:37 +0000 (00:44 +0000)]
Fix BytecodeParser op_catch assert to work with useProfiler=1
https://bugs.webkit.org/show_bug.cgi?id=181260

Reviewed by Keith Miller.

op_catch was asserting that the current block was empty. This is only true
if the profiler isn't enabled. When the profiler is enabled, we will
insert a CountExecution node before each bytecode. This patch fixes the
assert to work with the profiler.

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

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