2017-12-05 Matt Lewis Unreviewed, rolling out r225430. This caused an API failure on release. Reverted changeset: "Move DateComponents into WTF" https://bugs.webkit.org/show_bug.cgi?id=180211 https://trac.webkit.org/changeset/225430 2017-12-05 Simon Fraser Composited frames incorrectly get requestAnimationFrame throttled https://bugs.webkit.org/show_bug.cgi?id=178396 Reviewed by Zalan Bujtas. If a composited iframe was inside overflow:scroll, and the overflow was scrolled to the left further than the window width, then RenderLayer::childrenClipRect() would return an empty rectangle and we'd incorrectly consider the iframe out of view, and thus throttle its requestAnimationFrame. childrenClipRect() was taking unscaledDocumentRect(), applying the clip, and then mapping the result from local to absolute coordinates (which mapped it through the overflow scroll offset). This is incorrect because it considers the unscaledDocumentRect() to be in local coordinates, which it is not. Instead, start with the infinite rect, which essentially tells us if we have any clipping, and then intersect that with the document rect at the end. Something similar is done in other places that call. calculateRects(). Test: fast/animation/request-animation-frame-throttle-inside-overflow-scroll.html * rendering/RenderLayer.cpp: (WebCore::RenderLayer::calculateClipRects const): 2017-12-05 Michael Saboff Make WebKit build for ARM64_32 https://bugs.webkit.org/show_bug.cgi?id=180447 Reviewed by Mark Lam. No new test as this isn't a change to functionality. * platform/graphics/transforms/TransformationMatrix.cpp: (WebCore::TransformationMatrix::multiply): Fallback to the C++ version for ARM64_32. 2017-12-05 Chris Dumez XMLHttpRequest should not be exposed to service workers https://bugs.webkit.org/show_bug.cgi?id=180446 Reviewed by Youenn Fablet. Stop exposing XMLHttpRequest to service workers, as per: - https://xhr.spec.whatwg.org/#interface-xmlhttprequest * xml/XMLHttpRequest.idl: 2017-12-05 Joseph Pecoraro Web Inspector: content views for resources loaded through XHR do not reflect declared mime-type https://bugs.webkit.org/show_bug.cgi?id=141389 Reviewed by Brian Burg. Updated: http/tests/inspector/network/xhr-response-body.html: http/tests/inspector/network/fetch-response-body.html: * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::didFinishLoading): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didFinishXHRLoadingImpl): Deleted. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didFinishXHRLoading): Deleted. Remove special handling of XHR content that decoded output as text. * inspector/NetworkResourcesData.h: (WebCore::NetworkResourcesData::ResourceData::requestId const): (WebCore::NetworkResourcesData::ResourceData::loaderId const): (WebCore::NetworkResourcesData::ResourceData::frameId const): (WebCore::NetworkResourcesData::ResourceData::url const): (WebCore::NetworkResourcesData::ResourceData::content const): (WebCore::NetworkResourcesData::ResourceData::isContentEvicted const): (WebCore::NetworkResourcesData::ResourceData::textEncodingName const): * inspector/NetworkResourcesData.cpp: (WebCore::NetworkResourcesData::ResourceData::ResourceData): (WebCore::NetworkResourcesData::ResourceData::decodeDataToContent): (WebCore::NetworkResourcesData::responseReceived): (WebCore::NetworkResourcesData::setResourceContent): (WebCore::shouldBufferResourceData): (WebCore::NetworkResourcesData::maybeAddResourceData): (WebCore::NetworkResourcesData::maybeDecodeDataToContent): Make NetworkResourcesData only create a text decoder for resources we really think are text, and buffer resource data if it is text data or if it is a resource that would otherwise not be buffered by WebCore (such as XHRs with a DoNotBufferData policy). This ensures that the Inspector will have data to show for resources that won't be cached. * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::resourceContent): (WebCore::InspectorPageAgent::sourceMapURLForResource): (WebCore::InspectorPageAgent::searchInResource): (WebCore::InspectorPageAgent::searchInResources): (WebCore::hasTextContent): Deleted. (WebCore::InspectorPageAgent::cachedResourceContent): Deleted. (WebCore::InspectorPageAgent::createTextDecoder): Deleted. (WebCore::textContentForCachedResource): Deleted. * inspector/agents/InspectorPageAgent.h: * inspector/agents/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::didReceiveData): (WebCore::InspectorNetworkAgent::willDestroyCachedResource): (WebCore::InspectorNetworkAgent::getResponseBody): (WebCore::InspectorNetworkAgent::shouldTreatAsText): (WebCore::InspectorNetworkAgent::createTextDecoder): (WebCore::InspectorNetworkAgent::textContentForCachedResource): (WebCore::InspectorNetworkAgent::cachedResourceContent): (WebCore::textContentForResourceData): (WebCore::InspectorNetworkAgent::searchOtherRequests): (WebCore::isErrorStatusCode): Deleted. (WebCore::InspectorNetworkAgent::didFinishXHRLoading): Deleted. * inspector/agents/InspectorNetworkAgent.h: Move static PageAgent functions related to the generic data tuple (content, base64Encoded) to NetworkAgent. Also generalize it to not rely on the CachedResourceType, but instead rely on the MIME type. This has a few changes in behavior: - Images, may now be text if they have a text mime type (image/svg+xml). - XHR / Fetch / Other may be sent as text if they have a text mime type. - XHR / Fetch / Other are not assumed to be text, and may be sent as base64 encoded. For this to be useful the frontend should also check the mime type and display an appropriate ContentView. 2017-12-05 Youenn Fablet Implement https://w3c.github.io/ServiceWorker/#clients-claim https://bugs.webkit.org/show_bug.cgi?id=180261 Reviewed by Chris Dumez. Test: http/tests/workers/service/serviceworkerclients-claim.https.html Implement claim by going to the storage process and then iterate over clients to see whether active worker can be set. Update SWServerWorker to call registration tryClear/tryActivate whenever a service worker has no pending event. * workers/service/ServiceWorkerClients.cpp: (WebCore::ServiceWorkerClients::claim): * workers/service/context/SWContextManager.h: * workers/service/server/SWServer.cpp: (WebCore::SWServer::claim): (WebCore::SWServer::doRegistrationMatching): (WebCore::SWServer::doRegistrationMatching const): Deleted. * workers/service/server/SWServer.h: (WebCore::SWServer::Connection::doRegistrationMatching): * workers/service/server/SWServerRegistration.cpp: (WebCore::SWServerRegistration::controlClient): * workers/service/server/SWServerRegistration.h: * workers/service/server/SWServerToContextConnection.cpp: (WebCore::SWServerToContextConnection::claim): * workers/service/server/SWServerToContextConnection.h: * workers/service/server/SWServerWorker.cpp: (WebCore::SWServerWorker::claim): * workers/service/server/SWServerWorker.h: 2017-12-05 Per Arne Vollan [Win] Scrollbars are sometimes not rendered in accelerated compositing mode. https://bugs.webkit.org/show_bug.cgi?id=180431 Reviewed by Simon Fraser. No new tests, covered by existing tests. When a scroll layer is required, we will create an overflow control hosts layer. In this case the method RenderLayerCompositor::shouldCompositeOverflowControls() should return true, otherwise the scrollbars will not be rendered. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::shouldCompositeOverflowControls const): 2017-12-05 Youenn Fablet Call "Terminate Service Worker" on all workers when all their clients are gone https://bugs.webkit.org/show_bug.cgi?id=179552 Unreviewed. * workers/service/server/SWServer.cpp: Reducing from 60_s to 10_s based on bugzilla comment. 2017-12-05 Chris Dumez Add support for ServiceWorkerContainer.prototype.ready https://bugs.webkit.org/show_bug.cgi?id=180383 Reviewed by Youenn Fablet. Add support for ServiceWorkerContainer.prototype.ready: - https://w3c.github.io/ServiceWorker/#navigator-service-worker-ready No new tests, rebaselined existing test. * workers/service/SWClientConnection.h: * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::ServiceWorkerContainer): (WebCore::ServiceWorkerContainer::ready): * workers/service/ServiceWorkerContainer.h: * workers/service/ServiceWorkerRegistrationKey.h: * workers/service/server/SWServer.cpp: (WebCore::SWServer::resolveRegistrationReadyRequests): * workers/service/server/SWServer.h: * workers/service/server/SWServerRegistration.cpp: (WebCore::SWServerRegistration::activate): (WebCore::SWServerRegistration::setIsUninstalling): * workers/service/server/SWServerRegistration.h: 2017-12-05 Yusuke Suzuki Modernize WebThread code for further refactoring https://bugs.webkit.org/show_bug.cgi?id=180344 Reviewed by Alex Christensen. When touching Thread and its initialization component, we need to touch web thread initialization code too. However, since web thread code is old, it's style is not following to WebKit coding style guidelines. This patch first modernizes WebThread code for further refactoring. 1. `Type*` instead of `Type *`. 2. Use std::call_once instead of pthread_once. 3. Use static_cast instead of C-cast. 4. Use nullptr instead of NULL. 5. Use `ret` or `!ret` instead of `ret != 0` or `ret == 0`. 6. Do not use #pragma unused. 7. if-else with one statement should not have braces. In this patch, we do not change pthread_condition_t to WTF::Condition and pthread_mutex_t to WTF::Lock since web thread code requires extra care about threading. No behavior change. * platform/ios/wak/WebCoreThread.mm: (-[NSObject releaseOnMainThread]): (SendMessage): (HandleDelegateSource): (SendDelegateMessage): (WebThreadAdoptAndRelease): (lockWebCoreReleaseLock): (unlockWebCoreReleaseLock): (WebCoreObjCDeallocOnWebThreadImpl): (WebCoreObjCDeallocWithWebThreadLockImpl): (HandleWebThreadReleaseSource): (WebThreadCallDelegate): (WebThreadPostNotification): (WebThreadCallDelegateAsync): (WebThreadMakeNSInvocation): (MainRunLoopAutoUnlock): (_WebThreadAutoLock): (WebRunLoopLock): (WebRunLoopUnlock): (MainRunLoopUnlockGuard): (CurrentThreadContext): (RunWebThread): (StartWebThread): (WebTimedConditionLock): (_WebTryThreadLock): (WebThreadUnlockFromAnyThread): (WebThreadUnlockGuardForMail): (_WebThreadUnlock): (WebThreadIsLocked): (WebThreadLockPopModal): (WebThreadCurrentContext): (WebThreadEnable): (FreeThreadContext): Deleted. (InitThreadContextKey): Deleted. 2017-12-05 Alex Christensen Fix non-unified build after r225381 https://bugs.webkit.org/show_bug.cgi?id=180434 Reviewed by Keith Miller. * loader/ResourceTimingInformation.cpp: FrameLoader.h is included in other files that are combined with this file in unified builds, but we need to merge r225381 to a branch that doesn't use unified builds. This build failure would've come up randomly in the future when we add files, too. 2017-12-05 Simon Fraser Remove webkitGetImageDataHD and webkitPutImageDataHD from canvas API https://bugs.webkit.org/show_bug.cgi?id=180387 Reviewed by Dean Jackson. CanvasRenderingContext2D.webkitGetImageDataHD and webkitPutImageDataHD were never standardized, and Blink removed support in 2014 (https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/FOPH5dloGG8). Since our canvas backing store is always 1x, they have no use anyway, so remove them. * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::putImageData): (WebCore::CanvasRenderingContext2D::webkitGetImageDataHD const): Deleted. (WebCore::CanvasRenderingContext2D::webkitPutImageDataHD): Deleted. * html/canvas/CanvasRenderingContext2D.h: * html/canvas/CanvasRenderingContext2D.idl: 2017-12-05 Youenn Fablet Implement setting of service worker to client in SWServer without going to WebProcess https://bugs.webkit.org/show_bug.cgi?id=180382 Reviewed by Chris Dumez. No change of behavior. This patch removes the notification of active worker setting from ScriptExecution/WebProcess up to SWServer/StorageProcess. Instead, active worker setting is fully done/controlled in SWServer. Whenever there is a change, SWServer notifies WebProcess and ScriptExecutionContext gets updated accordingly. * dom/Document.cpp: (WebCore::Document::setServiceWorkerConnection): * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::setActiveServiceWorker): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::commitData): * workers/service/SWClientConnection.h: * workers/service/server/SWServer.cpp: (WebCore::SWServer::setClientActiveWorker): (WebCore::SWServer::registerServiceWorkerClient): (WebCore::SWServer::registrationFromServiceWorkerIdentifier): (WebCore::SWServer::unregisterServiceWorkerClient): (WebCore::SWServer::Connection::serviceWorkerStartedControllingClient): Deleted. (WebCore::SWServer::Connection::serviceWorkerStoppedControllingClient): Deleted. (WebCore::SWServer::serviceWorkerStartedControllingClient): Deleted. (WebCore::SWServer::serviceWorkerStoppedControllingClient): Deleted. * workers/service/server/SWServer.h: * workers/service/server/SWServerRegistration.cpp: (WebCore::SWServerRegistration::activate): 2017-12-01 Filip Pizlo GC constraint solving should be parallel https://bugs.webkit.org/show_bug.cgi?id=179934 Reviewed by JF Bastien. No new tests because no change in behavior. This change is best tested using DOM-GC-intensive benchmarks like Speedometer and Dromaeo. This parallelizes the DOM's output constraint, and makes some small changes to make this more scalable. * ForwardingHeaders/heap/SimpleMarkingConstraint.h: Added. * ForwardingHeaders/heap/VisitingTimeout.h: Removed. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/DOMGCOutputConstraint.cpp: Added. (WebCore::DOMGCOutputConstraint::DOMGCOutputConstraint): (WebCore::DOMGCOutputConstraint::~DOMGCOutputConstraint): (WebCore::DOMGCOutputConstraint::executeImpl): (WebCore::DOMGCOutputConstraint::doParallelWorkImpl): (WebCore::DOMGCOutputConstraint::finishParallelWorkImpl): * bindings/js/DOMGCOutputConstraint.h: Added. * bindings/js/WebCoreJSClientData.cpp: (WebCore::JSVMClientData::initNormalWorld): * dom/Node.cpp: (WebCore::Node::eventTargetDataConcurrently): (WebCore::Node::ensureEventTargetData): (WebCore::Node::clearEventTargetData): 2017-12-05 Antoine Quint