WebKit-https.git
13 months agoEnsure that ForInContexts are invalidated if their loop local is over-written.
mark.lam@apple.com [Wed, 19 Sep 2018 00:57:56 +0000 (00:57 +0000)]
Ensure that ForInContexts are invalidated if their loop local is over-written.
https://bugs.webkit.org/show_bug.cgi?id=189571
<rdar://problem/44402277>

Reviewed by Saam Barati.

JSTests:

* stress/regress-189571.js: Added.

Source/JavaScriptCore:

Instead of hunting down every place in the BytecodeGenerator that potentially
needs to invalidate an enclosing ForInContext (if one exists), we simply iterate
the bytecode range of the loop body when the ForInContext is popped, and
invalidate the context if we ever find the loop temp variable over-written.

This has 2 benefits:
1. It ensures that every type of opcode that can write to the loop temp will be
   handled appropriately, not just the op_mov that we've hunted down.
2. It avoids us having to check the BytecodeGenerator's m_forInContextStack
   every time we emit an op_mov (or other opcodes that can write to a local)
   even when we're not inside a for-in loop.

JSC benchmarks show that that this change is performance neutral.

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::pushIndexedForInScope):
(JSC::BytecodeGenerator::popIndexedForInScope):
(JSC::BytecodeGenerator::pushStructureForInScope):
(JSC::BytecodeGenerator::popStructureForInScope):
(JSC::ForInContext::finalize):
(JSC::StructureForInContext::finalize):
(JSC::IndexedForInContext::finalize):
(JSC::BytecodeGenerator::invalidateForInContextForLocal): Deleted.
* bytecompiler/BytecodeGenerator.h:
(JSC::ForInContext::ForInContext):
(JSC::ForInContext::bodyBytecodeStartOffset const):
(JSC::StructureForInContext::StructureForInContext):
(JSC::IndexedForInContext::IndexedForInContext):
* bytecompiler/NodesCodegen.cpp:
(JSC::PostfixNode::emitResolve):
(JSC::PrefixNode::emitResolve):
(JSC::ReadModifyResolveNode::emitBytecode):
(JSC::AssignResolveNode::emitBytecode):
(JSC::EmptyLetExpression::emitBytecode):
(JSC::ForInNode::emitLoopHeader):
(JSC::ForOfNode::emitBytecode):
(JSC::BindingNode::bindValue const):
(JSC::AssignmentElementNode::bindValue const):
* runtime/CommonSlowPaths.cpp:
(JSC::SLOW_PATH_DECL):

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

13 months ago[iOS] Layout Test imported/w3c/web-platform-tests/service-workers/service-worker...
ryanhaddad@apple.com [Wed, 19 Sep 2018 00:51:05 +0000 (00:51 +0000)]
[iOS] Layout Test imported/w3c/web-platform-tests/service-workers/service-worker/fetch-cors-xhr.https.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=189727

Unreviewed test gardening.

* platform/ios/TestExpectations:

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

13 months ago[iOS] Layout test imported/w3c/web-platform-tests/service-workers/service-worker...
ryanhaddad@apple.com [Wed, 19 Sep 2018 00:51:03 +0000 (00:51 +0000)]
[iOS] Layout test imported/w3c/web-platform-tests/service-workers/service-worker/fetch-mixed-content-to-inscope.https.html and fetch-mixed-content-to-outscope.https.html are flaky failures
https://bugs.webkit.org/show_bug.cgi?id=189726

Unreviewed test gardening.

* platform/ios/TestExpectations:

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

13 months ago[iOS] Allow WebContent process to check the "Protocol Characteristics" of files to...
bfulgham@apple.com [Tue, 18 Sep 2018 23:17:30 +0000 (23:17 +0000)]
[iOS] Allow WebContent process to check the "Protocol Characteristics" of files to which it has access
https://bugs.webkit.org/show_bug.cgi?id=189712
<rdar://problem/44386429>

Reviewed by Alex Christensen.

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

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

13 months ago[iOS] Crash under WebPageProxy::navigationGestureSnapshotWasRemoved()
cdumez@apple.com [Tue, 18 Sep 2018 22:05:51 +0000 (22:05 +0000)]
[iOS] Crash under WebPageProxy::navigationGestureSnapshotWasRemoved()
https://bugs.webkit.org/show_bug.cgi?id=189714
<rdar://problem/32839498>

Reviewed by Tim Horton.

The ViewGestureController::removeSwipeSnapshot() implementation for iOS calls
navigationGestureSnapshotWasRemoved() on m_webPageProxyForBackForwardListForCurrentSwipe.
m_webPageProxyForBackForwardListForCurrentSwipe can differ from m_webPageProxy, and
is a RefPtr<>. This means that this WebPageProxy's WKWebView might have been deallocated,
in which case we'll crash when trying to use the pageClient in
WebPageProxy::navigationGestureSnapshotWasRemoved(). To address the issue, we now return
early in WebPageProxy::navigationGestureSnapshotWasRemoved() if m_isClosed is true,
after resetting m_isShowingNavigationGestureSnapshot to false but *before* trying to use
the pageClient. When a WKWebView is deallocated, it calls WebPageProxy::close(), which
sets m_isClosed to true.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::navigationGestureSnapshotWasRemoved):

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

13 months ago[Curl] Limit capturing extra metrics for Web Inspector when not required.
Basuke.Suzuki@sony.com [Tue, 18 Sep 2018 21:52:10 +0000 (21:52 +0000)]
[Curl] Limit capturing extra metrics for Web Inspector when not required.
https://bugs.webkit.org/show_bug.cgi?id=189520

Reviewed by Alex Christensen.

Respect the value of NetworkDataTask::shouldCaptureExtraNetworkLoadMetrics() to reduce the process
time when they are not needed.

Source/WebCore:

No new tests because there's no behavior change.

* platform/network/curl/CurlContext.cpp:
(WebCore::CurlHandle::getNetworkLoadMetrics):
(WebCore::CurlHandle::addExtraNetworkLoadMetrics):
* platform/network/curl/CurlContext.h:
* platform/network/curl/CurlRequest.cpp:
(WebCore::CurlRequest::CurlRequest):
(WebCore::CurlRequest::updateNetworkLoadMetrics):
* platform/network/curl/CurlRequest.h:
(WebCore::CurlRequest::create):
* platform/network/curl/ResourceHandleCurl.cpp:
(WebCore::ResourceHandle::createCurlRequest):

Source/WebKit:

* NetworkProcess/curl/NetworkDataTaskCurl.cpp:
(WebKit::NetworkDataTaskCurl::createCurlRequest):

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

13 months agoSupport Images Module Level 4's double-position gradient color stop syntax
megan_gardner@apple.com [Tue, 18 Sep 2018 21:38:19 +0000 (21:38 +0000)]
Support Images Module Level 4's double-position gradient color stop syntax
https://bugs.webkit.org/show_bug.cgi?id=186154
<rdar://problem/44158152>

Reviewed by Simon Fraser.

Source/WebCore:

The CSS spec for all gradients allows for each color stop to have two angles to be used for hints.
This makes pie chart and checkerboard conic gradients much simpler to write.
Any time you want to have a hard line in a gradient, this syntax simplifies the gradient specification.

Test: fast/gradients/conic-two-hints.html
Test: fast/gradients/linear-two-hints-angle.html
Test: fast/gradients/linear-two-hints.html
Test: fast/gradients/radial-two-hints.html

* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeAngularGradientColorStops): Removed.
(WebCore::CSSPropertyParserHelpers::consumeGradientColorStops):

LayoutTests:

Test that uses two angles or positions per color stop.

* TestExpectations:
* fast/gradients/conic-two-hints-expected.html: Added.
* fast/gradients/conic-two-hints.html: Added.
* fast/gradients/linear-two-hints-angle-expected.html: Added.
* fast/gradients/linear-two-hints-angle.html: Added.
* fast/gradients/linear-two-hints-expected.html: Added.
* fast/gradients/linear-two-hints.html: Added.
* fast/gradients/radial-two-hints-expected.html: Added.
* fast/gradients/radial-two-hints.html: Added.
* platform/ios-12/TestExpectations:
* platform/mac/TestExpectations:

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

13 months agoMake WebPageProxy always have a API::NavigationClient instead of always having a...
achristensen@apple.com [Tue, 18 Sep 2018 21:03:30 +0000 (21:03 +0000)]
Make WebPageProxy always have a API::NavigationClient instead of always having a API::LoaderClient and API::PolicyClient
https://bugs.webkit.org/show_bug.cgi?id=189012

Reviewed by Andy Estes.

When WebKit2 was being developed, we initially made the C API WKPageSetPagePolicyClient and WKPageSetPageLoaderClient.
When we released WKWebView, it was using WKNavigationDelegate, equivalent to WKPageSetPageNavigationClient.
To support one or the other, we would use the navigation client if it was present, but if not we would fall back to the
loader or policy client.  Since the loader and policy clients are now being minimally supported only until legacy
software migrates to the navigation client, we are adding new functionality to the navigation client.
Making the navigation client the default and using the loader or policy client only if they are present supports
the legacy software and makes us have fewer forgotten null checks when adding new functionality to the navigation client.

* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageNavigationClient):
* UIProcess/Cocoa/NavigationState.h:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::createNavigationClient):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::setNavigationClient):
(WebKit::WebPageProxy::setLoaderClient):
(WebKit::WebPageProxy::setPolicyClient):
(WebKit::WebPageProxy::close):
(WebKit::WebPageProxy::didChangeBackForwardList):
(WebKit::WebPageProxy::willGoToBackForwardListItem):
(WebKit::WebPageProxy::findPlugin):
(WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
(WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
(WebKit::WebPageProxy::willPerformClientRedirectForFrame):
(WebKit::WebPageProxy::didCancelClientRedirectForFrame):
(WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
(WebKit::WebPageProxy::didCommitLoadForFrame):
(WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
(WebKit::WebPageProxy::didFinishLoadForFrame):
(WebKit::WebPageProxy::didFailLoadForFrame):
(WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
(WebKit::WebPageProxy::didReachLayoutMilestone):
(WebKit::WebPageProxy::didDisplayInsecureContentForFrame):
(WebKit::WebPageProxy::didRunInsecureContentForFrame):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::decidePolicyForNewWindowAction):
(WebKit::WebPageProxy::decidePolicyForResponse):
(WebKit::WebPageProxy::contentRuleListNotification):
(WebKit::WebPageProxy::webGLPolicyForURL):
(WebKit::WebPageProxy::resolveWebGLPolicyForURL):
(WebKit::WebPageProxy::processDidBecomeUnresponsive):
(WebKit::WebPageProxy::processDidBecomeResponsive):
(WebKit::WebPageProxy::dispatchProcessDidTerminate):
(WebKit::WebPageProxy::didReceiveAuthenticationChallengeProxy):
(WebKit::WebPageProxy::wrapCryptoKey):
(WebKit::WebPageProxy::unwrapCryptoKey):
(WebKit::WebPageProxy::signedPublicKeyAndChallengeString):
(WebKit::WebPageProxy::navigationGestureDidBegin):
(WebKit::WebPageProxy::navigationGestureWillEnd):
(WebKit::WebPageProxy::navigationGestureDidEnd):
(WebKit::WebPageProxy::navigationGestureSnapshotWasRemoved):
* UIProcess/WebPageProxy.h:

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

13 months agoClean up AuthenticationChallengeProxy
achristensen@apple.com [Tue, 18 Sep 2018 20:55:55 +0000 (20:55 +0000)]
Clean up AuthenticationChallengeProxy
https://bugs.webkit.org/show_bug.cgi?id=189668

Reviewed by Youenn Fablet.

At its core, it's a CompletionHandler with some information.
Make it more elegant and simple with no change in behavior and reduce the complexity of this security-sensitive object.

* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(toNSURLSessionAuthChallengeDisposition):
* Shared/Authentication/AuthenticationManager.cpp:
(WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge):
* Shared/Authentication/AuthenticationManager.h:
* UIProcess/API/C/WKAuthenticationChallenge.cpp:
(WKAuthenticationChallengeGetDecisionListener):
(WKAuthenticationChallengeGetProtectionSpace):
(WKAuthenticationChallengeGetProposedCredential):
(WKAuthenticationChallengeGetPreviousFailureCount):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageNavigationClient):
* UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm:
(-[WKNSURLAuthenticationChallengeSender cancelAuthenticationChallenge:]):
(-[WKNSURLAuthenticationChallengeSender continueWithoutCredentialForAuthenticationChallenge:]):
(-[WKNSURLAuthenticationChallengeSender useCredential:forAuthenticationChallenge:]):
(-[WKNSURLAuthenticationChallengeSender performDefaultHandlingForAuthenticationChallenge:]):
(-[WKNSURLAuthenticationChallengeSender rejectProtectionSpaceAndContinueWithChallenge:]):
* UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
(WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy):
(WebKit::AuthenticationChallengeProxy::~AuthenticationChallengeProxy): Deleted.
(WebKit::AuthenticationChallengeProxy::useCredential): Deleted.
(WebKit::AuthenticationChallengeProxy::cancel): Deleted.
(WebKit::AuthenticationChallengeProxy::performDefaultHandling): Deleted.
(WebKit::AuthenticationChallengeProxy::rejectProtectionSpaceAndContinue): Deleted.
(WebKit::AuthenticationChallengeProxy::proposedCredential const): Deleted.
(WebKit::AuthenticationChallengeProxy::protectionSpace const): Deleted.
(WebKit::AuthenticationChallengeProxy::setSecKeyProxyStore): Deleted.
* UIProcess/Authentication/AuthenticationChallengeProxy.h:
(WebKit::AuthenticationChallengeProxy::create):
(WebKit::AuthenticationChallengeProxy::listener const):
(WebKit::AuthenticationChallengeProxy::previousFailureCount const): Deleted.
* UIProcess/Authentication/AuthenticationDecisionListener.cpp:
(WebKit::AuthenticationDecisionListener::AuthenticationDecisionListener):
(WebKit::AuthenticationDecisionListener::~AuthenticationDecisionListener):
(WebKit::AuthenticationDecisionListener::useCredential):
(WebKit::AuthenticationDecisionListener::cancel):
(WebKit::AuthenticationDecisionListener::performDefaultHandling):
(WebKit::AuthenticationDecisionListener::rejectProtectionSpaceAndContinue):
(WebKit::AuthenticationDecisionListener::detachChallenge): Deleted.
* UIProcess/Authentication/AuthenticationDecisionListener.h:
(WebKit::AuthenticationDecisionListener::create):
* UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm:
(WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc):
(WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc const): Deleted.
* UIProcess/Cocoa/DownloadClient.mm:
(WebKit::DownloadClient::didReceiveAuthenticationChallenge):
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge):
* UIProcess/Downloads/DownloadProxy.cpp:
(WebKit::DownloadProxy::didReceiveAuthenticationChallenge):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
* UIProcess/ServiceWorkerProcessProxy.cpp:
(WebKit::ServiceWorkerProcessProxy::didReceiveAuthenticationChallenge):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::secKeyProxyStore):
(WebKit::WebPageProxy::didReceiveAuthenticationChallengeProxy):
* UIProcess/WebPageProxy.h:

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

13 months agoAdd script to generate WebContent service resource files and change XPC service main...
achristensen@apple.com [Tue, 18 Sep 2018 20:54:29 +0000 (20:54 +0000)]
Add script to generate WebContent service resource files and change XPC service main SPI to have it's own header
https://bugs.webkit.org/show_bug.cgi?id=188601

Patch by Ben Richards <benton_richards@apple.com> on 2018-09-18
Reviewed by Dan Bernstein.

Added a script to the process entitlements build phase of the WebContent service that copies resource
files to WebKit.framework/PrivateHeaders/CustomWebContentResources. These resource files are to
be used by clients who would like to make a custom WebContent service.

* Scripts/copy-webcontent-resources-to-private-headers.sh: Added.
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/API/Cocoa/WKWebProcess.h: Drive-by fix to make this header compileable alone.

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

13 months agowebkitpy: Clobbering and building occurs multiple times for iOS Simulator ports
jbedard@apple.com [Tue, 18 Sep 2018 20:10:33 +0000 (20:10 +0000)]
webkitpy: Clobbering and building occurs multiple times for iOS Simulator ports
https://bugs.webkit.org/show_bug.cgi?id=189702
<rdar://problem/44541704>

Reviewed by Aakash Jain.

* Scripts/webkitpy/layout_tests/controllers/manager.py:
(Manager._set_up_run): Move build check and clobbering to run, since set up is
run multiple times for iOS simulator.
(Manager.run):

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

13 months agoRemove the unused RenderLayerCompositor::enclosingCompositorFlushingLayers()
simon.fraser@apple.com [Tue, 18 Sep 2018 18:34:15 +0000 (18:34 +0000)]
Remove the unused RenderLayerCompositor::enclosingCompositorFlushingLayers()
https://bugs.webkit.org/show_bug.cgi?id=189689

Reviewed by Alex Christensen.

enclosingCompositorFlushingLayers() was added in r76196 but never used. Also use
a SetForScope<>.

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::flushPendingLayerChanges):
(WebCore::RenderLayerCompositor::enclosingCompositorFlushingLayers const): Deleted.
* rendering/RenderLayerCompositor.h:

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

13 months ago[macOS] Frequent leaks seen under WebCore::gpuIDForDisplayMask
commit-queue@webkit.org [Tue, 18 Sep 2018 18:30:02 +0000 (18:30 +0000)]
[macOS] Frequent leaks seen under WebCore::gpuIDForDisplayMask
https://bugs.webkit.org/show_bug.cgi?id=189685
<rdar://problem/44541974>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2018-09-18
Reviewed by Per Arne Vollan.

* platform/mac/PlatformScreenMac.mm:
(WebCore::gpuIDForDisplayMask):

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

13 months agoImplement RTCRtpReceiver getContributingSources/getSynchronizationSources
youenn@apple.com [Tue, 18 Sep 2018 18:29:06 +0000 (18:29 +0000)]
Implement RTCRtpReceiver getContributingSources/getSynchronizationSources
https://bugs.webkit.org/show_bug.cgi?id=189671

Reviewed by Eric Carlson.

LayoutTests/imported/w3c:

* web-platform-tests/webrtc/RTCRtpReceiver-getContributingSources.https-expected.txt:
* web-platform-tests/webrtc/RTCRtpReceiver-getSynchronizationSources.https-expected.txt:
* web-platform-tests/webrtc/interfaces-expected.txt: Removed, as no longer needed.

Source/ThirdParty/libwebrtc:

* Configurations/libwebrtc.iOS.exp:
* Configurations/libwebrtc.iOSsim.exp:
* Configurations/libwebrtc.mac.exp:

Source/WebCore:

Introduce implementation of these two methods by calling the libwebrtc corresponding method.
Add corresponding IDL as per spec.
Covered by rebased WPT tests.

* CMakeLists.txt:
* DerivedSources.make:
* Modules/mediastream/RTCRtpContributingSource.h: Added.
* Modules/mediastream/RTCRtpContributingSource.idl: Added.
* Modules/mediastream/RTCRtpReceiver.h:
(WebCore::RTCRtpReceiver::getContributingSources const):
(WebCore::RTCRtpReceiver::getSynchronizationSources const):
* Modules/mediastream/RTCRtpReceiver.idl:
* Modules/mediastream/RTCRtpReceiverBackend.h:
(WebCore::RTCRtpReceiverBackend::getContributingSources const):
(WebCore::RTCRtpReceiverBackend::getSynchronizationSources const):
* Modules/mediastream/RTCRtpSynchronizationSource.h: Added.
* Modules/mediastream/RTCRtpSynchronizationSource.idl: Added.
* Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.cpp:
(WebCore::fillRTCRtpContributingSource):
(WebCore::toRTCRtpContributingSource):
(WebCore::toRTCRtpSynchronizationSource):
(WebCore::LibWebRTCRtpReceiverBackend::getContributingSources const):
(WebCore::LibWebRTCRtpReceiverBackend::getSynchronizationSources const):
* Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.h:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:

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

13 months agoUnreviewed, rolling out r236138.
ryanhaddad@apple.com [Tue, 18 Sep 2018 17:59:45 +0000 (17:59 +0000)]
Unreviewed, rolling out r236138.

Caused API test and layout test failures on iOS.

Reverted changeset:

"REGRESSION (PSON): White or Black flash occurs when process
swapping on navigation on Mac"
https://bugs.webkit.org/show_bug.cgi?id=189663
https://trac.webkit.org/changeset/236138

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

13 months agoAlways log when granting/revoking capture sandbox extensions
eric.carlson@apple.com [Tue, 18 Sep 2018 17:32:42 +0000 (17:32 +0000)]
Always log when granting/revoking capture sandbox extensions
https://bugs.webkit.org/show_bug.cgi?id=189701
<rdar://problem/44564029>

Reviewed by Youenn Fablet.

* UIProcess/UserMediaProcessManager.cpp:
(WebKit::UserMediaProcessManager::willCreateMediaStream): Always log.
(WebKit::UserMediaProcessManager::endedCaptureSession): Ditto.

* WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
(WebKit::UserMediaPermissionRequestManager::grantUserMediaDeviceSandboxExtensions): Ditto.
(WebKit::UserMediaPermissionRequestManager::revokeUserMediaDeviceSandboxExtensions): Ditto.

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

13 months agoEnable Unified Plan by default
youenn@apple.com [Tue, 18 Sep 2018 17:11:17 +0000 (17:11 +0000)]
Enable Unified Plan by default
https://bugs.webkit.org/show_bug.cgi?id=189675

Reviewed by Eric Carlson.

Source/WebCore:

RTCRtpTransceiver.currentDirection is now gated by the unified plan runtime flag.
This will allow easy feature detection of unified plan support.
Covered by updated test.

* Modules/mediastream/RTCRtpTransceiver.idl:

Source/WebKit:

* Shared/WebPreferences.yaml:

LayoutTests:

* webrtc/video-addLegacyTransceiver-expected.txt:
* webrtc/video-addLegacyTransceiver.html:

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

13 months ago[WebVTT] change "middle" to "center" for consistency with CSS
pvollan@apple.com [Tue, 18 Sep 2018 16:07:24 +0000 (16:07 +0000)]
[WebVTT] change "middle" to "center" for consistency with CSS
https://bugs.webkit.org/show_bug.cgi?id=158478

Reviewed by Eric Carlson.

Source/WebCore:

No new tests, covered by existing tests.

* html/track/TextTrackCueGeneric.cpp:
(WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
* html/track/VTTCue.cpp:
(WebCore::centerKeyword):
(WebCore::VTTCue::initialize):
(WebCore::VTTCue::align const):
(WebCore::VTTCue::setAlign):
(WebCore::VTTCue::calculateDisplayParameters):
(WebCore::VTTCue::setCueSettings):
(WebCore::middleKeyword): Deleted.
* html/track/VTTCue.h:
* html/track/WebVTTParser.cpp:
(WebCore::WebVTTTreeBuilder::buildFromString):

LayoutTests:

* media/track/track-add-remove-cue-expected.txt:
* media/track/track-add-remove-cue.html:
* media/track/track-cue-mutable-expected.txt:
* media/track/track-cue-mutable.html:
* media/track/track-cue-rendering-snap-to-lines-not-set-expected.txt:
* media/track/track-vttcue-expected.txt:
* media/track/track-vttcue.html:
* media/track/track-webvtt-tc013-settings-expected.txt:
* media/track/track-webvtt-tc013-settings.html:
* media/track/track-webvtt-tc014-alignment-expected.txt:
* media/track/track-webvtt-tc014-alignment.html:
* media/track/track-webvtt-tc016-align-positioning-expected.txt:
* media/track/track-webvtt-tc016-align-positioning.html:
* media/track/track-webvtt-tc018-align-text-line-position-expected.txt:
* media/track/track-webvtt-tc018-align-text-line-position.html:
* media/track/track-webvtt-tc020-cue-size-align-expected.txt:
* media/track/track-webvtt-tc020-cue-size-align.html:
* media/track/track-webvtt-tc021-valign-expected.txt:
* media/track/track-webvtt-tc021-valign.html:

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

13 months ago"DidFirstVisuallyNonEmptyLayout" callback does not get called when restoring a page...
cdumez@apple.com [Tue, 18 Sep 2018 16:06:10 +0000 (16:06 +0000)]
"DidFirstVisuallyNonEmptyLayout" callback does not get called when restoring a page from PageCache
https://bugs.webkit.org/show_bug.cgi?id=189681
<rdar://problem/44526171>

Reviewed by Alex Christensen and Zalan Bujtas.

Source/WebCore:

The "DidFirstVisuallyNonEmptyLayout" callback was not getting called when restoring a page from PageCache
because the FrameView is restored from PageCache and we would fail to restore its flags (such as
m_firstVisuallyNonEmptyLayoutCallbackPending) when entering Page Cache. We now call reset those flags that
are related to layout miletones when entering PageCache so that layout milestone events properly get sent
again when restoring from Page Cache.

* history/CachedFrame.cpp:
(WebCore::CachedFrame::CachedFrame):

Tools:

Add API test coverage.

* TestWebKitAPI/Tests/WebKit/LayoutMilestonesWithAllContentInFrame.cpp:
(TestWebKitAPI::didFinishNavigation):
(TestWebKitAPI::TEST):

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

13 months agoREGRESSION (PSON): White or Black flash occurs when process swapping on navigation...
antti@apple.com [Tue, 18 Sep 2018 15:41:31 +0000 (15:41 +0000)]
REGRESSION (PSON): White or Black flash occurs when process swapping on navigation on Mac
https://bugs.webkit.org/show_bug.cgi?id=189663
<rdar://problem/44184955>

Reviewed by Geoff Garen.

We need to keep the layer tree of the previous page alive and visible until we have something
to render on the new page. With PSON on Mac this means that we should keep displaying the
layer tree from the previus process.

This patch moves the management of 'attaching' the drawing area (Mac only concept) from web process
to UI process. This is when we parent the layer tree to the view root layer. It also ensures that
the layer tree is not deleted too early on process swap and that it still eventually gets deleted.

* UIProcess/DrawingAreaProxy.h:
(WebKit::DrawingAreaProxy::attachInWebProcess):
* UIProcess/SuspendedPageProxy.cpp:
(WebKit::messageNamesToIgnoreWhileSuspended):
(WebKit::SuspendedPageProxy::tearDownDrawingAreaInWebProcess):

We no longer tear down drawing area (layer tree) for suspended pages automatically. Send an explicit
message for it.

* UIProcess/SuspendedPageProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::reattachToWebProcess):

Only call didRelaunchProcess when process actually relaunched (not navigation process launch) to
match not calling processDidExit in resetStateAfterProcessExited.

(WebKit::WebPageProxy::didCompletePageTransition):

Attach the drawing area if appropriate.

(WebKit::WebPageProxy::decidePolicyForNavigationAction):

Send suspend message to WebPage immediately instead waiting for the runloop callback. This is needed so we
can avoid flashing the initial empty document load when the new Page object is created.

(WebKit::WebPageProxy::resetStateAfterProcessExited):

Don't call processDidExit when suspending, not exiting the process (this function needs a new name or rafactoring).
This avoids clearing the drawing area and flashing to black.

(WebKit::WebPageProxy::enterAcceleratedCompositingMode):

This is called when we have switched to the new layer tree.
Tear down the drawing area in the previus process.

* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
(WebKit::TiledCoreAnimationDrawingAreaProxy::attachInWebProcess):

Send a message to the web process to attach the drawing area.

* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::attach):
(WebKit::DrawingArea::attachDrawingArea): Deleted.

Rename to be less redundant.

* WebProcess/WebPage/DrawingArea.messages.in:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::reinitializeWebPage):

Don't attach drawing area automatically. It will be done by a message from UI process.

(WebKit::WebPage::setLayerTreeStateIsFrozen):

Layer tree is always frozen in a suspended process (if it exists).

(WebKit::WebPage::didStartPageTransition):
(WebKit::WebPage::didCompletePageTransition):

Notify UI process of transition completion.

(WebKit::WebPage::setIsSuspended):
(WebKit::WebPage::tearDownDrawingAreaForSuspend):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):

Don't attach drawing area automatically. It will be done by a message from UI process.

(WebKit::TiledCoreAnimationDrawingArea::attach):
(WebKit::TiledCoreAnimationDrawingArea::attachDrawingArea): Deleted.

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

13 months ago[css-grid] Static position should use content-box, not padding-box
rego@igalia.com [Tue, 18 Sep 2018 15:13:40 +0000 (15:13 +0000)]
[css-grid] Static position should use content-box, not padding-box
https://bugs.webkit.org/show_bug.cgi?id=189698

Reviewed by Javier Fernandez.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-grid/abspos/absolute-positioning-grid-container-parent-001.html:
Update tests from WPT.

Source/WebCore:

This is a recent change by the CSSWG:
https://github.com/w3c/csswg-drafts/issues/3020

The spec text (https://drafts.csswg.org/css-grid/#static-position):
  "The static position of an absolutely-positioned child
   of a grid container is determined as if it were the sole grid item
   in a grid area whose edges coincide with the content edges
   of the grid container."

Test: imported/w3c/web-platform-tests/css/css-grid/abspos/absolute-positioning-grid-container-parent-001.html

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::prepareChildForPositionedLayout):
Simple change to use border and padding.

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

13 months ago[WPE] Gardening after r236124
csaavedra@igalia.com [Tue, 18 Sep 2018 14:50:41 +0000 (14:50 +0000)]
[WPE] Gardening after r236124

Quick gardening. There might be more tests that are now passing or
need updated results but this was the most obvious for now.
Unreviewed gardening.
* platform/wpe/TestExpectations:
* platform/wpe/svg/custom/pan-direction-expected.txt:

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

13 months ago[WPE] Implement mouse event modifiers
csaavedra@igalia.com [Tue, 18 Sep 2018 13:44:29 +0000 (13:44 +0000)]
[WPE] Implement mouse event modifiers
https://bugs.webkit.org/show_bug.cgi?id=189697

Reviewed by Carlos Garcia Campos.

Source/WebKit:

Only "CapsLocks" is missing, as WPE doesn't support that modifier.
* Shared/wpe/WebEventFactory.cpp:
(WebKit::modifiersForEventModifiers):
(WebKit::WebEventFactory::createWebKeyboardEvent):
(WebKit::WebEventFactory::createWebMouseEvent):
(WebKit::modifiersForEvent): Deleted.

Tools:

* WebKitTestRunner/wpe/EventSenderProxyWPE.cpp:
(WTR::wkEventModifiersToWPE):
(WTR::EventSenderProxy::mouseDown):
(WTR::EventSenderProxy::mouseUp):

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

13 months ago[EME][GStreamer] The current EME implementation doesn't support the waitingforkey...
calvaris@igalia.com [Tue, 18 Sep 2018 09:14:31 +0000 (09:14 +0000)]
[EME][GStreamer] The current EME implementation doesn't support the waitingforkey event
https://bugs.webkit.org/show_bug.cgi?id=185590

Reviewed by Philippe Normand.

Source/WebCore:

When decryptors are blocked waiting for the key, instruct the
player to run the Wait for key algorithm. As per spec, if we run
out of blocks pending to decrypt because we don't have the key, we
request running the algorithm again.

Test: imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-waitingforkey.https.html.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::handleMessage):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered):
(WebCore::MediaPlayerPrivateGStreamerBase::reportWaitingForKey):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
* platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
(webkitMediaCommonEncryptionDecryptTransformInPlace):
(webkitMediaCommonEncryptionDecryptSinkEventHandler):

LayoutTests:

Updated status of
imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-waitingforkey.https
and expectations.

* platform/wpe/TestExpectations:
* platform/wpe/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-waitingforkey.https-expected.txt:

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

13 months agoUpdate composedPath to match the latest spec
rniwa@webkit.org [Tue, 18 Sep 2018 07:47:35 +0000 (07:47 +0000)]
Update composedPath to match the latest spec
https://bugs.webkit.org/show_bug.cgi?id=180378
<rdar://problem/42843004>

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaselined the test now that all test cases pass.

* web-platform-tests/shadow-dom/event-composed-path-after-dom-mutation-expected.txt:

Source/WebCore:

This patch makes the check for whether a given node in the event path be included in composedPath
pre-determined at the time of the event dispatching per https://github.com/whatwg/dom/issues/525.
This was a fix for the issue that if an event listener in a closed shadow tree removes a node in the
same tree in the event path, then composedPath called on its shadow host, for example, will include
the removed node since it's no longer in the closed shadow tree.

Naively, implementing this behavior would require remembering the original document or shadow root
of each node in the event path as well as its parent shadow root, or worse which node is disclosed
to every other node at the time of computing the event path.

This patch takes a more novel and efficient approach to implement the new behavior by adding a single
integer indicating the number of closed-mode shadow root ancestors of each node in the event path.
In computePathUnclosedToTarget, any node whose *depth* is greater than the context object is excluded.

Consider the following example:
div ------- ShadowRoot (closed)
  +- span     +- slot
If an event is dispatched on span, then the event path would be [span, slot, ShadowRoot, div]. Then
the values of integers assigned to each node would be: [0, 1, 1, 0] respectively. When composedPath
is called on span or div, slot and ShadowRoot are excluded because they have a greater *depth* value.

Unfortunately, this simplistic solution doesn't work when there are multiple shadow roots of the same
depth through which an event is dispatched as in:
section -- ShadowRoot (closed, SR2)
  |          +- slot (s2)
  +div ------ ShadowRoot (closed, SR1)
    +- span     +- slot (s1)
If an event is dispatched on span, the event path would be [span, s1, SR1, div, s2, SR2, section].
The values of integers assigned are: [0, 1, 1, 0, 1, 1, 0] respectively. When composedPath is called
on SR1, the simplistic approach would include s2 and SR2, which would be wrong.

To account for this case, in computePathUnclosedToTarget, we traverse the event path upwards (i.e.
ancestors) and downwards (i.e. descendants) from the context object and decrease the *allowed depth*
of shadow trees when we traverse out of a shadow tree in either direction. When traversing upwards,
therefore, moving out of a shadow root to its host would would decrease the allowed depth. When
traversing dowards, moving from a slot element to its assigned node would decrease the allowed depth.

Note that the depths can be negative when a composed event is dispatched inside a closed shadow tree,
and it gets out of its shadow host.

Unfortunately, the latest DOM specification has a bug and doesn't match the behavior of Chrome. This
patch proposes a new algorithm which can be adopted in https://github.com/whatwg/dom/issues/684.

Test: imported/w3c/web-platform-tests/shadow-dom/event-composed-path-after-dom-mutation.html

* dom/EventContext.cpp:
(WebCore::EventContext::EventContext):
(WebCore::MouseOrFocusEventContext::MouseOrFocusEventContext):
(WebCore::TouchEventContext::TouchEventContext):
* dom/EventContext.h:
(WebCore::EventContext::closedShadowDepth const): Added.
* dom/EventPath.cpp:
(WebCore::WindowEventContext::WindowEventContext):
(WebCore::EventPath::buildPath): Compute the closed shadow tree's depths for each node in the path.
(WebCore::computePathUnclosedToTarget const): Implemented the aforementioned algorithm.
(WebCore::EventPath::EventPath):

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

13 months agoUnreviewed build fix after r236101.
zandobersek@gmail.com [Tue, 18 Sep 2018 06:36:36 +0000 (06:36 +0000)]
Unreviewed build fix after r236101.

* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
Correct a BinarySemaphore::wait() call which now accepts no arguments.

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

13 months ago[WTF] Use Semaphore and BinarySemaphore instead of dispatch_semaphore_t
yusukesuzuki@slowstart.org [Tue, 18 Sep 2018 05:47:33 +0000 (05:47 +0000)]
[WTF] Use Semaphore and BinarySemaphore instead of dispatch_semaphore_t
https://bugs.webkit.org/show_bug.cgi?id=185339

Patch by Yusuke Suzuki <utatane.tea@gmail.com> on 2018-09-17
Reviewed by Mark Lam.

Source/WebCore:

* fileapi/ThreadableBlobRegistry.cpp:
(WebCore::ThreadableBlobRegistry::blobSize):
* platform/cocoa/NetworkExtensionContentFilter.h:
* platform/cocoa/NetworkExtensionContentFilter.mm:
(WebCore::NetworkExtensionContentFilter::initialize):
(WebCore::NetworkExtensionContentFilter::willSendRequest):
(WebCore::NetworkExtensionContentFilter::responseReceived):
(WebCore::NetworkExtensionContentFilter::addData):
(WebCore::NetworkExtensionContentFilter::finishedAddingData):
(WebCore::NetworkExtensionContentFilter::handleDecision):
Use per-function BinarySemaphore instead of holding it in NetworkExtensionContentFilter's field.

* platform/glib/FileMonitorGLib.cpp:
(WebCore::FileMonitor::FileMonitor):
(WebCore::FileMonitor::~FileMonitor):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC):
(WebCore::MediaPlayerPrivateAVFoundationObjC::~MediaPlayerPrivateAVFoundationObjC):
(WebCore::MediaPlayerPrivateAVFoundationObjC::waitForVideoOutputMediaDataWillChange):
(WebCore::MediaPlayerPrivateAVFoundationObjC::outputMediaDataWillChange):
Use BinarySemaphore. And remove unused dispatch_semaphore_t.

* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(-[WebAVStreamDataParserListener streamDataParserWillProvideContentKeyRequestInitializationData:forTrackID:]):
(-[WebAVStreamDataParserListener streamDataParser:didProvideContentKeyRequestInitializationData:forTrackID:]):
(WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
(WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC):
(WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
(WebCore::SourceBufferPrivateAVFObjC::abort):
(WebCore::SourceBufferPrivateAVFObjC::setCDMSession):
(WebCore::SourceBufferPrivateAVFObjC::setCDMInstance):
Use Box<Semaphore> and Box<BinarySemaphore>.

* platform/graphics/cocoa/WebCoreDecompressionSession.h:
* platform/graphics/cocoa/WebCoreDecompressionSession.mm:
(WebCore::WebCoreDecompressionSession::WebCoreDecompressionSession):
Remove unused dispatch_semaphore_t.

* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::ResourceHandle::platformLoadResourceSynchronously):
* platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
(WebCore::getRunLoop):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
* platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
* platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
(-[WebCoreResourceHandleAsOperationQueueDelegate initWithHandle:messageQueue:]):
(-[WebCoreResourceHandleAsOperationQueueDelegate detachHandle]):
(-[WebCoreResourceHandleAsOperationQueueDelegate dealloc]):
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
Use BinarySemaphore instead.

Source/WebKit:

* Platform/IPC/Connection.cpp:
(IPC::Connection::SyncMessageState::wait):
* Shared/mac/SecItemShim.cpp:
(WebKit::sendSecItemRequest):
Use BinarySemaphore.

* UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
(WebKit::ResourceLoadStatisticsPersistentStorage::finishAllPendingWorkSynchronously):
* UIProcess/WebStorage/StorageManager.cpp:
(WebKit::StorageManager::applicationWillTerminate):
* UIProcess/ios/WKActionSheetAssistant.mm:
(appLinkForURL):
Use BinarySemaphore to wait for async completion handler. We also fix memory leak
since the old code does not call dispatch_release for the used semaphore.

Source/WTF:

This patch adds WTF::Semaphore, which is based on WTF::Lock and WTF::Condition.

* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/Semaphore.h: Added.
(WTF::Semaphore::Semaphore):
(WTF::Semaphore::signal):
(WTF::Semaphore::waitUntil):
(WTF::Semaphore::waitFor):
(WTF::Semaphore::wait):
* wtf/generic/WorkQueueGeneric.cpp:
(WorkQueue::platformInitialize):
* wtf/threads/BinarySemaphore.cpp:
(WTF::BinarySemaphore::waitUntil):
(WTF::BinarySemaphore::wait): Deleted.
* wtf/threads/BinarySemaphore.h:
(WTF::BinarySemaphore::waitFor):
(WTF::BinarySemaphore::wait):
Align the names of the functions to WTF::Condition.
Add BinarySemaphore::wait(), which is the same to waitUntil(WallTime::infinity()).

Tools:

* TestWebKitAPI/Tests/WTF/SynchronizedFixedQueue.cpp:
(TestWebKitAPI::ToUpperConverter::stopProducing):
(TestWebKitAPI::ToUpperConverter::stopConsuming):

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

13 months agoMany modern media control tests leak documents in testing
simon.fraser@apple.com [Tue, 18 Sep 2018 04:14:39 +0000 (04:14 +0000)]
Many modern media control tests leak documents in testing
https://bugs.webkit.org/show_bug.cgi?id=189437

Reviewed by Darin Adler.
Source/WebCore:

In order to accurately detect leaks in media controls tests which use lots of
SVGImages, we have to:
- Fire a zero-delay timer after the postTask, in order for ImagesLoader's m_derefElementTimer
  to clear references to elements.
- Have releaseCriticalMemory() call CachedResourceLoader's garbageCollectDocumentResources()
  to drop the last handle to the CachedResource for an SVGImage.
- Call WKBundleReleaseMemory() after the GC and timer, since we need garbageCollectDocumentResources()
  to run again after that timer has fired.

This should fix most of the spurious leak reports involving SVGImage documents.

* page/MemoryRelease.cpp:
(WebCore::releaseCriticalMemory):

Source/WebKit:

In order to accurately detect leaks in media controls tests which use lots of
SVGImages, we have to:
- Fire a zero-delay timer after the postTask, in order for ImagesLoader's m_derefElementTimer
  to clear references to elements.
- Have releaseCriticalMemory() call CachedResourceLoader's garbageCollectDocumentResources()
  to drop the last handle to the CachedResource for an SVGImage.
- Call WKBundleReleaseMemory() after the GC and timer, since we need garbageCollectDocumentResources()
  to run again after that timer has fired.

This should fix most of the spurious leak reports involving SVGImage documents.

* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageCallAfterTasksAndTimers):
(WKBundlePagePostTask): Deleted.
* WebProcess/InjectedBundle/API/c/WKBundlePage.h:

Tools:

In order to accurately detect leaks in media controls tests which use lots of
SVGImages, we have to:
- Fire a zero-delay timer after the postTask, in order for ImagesLoader's m_derefElementTimer
  to clear references to elements.
- Have releaseCriticalMemory() call CachedResourceLoader's garbageCollectDocumentResources()
  to drop the last handle to the CachedResource for an SVGImage.
- Call WKBundleReleaseMemory() after the GC and timer, since we need garbageCollectDocumentResources()
  to run again after that timer has fired.

This should fix most of the spurious leak reports involving SVGImage documents.

* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::reportLiveDocuments):
(WTR::InjectedBundle::didReceiveMessageToPage):

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

13 months ago[Win][Clang][WebKitLegacy] error: cannot pass object of non-trivial type through...
Hironori.Fujii@sony.com [Tue, 18 Sep 2018 02:54:37 +0000 (02:54 +0000)]
[Win][Clang][WebKitLegacy] error: cannot pass object of non-trivial type through variadic function
https://bugs.webkit.org/show_bug.cgi?id=189612

Reviewed by Alex Christensen.

Non-trivial types can't be used as aruguments of LOG_ERROR and
ASSERT_WITH_MESSAGE.

* DefaultPolicyDelegate.cpp:
(DefaultPolicyDelegate::unableToImplementPolicyWithError): Apply
static_cast<BSTR> to convert BString.
* WebLocalizableStrings.cpp:
(copyLocalizedStringFromBundle): Convert 'key' from WTF::String to
char* by using 'key.utf8().data()'.

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

13 months agoTry to fix Apple internal builds with the iOS 12.0 SDK.
mitz@apple.com [Tue, 18 Sep 2018 01:42:35 +0000 (01:42 +0000)]
Try to fix Apple internal builds with the iOS 12.0 SDK.

* Configurations/WebKit.xcconfig: Disable framework header postprocessing for iOS 12.0.

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

13 months agoUnreviewed, rolling out r236092 because it breaks internal builds. Also, remove...
ryanhaddad@apple.com [Tue, 18 Sep 2018 01:01:32 +0000 (01:01 +0000)]
Unreviewed, rolling out r236092 because it breaks internal builds. Also,  remove stray '+' character from ChangeLog file.

* Scripts/copy-webcontent-resources-to-private-headers.sh: Removed.
* WebKit.xcodeproj/project.pbxproj:

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

13 months agoLayout Test legacy-animation-engine/animations/play-state-in-shorthand.html is a...
ryanhaddad@apple.com [Tue, 18 Sep 2018 00:54:48 +0000 (00:54 +0000)]
Layout Test legacy-animation-engine/animations/play-state-in-shorthand.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=185651

Unreviewed test gardening.

* platform/mac/TestExpectations: Mark test as flaky.

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

13 months agoUpdated expected test [ PASS ] messages for new test-harness format for webgl tests
justin_fan@apple.com [Tue, 18 Sep 2018 00:31:40 +0000 (00:31 +0000)]
Updated expected test [ PASS ] messages for new test-harness format for webgl tests
https://bugs.webkit.org/show_bug.cgi?id=189677

Reviewed by Dean Jackson.

Update generate-webgl-tests.py's test expectation template
for my new version of webgl-test-harness.js for the webgl 2 suite,
and update all webgl/2.0.0 test expectations to match.

* webgl/resources/webgl-expectation-template.txt:
* webgl/2.0.0/.../*expected.txt: Modified all *expected.txts to match.

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

13 months agoAdd support for HEVC codec types in Media Capabilities
jer.noble@apple.com [Mon, 17 Sep 2018 23:24:21 +0000 (23:24 +0000)]
Add support for HEVC codec types in Media Capabilities
https://bugs.webkit.org/show_bug.cgi?id=189565

Reviewed by Eric Carlson.

Source/WebCore:

Test: media/hevc-codec-parameters.html

Add some utility methods for parsing HEVC codec strings, and using those parsed
values to query the platform for detailed support for HEVC decoding.

Drive-by fix: Modify MediaEngineConfigurationFactory to allow for null function
pointers in the encode/decode factory pair.

* Sources.txt:
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/cocoa/VideoToolboxSoftLink.cpp:
* platform/cocoa/VideoToolboxSoftLink.h:
* platform/graphics/HEVCUtilities.cpp: Added.
(WebCore::parseHEVCCodecParameters):
* platform/graphics/HEVCUtilities.h: Added.
* platform/graphics/cocoa/HEVCUtilitiesCocoa.cpp: Added.
(WebCore::validateHEVCParameters):
* platform/graphics/cocoa/HEVCUtilitiesCocoa.h: Added.
* platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.cpp: Added.
(WebCore::videoCodecTypeFromRFC4281Type):
(WebCore::createMediaPlayerDecodingConfigurationCocoa):
* platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.h: Added.
* platform/mediacapabilities/MediaEngineConfigurationFactory.cpp:
(WebCore::factories):
(WebCore::MediaEngineConfigurationFactory::createDecodingConfiguration):
(WebCore::MediaEngineConfigurationFactory::createEncodingConfiguration):
* testing/Internals.cpp:
(WebCore::Internals::parseHEVCCodecParameters):
* testing/Internals.h:
* testing/Internals.idl:

Source/WTF:

Extract the toIntegralType template into its own header.

* wtf/CMakeLists.txt:
* wtf/text/StringConversion.h: Added.
(isCharacterAllowedInBase):
(toIntegralType):
* wtf/text/WTFString.cpp:

LayoutTests:

* media/hevc-codec-parameters-expected.txt: Added.
* media/hevc-codec-parameters.html: Added.

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

13 months agoBuild fix after https://trac.webkit.org/changeset/236070
youenn@apple.com [Mon, 17 Sep 2018 23:21:49 +0000 (23:21 +0000)]
Build fix after https://trac.webkit.org/changeset/236070
https://bugs.webkit.org/show_bug.cgi?id=189635
<rdar://problem/44361849>

Unreviewed.
Fix for iOS internal builds.

* Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm:
(-[RTCVideoEncoderH264 resetCompressionSessionWithPixelFormat:]):

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

13 months ago+2018-08-17 Ben Richards <benton_richards@apple.com>
achristensen@apple.com [Mon, 17 Sep 2018 23:00:54 +0000 (23:00 +0000)]
+2018-08-17  Ben Richards  <benton_richards@apple.com>

Add script to generate WebContent service resource files and change XPC service main SPI to have it's own header
https://bugs.webkit.org/show_bug.cgi?id=188601

Reviewed by Dan Bernstein.

Added a script to the process entitlements build phase of the WebContent service that copies resource
files to WebKit.framework/PrivateHeaders/CustomWebContentResources. These resource files are to
be used by clients who would like to make a custom WebContent service.

* Scripts/copy-webcontent-resources-to-private-headers.sh: Added.
* WebKit.xcodeproj/project.pbxproj:

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

13 months agoWeb Inspector: generate CSSKeywordCompletions from backend values
drousso@apple.com [Mon, 17 Sep 2018 22:43:11 +0000 (22:43 +0000)]
Web Inspector: generate CSSKeywordCompletions from backend values
https://bugs.webkit.org/show_bug.cgi?id=189041

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

* inspector/protocol/CSS.json:
Include an optional `aliases` array and `inherited` boolean for `CSSPropertyInfo`.

Source/WebCore:

Modified existing test inspector/css/getSupportedCSSProperties.html.

* inspector/agents/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::getSupportedCSSProperties):
Send alias and longhand information for all properties, and any known keyword values for
those applicable. This makes use of `CSSParserFastPaths::isValidKeywordPropertyAndValue` to
determine if a given keyword is a valid value for each property. This only generates a list
for properties who have no non-keyword values.

* css/makeprop.pl:
* css/makevalues.pl:
Create additional helper functions/constants for retrieving strings of each CSS keyword.

* css/CSSProperty.h:
(WebCore::CSSProperty::aliasesForProperty):

* css/CSSPrimitiveValue.cpp:
(WebCore::valueName):

* css/CSSValuePool.cpp:
(WebCore::CSSValuePool::CSSValuePool):
(WebCore::CSSValuePool::createIdentifierValue):

Source/WebInspectorUI:

Moves the longhands map to `WI.CSSKeywordCompletions` for more global access. Creates an
aliases map to support completions on aliases with the same values as the non-alias name.
Removes all keyword-only properties from `WI.CSSKeywordCompletions._propertyKeywordMap` as
they are now generated by the backend (kept for compatibility).

* UserInterface/Models/CSSCompletions.js:
(WI.CSSCompletions):
(WI.CSSCompletions.requestCSSCompletions.propertyNamesCallback):
(WI.CSSCompletions.prototype.isShorthandPropertyName):

* UserInterface/Models/CSSKeywordCompletions.js:
(WI.CSSKeywordCompletions.forProperty.addKeywordsForName): Added.
(WI.CSSKeywordCompletions.forProperty):
(WI.CSSKeywordCompletions.addCustomCompletions):

* UserInterface/Models/CSSProperty.js:
(WI.CSSProperty.isInheritedPropertyName):

LayoutTests:

* inspector/css/getSupportedCSSProperties-expected.txt:
* inspector/css/getSupportedCSSProperties.html:

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

13 months agotrack.onmute isn't called for a remote MediaStreamTrack when its counter part track...
youenn@apple.com [Mon, 17 Sep 2018 22:22:15 +0000 (22:22 +0000)]
track.onmute isn't called for a remote MediaStreamTrack when its counter part track is removed from the peer connection
https://bugs.webkit.org/show_bug.cgi?id=176281
<rdar://problem/44525674>

Reviewed by Eric Carlson.

Source/WebCore:

Listen to libwebrtc remove track callbacks.
Implement handling as per https://w3c.github.io/webrtc-pc/#process-remote-track-removal.
This triggers a mute event on the track.

Test: webrtc/remove-track.html

* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::removeRemoteTrack):
(WebCore::LibWebRTCMediaEndpoint::OnRemoveTrack):
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
(WebCore::LibWebRTCPeerConnectionBackend::shouldOfferAllowToReceive const):
Drive by fix: Plan B code path does not mandate having an rtc backend for each sender.

LayoutTests:

* webrtc/remove-track-expected.txt: Added.
* webrtc/remove-track.html: Added.

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

13 months agoWe must convert ProfileType to CheckStructureOrEmpty instead of CheckStructure
sbarati@apple.com [Mon, 17 Sep 2018 22:21:32 +0000 (22:21 +0000)]
We must convert ProfileType to CheckStructureOrEmpty instead of CheckStructure
https://bugs.webkit.org/show_bug.cgi?id=189676
<rdar://problem/39682897>

Reviewed by Michael Saboff.

JSTests:

* typeProfiler/check-structure-or-empty-in-fixup.js: Added.
(A):
(K):
(i.catch):

Source/JavaScriptCore:

Because the incoming value may be TDZ, CheckStructure may end up crashing.
Since the Type Profile does not currently record TDZ values in any of its
data structures, this is not a semantic change in how it will show you data.
It just fixes crashes when we emit a CheckStructure and the incoming value
is TDZ.

* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGNode.h:
(JSC::DFG::Node::convertToCheckStructureOrEmpty):

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

13 months agoAdd more Fullscreen logging
simon.fraser@apple.com [Mon, 17 Sep 2018 22:05:45 +0000 (22:05 +0000)]
Add more Fullscreen logging
https://bugs.webkit.org/show_bug.cgi?id=189656

Reviewed by Jer Noble.

Add some fullscreen logging so I can tell whether WebFullScreenManager ever releases
the fullscreen element.

Source/WebCore:

* platform/cocoa/VideoFullscreenModelVideoElement.mm:
(VideoFullscreenModelVideoElement::VideoFullscreenModelVideoElement):
(VideoFullscreenModelVideoElement::~VideoFullscreenModelVideoElement):
(VideoFullscreenModelVideoElement::setVideoElement):

Source/WebKit:

* WebProcess/FullScreen/WebFullScreenManager.cpp:
(WebKit::WebFullScreenManager::WebFullScreenManager):
(WebKit::WebFullScreenManager::videoControlsManagerDidChange):
(WebKit::WebFullScreenManager::setPIPStandbyElement):
(WebKit::WebFullScreenManager::enterFullScreenForElement):
(WebKit::WebFullScreenManager::exitFullScreenForElement):
(WebKit::WebFullScreenManager::willEnterFullScreen):
(WebKit::WebFullScreenManager::didEnterFullScreen):
(WebKit::WebFullScreenManager::willExitFullScreen):
(WebKit::WebFullScreenManager::didExitFullScreen):
(WebKit::WebFullScreenManager::close):
* WebProcess/FullScreen/WebFullScreenManager.h:

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

13 months agoAdd support for dumping the GraphicsLayer tree via notifyutil
simon.fraser@apple.com [Mon, 17 Sep 2018 22:05:42 +0000 (22:05 +0000)]
Add support for dumping the GraphicsLayer tree via notifyutil
https://bugs.webkit.org/show_bug.cgi?id=189639

Reviewed by Zalan Bujtas.

Make "notifyutil -p com.apple.WebKit.showGraphicsLayerTree" work. It dumps the GraphicsLayer tree
for each top-level document (GraphicsLayers are connected across frame boundaries, so this prints
the entire tree for each main frame).

It uses WTFLogAlways rather than fprintf() so output shows on all platforms (other tree dumps should
be converted in the same way).

* page/mac/PageMac.mm:
(WebCore::Page::platformInitialize):
* platform/graphics/GraphicsLayer.cpp:
(showGraphicsLayerTree):
* rendering/RenderLayerCompositor.cpp:
(showGraphicsLayerTreeForCompositor):
* rendering/RenderLayerCompositor.h:
* rendering/RenderObject.cpp:
(WebCore::printGraphicsLayerTreeForLiveDocuments):
* rendering/RenderObject.h:

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

13 months agoSwipe snapshot can get stuck if swiping is disabled while it is visible
timothy_horton@apple.com [Mon, 17 Sep 2018 21:59:33 +0000 (21:59 +0000)]
Swipe snapshot can get stuck if swiping is disabled while it is visible
https://bugs.webkit.org/show_bug.cgi?id=189667
<rdar://problem/40367780>

Reviewed by Simon Fraser.

If navigation gestures are disabled while a swipe snapshot is visible,
WKWebView will tear down the ViewGestureController, which means that
the SnapshotRemovalTracker will no longer be around to ever remove
the snapshot.

It's currently very hard to write a test for this because we have
yet to come up with a good mechanism for testing swiping on iOS.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView setAllowsBackForwardNavigationGestures:]):
Instead of tearing down the ViewGestureController when navigation
gestures are disabled, just set a bit on it that disables gestures.

* UIProcess/Cocoa/ViewGestureController.cpp:
(WebKit::ViewGestureController::canSwipeInDirection const):
* UIProcess/Cocoa/ViewGestureController.h:
(WebKit::ViewGestureController::setSwipeGestureEnabled):
(WebKit::ViewGestureController::isSwipeGestureEnabled):
Add a bit to ViewGestureController that makes starting new gestures
always fail, but allows e.g. snapshots from existing swipes to continue
their usual behavior.

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

13 months ago[Curl] Add schema version and enable auto vacuum for cookie database.
chris.reid@sony.com [Mon, 17 Sep 2018 21:41:13 +0000 (21:41 +0000)]
[Curl] Add schema version and enable auto vacuum for cookie database.
https://bugs.webkit.org/show_bug.cgi?id=189669

Reviewed by Alex Christensen.

Turning on auto incremental vacuuming and adding versioning to the database. Right now we
reset tables if there's an unknown schema or if the none is set. There is placeholder logic
in place to upgrade databases as the schema changes in the future.

Tested by checking the database manually after launching MiniBrowser.

* platform/network/curl/CookieJarDB.cpp:
(WebCore::CookieJarDB::openDatabase):
(WebCore::CookieJarDB::verifySchemaVersion):
(WebCore::CookieJarDB::deleteAllTables):
(WebCore::CookieJarDB::createPrepareStatement):
(WebCore::CookieJarDB::getPrepareStatement):
(WebCore::CookieJarDB::executeSimpleSql):
* platform/network/curl/CookieJarDB.h:
* platform/network/curl/NetworkStorageSessionCurl.cpp:
(WebCore::defaultSession):
* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::turnOnIncrementalAutoVacuum): fixed a bug.

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

13 months agoFixed typo in TestExpectations file.
david_fenton@apple.com [Mon, 17 Sep 2018 21:14:34 +0000 (21:14 +0000)]
Fixed typo in TestExpectations file.
https://bugs.webkit.org/show_bug.cgi?id=188020.

Unreviewed test gardening.

Patch by Dawei Fenton <realdawei@apple.com> on 2018-09-17

* platform/ios/TestExpectations:

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

13 months agoRe-order Node flags based on semantics
rniwa@webkit.org [Mon, 17 Sep 2018 21:07:08 +0000 (21:07 +0000)]
Re-order Node flags based on semantics
https://bugs.webkit.org/show_bug.cgi?id=189643

Reviewed by Simon Fraser.

Re-ordered Node flags based on their category and subclasses of Node which use them.

* dom/Node.h:

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

13 months agoExpose WKWebProcess.h as a private header
achristensen@apple.com [Mon, 17 Sep 2018 20:36:09 +0000 (20:36 +0000)]
Expose WKWebProcess.h as a private header
https://bugs.webkit.org/show_bug.cgi?id=189636

* WebKit.xcodeproj/project.pbxproj:

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

13 months agoAdd more ResourceLoading logging, particularly in MemoryCache code
simon.fraser@apple.com [Mon, 17 Sep 2018 19:39:35 +0000 (19:39 +0000)]
Add more ResourceLoading logging, particularly in MemoryCache code
https://bugs.webkit.org/show_bug.cgi?id=189651

Reviewed by Tim Horton.

Adding more logging to the ResourceLoading log channel, which I found useful
when trying to understand cached SVGImage lifetimes (bug 189437).

* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::deleteIfPossible):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource):
(WebCore::CachedResourceLoader::garbageCollectDocumentResources):
* loader/cache/MemoryCache.cpp:
(WebCore::MemoryCache::add):
(WebCore::MemoryCache::pruneLiveResourcesToSize):
(WebCore::MemoryCache::pruneDeadResources):
(WebCore::MemoryCache::pruneDeadResourcesToSize):
(WebCore::MemoryCache::remove):
(WebCore::MemoryCache::dumpLRULists const):

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

13 months agoEnable USE_MEDIAREMOTE on iOS
jer.noble@apple.com [Mon, 17 Sep 2018 18:57:53 +0000 (18:57 +0000)]
Enable USE_MEDIAREMOTE on iOS
https://bugs.webkit.org/show_bug.cgi?id=189096

Reviewed by Eric Carlson.

Source/WebCore:

Migrate to using MediaRemote.framework on iOS from MediaPlayer.framework. This unifies the
Now Playing implementation on iOS and Mac.

* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/audio/cocoa/MediaSessionManagerCocoa.cpp: Removed.
* platform/audio/cocoa/MediaSessionManagerCocoa.h:
* platform/audio/cocoa/MediaSessionManagerCocoa.mm: Renamed from Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm.
(PlatformMediaSessionManager::sharedManager):
(PlatformMediaSessionManager::sharedManagerIfExists):
(MediaSessionManagerCocoa::updateSessionState):
(MediaSessionManagerCocoa::beginInterruption):
(MediaSessionManagerCocoa::scheduleUpdateNowPlayingInfo):
(MediaSessionManagerCocoa::sessionWillBeginPlayback):
(MediaSessionManagerCocoa::sessionDidEndRemoteScrubbing):
(MediaSessionManagerCocoa::removeSession):
(MediaSessionManagerCocoa::sessionWillEndPlayback):
(MediaSessionManagerCocoa::clientCharacteristicsChanged):
(MediaSessionManagerCocoa::sessionCanProduceAudioChanged):
(MediaSessionManagerCocoa::nowPlayingEligibleSession):
(MediaSessionManagerCocoa::updateNowPlayingInfo):
* platform/audio/ios/MediaSessionManagerIOS.h:
(): Deleted.
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::nowPlayingEligibleSession): Deleted.
(WebCore::MediaSessionManageriOS::updateNowPlayingInfo): Deleted.
(WebCore::MediaSessionManageriOS::sessionWillBeginPlayback): Deleted.
(WebCore::MediaSessionManageriOS::removeSession): Deleted.
(WebCore::MediaSessionManageriOS::sessionWillEndPlayback): Deleted.
(WebCore::MediaSessionManageriOS::clientCharacteristicsChanged): Deleted.
* platform/audio/mac/MediaSessionManagerMac.h: Removed.

Source/WTF:

* wtf/Platform.h:

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

13 months agoEnable VCP for iOS and reenable it for MacOS
youenn@apple.com [Mon, 17 Sep 2018 18:49:52 +0000 (18:49 +0000)]
Enable VCP for iOS and reenable it for MacOS
https://bugs.webkit.org/show_bug.cgi?id=189635
<rdar://problem/43621029>

Unreviewed, build fix for iOS simulator.

* Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h:

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

13 months agoExpose XPCServiceMain in a WebProcess header rather than WKProcessPool
commit-queue@webkit.org [Mon, 17 Sep 2018 18:45:46 +0000 (18:45 +0000)]
Expose XPCServiceMain in a WebProcess header rather than WKProcessPool
https://bugs.webkit.org/show_bug.cgi?id=189636

Patch by Alex Christensen <achristensen@webkit.org> on 2018-09-17
Reviewed by Dan Bernstein.

Fix a few build failures along the way.

* PluginProcess/mac/PluginControllerProxyMac.mm:
(WebKit::PluginControllerProxy::windowAndViewFramesChanged):
(WebKit::PluginControllerProxy::updateLayerHostingContext):
* PluginProcess/mac/PluginProcessMac.mm:
(WebKit::replacedNSWorkspace_launchApplicationAtURL_options_configuration_error):
(WebKit::PluginProcess::platformInitializeProcess):
* Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
* Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
(WebKit::XPCServiceMain):
(main):
* SourcesCocoa.txt:
* UIProcess/API/Cocoa/WKProcessPool.mm:
(+[WKProcessPool _webContentProcessXPCMain]): Deleted.
* UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/API: Added.
* WebProcess/API/Cocoa: Added.
* WebProcess/API/Cocoa/WKWebProcess.cpp: Added.
(WKWebProcessMain):
* WebProcess/API/Cocoa/WKWebProcess.h: Added.
* WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
(-[WKAccessibilityWebPageObject convertScreenPointToRootView:]):
(-[WKAccessibilityWebPageObject accessibilityAttributeValue:]):
(-[WKAccessibilityWebPageObject accessibilityHitTest:]):

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

13 months agoBuild error in ImageBufferCG when compiled with IOSurfacePool
commit-queue@webkit.org [Mon, 17 Sep 2018 18:24:10 +0000 (18:24 +0000)]
Build error in ImageBufferCG when compiled with IOSurfacePool
https://bugs.webkit.org/show_bug.cgi?id=189579

Patch by Frederic Wang <fwang@igalia.com> on 2018-09-17
Reviewed by Tim Horton.

IOSurface.h might be included with different value of IOSURFACE_CANVAS_BACKING_STORE, causing
compilation errors when files in the same unified source do not agree on the definition.
This patch moves the definition of IOSURFACE_CANVAS_BACKING_STORE from ImageBufferDataCG.h
to Platform.h so that IOSURFACE_CANVAS_BACKING_STORE is set to the same value in all files.
Finally some minors changes to explicitly declare/define ImageBuffer are performed in order
to prevent future issues with Unified build rotating.

Source/WebCore:

No new tests, behavior unchanged.

* html/HTMLCanvasElement.cpp: Explicitly include ImageBuffer.h since it's used in this file.
* platform/graphics/cg/ImageBufferDataCG.h: Move definition into Platform.h.
* platform/graphics/cocoa/IOSurface.h: Forward-declare ImageBuffer since it's used in this
header.

Source/WTF:

* wtf/Platform.h: Move definition from ImageBufferDataCG.h.

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

13 months ago[Curl] Respond with requested authentication scheme for authentication challenge.
Basuke.Suzuki@sony.com [Mon, 17 Sep 2018 18:19:34 +0000 (18:19 +0000)]
[Curl] Respond with requested authentication scheme for authentication challenge.
https://bugs.webkit.org/show_bug.cgi?id=189318

Reviewed by Alex Christensen.

Source/WebCore:

Curl port depends on libcurl's authentication handling by enabling CURLAUTH_ANY. With this
mode, the round-trip communication between the client and the server is handled by libcurl
internally. That's okay for many cases. But when initial request has a credentials
(i.e. XMLHttpRequest), there's no valid chance to store credential to the storage because
the returned response is not 401.

Passes following tests:
- http/tests/websocket/tests/hybi/httponly-cookie.pl
- http/tests/websocket/tests/hybi/secure-cookie-insecure-connection.pl
- http/tests/websocket/tests/hybi/secure-cookie-secure-connection.pl
- http/tests/xmlhttprequest/basic-auth-default.html
- http/tests/xmlhttprequest/cross-origin-authorization.html
- http/tests/xmlhttprequest/logout.html
- http/tests/xmlhttprequest/null-auth.php
- http/tests/xmlhttprequest/re-login-async.html
- http/tests/xmlhttprequest/re-login.html
- http/tests/xmlhttprequest/redirect-credentials-responseURL.html
- http/tests/xmlhttprequest/remember-bad-password.html

* platform/network/ResourceHandle.h:
* platform/network/curl/CurlContext.cpp:
(WebCore::CurlHandle::setHttpAuthUserPass):
(WebCore::CurlHandle::enableHttpAuthentication): Deleted.
* platform/network/curl/CurlContext.h:
* platform/network/curl/CurlRequest.cpp:
(WebCore::CurlRequest::setAuthenticationScheme):
(WebCore::CurlRequest::setupTransfer):
* platform/network/curl/CurlRequest.h:
* platform/network/curl/ResourceHandleCurl.cpp:
(WebCore::ResourceHandle::start):
(WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
(WebCore::ResourceHandle::receivedCredential):
(WebCore::ResourceHandle::getCredential):
(WebCore::ResourceHandle::restartRequestWithCredential):
(WebCore::ResourceHandle::platformLoadResourceSynchronously):
(WebCore::ResourceHandle::continueAfterWillSendRequest):

Source/WebKit:

Curl port depends on libcurl's authentication handling by enabling CURLAUTH_ANY. With this
mode, the round-trip communication between the client and the server is handled by libcurl
internally. That's okay for many cases. But when initial request has a credentials
(i.e. XMLHttpRequest), there's no valid chance to store credential to the storage because
the returned response is not 401.

* NetworkProcess/curl/NetworkDataTaskCurl.cpp:
(WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl):
(WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection):
(WebKit::NetworkDataTaskCurl::tryHttpAuthentication):
(WebKit::NetworkDataTaskCurl::tryProxyAuthentication):
(WebKit::NetworkDataTaskCurl::restartWithCredential):
* NetworkProcess/curl/NetworkDataTaskCurl.h:

LayoutTests:

* platform/wincairo/TestExpectations:

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

13 months ago[Web Animations] Positive delays of accelerated animations are not respected
graouts@webkit.org [Mon, 17 Sep 2018 17:37:48 +0000 (17:37 +0000)]
[Web Animations] Positive delays of accelerated animations are not respected
https://bugs.webkit.org/show_bug.cgi?id=189411
<rdar://problem/44151416>

Reviewed by Dean Jackson.

Use a mask over the animated rectangle to allow for a 1px rounding error when seeking to fix flakiness.

* webanimations/accelerated-animation-with-delay-and-seek-expected.html:
* webanimations/accelerated-animation-with-delay-and-seek.html:

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

13 months agoClear pending resource load statistics' writes after tests
commit-queue@webkit.org [Mon, 17 Sep 2018 17:18:27 +0000 (17:18 +0000)]
Clear pending resource load statistics' writes after tests
https://bugs.webkit.org/show_bug.cgi?id=189632
<rdar://problem/44469275>

Patch by Woodrow Wang <woodrow_wang@apple.com> on 2018-09-17
Reviewed by Chris Dumez.

* UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreStatisticsResetToConsistentState):

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

13 months agoEnable VCP for iOS and reenable it for MacOS
youenn@apple.com [Mon, 17 Sep 2018 17:15:56 +0000 (17:15 +0000)]
Enable VCP for iOS and reenable it for MacOS
https://bugs.webkit.org/show_bug.cgi?id=189635
<rdar://problem/43621029>

Reviewed by Eric Carlson.

Source/ThirdParty/libwebrtc:

Make sure VCP API is used to set encoding session parameters.

* Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h:
* Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm:
(-[RTCVideoEncoderH264 resetCompressionSessionWithPixelFormat:]):
* Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.cc:
* Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.h:

Source/WebCore:

Covered by exsiting and modified tests.
Instead of using libwebrtc YUV frames for black frames, use CVPixelBuffer to make it efficient.
Add internal API to know whether VCP is enabled so as to make capture-webrtc test pass on all platforms.

* platform/mediastream/RealtimeOutgoingVideoSource.cpp:
(WebCore::RealtimeOutgoingVideoSource::sendBlackFramesIfNeeded):
* platform/mediastream/RealtimeOutgoingVideoSource.h:
* platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.h:
* platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h:
* platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
(WebCore::createBlackPixelBuffer):
(WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
* platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
(WebCore::RealtimeOutgoingVideoSourceCocoa::createBlackFrame):
* platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.h:
* testing/Internals.cpp:
(WebCore::Internals::supportsVCPEncoder):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

* platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html:
For platforms suppporting VCP, arbitrary size should be supported.
* webrtc/routines.js:

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

13 months agoPSON: window.open() with 'noopener' should only process-swap cross-site, not cross...
cdumez@apple.com [Mon, 17 Sep 2018 17:15:07 +0000 (17:15 +0000)]
PSON: window.open() with 'noopener' should only process-swap cross-site, not cross-origin
https://bugs.webkit.org/show_bug.cgi?id=189602
<rdar://problem/44430549>

Reviewed by Geoff Garen.

Source/WebCore:

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::setTriggeringAction):
* loader/DocumentLoader.h:
* loader/FrameLoadRequest.h:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadURL):
(WebCore::FrameLoader::loadWithNavigationAction):
(WebCore::FrameLoader::loadWithDocumentLoader):
(WebCore::FrameLoader::loadPostRequest):
(WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
(WebCore::FrameLoader::loadDifferentDocumentItem):
Move NavigationAction's opener setting to loadWithNavigationAction() as this is a better bottleneck.
Otherwise, we'd have to set it at several call sites. Also move the NavigationAction around instead
of copying it.

* loader/FrameLoader.h:
(WebCore::FrameLoader::loadWithNavigationAction):
* loader/NavigationAction.h:
(WebCore::NavigationAction::setShouldOpenExternalURLsPolicy):
* loader/PolicyChecker.cpp:
(WebCore::PolicyChecker::checkNavigationPolicy):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::createWindow):

Source/WebKit:

The following fixes were made to our process swap on navigation logic:
- Browsing contexts opened via window.open() with 'noopener' option now only same if
  they are cross-site, instead of doing a stricter cross-origin check.
- Support process swapping when opening a new window via <a target="_blank" rel="noopener">
  that is cross-site.

In order to support this, the following changes were made:
- Stop passing a 'isCrossOriginWindowOpenNavigation' flag to the UIProcess when navigating because:
  - This is specific to window.open() and does not apply to other windows opened by DOM
  - This forces the origin check to happens on WebContent process side instead of relying on the
    one in WebProcessPool in the UIProcess
- Pass the origin of the requester to the UIProcess when navigating, so that the WebProcessPool
  can use the requester's host for the cross-site check for the initial navigation in a new window
  created by DOM.
- Add 2 flags to WebPageProxy which indicate if the page was created by the DOM and if any provisional
  loads have been committed. The WebProcessPool uses theses flags to recognize initial loads in
  new windows created by the DOM, so that it uses the requester's origin for the cross-site check.

* Shared/NavigationActionData.cpp:
(WebKit::NavigationActionData::encode const):
(WebKit::NavigationActionData::decode):
* Shared/NavigationActionData.h:
* UIProcess/API/APINavigation.h:
(API::Navigation::setRequesterOrigin):
(API::Navigation::requesterOrigin const):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::continueNavigationInNewProcess):
(WebKit::WebPageProxy::didCommitLoadForFrame):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::createNewPage):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::setOpenedByDOM):
(WebKit::WebPageProxy::openedByDOM const):
(WebKit::WebPageProxy::hasCommittedAnyProvisionalLoads const):
* UIProcess/WebProcessPool.cpp:
(WebKit::shouldUseSameProcessBasedOnURLs):
(WebKit::WebProcessPool::processForNavigationInternal):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):

Tools:

Add API test coverage.

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:

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

13 months agoRevert https://trac.webkit.org/r235910, because the new test times out.
ap@apple.com [Mon, 17 Sep 2018 17:11:15 +0000 (17:11 +0000)]
Revert https://trac.webkit.org/r235910, because the new test times out.
Crash under PlatformPopupMenuData::encode when interacting with a select menu that has variable fonts
https://bugs.webkit.org/show_bug.cgi?id=188008

Source/WebKit:

* Shared/cf/ArgumentCodersCF.cpp:
(IPC::encode):
(IPC::decode):

LayoutTests:

* fast/text/variations/ipc2-expected.txt: Removed.
* fast/text/variations/ipc2.html: Removed.
* platform/mac-wk1/TestExpectations:

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

13 months agoRefactoring related to Safe Browsing
commit-queue@webkit.org [Mon, 17 Sep 2018 17:09:43 +0000 (17:09 +0000)]
Refactoring related to Safe Browsing
https://bugs.webkit.org/show_bug.cgi?id=189631

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

Make SafeBrowsingResult RefCounted.
Move logic from an unnamed lambda to WebPageProxy::receivedNavigationPolicyDecision.

* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::beginSafeBrowsingCheck):
(WebKit::WebPageProxy::contentFilterDidBlockLoadForFrame): Deleted.
(WebKit::WebPageProxy::addPlatformLoadParameters): Deleted.
(WebKit::WebPageProxy::createSandboxExtensionsIfNeeded): Deleted.
(WebKit::WebPageProxy::startDrag): Deleted.
(WebKit::WebPageProxy::setPromisedDataForImage): Deleted.
(WebKit::WebPageProxy::setDragCaretRect): Deleted.
(WebKit::WebPageProxy::platformRegisterAttachment): Deleted.
(WebKit::WebPageProxy::platformCloneAttachment): Deleted.
* UIProcess/SafeBrowsingResult.h:
(WebKit::SafeBrowsingResult::create):
* UIProcess/WebFramePolicyListenerProxy.cpp:
(WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
* UIProcess/WebFramePolicyListenerProxy.h:
* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::setUpPolicyListenerProxy):
* UIProcess/WebFrameProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::receivedNavigationPolicyDecision):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::decidePolicyForNewWindowAction):
(WebKit::WebPageProxy::decidePolicyForResponse):
* UIProcess/WebPageProxy.h:

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

13 months agoUse OpaqueJSString rather than JSRetainPtr inside WebKit
darin@apple.com [Mon, 17 Sep 2018 16:54:55 +0000 (16:54 +0000)]
Use OpaqueJSString rather than JSRetainPtr inside WebKit
https://bugs.webkit.org/show_bug.cgi?id=189652

Reviewed by Saam Barati.

Source/JavaScriptCore:

* API/JSCallbackObjectFunctions.h: Removed an uneeded include of
JSStringRef.h.

* API/JSContext.mm:
(-[JSContext evaluateScript:withSourceURL:]): Use OpaqueJSString::create rather
than JSStringCreateWithCFString, simplifying the code and also obviating the
need for explicit JSStringRelease.
(-[JSContext setName:]): Ditto.

* API/JSStringRef.cpp:
(JSStringIsEqualToUTF8CString): Use adoptRef rather than explicit JSStringRelease.
It seems that additional optimization is possible, obviating the need to allocate
an OpaqueJSString, but that's true almost everywhere else in this patch, too.

* API/JSValue.mm:
(+[JSValue valueWithNewRegularExpressionFromPattern:flags:inContext:]): Use
OpaqueJSString::create and adoptRef as appropriate.
(+[JSValue valueWithNewErrorFromMessage:inContext:]): Ditto.
(+[JSValue valueWithNewSymbolFromDescription:inContext:]): Ditto.
(performPropertyOperation): Ditto.
(-[JSValue invokeMethod:withArguments:]): Ditto.
(valueToObjectWithoutCopy): Ditto.
(containerValueToObject): Ditto.
(valueToString): Ditto.
(objectToValueWithoutCopy): Ditto.
(objectToValue): Ditto.

Source/WebCore:

* Modules/plugins/QuickTimePluginReplacement.mm:
(WebCore::jsValueWithDictionaryInContext): Use OpaqueJSString::create.
(WebCore::jsValueWithAVMetadataItemInContext): Use adoptCF.

* platform/mac/SerializedPlatformRepresentationMac.mm:
(WebCore::jsValueWithDictionaryInContext): Use OpaqueJSString::create.

Source/WebKit:

* Shared/API/c/WKString.cpp: Removed unneeded include of JSStringRef.h.

* WebProcess/Automation/WebAutomationSessionProxy.cpp: Removed unneeded
include of JSRetainPtr.
(WebKit::toJSString): Deleted.
(WebKit::toJSValue): Use OpaqueJSString::create.
(WebKit::callPropertyFunction): Ditto.
(WebKit::evaluate): Use adoptRef.
(WebKit::evaluateJavaScriptCallback): Ditto.
(WebKit::WebAutomationSessionProxy::scriptObjectForFrame):
Use OpaqueJSString::create.
(WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction): Use
String rather than JSStringRef.

* WebProcess/Plugins/PDF/PDFPlugin.mm: Removed unneeded includes.
(WebKit::PDFPlugin::runScriptsInPDFDocument): Use OpaqueJSString::create.

Source/WebKitLegacy/ios:

* WebView/WebPDFViewIOS.mm:
(-[WebPDFView finishedLoadingWithDataSource:]): Use OpaqueJSString::create.
* WebView/WebPDFViewPlaceholder.mm:
(-[WebPDFViewPlaceholder _evaluateJSForDocument:]): Ditto.

Source/WebKitLegacy/mac:

* WebView/WebPDFRepresentation.mm:
(-[WebPDFRepresentation finishedLoadingWithDataSource:]): Use OpaqueJSString::create.

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

13 months agoLayout Test imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap...
david_fenton@apple.com [Mon, 17 Sep 2018 16:41:29 +0000 (16:41 +0000)]
Layout Test imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage.html is a flaky failure.
https://bugs.webkit.org/show_bug.cgi?id=188020.

Unreviewed test gardening.

Patch by Dawei Fenton <realdawei@apple.com> on 2018-09-17

* platform/ios/TestExpectations:

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

13 months ago[WPE] Add new failure
csaavedra@igalia.com [Mon, 17 Sep 2018 15:04:32 +0000 (15:04 +0000)]
[WPE] Add new failure

Unreviewed gardening.
* platform/wpe/TestExpectations:

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

13 months ago[GTK][WPE] Update baseline for fast/dom/navigator-detached-no-crash
csaavedra@igalia.com [Mon, 17 Sep 2018 14:36:36 +0000 (14:36 +0000)]
[GTK][WPE] Update baseline for fast/dom/navigator-detached-no-crash

In GTK it's just a matter of updating the baseline. In WPE
there's some JS output that just needs to be ignored.
* platform/gtk/TestExpectations:
* platform/gtk/fast/dom/navigator-detached-no-crash-expected.txt:
* platform/wpe/TestExpectations:

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

13 months ago[WPE] Mark crashing animations test.
csaavedra@igalia.com [Mon, 17 Sep 2018 14:09:19 +0000 (14:09 +0000)]
[WPE] Mark crashing animations test.

animations/play-state-start-paused.html crashing.
Unreviewed gardening.
* platform/wpe/TestExpectations:

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

13 months ago[WPE] Unmark now passing tests
csaavedra@igalia.com [Mon, 17 Sep 2018 12:23:51 +0000 (12:23 +0000)]
[WPE] Unmark now passing tests

Unreviewed gardening.
* platform/wpe/TestExpectations:

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

13 months ago[GTK] Unmark now passing tests.
csaavedra@igalia.com [Mon, 17 Sep 2018 12:07:04 +0000 (12:07 +0000)]
[GTK] Unmark now passing tests.

Unreviewed gardening.
* platform/gtk/TestExpectations:

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

13 months agoUnreviewed, fix incorrect WPE build fix made in r236009
mcatanzaro@igalia.com [Mon, 17 Sep 2018 11:23:13 +0000 (11:23 +0000)]
Unreviewed, fix incorrect WPE build fix made in r236009

This isn't the right place to add the typedef. I failed to notice that the WebKitWebView
type is not actually used anywhere in this header. Actually, the problematic function is no
longer declared or used anywhere and was just missed when WebKitScriptDialog was refactored,
so remove it.

* UIProcess/API/wpe/WebKitScriptDialog.h:
* UIProcess/API/wpe/WebKitScriptDialogWPE.cpp:
(webkitScriptDialogRun): Deleted.

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

13 months ago[JHBuild] Update to GStreamer 1.14.3
philn@webkit.org [Mon, 17 Sep 2018 11:06:44 +0000 (11:06 +0000)]
[JHBuild] Update to GStreamer 1.14.3
https://bugs.webkit.org/show_bug.cgi?id=189450

Reviewed by Xabier Rodriguez-Calvar.

* gstreamer/jhbuild.modules: Bump GStreamer modules from 1.14.1 to 1.14.3.

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

13 months ago[JHBuild] Doesn't check sha256 sums
philn@webkit.org [Mon, 17 Sep 2018 08:30:03 +0000 (08:30 +0000)]
[JHBuild] Doesn't check sha256 sums
https://bugs.webkit.org/show_bug.cgi?id=189646

Reviewed by Michael Catanzaro.

* gstreamer/jhbuild.modules: Properly set the sha256: prefix on hashes.

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

13 months agoMove IndexedDB to Network Process
sihui_liu@apple.com [Mon, 17 Sep 2018 07:11:55 +0000 (07:11 +0000)]
Move IndexedDB to Network Process
https://bugs.webkit.org/show_bug.cgi?id=189415
<rdar://problem/44396973>

Reviewed by Chris Dumez.

Source/WebKit:

We are going to eliminate storage process and move its functionality to network process.
The reasons why we want to do this:
1. Lower resource usage of having an additional process for storage operations, especially
memory. Single storage process takes about 5MB memory on macOS.
2. Reduce latency of Service Workers. After enabling Service Workers, we've seen
regression in app launch. The launch time of storage process is partly attributed to this:
Service Workers delay page loading until receiving response from storage process.
3. We choose network process because UI process may have broader access in file system
that we don't want the storage operations to have.

This patch is the first piece towards the goal. It mainly moves indexedDB from storage process
to corresponding components of network process. Moving of Service Worker and stopping to
launch storage process will be done in following patches.

We expect to see the higher cpu and memory usage of network process as it is taking more work,
but the overall gain in memory and latency after we completely remove storage process should be
positive.

* CMakeLists.txt:
* DerivedSources.make:
* NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.cpp.
(WebKit::WebIDBConnectionToClient::create):
(WebKit::WebIDBConnectionToClient::WebIDBConnectionToClient):
(WebKit::WebIDBConnectionToClient::~WebIDBConnectionToClient):
(WebKit::WebIDBConnectionToClient::disconnectedFromWebProcess):
(WebKit::WebIDBConnectionToClient::messageSenderConnection):
(WebKit::WebIDBConnectionToClient::connectionToClient):
(WebKit::WebIDBConnectionToClient::didDeleteDatabase):
(WebKit::WebIDBConnectionToClient::didOpenDatabase):
(WebKit::WebIDBConnectionToClient::didAbortTransaction):
(WebKit::WebIDBConnectionToClient::didCommitTransaction):
(WebKit::WebIDBConnectionToClient::didCreateObjectStore):
(WebKit::WebIDBConnectionToClient::didDeleteObjectStore):
(WebKit::WebIDBConnectionToClient::didRenameObjectStore):
(WebKit::WebIDBConnectionToClient::didClearObjectStore):
(WebKit::WebIDBConnectionToClient::didCreateIndex):
(WebKit::WebIDBConnectionToClient::didDeleteIndex):
(WebKit::WebIDBConnectionToClient::didRenameIndex):
(WebKit::WebIDBConnectionToClient::didPutOrAdd):
(WebKit::WebIDBConnectionToClient::handleGetResult):
(WebKit::WebIDBConnectionToClient::didGetRecord):
(WebKit::WebIDBConnectionToClient::didGetAllRecords):
(WebKit::WebIDBConnectionToClient::didGetCount):
(WebKit::WebIDBConnectionToClient::didDeleteRecord):
(WebKit::WebIDBConnectionToClient::didOpenCursor):
(WebKit::WebIDBConnectionToClient::didIterateCursor):
(WebKit::WebIDBConnectionToClient::fireVersionChangeEvent):
(WebKit::WebIDBConnectionToClient::didStartTransaction):
(WebKit::WebIDBConnectionToClient::didCloseFromServer):
(WebKit::WebIDBConnectionToClient::notifyOpenDBRequestBlocked):
(WebKit::WebIDBConnectionToClient::didGetAllDatabaseNames):
(WebKit::WebIDBConnectionToClient::deleteDatabase):
(WebKit::WebIDBConnectionToClient::openDatabase):
(WebKit::WebIDBConnectionToClient::abortTransaction):
(WebKit::WebIDBConnectionToClient::commitTransaction):
(WebKit::WebIDBConnectionToClient::didFinishHandlingVersionChangeTransaction):
(WebKit::WebIDBConnectionToClient::createObjectStore):
(WebKit::WebIDBConnectionToClient::deleteObjectStore):
(WebKit::WebIDBConnectionToClient::renameObjectStore):
(WebKit::WebIDBConnectionToClient::clearObjectStore):
(WebKit::WebIDBConnectionToClient::createIndex):
(WebKit::WebIDBConnectionToClient::deleteIndex):
(WebKit::WebIDBConnectionToClient::renameIndex):
(WebKit::WebIDBConnectionToClient::putOrAdd):
(WebKit::WebIDBConnectionToClient::getRecord):
(WebKit::WebIDBConnectionToClient::getAllRecords):
(WebKit::WebIDBConnectionToClient::getCount):
(WebKit::WebIDBConnectionToClient::deleteRecord):
(WebKit::WebIDBConnectionToClient::openCursor):
(WebKit::WebIDBConnectionToClient::iterateCursor):
(WebKit::WebIDBConnectionToClient::establishTransaction):
(WebKit::WebIDBConnectionToClient::databaseConnectionPendingClose):
(WebKit::WebIDBConnectionToClient::databaseConnectionClosed):
(WebKit::WebIDBConnectionToClient::abortOpenAndUpgradeNeeded):
(WebKit::WebIDBConnectionToClient::didFireVersionChangeEvent):
(WebKit::WebIDBConnectionToClient::openDBRequestCancelled):
(WebKit::WebIDBConnectionToClient::confirmDidCloseFromServer):
(WebKit::WebIDBConnectionToClient::getAllDatabaseNames):
* NetworkProcess/IndexedDB/WebIDBConnectionToClient.h: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.h.
* NetworkProcess/IndexedDB/WebIDBConnectionToClient.messages.in: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.messages.in.
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::didReceiveMessage):

Code moved from StorageToWebProcessConnection::didReceiveMessage.

(WebKit::NetworkConnectionToWebProcess::didClose):
(WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):

Network process receives and stores sandbox extension of temporary files for later indexedDB
use.

(WebKit::NetworkConnectionToWebProcess::didClose):
(WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
(WebKit::generateIDBConnectionToServerIdentifier):
(WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
(WebKit::NetworkConnectionToWebProcess::removeIDBConnectionToServer):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::NetworkProcess):
(WebKit::NetworkProcess::initializeNetworkProcess):
(WebKit::NetworkProcess::addWebsiteDataStore):
(WebKit::NetworkProcess::fetchWebsiteData):
(WebKit::NetworkProcess::deleteWebsiteData):
(WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
(WebKit::NetworkProcess::idbServer):
(WebKit::NetworkProcess::ensurePathExists):
(WebKit::NetworkProcess::postStorageTask):
(WebKit::NetworkProcess::performNextStorageTask):
(WebKit::NetworkProcess::prepareForAccessToTemporaryFile):
(WebKit::NetworkProcess::accessToTemporaryFileComplete):
(WebKit::NetworkProcess::indexedDatabaseOrigins):
(WebKit::NetworkProcess::addIndexedDatabaseSession):
(WebKit::NetworkProcess::getSandboxExtensionsForBlobFiles):

Instead of asking UI process to grant sandbox extension to storage process, now network
process just asks for sandbox extension fot itself.

(WebKit::NetworkProcess::didGetSandboxExtensionsForBlobFiles):
(WebKit::NetworkProcess::updateTemporaryFileSandboxExtensions):
(WebKit::NetworkProcess::grantSandboxExtensionsToStorageProcessForBlobs): Deleted.
(WebKit::NetworkProcess::didGrantSandboxExtensionsToStorageProcessForBlobs): Deleted.
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode const):
(WebKit::NetworkProcessCreationParameters::decode):
* NetworkProcess/NetworkProcessCreationParameters.h:
* Shared/Storage/StorageProcessCreationParameters.cpp:
(WebKit::StorageProcessCreationParameters::encode const):
(WebKit::StorageProcessCreationParameters::decode):
* Shared/Storage/StorageProcessCreationParameters.h:
* Shared/WebsiteDataStoreParameters.cpp:
(WebKit::WebsiteDataStoreParameters::encode const):
(WebKit::WebsiteDataStoreParameters::decode):
(WebKit::WebsiteDataStoreParameters::privateSessionParameters):
* Shared/WebsiteDataStoreParameters.h:
* Sources.txt:
* StorageProcess/StorageProcess.cpp:
(WebKit::StorageProcess::initializeWebsiteDataStore):
(WebKit::StorageProcess::fetchWebsiteData):
(WebKit::StorageProcess::deleteWebsiteData):
(WebKit::StorageProcess::deleteWebsiteDataForOrigins):
(WebKit::StorageProcess::idbServer): Deleted.
(WebKit::StorageProcess::grantSandboxExtensionsForBlobs): Deleted.
(WebKit::StorageProcess::prepareForAccessToTemporaryFile): Deleted.
(WebKit::StorageProcess::accessToTemporaryFileComplete): Deleted.
(WebKit::StorageProcess::indexedDatabaseOrigins): Deleted.
(WebKit::StorageProcess::getSandboxExtensionsForBlobFiles): Deleted.
(WebKit::StorageProcess::didGetSandboxExtensionsForBlobFiles): Deleted.
* StorageProcess/StorageProcess.h:
(WebKit::StorageProcess::queue): Deleted.
* StorageProcess/StorageProcess.messages.in:
* StorageProcess/StorageToWebProcessConnection.cpp:
(WebKit::StorageToWebProcessConnection::didReceiveMessage):
(WebKit::StorageToWebProcessConnection::didClose):
(WebKit::generateIDBConnectionToServerIdentifier): Deleted.
(WebKit::StorageToWebProcessConnection::establishIDBConnectionToServer): Deleted.
(WebKit::StorageToWebProcessConnection::removeIDBConnectionToServer): Deleted.
* StorageProcess/StorageToWebProcessConnection.h:
* StorageProcess/StorageToWebProcessConnection.messages.in:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::getSandboxExtensionsForBlobFiles):
(WebKit::NetworkProcessProxy::grantSandboxExtensionsToStorageProcessForBlobs): Deleted.
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.messages.in:
* UIProcess/Storage/StorageProcessProxy.cpp:
(WebKit::StorageProcessProxy::getSandboxExtensionsForBlobFiles): Deleted.
* UIProcess/Storage/StorageProcessProxy.h:
* UIProcess/Storage/StorageProcessProxy.messages.in:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::ensureNetworkProcess):
(WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
(WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::parameters):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::computeNetworkProcessAccessTypeForDataFetch):
(WebKit::WebsiteDataStore::fetchDataAndApply):
(WebKit::computeNetworkProcessAccessTypeForDataRemoval):
(WebKit::WebsiteDataStore::removeData):
(WebKit::WebsiteDataStore::storageProcessParameters):
(WebKit::WebsiteDataStore::parameters):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
(WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer):
(WebKit::WebIDBConnectionToServer::~WebIDBConnectionToServer):
(WebKit::WebIDBConnectionToServer::messageSenderConnection):
* WebProcess/Databases/WebDatabaseProvider.cpp:
(WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
* WebProcess/Network/NetworkProcessConnection.cpp:
(WebKit::NetworkProcessConnection::didReceiveMessage):
(WebKit::NetworkProcessConnection::didClose):
(WebKit::NetworkProcessConnection::idbConnectionToServerForSession):
* WebProcess/Network/NetworkProcessConnection.h:
(WebKit::NetworkProcessConnection::existingIDBConnectionToServerForIdentifier const):
* WebProcess/Storage/WebToStorageProcessConnection.cpp:
(WebKit::WebToStorageProcessConnection::didReceiveMessage):
(WebKit::WebToStorageProcessConnection::didClose):
(WebKit::WebToStorageProcessConnection::idbConnectionToServerForSession): Deleted.
* WebProcess/Storage/WebToStorageProcessConnection.h:
(WebKit::WebToStorageProcessConnection::existingIDBConnectionToServerForIdentifier): Deleted.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::networkProcessConnectionClosed):
(WebKit::WebProcess::webToStorageProcessConnectionClosed):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/IDBDeleteRecovery.mm:
(TEST):
* TestWebKitAPI/Tests/WebKitCocoa/IDBIndexUpgradeToV2.mm:
(TEST):
* TestWebKitAPI/Tests/WebKitCocoa/IndexedDBDatabaseProcessKill.mm:
(TEST):
* TestWebKitAPI/Tests/WebKitCocoa/IndexedDBMultiProcess.mm:
(TEST):
* TestWebKitAPI/Tests/WebKitCocoa/IndexedDBPersistence.mm:
(TEST):

LayoutTests:

* storage/indexeddb/modern/opendatabase-after-storage-crash.html:

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

13 months agoUnreviewed test gardening, mark fast/text/variations/ipc2.html as slow.
ryanhaddad@apple.com [Mon, 17 Sep 2018 00:35:31 +0000 (00:35 +0000)]
Unreviewed test gardening, mark fast/text/variations/ipc2.html as slow.

* platform/mac-wk2/TestExpectations:

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

13 months agoWeb Inspector: REGRESSION: breakpoint context menu appears twice in DOM tree
drousso@apple.com [Sat, 15 Sep 2018 18:41:58 +0000 (18:41 +0000)]
Web Inspector: REGRESSION: breakpoint context menu appears twice in DOM tree
https://bugs.webkit.org/show_bug.cgi?id=189308

Reviewed by Joseph Pecoraro.

* UserInterface/Controllers/DOMBreakpointTreeController.js:
(WI.DOMBreakpointTreeController.appendBreakpointContextMenuItems):
Set a symbol on the `contextMenu` to ensure that the same items are not added twice.

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

13 months agoStreamline JSRetainPtr, fix leaks of JSString and JSGlobalContext
darin@apple.com [Sat, 15 Sep 2018 16:17:24 +0000 (16:17 +0000)]
Streamline JSRetainPtr, fix leaks of JSString and JSGlobalContext
https://bugs.webkit.org/show_bug.cgi?id=189455

Reviewed by Keith Miller.

Source/JavaScriptCore:

* API/JSObjectRef.cpp:
(OpaqueJSPropertyNameArray): Use Ref<OpaqueJSString> instead of
JSRetainPtr<JSStringRef>.
(JSObjectCopyPropertyNames): Remove now-unneeded use of leakRef and
adopt constructor.
(JSPropertyNameArrayGetNameAtIndex): Use ptr() instead of get() since
the array elements are now Ref.

* API/JSRetainPtr.h: While JSRetainPtr is written as a template,
it only works for two specific unrelated types, JSStringRef and
JSGlobalContextRef. Simplified the default constructor using data
member initialization. Prepared to make the adopt constructor private
(got everything compiling that way, then made it public again so that
Apple internal software will still build). Got rid of unneeded
templated constructor and assignment operator, since it's not relevant
since there is no inheritance between JSRetainPtr template types.
Added WARN_UNUSED_RETURN to leakRef as in RefPtr and RetainPtr.
Added move constructor and move assignment operator for slightly better
performance. Simplified implementations of various member functions
so they are more obviously correct, by using leakPtr in more of them
and using std::exchange to make the flow of values more obvious.

* API/JSValue.mm:
(+[JSValue valueWithNewSymbolFromDescription:inContext:]): Added a
missing JSStringRelease to fix a leak.

* API/tests/CustomGlobalObjectClassTest.c:
(customGlobalObjectClassTest): Added a JSGlobalContextRelease to fix a leak.
(globalObjectSetPrototypeTest): Ditto.
(globalObjectPrivatePropertyTest): Ditto.

* API/tests/ExecutionTimeLimitTest.cpp:
(testResetAfterTimeout): Added a call to JSStringRelease to fix a leak.
(testExecutionTimeLimit): Ditto, lots more.

* API/tests/FunctionOverridesTest.cpp:
(testFunctionOverrides): Added a call to JSStringRelease to fix a leak.

* API/tests/JSObjectGetProxyTargetTest.cpp:
(testJSObjectGetProxyTarget): Added a call to JSGlobalContextRelease to fix
a leak.

* API/tests/PingPongStackOverflowTest.cpp:
(testPingPongStackOverflow): Added calls to JSGlobalContextRelease and
JSStringRelease to fix leaks.

* API/tests/testapi.c:
(throwException): Added. Helper function for repeated idiom where we want
to throw an exception, but with additional JSStringRelease calls so we don't
have to leak just to keep the code simpler to read.
(MyObject_getProperty): Use throwException.
(MyObject_setProperty): Ditto.
(MyObject_deleteProperty): Ditto.
(isValueEqualToString): Added. Helper function for an idiom where we check
if something is a string and then if it's equal to a particular string
constant, but a version that has an additional JSStringRelease call so we
don't have to leak just to keep the code simpler to read.
(MyObject_callAsFunction): Use isValueEqualToString and throwException.
(MyObject_callAsConstructor): Ditto.
(MyObject_hasInstance): Ditto.
(globalContextNameTest): Added a JSGlobalContextRelease to fix a leak.
(testMarkingConstraintsAndHeapFinalizers): Ditto.

Source/WebCore:

* Modules/plugins/QuickTimePluginReplacement.mm:
(WebCore::jsValueWithDictionaryInContext): Adding a missing
JSStringRelease to fix a leak.

Source/WebKit:

* WebProcess/Automation/WebAutomationSessionProxy.cpp:
(WebKit::toJSString): Use adopt function instead of adopt construuctor.
(WebKit::evaluate): Ditto.
(WebKit::evaluateJavaScriptCallback): Ditto.
(WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction): Ditto.

Tools:

There is a lot of copied and pasted code for WebKit vs. Legacy WebKit
testing and even for macOS vs. iOS vs. Windows platform-specific code.
For now, this patch just makes corresponding changes to the copied code.
Later we might get better results by merging more code instead of having
all these separate copies.

* DumpRenderTree/AccessibilityController.cpp:
(AccessibilityController::makeWindowObject): Use the adopt function
instead of the special Adopt constructor of JSRetainPtr.

* DumpRenderTree/AccessibilityTextMarker.cpp: Removed unneeded include.

* DumpRenderTree/AccessibilityUIElement.cpp: Ditto.
(allAttributesCallback): Don't adopt at this level; changed the
underlying function to return a JSRetainPtr so the adopt is right next
to the call to the create or copy function.
(attributesOfLinkedUIElementsCallback): Ditto.
(attributesOfDocumentLinksCallback): Ditto.
(attributesOfChildrenCallback): Ditto.
(parameterizedAttributeNamesCallback): Ditto.
(attributesOfColumnHeadersCallback): Ditto.
(attributesOfRowHeadersCallback): Ditto.
(attributesOfColumnsCallback): Ditto.
(attributesOfRowsCallback): Ditto.
(attributesOfVisibleCellsCallback): Ditto.
(attributesOfHeaderCallback): Ditto.
(rowIndexRangeCallback): Ditto.
(columnIndexRangeCallback): Ditto.
(rangeForLineCallback): Ditto.
(boundsForRangeCallback): Ditto.
(rangeForPositionCallback): Ditto.
(stringForRangeCallback): Ditto.
(attributedStringForRangeCallback): Ditto.
(uiElementCountForSearchPredicateCallback): Use the free adopt
function instead of the adopt member function.
(uiElementForSearchPredicateCallback): Ditto.
(selectTextWithCriteriaCallback): Don't adopt at this level.
(attributedStringForElementCallback): Ditto.
(setValueCallback): Use free adopt.
(stringAttributeValueCallback): Don't adopt at this level.
(uiElementArrayAttributeValueCallback): Ditto.
(uiElementAttributeValueCallback): Ditto.
(stringForTextMarkerRangeCallback): Ditto.
(attributedStringForTextMarkerRangeCallback): Ditto.
(attributedStringForTextMarkerRangeWithOptionsCallback): Ditto.
(getARIADropEffectsCallback): Ditto.
(getClassListCallback): Ditto.
(getRoleCallback): Ditto.
(getSubroleCallback): Ditto.
(getRoleDescriptionCallback): Ditto.
(getComputedRoleStringCallback): Ditto.
(getTitleCallback): Ditto.
(getDescriptionCallback): Ditto.
(getStringValueCallback): Ditto.
(getLanguageCallback): Ditto.
(getHelpTextCallback): Ditto.
(getOrientationCallback): Ditto.
(getPathDescriptionCallback): Ditto.
(getSelectedTextRangeCallback): Ditto.
(speakAsCallback): Ditto.
(getValueDescriptionCallback): Ditto.
(getAccessibilityValueCallback): Ditto.
(getDocumentEncodingCallback): Ditto.
(getDocumentURICallback): Ditto.
(getURLCallback): Ditto.
(characterAtOffsetCallback): Ditto.
(wordAtOffsetCallback): Ditto.
(lineAtOffsetCallback): Ditto.
(sentenceAtOffsetCallback): Ditto.
(stringForSelectionCallback): Ditto.
(getIdentifierCallback): Ditto.
(getTraitsCallback): Ditto.
(supportedActionsCallback): Ditto.
(mathPostscriptsDescriptionCallback): Ditto.
(mathPrescriptsDescriptionCallback): Ditto.
(AccessibilityUIElement::rangeForLine): Updated to return JSRetainPtr.
(AccessibilityUIElement::rangeForPosition): Ditto.
(AccessibilityUIElement::speakAs): Ditto.
(AccessibilityUIElement::pathDescription const): Ditto.
(AccessibilityUIElement::stringForTextMarkerRange): Ditto.
(AccessibilityUIElement::attributedStringForTextMarkerRange): Ditto.
(AccessibilityUIElement::attributedStringForTextMarkerRangeWithOptions): Ditto.

* DumpRenderTree/AccessibilityUIElement.h: Use JSRetainPtr instead of
raw pointers for the results of the functions that create strings.
The old way was difficult to get right; the functions didn't even follow
the create/copy naming rule.

* DumpRenderTree/Bindings/CodeGeneratorDumpRenderTree.pm:
(_platformTypeConstructor): Use the adopt function instead of the
JSRetainPtr adopt constructor. Also nullptr instead of 0.

* DumpRenderTree/GCController.cpp:
(GCController::makeWindowObject): Use adopt function instead of constructor.

* DumpRenderTree/TestRunner.cpp:
(pathToLocalResourceCallback): Use adopt function instead of constructor.
(addDisallowedURLCallback): Ditto.
(addURLToRedirectCallback): Ditto.
(clearApplicationCacheForOriginCallback): Ditto.
(applicationCacheDiskUsageForOriginCallback): Ditto.
(decodeHostNameCallback): Don't adopt at this level.
(encodeHostNameCallback): Ditto.
(execCommandCallback): Use adopt instead of JSRetainPtr::adopt.
(findStringCallback): Use adopt function instead of constructor.
(isCommandEnabledCallback): Ditto.
(overridePreferenceCallback): Ditto.
(queueLoadCallback): Ditto.
(queueLoadHTMLStringCallback): Ditto.
(queueLoadingScriptCallback): Ditto.
(queueNonLoadingScriptCallback): Ditto.
(setAuthenticationPasswordCallback): Ditto.
(setAuthenticationUsernameCallback): Ditto.
(setDomainRelaxationForbiddenForURLSchemeCallback): Ditto.
(setMockGeolocationPositionUnavailableErrorCallback): Ditto.
(setPOSIXLocaleCallback): Ditto.
(setPersistentUserStyleSheetLocationCallback): Ditto.
(setUserStyleSheetLocationCallback): Ditto.
(setValueForUserCallback): Ditto.
(setWillSendRequestClearHeaderCallback): Ditto.
(setPageVisibilityCallback): Ditto.
(evaluateInWebInspectorCallback): Ditto.
(evaluateScriptInIsolatedWorldCallback): Ditto.
(evaluateScriptInIsolatedWorldAndReturnValueCallback): Ditto.
(addOriginAccessWhitelistEntryCallback): Ditto.
(removeOriginAccessWhitelistEntryCallback): Ditto.
(setScrollbarPolicyCallback): Ditto.
(addUserScriptCallback): Ditto.
(addUserStyleSheetCallback): Ditto.
(apiTestNewWindowDataLoadBaseURLCallback): Ditto.
(authenticateSessionCallback): Ditto.
(getTitleTextDirectionCallback): Ditto.
(getInspectorTestStubURLCallback): Ditto.
(simulateLegacyWebNotificationClickCallback): Ditto.
(setTextDirectionCallback): Ditto.
(grantWebNotificationPermissionCallback): Ditto.
(denyWebNotificationPermissionCallback): Ditto.
(accummulateLogsForChannel): Ditto.
(runUIScriptCallback): Ditto.
(TestRunner::makeWindowObject): Ditto.
(TestRunner::uiScriptDidComplete): Ditto.
(TestRunner::setOpenPanelFiles): Ditto.

* DumpRenderTree/TestRunner.h: Use JSRetainPtr instead of
raw pointers for the results of the functions that create strings.

* DumpRenderTree/ios/AccessibilityControllerIOS.mm:
(AccessibilityController::platformName const): Use the adopt
function instead of the adopt constructor.

* DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
(createEmptyJSString): Added. This helper function makes reduces the
repetitive code to create empty strings.
(concatenateAttributeAndValue): Changed to return a JSRetainPtr.
(AccessibilityUIElement::identifier): Ditto.
(AccessibilityUIElement::traits): Ditto.
(AccessibilityUIElement::url): Ditto.
(AccessibilityUIElement::speakAs): Ditto.
(AccessibilityUIElement::stringForSelection): Ditto.
(AccessibilityUIElement::stringForRange): Ditto.
(AccessibilityUIElement::attributedStringForRange): Ditto.
(AccessibilityUIElement::attributedStringForElement): Ditto.
(AccessibilityUIElement::pathDescription const): Ditto.
(AccessibilityUIElement::stringForTextMarkerRange): Ditto.
(AccessibilityUIElement::attributedStringForTextMarkerRange): Ditto.
(AccessibilityUIElement::attributedStringForTextMarkerRangeWithOptions): Ditto.
(AccessibilityUIElement::attributesOfLinkedUIElements): Ditto.
(AccessibilityUIElement::attributesOfDocumentLinks): Ditto.
(AccessibilityUIElement::attributesOfChildren): Ditto.
(AccessibilityUIElement::allAttributes): Ditto.
(AccessibilityUIElement::stringAttributeValue): Ditto.
(AccessibilityUIElement::parameterizedAttributeNames): Ditto.
(AccessibilityUIElement::role): Ditto.
(AccessibilityUIElement::subrole): Ditto.
(AccessibilityUIElement::roleDescription): Ditto.
(AccessibilityUIElement::computedRoleString): Ditto.
(AccessibilityUIElement::title): Ditto.
(AccessibilityUIElement::description): Ditto.
(AccessibilityUIElement::orientation const): Ditto.
(AccessibilityUIElement::stringValue): Ditto.
(AccessibilityUIElement::language): Ditto.
(AccessibilityUIElement::helpText const): Ditto.
(AccessibilityUIElement::valueDescription): Ditto.
(AccessibilityUIElement::ariaDropEffects const): Ditto.
(AccessibilityUIElement::boundsForRange): Ditto.
(AccessibilityUIElement::attributesOfColumnHeaders): Ditto.
(AccessibilityUIElement::attributesOfRowHeaders): Ditto.
(AccessibilityUIElement::attributesOfColumns): Ditto.
(AccessibilityUIElement::attributesOfRows): Ditto.
(AccessibilityUIElement::attributesOfVisibleCells): Ditto.
(AccessibilityUIElement::attributesOfHeader): Ditto.
(AccessibilityUIElement::rowIndexRange): Ditto.
(AccessibilityUIElement::columnIndexRange): Ditto.
(AccessibilityUIElement::selectedTextRange): Ditto.
(AccessibilityUIElement::accessibilityValue const): Ditto.
(AccessibilityUIElement::documentEncoding): Ditto.
(AccessibilityUIElement::documentURI): Ditto.
(AccessibilityUIElement::selectTextWithCriteria): Ditto.
(AccessibilityUIElement::classList const): Ditto.

* DumpRenderTree/mac/AccessibilityCommonMac.h: Changed the
createJSStringRef method to return a JSRetainPtr.
* DumpRenderTree/mac/AccessibilityCommonMac.mm:
(-[NSString createJSStringRef]): Ditto.
(searchPredicateParameterizedAttributeForSearchCriteria): Use the
adopt function instead of the adopt constructor.
* DumpRenderTree/mac/AccessibilityControllerMac.mm:
(AccessibilityController::platformName const): Ditto.

* DumpRenderTree/mac/AccessibilityNotificationHandler.mm:
(-[NSString createJSStringRef]): Return a JSRetainPtr.
(makeValueRefForValue): Updated for the above, no adopt needed here now.
(makeObjectRefForDictionary): Ditto.
(-[AccessibilityNotificationHandler _notificationReceived:]): Ditto.

* DumpRenderTree/mac/AccessibilityUIElementMac.mm:
(createEmptyJSString): Added. This helper function makes reduces the
repetitive code to create empty strings.
(concatenateAttributeAndValue): Changed to return a JSRetainPtr.
(descriptionOfElements): Ditto.
(selectTextParameterizedAttributeForCriteria): Ditto.
(AccessibilityUIElement::attributesOfLinkedUIElements): Ditto.
(AccessibilityUIElement::attributesOfDocumentLinks): Ditto.
(AccessibilityUIElement::attributesOfChildren): Ditto.
(AccessibilityUIElement::allAttributes): Ditto.
(AccessibilityUIElement::stringAttributeValue): Ditto.
(AccessibilityUIElement::parameterizedAttributeNames): Ditto.
(AccessibilityUIElement::role): Ditto.
(AccessibilityUIElement::subrole): Ditto.
(AccessibilityUIElement::roleDescription): Ditto.
(AccessibilityUIElement::computedRoleString): Ditto.
(AccessibilityUIElement::title): Ditto.
(AccessibilityUIElement::description): Ditto.
(AccessibilityUIElement::orientation const): Ditto.
(AccessibilityUIElement::stringValue): Ditto.
(AccessibilityUIElement::language): Ditto.
(AccessibilityUIElement::helpText const): Ditto.
(AccessibilityUIElement::valueDescription): Ditto.
(AccessibilityUIElement::speakAs): Ditto.
(AccessibilityUIElement::classList const): Ditto.
(AccessibilityUIElement::ariaDropEffects const): Ditto.
(AccessibilityUIElement::rangeForLine): Ditto.
(AccessibilityUIElement::rangeForPosition): Ditto.
(AccessibilityUIElement::boundsForRange): Ditto.
(AccessibilityUIElement::stringForRange): Ditto.
(AccessibilityUIElement::attributedStringForRange): Ditto.
(AccessibilityUIElement::selectTextWithCriteria): Ditto.
(AccessibilityUIElement::attributesOfColumnHeaders): Ditto.
(AccessibilityUIElement::attributesOfRowHeaders): Ditto.
(AccessibilityUIElement::attributesOfColumns): Ditto.
(AccessibilityUIElement::attributesOfRows): Ditto.
(AccessibilityUIElement::attributesOfVisibleCells): Ditto.
(AccessibilityUIElement::attributesOfHeader): Ditto.
(AccessibilityUIElement::rowIndexRange): Ditto.
(AccessibilityUIElement::columnIndexRange): Ditto.
(AccessibilityUIElement::pathDescription const): Ditto.
(AccessibilityUIElement::selectedTextRange): Ditto.
(AccessibilityUIElement::accessibilityValue const): Ditto.
(AccessibilityUIElement::documentEncoding): Ditto.
(AccessibilityUIElement::documentURI): Ditto.
(AccessibilityUIElement::url): Ditto.
(AccessibilityUIElement::stringForTextMarkerRange): Ditto.
(createJSStringRef): Ditto.
(AccessibilityUIElement::attributedStringForTextMarkerRange): Ditto.
(AccessibilityUIElement::attributedStringForTextMarkerRangeWithOptions): Ditto.
(AccessibilityUIElement::supportedActions): Ditto.
(AccessibilityUIElement::mathPostscriptsDescription const): Ditto.
(AccessibilityUIElement::mathPrescriptsDescription const): Ditto.

* DumpRenderTree/mac/FrameLoadDelegate.mm:
(-[FrameLoadDelegate didClearWindowObjectForFrame:inIsolatedWorld:]):
Use the adopt function instead of the adopt constructor.
* DumpRenderTree/mac/TestRunnerMac.mm:
(originsArrayToJS): Ditto.
(TestRunner::copyDecodedHostName): Return a JSRetainPtr.
(TestRunner::copyEncodedHostName): Ditto.
(TestRunner::pathToLocalResource): Ditto.
(TestRunner::queueLoad): Use adopt function instead of constructor.
(TestRunner::findString): Ditto.
(TestRunner::inspectorTestStubURL): Return a JSRetainPtr.

* DumpRenderTree/win/AccessibilityControllerWin.cpp:
(AccessibilityController::winNotificationReceived): Use adopt function
instead of adopt constructor.
(AccessibilityController::platformName const): Ditto.

* DumpRenderTree/win/AccessibilityUIElementWin.cpp:
(createEmptyJSString): Added. This helper function makes reduces the
repetitive code to create empty strings.
(AccessibilityUIElement::allAttributes): Changed to return a JSRetainPtr.
(AccessibilityUIElement::attributesOfLinkedUIElements): Ditto.
(AccessibilityUIElement::attributesOfDocumentLinks): Ditto.
(AccessibilityUIElement::attributesOfChildren): Ditto.
(AccessibilityUIElement::parameterizedAttributeNames): Ditto.
(AccessibilityUIElement::role): Ditto.
(AccessibilityUIElement::subrole): Ditto.
(AccessibilityUIElement::roleDescription): Ditto.
(AccessibilityUIElement::computedRoleString): Ditto.
(AccessibilityUIElement::title): Ditto.
(AccessibilityUIElement::description): Ditto.
(AccessibilityUIElement::stringValue): Ditto.
(AccessibilityUIElement::language): Ditto.
(AccessibilityUIElement::helpText const): Ditto.
(AccessibilityUIElement::valueDescription): Ditto.
(AccessibilityUIElement::ariaDropEffects const): Ditto.
(AccessibilityUIElement::orientation const): Ditto.
(AccessibilityUIElement::attributesOfColumnHeaders): Ditto.
(AccessibilityUIElement::attributesOfRowHeaders): Ditto.
(AccessibilityUIElement::attributesOfColumns): Ditto.
(AccessibilityUIElement::attributesOfRows): Ditto.
(AccessibilityUIElement::attributesOfVisibleCells): Ditto.
(AccessibilityUIElement::attributesOfHeader): Ditto.
(AccessibilityUIElement::rowIndexRange): Ditto.
(AccessibilityUIElement::columnIndexRange): Ditto.
(AccessibilityUIElement::boundsForRange): Ditto.
(AccessibilityUIElement::stringForRange): Ditto.
(AccessibilityUIElement::attributedStringForRange): Ditto.
(AccessibilityUIElement::selectTextWithCriteria): Ditto.
(AccessibilityUIElement::selectedTextRange): Ditto.
(AccessibilityUIElement::stringAttributeValue): Ditto.
(AccessibilityUIElement::accessibilityValue const): Ditto.
(AccessibilityUIElement::documentEncoding): Ditto.
(AccessibilityUIElement::documentURI): Ditto.
(AccessibilityUIElement::url): Ditto.
(AccessibilityUIElement::classList const): Ditto.

* DumpRenderTree/win/TestRunnerWin.cpp:
(TestRunner::copyDecodedHostName): Changed to return a JSRetainPtr.
(TestRunner::copyEncodedHostName): Ditto.
(TestRunner::pathToLocalResource): Ditto.
(TestRunner::queueLoad): Ditto.
(TestRunner::findString): Ditto.
(TestRunner::inspectorTestStubURL): Ditto.

* TestRunnerShared/Bindings/JSWrapper.h:
(WTR::setProperty): Use adopt function instead of constructor.
* TestRunnerShared/UIScriptContext/UIScriptContext.cpp:
(UIScriptContext::UIScriptContext): Ditto.
(UIScriptContext::runUIScript): Ditto.
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::toDeviceOrientation): Ditto.

* TestRunnerShared/cocoa/LayoutTestSpellChecker.mm:
(nsTextCheckingType): Changed this function to not take an rvalue
reference to a JSRetainPtr since it doesn't take ownership.
(-[LayoutTestSpellChecker setResultsFromJSObject:inContext:]): Updated
for the above change.

* TestWebKitAPI/JavaScriptTest.cpp:
(TestWebKitAPI::javaScriptCallback): Use adopt function instead of
adopt member function.

* TestWebKitAPI/Tests/WebKit/WKPageIsPlayingAudio.cpp: Removed unneeded include.
* TestWebKitAPI/Tests/WebKitCocoa/PictureInPictureDelegate.mm: Ditto.
* TestWebKitAPI/Tests/mac/DOMNodeFromJSObject.mm: Use adopt function instead of
adopt constructor.
* TestWebKitAPI/Tests/mac/JSWrapperForNodeInWebFrame.mm: Ditto.

* WebKitTestRunner/InjectedBundle/AccessibilityController.cpp:
Removed unneeded includes.
* WebKitTestRunner/InjectedBundle/AccessibilityTextMarker.cpp: Ditto.
* WebKitTestRunner/InjectedBundle/AccessibilityTextMarkerRange.cpp: Ditto.
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp: Ditto.

* WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm:
(_platformTypeConstructor): Use the adopt function instead of the
JSRetainPtr adopt constructor. Also nullptr instead of 0.

* WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
(WTR::arrayLength): Use adopt function instead of constructor.
(WTR::parseModifierArray): Ditto.
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::propertyValue): Ditto.
(WTR::dumpPath): Ditto.
(WTR::toJS): Ditto.
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::findString): Ditto.
(WTR::TestRunner::statisticsDidRunTelemetryCallback): Ditto.
(WTR::TestRunner::callDidReceiveAllStorageAccessEntriesCallback): Ditto.
(WTR::TestRunner::setOpenPanelFiles): Ditto.
* WebKitTestRunner/InjectedBundle/ios/AccessibilityControllerIOS.mm:
(WTR::AccessibilityController::platformName): Ditto.

* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(-[NSString createJSStringRef]): Return a JSRetainPtr.
This fixes storage leaks in many functions below, which were using
the create function and putting the value right into a JSRetainPtr
without adoption.
(WTR::createEmptyJSString): Added. This helper function reduces the
repetitive code to create empty strings.
(WTR::concatenateAttributeAndValue): Return a JSRetainPtr.
(WTR::AccessibilityUIElement::attributesOfLinkedUIElements):
Use createEmptyJSString, fixing a storage leak due to missing adoption.
(WTR::AccessibilityUIElement::attributesOfDocumentLinks): Ditto.
(WTR::AccessibilityUIElement::attributesOfChildren): Ditto.
(WTR::AccessibilityUIElement::allAttributes): Ditto.
(WTR::AccessibilityUIElement::stringAttributeValue): Ditto.
(WTR::AccessibilityUIElement::parameterizedAttributeNames): Ditto.
(WTR::AccessibilityUIElement::role): Ditto.
(WTR::AccessibilityUIElement::subrole): Ditto.
(WTR::AccessibilityUIElement::roleDescription): Ditto.
(WTR::AccessibilityUIElement::computedRoleString): Ditto.
(WTR::AccessibilityUIElement::title): Ditto.
(WTR::AccessibilityUIElement::orientation const): Ditto.
(WTR::AccessibilityUIElement::language): Ditto.
(WTR::AccessibilityUIElement::valueDescription): Ditto.
(WTR::AccessibilityUIElement::ariaDropEffects const): Ditto.
(WTR::AccessibilityUIElement::boundsForRange): Ditto.
(WTR::AccessibilityUIElement::stringForRange): Removed unneeded null check.
(WTR::AccessibilityUIElement::attributedStringForRange): Ditto.
(WTR::AccessibilityUIElement::attributesOfColumnHeaders):
Use createEmptyJSString, fixing a storage leak due to missing adoption.
(WTR::AccessibilityUIElement::attributesOfRowHeaders): Ditto.
(WTR::AccessibilityUIElement::attributesOfColumns): Ditto.
(WTR::AccessibilityUIElement::attributesOfRows): Ditto.
(WTR::AccessibilityUIElement::attributesOfVisibleCells): Ditto.
(WTR::AccessibilityUIElement::attributesOfHeader): Ditto.
(WTR::AccessibilityUIElement::selectedTextRange): Ditto.
(WTR::AccessibilityUIElement::accessibilityValue const): Ditto.
(WTR::AccessibilityUIElement::documentEncoding): Ditto.
(WTR::AccessibilityUIElement::documentURI): Ditto.
(WTR::AccessibilityUIElement::stringForSelection): Removed unneeded
null check.
(WTR::AccessibilityUIElement::stringForTextMarkerRange):
Use createEmptyJSString, fixing a storage leak due to missing adoption.

* WebKitTestRunner/InjectedBundle/mac/AccessibilityCommonMac.h:
Use JSRetainPtr for the return value of createJSStringRef.
* WebKitTestRunner/InjectedBundle/mac/AccessibilityCommonMac.mm:
(-[NSString createJSStringRef]): Ditto.
(WTR::searchPredicateParameterizedAttributeForSearchCriteria): Use the
adopt function instead of the adopt constructor.
* WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm:
(WTR::AccessibilityController::platformName): Ditto

* WebKitTestRunner/InjectedBundle/mac/AccessibilityNotificationHandler.mm:
(-[NSString createJSStringRef]): Return a JSRetainPtr.
(makeValueRefForValue): Updated for above by removing adopt.
(makeObjectRefForDictionary): Ditto.
(-[AccessibilityNotificationHandler _notificationReceived:]): Ditto.

* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::createEmptyJSString): Added. This helper function makes reduces the
repetitive code to create empty strings.
(WTR::concatenateAttributeAndValue): Return a JSRetainPtr.
(WTR::descriptionOfElements): Ditto.
(WTR::selectTextParameterizedAttributeForCriteria): Ditto.
(WTR::AccessibilityUIElement::accessibilityValue const): Use createEmptyJSString,
fixing a storage leak due to missing adoption.
(WTR::AccessibilityUIElement::documentEncoding): Ditto.
(WTR::AccessibilityUIElement::documentURI): Ditto.
(WTR::createJSStringRef): Return a JSRetainPtr.

* WebKitTestRunner/StringFunctions.h:
(WTR::toWK): Take a const& to eliminate a little bit of reference count churn.
(WTR::toJS): Use the adopt function instead of the constructor.

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

13 months ago2018-09-15 Rob Buis <rbuis@igalia.com>
rwlbuis@webkit.org [Sat, 15 Sep 2018 14:08:47 +0000 (14:08 +0000)]
2018-09-15  Rob Buis  <rbuis@igalia.com>

        XMLHttpRequest::createResponseBlob() should create a Blob with type for empty response
        https://bugs.webkit.org/show_bug.cgi?id=189627

        Reviewed by Alexey Proskuryakov.

        Right now we return an empty Blob without type when the response is empty, but
        it should always include the type [1].

        Test: web-platform-tests/xhr/overridemimetype-blob.html

        [1] https://xhr.spec.whatwg.org/#blob-response

        * xml/XMLHttpRequest.cpp:
        (WebCore::XMLHttpRequest::createResponseBlob):

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

13 months agoUnreviewed, rolling out r236020.
jlewis3@apple.com [Sat, 15 Sep 2018 01:20:27 +0000 (01:20 +0000)]
Unreviewed, rolling out r236020.

This caused an api failure on High Sierra

Reverted changeset:

"Refactoring related to Safe Browsing"
https://bugs.webkit.org/show_bug.cgi?id=189631
https://trac.webkit.org/changeset/236020

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

13 months ago[Curl] Bug fix on some inaccurate values in NetworkLoadMetrics.
Basuke.Suzuki@sony.com [Sat, 15 Sep 2018 00:46:47 +0000 (00:46 +0000)]
[Curl] Bug fix on some inaccurate values in NetworkLoadMetrics.
https://bugs.webkit.org/show_bug.cgi?id=189530

Reviewed by Alex Christensen.

Curl port uses the start time libcurl provided. But there's a lug between main thread and Curl thread.
Record the start time of request instead of libcurl's start timing and use it to measure the metrics.
Source/WebCore:

Also respondEnd was not correctly recorded and fixed.

No new tests because it cannot be measured from DRT.

* platform/network/ResourceHandleInternal.h:
* platform/network/curl/CurlContext.cpp:
(WebCore::CurlHandle::getNetworkLoadMetrics):
* platform/network/curl/CurlContext.h:
* platform/network/curl/CurlRequest.cpp:
(WebCore::CurlRequest::start):
(WebCore::CurlRequest::setupTransfer):
(WebCore::CurlRequest::didCompleteTransfer):
(WebCore::CurlRequest::updateNetworkLoadMetrics):
* platform/network/curl/CurlRequest.h:
(WebCore::CurlRequest::setStartTime):
* platform/network/curl/ResourceHandleCurl.cpp:
(WebCore::ResourceHandle::start):
(WebCore::ResourceHandle::restartRequestWithCredential):
(WebCore::ResourceHandle::platformLoadResourceSynchronously):
(WebCore::ResourceHandle::willSendRequest):
(WebCore::ResourceHandle::continueAfterWillSendRequest):

Source/WebKit:

* NetworkProcess/curl/NetworkDataTaskCurl.cpp:
(WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl):
(WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection):
(WebKit::NetworkDataTaskCurl::restartWithCredential):
* NetworkProcess/curl/NetworkDataTaskCurl.h:

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

13 months agoWeb Inspector: Source View doesn't scroll to show line when breakpoint is hit inside...
commit-queue@webkit.org [Sat, 15 Sep 2018 00:39:59 +0000 (00:39 +0000)]
Web Inspector: Source View doesn't scroll to show line when breakpoint is hit inside of <script> in HTML resource
https://bugs.webkit.org/show_bug.cgi?id=189638
<rdar://problem/43359278>

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

Pausing in Document resources on page load have special considerations where we
may not receive their full content immediately, so we may synthesize inline script
content for the resource until we have full content. Unfortunately, when we get
full content and update the TextEditor we were losing the revealed position and
other editor information. This change specifically targets those cases, by
re-applying editor state when updating such a resource from partial to full content.

* UserInterface/Views/SourceCodeTextEditor.js:
(WI.SourceCodeTextEditor.prototype._contentAvailable):
Signal to the editor that when updating the content it should carry
over editor state. Only do this if we had partial content before.

* UserInterface/Views/TextEditor.js:
(WI.TextEditor):
(WI.TextEditor.prototype.set repeatReveal):
Provide a way to signal we should restore state when update the content.

(WI.TextEditor.set string.update):
(WI.TextEditor.prototype.set string):
When repeatReveal was enabled, restore editor state such as the
revealed location and text selection.

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

13 months agoAdditional tests for conic gradients
megan_gardner@apple.com [Sat, 15 Sep 2018 00:33:58 +0000 (00:33 +0000)]
Additional tests for conic gradients
https://bugs.webkit.org/show_bug.cgi?id=189566

Reviewed by Simon Fraser.

Adding tests that actually test the gradient nature of gradients.
This is done by using an svg filter to consolidate the sections
of the gradient to sections we can actuall test the color of. Also,
the seams are clipped out, to reduce noise. Since gradients are
highly noise prone, this is the best way to check and make sure
that gradients are functional without sevear noise issues.

* TestExpectations:
* fast/gradients/conic-gradient-alpha-expected.html: Added.
* fast/gradients/conic-gradient-alpha.html: Added.
* fast/gradients/conic-gradient-expected.html: Added.
* fast/gradients/conic-gradient-extended-stops-expected.html: Added.
* fast/gradients/conic-gradient-extended-stops.html: Added.
* fast/gradients/conic-gradient.html: Added.
* platform/ios-12/TestExpectations:
* platform/mac/TestExpectations:

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

13 months agoAdd Justin Michaud.
dino@apple.com [Sat, 15 Sep 2018 00:22:46 +0000 (00:22 +0000)]
Add Justin Michaud.

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

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

13 months agoWebGL 2 conformance: rgb-format-support.html
justin_fan@apple.com [Sat, 15 Sep 2018 00:05:22 +0000 (00:05 +0000)]
WebGL 2 conformance: rgb-format-support.html
https://bugs.webkit.org/show_bug.cgi?id=189610
<rdar://problem/44403343>

Reviewed by Dean Jackson.

Source/WebCore:

Implementing getInternalformatParameter (emulating on macOS) and updating
renderbufferStorage{Multisample} for WebGL 2 conformance.

Test: webgl/2.0.0/conformance2/rendering/rgb-format-support.html enabled.

* html/canvas/WebGL2RenderingContext.cpp:
(WebCore::isRenderableInternalformat):
(WebCore::WebGL2RenderingContext::getInternalformatParameter):
(WebCore::WebGL2RenderingContext::renderbufferStorageMultisample):
(WebCore::WebGL2RenderingContext::renderbufferStorage):
(WebCore::WebGL2RenderingContext::baseInternalFormatFromInternalFormat):
(WebCore::WebGL2RenderingContext::isIntegerFormat):
* platform/graphics/GraphicsContext3D.h:
* platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
(WebCore::GraphicsContext3D::getInternalformativ):
(WebCore::GraphicsContext3D::renderbufferStorageMultisample):

LayoutTests:

Enabled rgb-format-support.html, and updated expectation for gl-teximage.html.

* TestExpectations:
* platform/mac/TestExpectations:
* webgl/2.0.0/conformance2/rendering/rgb-format-support-expected.txt:

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

13 months agoAdd support for spreadMethod=reflect and repeat on SVG gradients (for CoreGraphics...
commit-queue@webkit.org [Fri, 14 Sep 2018 23:55:37 +0000 (23:55 +0000)]
Add support for spreadMethod=reflect and repeat on SVG gradients (for CoreGraphics platforms)
https://bugs.webkit.org/show_bug.cgi?id=5968

Source/WebCore:

Add support for spreadMethod=repeat and reflect. Also, the opacity of a gradient is now
the result of multiplying stop-opacity with the opacity of the color.

Patch by Justin Michaud <justin_michaud@apple.com> on 2018-09-14
Reviewed by Simon Fraser.

Tests: svg/gradients/spreadMethod-expected.svg
       svg/gradients/spreadMethod.svg
       svg/gradients/spreadMethodAlpha-expected.svg
       svg/gradients/spreadMethodAlpha.svg
       svg/gradients/spreadMethodClose0-expected-mismatch.svg
       svg/gradients/spreadMethodClose0.svg
       svg/gradients/spreadMethodClose1-expected-mismatch.svg
       svg/gradients/spreadMethodClose1.svg
       svg/gradients/spreadMethodClose2-expected.svg
       svg/gradients/spreadMethodClose2.svg
       svg/gradients/spreadMethodDiagonal-expected.svg
       svg/gradients/spreadMethodDiagonal.svg
       svg/gradients/spreadMethodDiagonal2-expected.svg
       svg/gradients/spreadMethodDiagonal2.svg
       svg/gradients/spreadMethodDuplicateStop-expected.svg
       svg/gradients/spreadMethodDuplicateStop.svg
       svg/gradients/spreadMethodReversed-expected.svg
       svg/gradients/spreadMethodReversed.svg
       svg/gradients/stopAlpha-expected.svg
       svg/gradients/stopAlpha.svg

* platform/graphics/cg/GradientCG.cpp:
(WebCore::Gradient::paint):
* svg/SVGStopElement.cpp:
(WebCore::SVGStopElement::stopColorIncludingOpacity const):

LayoutTests:

Add new svg tests for linear gradients with spreadMethod, and alpha values specified in
both stop-opacity and color.

Patch by Justin Michaud <justin_michaud@apple.com> on 2018-09-14
Reviewed by Simon Fraser.

* platform/mac/svg/W3C-SVG-1.1/pservers-grad-10-b-expected.png:
* svg/gradients/spreadMethod-expected.svg: Added.
* svg/gradients/spreadMethod.svg: Added.
* svg/gradients/spreadMethodAlpha-expected.svg: Added.
* svg/gradients/spreadMethodAlpha.svg: Added.
* svg/gradients/spreadMethodClose0-expected-mismatch.svg: Added.
* svg/gradients/spreadMethodClose0.svg: Added.
* svg/gradients/spreadMethodClose1-expected-mismatch.svg: Added.
* svg/gradients/spreadMethodClose1.svg: Added.
* svg/gradients/spreadMethodClose2-expected.svg: Added.
* svg/gradients/spreadMethodClose2.svg: Added.
* svg/gradients/spreadMethodDiagonal-expected.svg: Added.
* svg/gradients/spreadMethodDiagonal.svg: Added.
* svg/gradients/spreadMethodDiagonal2-expected.svg: Added.
* svg/gradients/spreadMethodDiagonal2.svg: Added.
* svg/gradients/spreadMethodDuplicateStop-expected.svg: Added.
* svg/gradients/spreadMethodDuplicateStop.svg: Added.
* svg/gradients/spreadMethodReversed-expected.svg: Added.
* svg/gradients/spreadMethodReversed.svg: Added.
* svg/gradients/stopAlpha-expected.svg: Added.
* svg/gradients/stopAlpha.svg: Added.

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

13 months ago[WinCairo] Unreviewed test gardening.
ross.kirsling@sony.com [Fri, 14 Sep 2018 23:54:09 +0000 (23:54 +0000)]
[WinCairo] Unreviewed test gardening.

* TestExpectations: Remove duplicative line introduced in r235959.
* platform/wincairo/TestExpectations:

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

13 months agoDon't dump OSRAvailabilityData in Graph::dump because a stale Availability may point...
sbarati@apple.com [Fri, 14 Sep 2018 23:47:55 +0000 (23:47 +0000)]
Don't dump OSRAvailabilityData in Graph::dump because a stale Availability may point to a Node that is already freed
https://bugs.webkit.org/show_bug.cgi?id=189628
<rdar://problem/39481690>

Reviewed by Mark Lam.

JSTests:

* stress/verbose-failure-dont-graph-dump-availability-already-freed.js: Added.
(foo):

Source/JavaScriptCore:

An Availability may point to a Node. And that Node may be removed from
the graph, e.g, it's freed and its memory is no longer owned by Graph.
This patch makes it so we no longer dump this metadata by default. If
this metadata is interesting to you, you'll need to go in and change
Graph::dump to dump the needed metadata.

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

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

13 months agoAdd stability to tests for web API statistics
commit-queue@webkit.org [Fri, 14 Sep 2018 23:15:27 +0000 (23:15 +0000)]
Add stability to tests for web API statistics
https://bugs.webkit.org/show_bug.cgi?id=189560
<rdar://problem/44396413>

Patch by Woodrow Wang <woodrow_wang@apple.com> on 2018-09-14
Reviewed by Chris Dumez.

Using js-test added some data to the font loading collection, which made the tests dependent on
js-test.js. Thus, if any changes were made to js-test.js the tests for web API statistics would
fail. This patch removes the dependency on js-test. Also, this patch speeds up each test
significantly by bypassing the timer in ResourceLoadObserver for recording the statistics.

* http/tests/webAPIStatistics/canvas-read-and-write-data-collection-expected.txt:
* http/tests/webAPIStatistics/canvas-read-and-write-data-collection.html:
* http/tests/webAPIStatistics/font-load-data-collection-expected.txt:
* http/tests/webAPIStatistics/font-load-data-collection.html:
* http/tests/webAPIStatistics/navigator-functions-accessed-data-collection-expected.txt:
* http/tests/webAPIStatistics/navigator-functions-accessed-data-collection.html:
* http/tests/webAPIStatistics/screen-functions-accessed-data-collection-expected.txt:
* http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html:

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

13 months agoRefactoring related to Safe Browsing
commit-queue@webkit.org [Fri, 14 Sep 2018 22:09:30 +0000 (22:09 +0000)]
Refactoring related to Safe Browsing
https://bugs.webkit.org/show_bug.cgi?id=189631

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

Make SafeBrowsingResult RefCounted.
Move logic from an unnamed lambda to WebPageProxy::receivedNavigationPolicyDecision.

* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::beginSafeBrowsingCheck):
(WebKit::WebPageProxy::contentFilterDidBlockLoadForFrame): Deleted.
(WebKit::WebPageProxy::addPlatformLoadParameters): Deleted.
(WebKit::WebPageProxy::createSandboxExtensionsIfNeeded): Deleted.
(WebKit::WebPageProxy::startDrag): Deleted.
(WebKit::WebPageProxy::setPromisedDataForImage): Deleted.
(WebKit::WebPageProxy::setDragCaretRect): Deleted.
(WebKit::WebPageProxy::platformRegisterAttachment): Deleted.
(WebKit::WebPageProxy::platformCloneAttachment): Deleted.
* UIProcess/SafeBrowsingResult.h:
(WebKit::SafeBrowsingResult::create):
* UIProcess/WebFramePolicyListenerProxy.cpp:
(WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
* UIProcess/WebFramePolicyListenerProxy.h:
* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::setUpPolicyListenerProxy):
* UIProcess/WebFrameProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::receivedNavigationPolicyDecision):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::decidePolicyForNewWindowAction):
(WebKit::WebPageProxy::decidePolicyForResponse):
* UIProcess/WebPageProxy.h:

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

13 months agoClarify the configuration used by WKUIDelegate's createWebViewWithConfiguration
ggaren@apple.com [Fri, 14 Sep 2018 21:59:27 +0000 (21:59 +0000)]
Clarify the configuration used by WKUIDelegate's createWebViewWithConfiguration
https://bugs.webkit.org/show_bug.cgi?id=189634

Reviewed by Tim Horton.

* UIProcess/API/Cocoa/WKUIDelegate.h:

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

13 months agoRefactor some ForInContext code for better encapsulation.
mark.lam@apple.com [Fri, 14 Sep 2018 21:00:21 +0000 (21:00 +0000)]
Refactor some ForInContext code for better encapsulation.
https://bugs.webkit.org/show_bug.cgi?id=189626
<rdar://problem/44466415>

Reviewed by Keith Miller.

1. Add a ForInContext::m_type field to store the context type.  This does not
   increase the class size, but eliminates the need for a virtual call to get the
   type.

   Note: we still need a virtual destructor because we'll be mingling
   IndexedForInContexts and StructureForInContexts in the BytecodeGenerator::m_forInContextStack.

2. Add ForInContext::isIndexedForInContext() and ForInContext::isStructureForInContext()
   convenience methods.

3. Add ForInContext::asIndexedForInContext() and ForInContext::asStructureForInContext()
   to do the casting to the subclass types.  This ensures that we'll properly
   assert that the casting is legal.

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitGetByVal):
(JSC::BytecodeGenerator::popIndexedForInScope):
(JSC::BytecodeGenerator::popStructureForInScope):
* bytecompiler/BytecodeGenerator.h:
(JSC::ForInContext::type const):
(JSC::ForInContext::isIndexedForInContext const):
(JSC::ForInContext::isStructureForInContext const):
(JSC::ForInContext::asIndexedForInContext):
(JSC::ForInContext::asStructureForInContext):
(JSC::ForInContext::ForInContext):
(JSC::StructureForInContext::StructureForInContext):
(JSC::IndexedForInContext::IndexedForInContext):
(JSC::ForInContext::~ForInContext): Deleted.

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

13 months agoUnreviewed, attempt to fix the iOSMac build after r236015.
ryanhaddad@apple.com [Fri, 14 Sep 2018 20:36:45 +0000 (20:36 +0000)]
Unreviewed, attempt to fix the iOSMac build after r236015.

* platform/graphics/cv/PixelBufferResizer.mm:
(WebCore::PixelBufferResizer::PixelBufferResizer):

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

13 months agoMake GraphicsLayers ref-counted, so their tree can persist when disconnected from...
simon.fraser@apple.com [Fri, 14 Sep 2018 19:49:46 +0000 (19:49 +0000)]
Make GraphicsLayers ref-counted, so their tree can persist when disconnected from RenderLayerBackings
https://bugs.webkit.org/show_bug.cgi?id=189521

Reviewed by Tim Horton.
Source/WebCore:

Make GraphicsLayer be RefCounted<GraphicsLayer>. GraphicsLayers own their children, via a Vector<Ref<GraphicsLayer>>.

RenderLayerBacking and other holders of GraphicsLayers use RefPtr<GraphicsLayer>.

All the other changes are just to adapt to the new ownership patterns.

I verified that no GraphicsLayers were leaked or abandoned after this change.

No behavior change.

* page/PageOverlayController.cpp:
(WebCore::PageOverlayController::layerWithDocumentOverlays):
(WebCore::PageOverlayController::layerWithViewOverlays):
(WebCore::PageOverlayController::installPageOverlay):
(WebCore::PageOverlayController::uninstallPageOverlay):
(WebCore::PageOverlayController::setPageOverlayNeedsDisplay):
(WebCore::PageOverlayController::didChangeViewSize):
(WebCore::PageOverlayController::didChangeDocumentSize):
(WebCore::PageOverlayController::didChangeSettings):
(WebCore::PageOverlayController::paintContents):
(WebCore::PageOverlayController::didChangeOverlayFrame):
(WebCore::PageOverlayController::didChangeOverlayBackgroundColor):
* page/PageOverlayController.h:
* page/mac/ServicesOverlayController.h:
(WebCore::ServicesOverlayController::Highlight::layer const):
* page/mac/ServicesOverlayController.mm:
(WebCore::ServicesOverlayController::Highlight::Highlight):
(WebCore::ServicesOverlayController::Highlight::invalidate):
(WebCore::ServicesOverlayController::Highlight::fadeIn):
(WebCore::ServicesOverlayController::Highlight::fadeOut):
(WebCore::ServicesOverlayController::Highlight::didFinishFadeOutAnimation):
(WebCore::ServicesOverlayController::determineActiveHighlight):
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::GraphicsLayer):
(WebCore::GraphicsLayer::willBeDestroyed):
(WebCore::GraphicsLayer::setChildren):
(WebCore::GraphicsLayer::addChild):
(WebCore::GraphicsLayer::addChildAtIndex):
(WebCore::GraphicsLayer::addChildBelow):
(WebCore::GraphicsLayer::addChildAbove):
(WebCore::GraphicsLayer::replaceChild):
(WebCore::GraphicsLayer::removeAllChildren):
(WebCore::GraphicsLayer::removeFromParent):
(WebCore::GraphicsLayer::setMaskLayer):
(WebCore::GraphicsLayer::noteDeviceOrPageScaleFactorChangedIncludingDescendants):
(WebCore::GraphicsLayer::distributeOpacity):
(WebCore::GraphicsLayer::traverse):
(WebCore::dumpChildren):
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::children const):
(WebCore::GraphicsLayer::children):
(WebCore::GraphicsLayer::maskLayer const):
(WebCore::GraphicsLayer::replicaLayer const):
(WebCore::GraphicsLayer::beingDestroyed const):
(WebCore::GraphicsLayer:: const): Deleted.
* platform/graphics/GraphicsLayerFactory.h:
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayer::create):
(WebCore::GraphicsLayerCA::setChildren):
(WebCore::GraphicsLayerCA::addChild):
(WebCore::GraphicsLayerCA::addChildAtIndex):
(WebCore::GraphicsLayerCA::addChildBelow):
(WebCore::GraphicsLayerCA::addChildAbove):
(WebCore::GraphicsLayerCA::replaceChild):
(WebCore::GraphicsLayerCA::setMaskLayer):
(WebCore::GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush const):
(WebCore::GraphicsLayerCA::recursiveCommitChanges):
(WebCore::GraphicsLayerCA::updateSublayerList):
(WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
(WebCore::GraphicsLayer::create):
(WebCore::GraphicsLayerTextureMapper::setChildren):
(WebCore::GraphicsLayerTextureMapper::addChild):
(WebCore::GraphicsLayerTextureMapper::addChildAtIndex):
(WebCore::GraphicsLayerTextureMapper::addChildAbove):
(WebCore::GraphicsLayerTextureMapper::addChildBelow):
(WebCore::GraphicsLayerTextureMapper::replaceChild):
(WebCore::GraphicsLayerTextureMapper::setMaskLayer):
(WebCore::GraphicsLayerTextureMapper::updateBackingStoreIncludingSubLayers):
* platform/graphics/texmap/GraphicsLayerTextureMapper.h:
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::GraphicsLayer::create):
(WebCore::CoordinatedGraphicsLayer::setShouldUpdateVisibleRect):
(WebCore::CoordinatedGraphicsLayer::addChild):
(WebCore::CoordinatedGraphicsLayer::addChildAtIndex):
(WebCore::CoordinatedGraphicsLayer::addChildAbove):
(WebCore::CoordinatedGraphicsLayer::addChildBelow):
(WebCore::CoordinatedGraphicsLayer::replaceChild):
(WebCore::CoordinatedGraphicsLayer::setMaskLayer):
(WebCore::CoordinatedGraphicsLayer::syncPendingStateChangesIncludingSubLayers):
(WebCore::CoordinatedGraphicsLayer::updateContentBuffersIncludingSubLayers):
(WebCore::CoordinatedGraphicsLayer::setCoordinatorIncludingSubLayersIfNeeded):
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
* platform/graphics/win/GraphicsLayerDirect2D.cpp:
(WebCore::GraphicsLayer::create):
(WebCore::GraphicsLayerDirect2D::GraphicsLayerDirect2D): Deleted.
(WebCore::GraphicsLayerDirect2D::initialize): Deleted.
(WebCore::GraphicsLayerDirect2D::~GraphicsLayerDirect2D): Deleted.
(WebCore::GraphicsLayerDirect2D::setNeedsDisplay): Deleted.
(WebCore::GraphicsLayerDirect2D::setNeedsDisplayInRect): Deleted.
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::createGraphicsLayer):
(WebCore::RenderLayerBacking::createPrimaryGraphicsLayer):
(WebCore::RenderLayerBacking::updateConfiguration):
(WebCore::RenderLayerBacking::updateInternalHierarchy):
(WebCore::RenderLayerBacking::updateMaskingLayer):
(WebCore::RenderLayerBacking::updateChildClippingStrategy):
(WebCore::RenderLayerBacking::updateScrollingLayers):
* rendering/RenderLayerBacking.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateCompositingLayers):
(WebCore::RenderLayerCompositor::appendDocumentOverlayLayers):
(WebCore::RenderLayerCompositor::setCompositingParent):
(WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
(WebCore::RenderLayerCompositor::parentFrameContentLayers):
(WebCore::RenderLayerCompositor::updateLayerForTopOverhangArea):
(WebCore::RenderLayerCompositor::updateLayerForBottomOverhangArea):
(WebCore::RenderLayerCompositor::updateLayerForHeader):
(WebCore::RenderLayerCompositor::updateLayerForFooter):
(WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
(WebCore::RenderLayerCompositor::ensureRootLayer):
(WebCore::RenderLayerCompositor::rootLayerAttachmentChanged):
* rendering/RenderLayerCompositor.h:

Source/WebKit:

Make GraphicsLayer be RefCounted<GraphicsLayer>. GraphicsLayers own their children, via a Vector<Ref<GraphicsLayer>>.

RenderLayerBacking and other holders of GraphicsLayers use RefPtr<GraphicsLayer>.

Added some helper functions to null out a RefPtr<GraphicsLayer> after removing from the tree,
clearing the client. GraphicsLayer.m_client becomes a pointer, so it can be set to point to a singleton
empty client when a GraphicsLayer gets detached from its owner. More explicit layer unparenting,
and removed some unnecessary parent checks, and redundant unparenting.

Other changes are just to adapt to the new ownership patterns.

I verified that no GraphicsLayers were leaked or abandoned after this change.

* WebProcess/WebCoreSupport/WebInspectorClient.cpp:
(WebKit::WebInspectorClient::~WebInspectorClient):
(WebKit::WebInspectorClient::showPaintRect):
(WebKit::WebInspectorClient::animationEndedForLayer):
* WebProcess/WebCoreSupport/WebInspectorClient.h:
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h:
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
(WebKit::RemoteLayerTreeContext::createGraphicsLayer):
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::updateRootLayers):
(WebKit::RemoteLayerTreeDrawingArea::flushLayers):

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

13 months agoSupport arbitrary video resolution in getUserMedia API
eric.carlson@apple.com [Fri, 14 Sep 2018 19:01:41 +0000 (19:01 +0000)]
Support arbitrary video resolution in getUserMedia API
https://bugs.webkit.org/show_bug.cgi?id=178109
<rdar://problem/35083128>

Reviewed by Youenn Fablet.

Source/WebCore:

Support arbitrary video resolutions by configuring the camera to capture at the closest
larger size it supports and scaling/cropping frames as necessary.

No new tests, existing tests updated.

* Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
* Modules/webaudio/MediaStreamAudioSource.cpp:
(WebCore::MediaStreamAudioSource::capabilities): Make non-const, it wasn't helpful.
(WebCore::MediaStreamAudioSource::settings): Ditto.
(WebCore::MediaStreamAudioSource::capabilities const): Deleted.
(WebCore::MediaStreamAudioSource::settings const): Deleted.
* Modules/webaudio/MediaStreamAudioSource.h:

* SourcesCocoa.txt: Add PixelBufferResizer.

* WebCore.xcodeproj/project.pbxproj: Ditto.

* platform/cocoa/CoreVideoSoftLink.h:
* platform/cocoa/VideoToolboxSoftLink.cpp:
* platform/cocoa/VideoToolboxSoftLink.h:

* platform/graphics/cv/PixelBufferResizer.h: Added.
(WebCore::PixelBufferResizer::canResizeTo):
* platform/graphics/cv/PixelBufferResizer.mm: Added.
(WebCore::PixelBufferResizer::PixelBufferResizer):
(WebCore::PixelBufferResizer::resize):

* platform/mediastream/RealtimeIncomingAudioSource.cpp:
(WebCore::RealtimeIncomingAudioSource::capabilities): Make non-const, it wasn't helpful.
(WebCore::RealtimeIncomingAudioSource::settings): Ditto.
(WebCore::RealtimeIncomingAudioSource::capabilities const): Deleted.
(WebCore::RealtimeIncomingAudioSource::settings const): Deleted.
* platform/mediastream/RealtimeIncomingAudioSource.h:

* platform/mediastream/RealtimeIncomingVideoSource.cpp:
(WebCore::RealtimeIncomingVideoSource::capabilities): Make non-const, it wasn't helpful.
(WebCore::RealtimeIncomingVideoSource::settings): Ditto.
(WebCore::RealtimeIncomingVideoSource::capabilities const): Deleted.
(WebCore::RealtimeIncomingVideoSource::settings const): Deleted.
* platform/mediastream/RealtimeIncomingVideoSource.h:

* platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::supportsConstraint):
(WebCore::RealtimeMediaSource::supportsConstraint const): Deleted.
* platform/mediastream/RealtimeMediaSource.h:

* platform/mediastream/RealtimeVideoSource.cpp:
(WebCore::RealtimeVideoSource::presets):
(WebCore::RealtimeVideoSource::setSupportedPresets):
(WebCore::standardVideoSizes):
(WebCore::RealtimeVideoSource::updateCapabilities): Make non-const, it wasn't helpful.
(WebCore::presetSupportsFrameRate):
(WebCore::RealtimeVideoSource::supportsCaptureSize):
(WebCore::RealtimeVideoSource::shouldUsePreset):
(WebCore::RealtimeVideoSource::bestSupportedSizeAndFrameRate):
(WebCore::RealtimeVideoSource::setSizeAndFrameRate):
(WebCore::RealtimeVideoSource::addSupportedCapabilities const): Deleted.
* platform/mediastream/RealtimeVideoSource.h:
(WebCore::VideoPresetData::encode const):
(WebCore::VideoPresetData::decode):
(WebCore::VideoPreset::create):
(WebCore::VideoPreset::VideoPreset):
(WebCore::RealtimeVideoSource::prefersPreset):
(WebCore::RealtimeVideoSource::canResizeVideoFrames const):
(WebCore::RealtimeVideoSource::setDefaultSize):
(WebCore::RealtimeVideoSource::observedFrameRate const):
(WebCore::VideoPreset::encode const): Deleted.
(WebCore::VideoPreset::decode): Deleted.

* platform/mediastream/mac/AVVideoCaptureSource.h:
(WebCore::AVVideoCaptureSource::videoPresets): Deleted.
* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoPreset::create):
(WebCore::AVVideoPreset::AVVideoPreset):
(WebCore::AVVideoCaptureSource::AVVideoCaptureSource):
(WebCore::AVVideoCaptureSource::settings):
(WebCore::AVVideoCaptureSource::capabilities): Make non-const, it wasn't helpful.
(WebCore::AVVideoCaptureSource::setFrameRate):
(WebCore::AVVideoCaptureSource::prefersPreset):
(WebCore::AVVideoCaptureSource::setSizeAndFrameRateWithPreset):
(WebCore::AVVideoCaptureSource::frameDurationForFrameRate):
(WebCore::AVVideoCaptureSource::setupCaptureSession):
(WebCore::AVVideoCaptureSource::processNewFrame):
(WebCore::AVVideoCaptureSource::captureOutputDidOutputSampleBufferFromConnection):
(WebCore::AVVideoCaptureSource::isFrameRateSupported):
(WebCore::AVVideoCaptureSource::generatePresets):
(WebCore::updateSizeMinMax): Deleted.
(WebCore::updateAspectRatioMinMax): Deleted.
(WebCore::AVVideoCaptureSource::settings const): Deleted.
(WebCore::AVVideoCaptureSource::capabilities const): Deleted.
(WebCore::AVVideoCaptureSource::sizeForPreset): Deleted.
(WebCore::AVVideoCaptureSource::setPreset): Deleted.
(WebCore::AVVideoCaptureSource::setSizeAndFrameRate): Deleted.
(WebCore::AVVideoCaptureSource::bestSessionPresetForVideoDimensions): Deleted.
(WebCore::AVVideoCaptureSource::supportsSizeAndFrameRate): Deleted.

* platform/mediastream/mac/CoreAudioCaptureSource.cpp:
(WebCore::CoreAudioCaptureSource::capabilities): Make non-const, it wasn't helpful.
(WebCore::CoreAudioCaptureSource::settings): Ditto.
(WebCore::CoreAudioCaptureSource::capabilities const): Deleted.
(WebCore::CoreAudioCaptureSource::settings const): Deleted.
* platform/mediastream/mac/CoreAudioCaptureSource.h:

* platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
(WebCore::DisplayCaptureSourceCocoa::capabilities): Make non-const, it wasn't helpful.
(WebCore::DisplayCaptureSourceCocoa::settings): Ditto.
(WebCore::DisplayCaptureSourceCocoa::capabilities const): Deleted.
(WebCore::DisplayCaptureSourceCocoa::settings const): Deleted.
* platform/mediastream/mac/DisplayCaptureSourceCocoa.h:

* platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
* platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
(WebCore::MockRealtimeVideoSourceMac::CMSampleBufferFromPixelBuffer):
(WebCore::MockRealtimeVideoSourceMac::updateSampleBuffer):
(WebCore::MockRealtimeVideoSourceMac::setSizeAndFrameRateWithPreset):
* platform/mock/MockMediaDevice.h:
(WebCore::MockCameraProperties::decode):

* platform/mock/MockRealtimeAudioSource.cpp:
(WebCore::MockRealtimeAudioSource::settings): Make non-const, it wasn't helpful.
(WebCore::MockRealtimeAudioSource::capabilities): Ditto.
(WebCore::MockRealtimeAudioSource::settings const): Deleted.
(WebCore::MockRealtimeAudioSource::capabilities const): Deleted.
* platform/mock/MockRealtimeAudioSource.h:

* platform/mock/MockRealtimeMediaSourceCenter.cpp:
(WebCore::defaultDevices): Change video device presets to trigger resize code more often.

* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource):
(WebCore::MockRealtimeVideoSource::generatePresets):
(WebCore::MockRealtimeVideoSource::capabilities): Make non-const, it wasn't helpful.
(WebCore::MockRealtimeVideoSource::settings): Ditto.
(WebCore::MockRealtimeVideoSource::capabilities const): Deleted.
(WebCore::MockRealtimeVideoSource::settings const): Deleted.
* platform/mock/MockRealtimeVideoSource.h:

Source/WebCore/PAL:

* pal/cf/CoreMediaSoftLink.cpp:
* pal/cf/CoreMediaSoftLink.h:

Source/WebKit:

* WebProcess/cocoa/UserMediaCaptureManager.cpp:

LayoutTests:

* fast/mediastream/MediaStreamTrack-getCapabilities-expected.txt:
* fast/mediastream/apply-constraints-advanced-expected.txt:
* fast/mediastream/apply-constraints-advanced.html:
* fast/mediastream/apply-constraints-video.html:

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

13 months agobots should pass --clobber-old-results to run-webkit-tests
ryanhaddad@apple.com [Fri, 14 Sep 2018 18:47:27 +0000 (18:47 +0000)]
bots should pass --clobber-old-results to run-webkit-tests
https://bugs.webkit.org/show_bug.cgi?id=189623

Reviewed by Aakash Jain.

In order to ensure that bots to not produce confusing results due to transient execptions,
or run out of space if they continually hit an exception, old layout test results should be clobbered.

* BuildSlaveSupport/build.webkit.org-config/steps.py:
(RunWebKitTests):

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

13 months agoBug 189541 - Build error in FontDescriptionKey::computeHash when compiling FontTagged...
commit-queue@webkit.org [Fri, 14 Sep 2018 18:33:44 +0000 (18:33 +0000)]
Bug 189541 - Build error in FontDescriptionKey::computeHash when compiling FontTaggedSettings and FontCascadeFonts together
https://bugs.webkit.org/show_bug.cgi?id=189541

Patch by Frederic Wang <fwang@igalia.com> on 2018-09-14
Reviewed by Alex Christensen.

FontDescriptionKey::computeHash() from In FontCache.h requires implicit instantiation of the
FontTaggedSettings::hash() template function. This instantiation may happen before
FontTaggedSettings::hash() is actually fully specialized in FontTaggedSettings.cpp. To avoid
compiler errors when FontCache.h and FontTaggedSettings.cpp are in the same translation unit,
we declare full specialization of the hash() functions in FontTaggedSettings.h.

No new tests, behavior unchanged.

* platform/graphics/FontCache.h: Explicitly include FontTaggedSettings to avoid possible future breakage.
* platform/graphics/FontTaggedSettings.h: Declare full specialization of FontTaggedSettings::hash().

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

13 months ago[Curl][WebKit] Bug fix for continuously retrying with empty credentials.
Basuke.Suzuki@sony.com [Fri, 14 Sep 2018 18:28:29 +0000 (18:28 +0000)]
[Curl][WebKit] Bug fix for continuously retrying with empty credentials.
https://bugs.webkit.org/show_bug.cgi?id=189601

Reviewed by Alex Christensen.

Added stop condition for empty credentials passed by client.

* NetworkProcess/curl/NetworkDataTaskCurl.cpp:
(WebKit::NetworkDataTaskCurl::curlDidReceiveResponse):
(WebKit::NetworkDataTaskCurl::invokeDidReceiveResponse):
(WebKit::NetworkDataTaskCurl::tryHttpAuthentication):
(WebKit::NetworkDataTaskCurl::tryProxyAuthentication):
* NetworkProcess/curl/NetworkDataTaskCurl.h:

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

13 months agoUnreviewed, rolling out r235990.
ryanhaddad@apple.com [Fri, 14 Sep 2018 18:17:42 +0000 (18:17 +0000)]
Unreviewed, rolling out r235990.

Introduced TestWebKitAPI.NowPlayingTest timeouts on iOS

Reverted changeset:

"Enable USE_MEDIAREMOTE on iOS"
https://bugs.webkit.org/show_bug.cgi?id=189096
https://trac.webkit.org/changeset/235990

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

13 months agoTurn SourceBufferChangeTypeEnabled on by default
jer.noble@apple.com [Fri, 14 Sep 2018 17:03:35 +0000 (17:03 +0000)]
Turn SourceBufferChangeTypeEnabled on by default
https://bugs.webkit.org/show_bug.cgi?id=189527

Reviewed by Eric Carlson.

Source/WebCore:

* page/Settings.yaml:

Source/WebKit:

* Shared/WebPreferences.yaml:
* UIProcess/API/C/WKPreferencesRefPrivate.h:

Source/WebKitLegacy/mac:

* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):

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

13 months agoUnreviewed, speculative WPE build fix after r236004
mcatanzaro@igalia.com [Fri, 14 Sep 2018 16:50:14 +0000 (16:50 +0000)]
Unreviewed, speculative WPE build fix after r236004
https://bugs.webkit.org/show_bug.cgi?id=189545

* UIProcess/API/wpe/WebKitScriptDialog.h:

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

13 months agoWeb Inspector: Record actions performed on ImageBitmapRenderingContext
webkit@devinrousso.com [Fri, 14 Sep 2018 16:44:22 +0000 (16:44 +0000)]
Web Inspector: Record actions performed on ImageBitmapRenderingContext
https://bugs.webkit.org/show_bug.cgi?id=181341

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

* inspector/protocol/Recording.json:
* inspector/scripts/codegen/generator.py:

Source/WebCore:

Test: inspector/canvas/recording-bitmaprenderer.html

* html/canvas/ImageBitmapRenderingContext.idl:

* inspector/InspectorCanvas.cpp:
(WebCore::shouldSnapshotBitmapRendererAction):
(WebCore::InspectorCanvas::recordAction):

* inspector/agents/InspectorCanvasAgent.cpp:
(WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):

* page/PageConsoleClient.cpp:
(canvasRenderingContext):

Source/WebInspectorUI:

* UserInterface/Models/Recording.js:
(WI.Recording.fromPayload):
(WI.Recording.prototype.createContext):

* UserInterface/Models/RecordingAction.js:
(WI.RecordingAction._prototypeForType):
(WI.RecordingAction.prototype.getImageParameters):

* UserInterface/Views/RecordingActionTreeElement.js:
(WI.RecordingActionTreeElement._classNameForAction.classNameForActionName):

* UserInterface/Views/RecordingContentView.js:
(WI.RecordingContentView):
(WI.RecordingContentView.prototype.get navigationItems):
(WI.RecordingContentView.prototype.updateActionIndex):
(WI.RecordingContentView.prototype.shown):
(WI.RecordingContentView.prototype.hidden):
(WI.RecordingContentView.prototype._generateContentFromSnapshot): Renamed.
(WI.RecordingContentView.prototype._updateImageGrid):
(WI.RecordingContentView.prototype._generateContentCanvasWebGL): Deleted.

* UserInterface/Views/CanvasContentView.js:
(WI.CanvasContentView):

LayoutTests:

* inspector/canvas/recording-2d-expected.txt:
* inspector/canvas/recording-bitmaprenderer-expected.txt: Added.
* inspector/canvas/recording-bitmaprenderer.html: Added.
* inspector/canvas/recording-webgl-expected.txt:
* inspector/canvas/recording-webgl-snapshots-expected.txt:
* inspector/canvas/resources/recording-utilities.js:
Simplify the test output to avoid unrelated failures, such as if line numbers change.
Also remove non-human-readable text, as it makes it more difficult for those unfamiliar with
the test to determine if any differences are acceptable.

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

13 months agoREGRESSION (r235954): Fix build failure on watchOS
ddkilzer@apple.com [Fri, 14 Sep 2018 16:38:19 +0000 (16:38 +0000)]
REGRESSION (r235954): Fix build failure on watchOS
<https://webkit.org/b/189605>

Reviewed by Geoffrey Garen.

Remove `using WebCore::IndexedDB::KeyType;` from
Source/WebCore/Modules/indexeddb/IDBKey.h and fix all the
resulting build failures.

* Modules/indexeddb/IDBKey.cpp:
(WebCore::IDBKey::IDBKey):
(WebCore::IDBKey::isValid const):
(WebCore::IDBKey::compare const):
* Modules/indexeddb/IDBKey.h:
(WebCore::IDBKey::createNumber):
(WebCore::IDBKey::createDate):
(WebCore::IDBKey::type const):
(WebCore::IDBKey::array const):
(WebCore::IDBKey::string const):
(WebCore::IDBKey::date const):
(WebCore::IDBKey::number const):
(WebCore::IDBKey::binary const):
(WebCore::IDBKey::compareTypes):
(WebCore::IDBKey::IDBKey):
* Modules/indexeddb/IDBKeyData.cpp:
(WebCore::IDBKeyData::IDBKeyData):
(WebCore::IDBKeyData::maybeCreateIDBKey const):
(WebCore::IDBKeyData::isolatedCopy):
(WebCore::IDBKeyData::encode const):
(WebCore::IDBKeyData::decode):
(WebCore::IDBKeyData::compare const):
(WebCore::IDBKeyData::loggingString const):
(WebCore::IDBKeyData::setArrayValue):
(WebCore::IDBKeyData::setBinaryValue):
(WebCore::IDBKeyData::setStringValue):
(WebCore::IDBKeyData::setDateValue):
(WebCore::IDBKeyData::setNumberValue):
(WebCore::IDBKeyData::isValid const):
(WebCore::IDBKeyData::operator== const):
* Modules/indexeddb/IDBKeyData.h:
(WebCore::IDBKeyData::IDBKeyData):
(WebCore::IDBKeyData::minimum):
(WebCore::IDBKeyData::maximum):
(WebCore::IDBKeyData::type const):
(WebCore::IDBKeyData::hash const):
(WebCore::IDBKeyData::string const):
(WebCore::IDBKeyData::date const):
(WebCore::IDBKeyData::number const):
(WebCore::IDBKeyData::binary const):
(WebCore::IDBKeyData::array const):
(WebCore::IDBKeyData::encode const):
(WebCore::IDBKeyData::decode):
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetIndexRecordForOneKey):
* bindings/js/IDBBindingUtilities.cpp:
(WebCore::toJS):

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

13 months ago[EME] Add support the waitingforkey event
calvaris@igalia.com [Fri, 14 Sep 2018 15:37:14 +0000 (15:37 +0000)]
[EME] Add support the waitingforkey event
https://bugs.webkit.org/show_bug.cgi?id=189616

Reviewed by Philippe Normand.

Crossplatform support to fire the waitingforkey event from the
player to the element. The element implements the W3C specified
algorithm.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaPlayerWaitingForKey):
(WebCore::HTMLMediaElement::attemptToResumePlaybackIfNecessary):
* html/HTMLMediaElement.h:
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::waitingForKey):
* platform/graphics/MediaPlayer.h:
(WebCore::MediaPlayerClient::mediaPlayerWaitingForKey):

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

13 months agobuiltins directory causes name conflict on Python 3
commit-queue@webkit.org [Fri, 14 Sep 2018 15:16:09 +0000 (15:16 +0000)]
builtins directory causes name conflict on Python 3
https://bugs.webkit.org/show_bug.cgi?id=189552

Patch by Mike Gorse <mgorse@suse.com> on 2018-09-14
Reviewed by Michael Catanzaro.

Source/JavaScriptCore:

* CMakeLists.txt: builtins -> wkbuiltins.
* DerivedSources.make: builtins -> wkbuiltins.
* Scripts/generate-js-builtins.py: import wkbuiltins, rather than
  builtins.
* Scripts/wkbuiltins/__init__.py: Renamed from Source/JavaScriptCore/Scripts/builtins/__init__.py.
* Scripts/wkbuiltins/builtins_generate_combined_header.py: Renamed from Source/JavaScriptCore/Scripts/builtins/builtins_generate_combined_header.py.
* Scripts/wkbuiltins/builtins_generate_internals_wrapper_implementation.py: Renamed from Source/JavaScriptCore/Scripts/builtins/builtins_generate_internals_wrapper_implementation.py.
* Scripts/wkbuiltins/builtins_generate_separate_header.py: Renamed from Source/JavaScriptCore/Scripts/builtins/builtins_generate_separate_header.py.
* Scripts/wkbuiltins/builtins_generate_separate_implementation.py: Renamed from Source/JavaScriptCore/Scripts/builtins/builtins_generate_separate_implementation.py.
* Scripts/wkbuiltins/builtins_generate_wrapper_header.py: Renamed from Source/JavaScriptCore/Scripts/builtins/builtins_generate_wrapper_header.py.
* Scripts/wkbuiltins/builtins_generate_wrapper_implementation.py: Renamed from Source/JavaScriptCore/Scripts/builtins/builtins_generate_wrapper_implementation.py.
* Scripts/wkbuiltins/builtins_generator.py: Renamed from Source/JavaScriptCore/Scripts/builtins/builtins_generator.py.
* Scripts/wkbuiltins/builtins_model.py: Renamed from Source/JavaScriptCore/Scripts/builtins/builtins_model.py.
* Scripts/wkbuiltins/builtins_templates.py: Renamed from Source/JavaScriptCore/Scripts/builtins/builtins_templates.py.
* Scripts/wkbuiltins/wkbuiltins.py: Renamed from Source/JavaScriptCore/Scripts/builtins/builtins.py.
* JavaScriptCore.xcodeproj/project.pbxproj: Update for the renaming.

Source/WebCore:

No new tests (No behavior change).

* CMakeLists.txt: builtins -> wkbuiltins.
* DerivedSources.make: builtins -> wkbuiltins.

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

13 months ago[GTK] Make script dialogs modal to the current web view only
carlosgc@webkit.org [Fri, 14 Sep 2018 11:01:06 +0000 (11:01 +0000)]
[GTK] Make script dialogs modal to the current web view only
https://bugs.webkit.org/show_bug.cgi?id=189545

Reviewed by Michael Catanzaro.

Source/WebCore/platform/gtk/po:

* POTFILES.in:

Source/WebKit:

Change the default implementation of script dialogs to use an embedded window, like the HTTP auth dialog,
instead of a GtkMessageDialog. This patch adds a base class WebKitWebViewDialog shared by
WebKitAuthenticationDialog and the new WebKitScriptDialogImpl.

* SourcesGTK.txt: Add new files to compilation.
* UIProcess/API/glib/WebKitScriptDialogPrivate.h:
* UIProcess/API/gtk/WebKitAuthenticationDialog.cpp:
(webkitAuthenticationDialogInitialize): Do not use a frame and use a better styled title.
(webkit_authentication_dialog_class_init): Remove implementation of vfuncs that are now implemented by the
parent.
* UIProcess/API/gtk/WebKitAuthenticationDialog.h:
* UIProcess/API/gtk/WebKitScriptDialogGtk.cpp:
(webkitScriptDialogAccept): Use WebKitScriptDialogImpl API.
(webkitScriptDialogDismiss): Ditto.
(webkitScriptDialogSetUserInput): Ditto.
* UIProcess/API/gtk/WebKitScriptDialogImpl.cpp: Added.
(webkitScriptDialogImplClose):
(webkitScriptDialogImplKeyPressEvent):
(webkitScriptDialogImplMap):
(webkitScriptDialogImplConstructed):
(webkitScriptDialogImplDispose):
(webkit_script_dialog_impl_class_init):
(webkitScriptDialogImplAddButton):
(webkitScriptDialogImplNew):
(webkitScriptDialogImplCancel):
(webkitScriptDialogImplConfirm):
(webkitScriptDialogImplSetEntryText):
* UIProcess/API/gtk/WebKitScriptDialogImpl.h: Added.
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewChildIsInternalWidget): Rename authenticationDialog as just dialog.
(webkitWebViewBaseAddDialog): Ditto.
(webkitWebViewBaseContainerRemove): Ditto.
(webkitWebViewBaseContainerForall): Ditto.
(webkitWebViewBaseConstructed): Ditto.
(webkitWebViewBaseSizeAllocate): Ditto.
(webkitWebViewBaseKeyPressEvent): Ditto.
(webkitWebViewBaseHandleMouseEvent): Ditto.
(webkitWebViewBaseButtonPressEvent): Ditto.
(webkitWebViewBaseButtonReleaseEvent): Ditto.
(webkitWebViewBaseHandleWheelEvent): Ditto.
(webkitWebViewBaseScrollEvent): Ditto.
(webkitWebViewBaseMotionNotifyEvent): Ditto.
(webkitWebViewBaseCrossingNotifyEvent): Ditto.
(webkitWebViewBaseTouchEvent): Ditto.
(webkitWebViewBaseFocus): Ditto.
(webkitWebViewBaseDestroy): Ditto.
* UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
* UIProcess/API/gtk/WebKitWebViewDialog.cpp: Added.
(webkitWebViewDialogDraw):
(webkitWebViewDialogSizeAllocate):
(webkitWebViewDialogConstructed):
(webkit_web_view_dialog_class_init):
* UIProcess/API/gtk/WebKitWebViewDialog.h: Added.
* UIProcess/API/gtk/WebKitWebViewGtk.cpp:
(webkitWebViewAuthenticate):
(webkitWebViewScriptDialog):

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