WebKit-https.git
17 months agoAdd Payment Request demo content.
aestes@apple.com [Wed, 4 Apr 2018 19:51:42 +0000 (19:51 +0000)]
Add Payment Request demo content.

Rubber-stamped by Zalan Bujtas.

* demos/payment-request/demo.js: Added.
(string_appeared_here.async.applePayButtonClicked):
* demos/payment-request/index.html: Added.
* demos/payment-request/merchant-validation.php: Added.
* demos/payment-request/squirrelfish.png: Added.
* demos/payment-request/style.css: Added.
(@supports (-webkit-appearance: -apple-pay-button)):
(.apple-pay-not-supported::before):
(.hidden):
(#black-buttons > .apple-pay-button):
(#white-buttons > .apple-pay-button):
(#demo):
(#description):

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

17 months agoFailures from mach port reference handling should be fatal
bfulgham@apple.com [Wed, 4 Apr 2018 19:43:01 +0000 (19:43 +0000)]
Failures from mach port reference handling should be fatal
https://bugs.webkit.org/show_bug.cgi?id=184202
<rdar://problem/37771114>

Reviewed by Anders Carlsson.

Source/WebCore:

We may corrupt the Mach port space by improperly matching the equivalent of reference counting
retains (mach_port_mod_refs) with releases (mach_port_deallocate).

Our current implementation of MachSendRights::create does not grab a reference if the passed
port is MACH_PORT_DEAD, but we unconditionally call mach_port_deallocate on the port, which
could lead to a reference count mismatch.

Likewise, our MachSendRight destructor does not release the port if it has changed to MACH_PORT_DEAD
(e.g., if a child process dies), again leading to a mismatch in retain/releases.

Finally, failures in mach_port_deallocate should be fatal because they indicate that the
application was attempting to remove an unowned right. This is a fatal condition for Mach, and
should lead to an abort.

This patch does the following:

1. It creates a helper function that does the right thing for safely deallocating a mach port.
2. It uses it in multiple places.
3. It revises 'MachSendRight::create" so that it properly handles the condition of a dead port.
4. It revises the MachSendRight destructor to properly handle the condition of a dead port.

No new tests, no change in behavior expected.

* SourcesCocoa.txt: Update for move of MachSendRight files.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* page/cocoa/ResourceUsageThreadCocoa.mm:
(WebCore::getMachThreads): Added.
(WebCore::cpuUsage): Use the new cleanup helper function.
* platform/cocoa/MachSendRight.cpp: Removed.
* platform/cocoa/MachSendRight.h: Removed.
* platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm:
(WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer):
* platform/graphics/cocoa/IOSurface.h:
* platform/graphics/cocoa/IOSurface.mm:

Source/WebKit:

Update for new location of MachSendRight.h. Switch to
#pragma once in a few places.

* Platform/IPC/mac/ConnectionMac.mm:
(IPC::Connection::platformInvalidate): Adopt new 'safe mach_port_t deallocation' function.
(IPC::Connection::initializeSendSource): Ditto.
(IPC::Connection::receiveSourceEventHandler): Ditto.
* Platform/SharedMemory.h:
* Platform/cocoa/SharedMemoryCocoa.cpp:
(WebKit::SharedMemory::Handle::clear): Ditto.
(WebKit::makeMemoryEntry): Ditto.
(WebKit::SharedMemory::createSendRight const): Ditto.
* Platform/mac/LayerHostingContext.h:
* Platform/mac/LayerHostingContext.mm:
* PluginProcess/PluginControllerProxy.h:
* PluginProcess/PluginProcess.h:
(WebKit::PluginProcess::compositingRenderServerPort const):
* Scripts/messages.py:
(headers_for_type): Update for new location of MachSendRight.
* Shared/Plugins/PluginProcessCreationParameters.h:
* Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::encode const):
* Shared/WebCoreArgumentCoders.h:
* Shared/WebProcessCreationParameters.h:
* Shared/mac/WebCoreArgumentCodersMac.mm:
* UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
* UIProcess/DrawingAreaProxy.cpp:
* UIProcess/DrawingAreaProxy.h:
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::ProcessLauncher::launchProcess): Ditto. Remove uneeded mach_port_dealloc called after
xpc_dictionary_set_mach_send. While '..._set_mach_send' retains the send right, it gets automatically
released when the message is handled. We only want to manually deallocate the send right if
the message failed to send.
* UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
* UIProcess/WebPageProxy.cpp:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
* UIProcess/mac/WKViewLayoutStrategy.mm:
* WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
* WebProcess/Plugins/Netscape/NetscapePlugin.h:
* WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
* WebProcess/Plugins/PluginController.h:
* WebProcess/Plugins/PluginView.h:
* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::addFence):
(WebKit::DrawingArea::updateGeometry):
* WebProcess/WebPage/DrawingArea.messages.in:
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::updateGeometry):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setTopContentInsetFenced):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::updateGeometry):
* WebProcess/WebProcess.h:
(WebKit::WebProcess::compositingRenderServerPort const):
* WebProcess/cocoa/VideoFullscreenManager.mm:
(WebKit::VideoFullscreenManager::setVideoLayerFrameFenced):

Source/WebKitLegacy/mac:

* Plugins/Hosted/NetscapePluginHostManager.mm:
(WebKit::NetscapePluginHostManager::spawnPluginHost): Adopt new 'safe mach_port_t deallocation' function.

Source/WTF:

* WTF.xcodeproj/project.pbxproj:
* wtf/MachSendRight.h: Copied from WebCore/platform/cocoa/MachSendRight.h.
(WebCore::MachSendRight::operator bool const): Deleted.
(WebCore::MachSendRight::sendRight const): Deleted.
* wtf/PlatformMac.cmake:
* wtf/cocoa/CPUTimeCocoa.mm:
(WTF::CPUTime::forCurrentThread): Do proper cleanup if the port is invalid.
* wtf/cocoa/MachSendRight.cpp: Copied from WebCore/platform/cocoa/MachSendRight.cpp.
(WTF::retainSendRight):
(WTF::releaseSendRight):
(WTF::deallocateSendRightSafely):
(WebCore::retainSendRight): Deleted.
(WebCore::releaseSendRight): Deleted.
(WebCore::MachSendRight::adopt): Deleted.
(WebCore::MachSendRight::create): Deleted.
(WebCore::MachSendRight::MachSendRight): Deleted.
(WebCore::MachSendRight::~MachSendRight): Deleted.
(WebCore::MachSendRight::operator=): Deleted.
(WebCore::MachSendRight::copySendRight const): Deleted.
(WebCore::MachSendRight::leakSendRight): Deleted.

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

17 months agoFix the print formatter build
bdakin@apple.com [Wed, 4 Apr 2018 18:28:58 +0000 (18:28 +0000)]
Fix the print formatter build
https://bugs.webkit.org/show_bug.cgi?id=184289
-and corresponding-
rdar://problem/39164641

Reviewed by Dan Bernstein.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _webViewPrintFormatter]):
* UIProcess/API/Cocoa/WKWebViewInternal.h:
* UIProcess/_WKWebViewPrintFormatter.h:
* UIProcess/_WKWebViewPrintFormatter.mm:
* UIProcess/_WKWebViewPrintFormatterInternal.h:
* UIProcess/ios/WKContentView.mm:
* UIProcess/ios/WKPDFView.mm:

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

17 months agoRemove unused HTTP header names
youenn@apple.com [Wed, 4 Apr 2018 18:26:24 +0000 (18:26 +0000)]
Remove unused HTTP header names
https://bugs.webkit.org/show_bug.cgi?id=184272

Reviewed by Alex Christensen.

No change of behavior.
Removed some names that are not used in the code base.
This allows to strengthen filtering of responses sent to WebProcess.
Added two headers used by web inspector.
Updated existing code to use indexed HTTP header names.

* html/parser/XSSAuditor.cpp:
(WebCore::XSSAuditor::init):
* inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::sourceMapURLForResource):
* platform/network/HTTPHeaderNames.in:

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

17 months agoDon't do index masking or poisoning for DirectArguments
fpizlo@apple.com [Wed, 4 Apr 2018 17:55:44 +0000 (17:55 +0000)]
Don't do index masking or poisoning for DirectArguments
https://bugs.webkit.org/show_bug.cgi?id=184280

Reviewed by Saam Barati.

* JavaScriptCore.xcodeproj/project.pbxproj:
* bytecode/AccessCase.cpp:
(JSC::AccessCase::generateWithGuard):
* dfg/DFGCallCreateDirectArgumentsSlowPathGenerator.h:
(JSC::DFG::CallCreateDirectArgumentsSlowPathGenerator::CallCreateDirectArgumentsSlowPathGenerator):
* dfg/DFGCallCreateDirectArgumentsWithKnownLengthSlowPathGenerator.h: Removed.
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileGetByValOnDirectArguments):
(JSC::DFG::SpeculativeJIT::compileGetArrayLength):
(JSC::DFG::SpeculativeJIT::compileCreateDirectArguments):
(JSC::DFG::SpeculativeJIT::compileGetFromArguments):
(JSC::DFG::SpeculativeJIT::compilePutToArguments):
* ftl/FTLAbstractHeapRepository.h:
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileGetArrayLength):
(JSC::FTL::DFG::LowerDFGToB3::compileGetByVal):
(JSC::FTL::DFG::LowerDFGToB3::compileCreateDirectArguments):
(JSC::FTL::DFG::LowerDFGToB3::compileGetFromArguments):
(JSC::FTL::DFG::LowerDFGToB3::compilePutToArguments):
(JSC::FTL::DFG::LowerDFGToB3::compileCheckSubClass):
(JSC::FTL::DFG::LowerDFGToB3::dynamicPoison):
(JSC::FTL::DFG::LowerDFGToB3::dynamicPoisonOnLoadedType):
(JSC::FTL::DFG::LowerDFGToB3::dynamicPoisonOnType):
(JSC::FTL::DFG::LowerDFGToB3::allocateVariableSizedHeapCell): Deleted.
* heap/SecurityKind.h:
* jit/JITPropertyAccess.cpp:
(JSC::JIT::emit_op_get_from_arguments):
(JSC::JIT::emit_op_put_to_arguments):
(JSC::JIT::emitDirectArgumentsGetByVal):
* jit/JITPropertyAccess32_64.cpp:
(JSC::JIT::emit_op_get_from_arguments):
(JSC::JIT::emit_op_put_to_arguments):
* llint/LowLevelInterpreter.asm:
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
* runtime/DirectArguments.cpp:
(JSC::DirectArguments::DirectArguments):
(JSC::DirectArguments::createUninitialized):
(JSC::DirectArguments::create):
(JSC::DirectArguments::createByCopying):
(JSC::DirectArguments::estimatedSize):
(JSC::DirectArguments::visitChildren):
(JSC::DirectArguments::overrideThings):
(JSC::DirectArguments::copyToArguments):
(JSC::DirectArguments::mappedArgumentsSize):
* runtime/DirectArguments.h:
* runtime/JSCPoison.h:
* runtime/JSLexicalEnvironment.h:
* runtime/JSSymbolTableObject.h:

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

17 months agoFix the !HAVE(AVFOUNDATION_VIDEO_OUTPUT) build
bdakin@apple.com [Wed, 4 Apr 2018 17:43:55 +0000 (17:43 +0000)]
Fix the !HAVE(AVFOUNDATION_VIDEO_OUTPUT) build
https://bugs.webkit.org/show_bug.cgi?id=184309
-and corresponding-
rdar://problem/39179126

Reviewed by Jer Noble.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoFullscreenInlineImage):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer):

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

17 months agoJSArray::appendMemcpy seems to be missing a barrier
fpizlo@apple.com [Wed, 4 Apr 2018 17:42:11 +0000 (17:42 +0000)]
JSArray::appendMemcpy seems to be missing a barrier
https://bugs.webkit.org/show_bug.cgi?id=184290

Reviewed by Mark Lam.

If you write to an array that may contain pointers and you didn't just allocate it, then you need to
barrier right after.

I don't know if this is really a bug - it's possible that all callers of appendMemcpy do things that
obviate the need for this barrier. But these barriers are cheap, so we should do them if in doubt.

* runtime/JSArray.cpp:
(JSC::JSArray::appendMemcpy):

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

17 months agoAdd a test for HttpOnly cookies used to load AppCache resources
youenn@apple.com [Wed, 4 Apr 2018 17:41:29 +0000 (17:41 +0000)]
Add a test for HttpOnly cookies used to load AppCache resources
https://bugs.webkit.org/show_bug.cgi?id=184305
<rdar://problem/39175648>

Reviewed by Brady Eidson.

* http/tests/appcache/document-cookie-http-only-expected.txt: Added.
* http/tests/appcache/document-cookie-http-only.php: Added.

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

17 months agoMockRealtimeVideoSourceMac should produce kCVPixelFormatType_420YpCbCr8Planar buffers
youenn@apple.com [Wed, 4 Apr 2018 17:34:04 +0000 (17:34 +0000)]
MockRealtimeVideoSourceMac should produce kCVPixelFormatType_420YpCbCr8Planar buffers
https://bugs.webkit.org/show_bug.cgi?id=184304

Reviewed by Eric Carlson.

Allows covering RealtimeOutgoingVideoSourceMac code path handling native buffers produced by capture video sources.
ARGB buffer coverage is done through canvas capture streams.

* platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
* platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
(WebCore::MockRealtimeVideoSourceMac::CMSampleBufferFromPixelBuffer):

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

17 months ago[iOS] Rename WKPDFView to WKLegacyPDFView
aestes@apple.com [Wed, 4 Apr 2018 17:16:11 +0000 (17:16 +0000)]
[iOS] Rename WKPDFView to WKLegacyPDFView
https://bugs.webkit.org/show_bug.cgi?id=184286

Rubber-stamped by Wenson Hsieh.

A series of upcoming patches will implement a new WKPDFView based on PDFKit.

* UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
(-[WKWebViewContentProviderRegistry init]):
* UIProcess/ios/WKLegacyPDFView.h: Renamed from Source/WebKit/UIProcess/ios/WKPDFView.h.
* UIProcess/ios/WKLegacyPDFView.mm: Renamed from Source/WebKit/UIProcess/ios/WKPDFView.mm.
(-[WKLegacyPDFView _computeMatchesForString:options:maxCount:completionHandler:]):
* WebKit.xcodeproj/project.pbxproj:

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

17 months ago[WinCairo] Add WebKit Shared/win files for wincairo webkit
Hironori.Fujii@sony.com [Wed, 4 Apr 2018 17:00:32 +0000 (17:00 +0000)]
[WinCairo] Add WebKit Shared/win files for wincairo webkit
https://bugs.webkit.org/show_bug.cgi?id=183044

Reviewed by Alex Christensen.

* Shared/win/ChildProcessMainWin.cpp: Added.

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

17 months agoIntroduce a ThreadSafeRefCounted parameter to ensure being destroyed on the main...
youenn@apple.com [Wed, 4 Apr 2018 16:40:08 +0000 (16:40 +0000)]
Introduce a ThreadSafeRefCounted parameter to ensure being destroyed on the main thread
https://bugs.webkit.org/show_bug.cgi?id=183988

Reviewed by Darin Adler.

Source/WebCore:

No change of behavior, TrackPrivate remains destroyed on the main thread.

* platform/graphics/TrackPrivateBase.h:
* platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
(WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
(WebCore::AudioTrackPrivateMediaStreamCocoa::render):

Source/WTF:

* wtf/ThreadSafeRefCounted.h:
(WTF::ThreadSafeRefCounted::deref const):

Tools:

* TestWebKitAPI/Tests/WTF/RefPtr.cpp:
(TestWebKitAPI::ThreadSafeRefCountedObject::create):
(TestWebKitAPI::ThreadSafeRefCountedObject::~ThreadSafeRefCountedObject):
(TestWebKitAPI::MainThreadSafeRefCountedObject::create):
(TestWebKitAPI::MainThreadSafeRefCountedObject::~MainThreadSafeRefCountedObject):
(TestWebKitAPI::TEST):

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

17 months ago[Extra zoom mode] Remove effective font size constraints when determining focus zoom...
wenson_hsieh@apple.com [Wed, 4 Apr 2018 16:12:10 +0000 (16:12 +0000)]
[Extra zoom mode] Remove effective font size constraints when determining focus zoom scale
https://bugs.webkit.org/show_bug.cgi?id=184287
<rdar://problem/39063886>

Reviewed by Timothy Hatcher.

As it turns out, form controls on some important websites can be very wide, with a small font size, which
renders the approach taken in <https://trac.webkit.org/r230171> moot, since we'll just end up zooming to a scale
that is too large anyways. To mitigate this for now, remove the minimum font scaling threshold while we think of
more clever ways to account for this scenario.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):

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

17 months ago[Win] WebFrameLoaderClient: 'getpid': identifier not found
annulen@yandex.ru [Wed, 4 Apr 2018 15:20:48 +0000 (15:20 +0000)]
[Win] WebFrameLoaderClient: 'getpid': identifier not found
https://bugs.webkit.org/show_bug.cgi?id=184291

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

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad):
Use WTF::getCurrentProcessID() instead of getpid().
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): Ditto.

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

17 months agoEnable Gigacage unconditionally when building JSCOnly on macOS (build fix)
annulen@yandex.ru [Wed, 4 Apr 2018 15:00:26 +0000 (15:00 +0000)]
Enable Gigacage unconditionally when building JSCOnly on macOS (build fix)
https://bugs.webkit.org/show_bug.cgi?id=184301

Reviewed by Yusuke Suzuki.

bmalloc/ProcessCheck.mm implements specific behavior for Mac and iOS ports,
which is guarded with BPLATFORM(COCOA). if we don't enable BPLATFORM(MAC)
or BPLATFORM(IOS) in JSCOnly, then BPLATFORM(COCOA) won't be defined
as well, and code path from ProcessCheck.mm will not be taken.

* CMakeLists.txt: Exclude ProcessCheck.mm from port-independent file
list.
* PlatformMac.cmake: Build ProcessCheck.mm for Mac port.
* bmalloc/BPlatform.h: Don't enable BPLATFORM(MAC) or BPLATFORM(IOS)
when building JSCOnly port.

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

17 months ago[WTF] Remove Atomics.cpp
utatane.tea@gmail.com [Wed, 4 Apr 2018 13:46:21 +0000 (13:46 +0000)]
[WTF] Remove Atomics.cpp
https://bugs.webkit.org/show_bug.cgi?id=184300

Reviewed by Konstantin Tokarev.

This Atomics.cpp is a workaround for GCC which version is < 4.8.
Our compiler requirement is now 5.0.0. This workaround is no
longer necessary.

* wtf/Atomics.cpp: Removed.
* wtf/CMakeLists.txt:

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

17 months agoTest gardening for GTK.
Ms2ger@igalia.com [Wed, 4 Apr 2018 13:34:26 +0000 (13:34 +0000)]
Test gardening for GTK.
https://bugs.webkit.org/show_bug.cgi?id=184298

Unreviewed test gardening.

LayoutTests/imported/w3c:

* web-platform-tests/XMLHttpRequest/event-upload-progress-crossorigin-expected.txt:
  update expectations: the test started passing in r230066, but this was
  not noticed because it is marked as flaky on macOS.

Tools:

* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: Add pointer to
https://bugs.webkit.org/show_bug.cgi?id=184295.

LayoutTests:

* platform/gtk/TestExpectations:
  - update expectations for fast/mediastream tests for the libwebrtc
    integration in r230152
  - skip http/wpt/loading/redirect-headers.html, which was added in
    r230224, because the API it uses is only implemented for cocoa
    (https://bugs.webkit.org/show_bug.cgi?id=184295)
* platform/wpe/TestExpectations:
  - skip http/wpt/loading/redirect-headers.html, which was added in
    r230224, because the API it uses is only implemented for cocoa
    (https://bugs.webkit.org/show_bug.cgi?id=184295)

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

17 months agoUnreviewed. Fix the build with libsoup < 2.49.91 after r230251.
carlosgc@webkit.org [Wed, 4 Apr 2018 09:31:31 +0000 (09:31 +0000)]
Unreviewed. Fix the build with libsoup < 2.49.91 after r230251.

Stop using ResourceHandle in SoupNetworkSession.

* platform/network/soup/SoupNetworkSession.cpp:
(WebCore::SoupNetworkSession::SoupNetworkSession):
(WebCore::authenticateCallback): Deleted.
(WebCore::requestStartedCallback): Deleted.

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

17 months agoRemove unused libsoup ResourceHandle implementation
commit-queue@webkit.org [Wed, 4 Apr 2018 06:55:15 +0000 (06:55 +0000)]
Remove unused libsoup ResourceHandle implementation
https://bugs.webkit.org/show_bug.cgi?id=184048

Patch by Alex Christensen <achristensen@webkit.org> on 2018-04-03
Reviewed by Michael Catanzaro.

This code is unused since r228901 so let's remove it!

* platform/network/ResourceHandle.h:
* platform/network/ResourceHandleInternal.h:
(WebCore::ResourceHandleInternal::ResourceHandleInternal):
* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::ResourceHandle::~ResourceHandle):
(WebCore::ResourceHandleInternal::soupSession):
(WebCore::ResourceHandle::cancelledOrClientless):
(WebCore::ResourceHandle::ensureReadBuffer):
(WebCore::ResourceHandle::currentStreamPosition const):
(WebCore::ResourceHandle::platformContinueSynchronousDidReceiveResponse):
(WebCore::ResourceHandle::didStartRequest):
(WebCore::ResourceHandle::start):
(WebCore::ResourceHandle::releaseForDownload):
(WebCore::ResourceHandle::sendPendingRequest):
(WebCore::ResourceHandle::cancel):
(WebCore::ResourceHandle::shouldUseCredentialStorage):
(WebCore::ResourceHandle::continueDidReceiveAuthenticationChallenge):
(WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
(WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
(WebCore::ResourceHandle::receivedCredential):
(WebCore::ResourceHandle::receivedCancellation):
(WebCore::ResourceHandle::receivedChallengeRejection):
(WebCore::ResourceHandle::platformSetDefersLoading):
(WebCore::sessionFromContext): Deleted.
(WebCore::ResourceHandle::create): Deleted.
(WebCore::ResourceHandle::ResourceHandle): Deleted.
(WebCore::isAuthenticationFailureStatusCode): Deleted.
(WebCore::tlsErrorsChangedCallback): Deleted.
(WebCore::gotHeadersCallback): Deleted.
(WebCore::applyAuthenticationToRequest): Deleted.
(WebCore::restartedCallback): Deleted.
(WebCore::shouldRedirect): Deleted.
(WebCore::shouldRedirectAsGET): Deleted.
(WebCore::continueAfterWillSendRequest): Deleted.
(WebCore::doRedirect): Deleted.
(WebCore::redirectSkipCallback): Deleted.
(WebCore::wroteBodyDataCallback): Deleted.
(WebCore::cleanupSoupRequestOperation): Deleted.
(WebCore::nextMultipartResponsePartCallback): Deleted.
(WebCore::sendRequestCallback): Deleted.
(WebCore::continueAfterDidReceiveResponse): Deleted.
(WebCore::startingCallback): Deleted.
(WebCore::networkEventCallback): Deleted.
(WebCore::createSoupMessageForHandleAndRequest): Deleted.
(WebCore::createSoupRequestAndMessageForHandle): Deleted.
(WebCore::ResourceHandle::timeoutFired): Deleted.
(WebCore::waitingToSendRequest): Deleted.
(WebCore::readCallback): Deleted.

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

17 months agoASSERTION FAILED: !m_mainFrame->coreFrame()->loader().frameHasLoaded() || !m_pendingN...
carlosgc@webkit.org [Wed, 4 Apr 2018 06:02:53 +0000 (06:02 +0000)]
ASSERTION FAILED: !m_mainFrame->coreFrame()->loader().frameHasLoaded() || !m_pendingNavigationID when reloading page while a page is loading
https://bugs.webkit.org/show_bug.cgi?id=153210

Reviewed by Alex Christensen.

Source/WebKit:

The assert happens when WebPage::reload() is called twice and the first time the reload is ignored by
FrameLoader because the document URL is empty. In that case the pending navigation is not reset, because
FrameLoader::reload() returns before creating the document loader.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::reload): Check if the pending navigation has been reset after calling FrameLoader::reload()
and reset it otherwise.

Tools:

Add unit tests to WebKit C API and WebKitGLib.

* TestWebKitAPI/Tests/WebKit/PageLoadBasic.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitGLib/TestLoaderClient.cpp:
(LoadTwiceAndReloadTest::reloadOnFinishLoad):
(LoadTwiceAndReloadTest::LoadTwiceAndReloadTest):
(LoadTwiceAndReloadTest::~LoadTwiceAndReloadTest):
(LoadTwiceAndReloadTest::waitUntilFinished):
(testWebViewLoadTwiceAndReload):
(beforeAll):

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

17 months ago[GTK] Test /webkit/WebKitWebPage/context-menu is failing since r229831
carlosgc@webkit.org [Wed, 4 Apr 2018 06:00:58 +0000 (06:00 +0000)]
[GTK] Test /webkit/WebKitWebPage/context-menu is failing since r229831
https://bugs.webkit.org/show_bug.cgi?id=184260

Reviewed by Michael Catanzaro.

This is not a regression introduced in r229831, though, it's a bug in the test itself revealed by r229831. We
should wait for the load to complete before trying to show the context menu.

* TestWebKitAPI/Tests/WebKitGtk/TestContextMenu.cpp:
(testContextMenuWebExtensionMenu):

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

17 months ago[LayoutReloaded] Introduce floating to InlineFormattingContext
zalan@apple.com [Wed, 4 Apr 2018 04:36:36 +0000 (04:36 +0000)]
[LayoutReloaded] Introduce floating to InlineFormattingContext
https://bugs.webkit.org/show_bug.cgi?id=184288

Reviewed by Antti Koivisto.

* LayoutReloaded/FormattingContext/BlockFormatting/BlockFormattingContext.js:
(BlockFormattingContext.prototype._computeFloatingWidth): Deleted.
(BlockFormattingContext.prototype._computeFloatingHeight): Deleted.
* LayoutReloaded/FormattingContext/FormattingContext.js:
(FormattingContext.prototype._computeFloatingWidth):
(FormattingContext.prototype._computeFloatingHeight):
* LayoutReloaded/FormattingContext/InlineFormatting/InlineFormattingContext.js:
(InlineFormattingContext.prototype.layout):
(InlineFormattingContext.prototype._handleFloatingBox):
* LayoutReloaded/FormattingContext/InlineFormatting/Line.js:
(Line.prototype.addFloatingBox):
(Line):
* LayoutReloaded/test/float-is-inside-inline-formatting-context-simple.html: Added.
* LayoutReloaded/test/index.html:

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

17 months agoMake NetworkProcess get ContentBlocker information from UIProcess
youenn@apple.com [Wed, 4 Apr 2018 03:03:42 +0000 (03:03 +0000)]
Make NetworkProcess get ContentBlocker information from UIProcess
https://bugs.webkit.org/show_bug.cgi?id=184205
<rdar://problem/39146551>

Unreviewed.
Updated decode/encode methods to not hit null identifier assertion.

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageGroupData.cpp:
(WebKit::WebPageGroupData::encode const):
(WebKit::WebPageGroupData::decode):

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

17 months ago[iOS] WKWebView shouldn't know about WKPDFView
aestes@apple.com [Wed, 4 Apr 2018 02:41:42 +0000 (02:41 +0000)]
[iOS] WKWebView shouldn't know about WKPDFView
https://bugs.webkit.org/show_bug.cgi?id=184283

Reviewed by Timothy Hatcher.

WKWebView shouldn't be checking if _customContentView is a particular kind of
class (e.g., WKPDFView). Instead, it should interact with the _customContentView
using the WKWebViewContentProvider protocol.

Reimplement -_isBackground, -_isDisplayingPDF, -_dataForDisplayedPDF, and
-_suggestedFilenameForDisplayedPDF using new WKWebViewContentProvider protocol
methods that WKPDFView implements.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _isBackground]):
(-[WKWebView _isDisplayingPDF]):
(-[WKWebView _dataForDisplayedPDF]):
(-[WKWebView _suggestedFilenameForDisplayedPDF]):
* UIProcess/Cocoa/WKWebViewContentProvider.h:
* UIProcess/ios/WKPDFView.h:
* UIProcess/ios/WKPDFView.mm:
(-[WKPDFView web_dataRepresentation]):
(-[WKPDFView web_suggestedFilename]):
(-[WKPDFView web_isBackground]):
(-[WKPDFView suggestedFilename]): Deleted.
(-[WKPDFView pdfDocument]): Deleted.
(-[WKPDFView isBackground]): Deleted.

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

17 months agoTest js-fixed-array-out-of-memory.js should be excluded for memory limited devices.
mark.lam@apple.com [Wed, 4 Apr 2018 01:19:52 +0000 (01:19 +0000)]
Test js-fixed-array-out-of-memory.js should be excluded for memory limited devices.
https://bugs.webkit.org/show_bug.cgi?id=184284

Reviewed by Saam Barati.

* stress/js-fixed-array-out-of-memory.js:

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

17 months agoAdd missing WEBCORE_EXPORTs (for Windows shared library build)
ross.kirsling@sony.com [Wed, 4 Apr 2018 00:56:07 +0000 (00:56 +0000)]
Add missing WEBCORE_EXPORTs (for Windows shared library build)
https://bugs.webkit.org/show_bug.cgi?id=184279

Reviewed by Alex Christensen.

* dom/Element.h:
* dom/Node.h:
* editing/FrameSelection.h:
* html/DOMURL.h:
* html/HTMLFormElement.h:
* html/canvas/CanvasRenderingContext.h:
* platform/graphics/GraphicsContext.h:
* platform/graphics/PlatformDisplay.h:
* platform/graphics/cairo/CairoOperations.h:
* platform/graphics/cairo/GraphicsContextImplCairo.h:
* platform/graphics/texmap/TextureMapperLayer.h:
* platform/network/HTTPHeaderMap.h:
* platform/network/ResourceRequestBase.h:
* platform/network/ResourceResponseBase.h:
* platform/network/curl/AuthenticationChallenge.h:
* platform/network/curl/CurlFormDataStream.h:
* platform/network/curl/CurlRequest.h:
* platform/network/curl/CurlSSLHandle.h:
* platform/network/curl/ResourceError.h:
* platform/network/curl/ResourceResponse.h:

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

17 months agoAX: Add Experimental setting for Accessibility Audit
commit-queue@webkit.org [Wed, 4 Apr 2018 00:46:50 +0000 (00:46 +0000)]
AX: Add Experimental setting for Accessibility Audit
https://bugs.webkit.org/show_bug.cgi?id=183646
<rdar://problem/38478583>

Patch by Aaron Chu <aaron_chu@apple.com> on 2018-04-03
Reviewed by Brian Burg.

Added experimental feature flag for Accessibility Audit work.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Base/Setting.js:
* UserInterface/Views/SettingsTabContentView.js:
(WI.SettingsTabContentView.prototype._createExperimentalSettingsView):

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

17 months agoRealtimeOutgoingVideoSourceMac should pass a ObjCFrameBuffer buffer
youenn@apple.com [Wed, 4 Apr 2018 00:44:24 +0000 (00:44 +0000)]
RealtimeOutgoingVideoSourceMac should pass a ObjCFrameBuffer buffer
https://bugs.webkit.org/show_bug.cgi?id=184281
rdar://problem/39153262

Reviewed by Jer Noble.

Source/ThirdParty/libwebrtc:

Introduce a routine to create the wrapper around native pixel buffers as expected by the new libwebrtc H264 encoder.

* Configurations/libwebrtc.iOS.exp:
* Configurations/libwebrtc.iOSsim.exp:
* Configurations/libwebrtc.mac.exp:
* Source/webrtc/sdk/WebKit/WebKitUtilities.h:
* Source/webrtc/sdk/WebKit/WebKitUtilities.mm:
(webrtc::pixelBufferToFrame):

Source/WebCore:

Covered by manual testing by going to WebRTC web sites.

* platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
(WebCore::RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated):

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

17 months agoGC shouldn't do object distancing
fpizlo@apple.com [Tue, 3 Apr 2018 23:52:09 +0000 (23:52 +0000)]
GC shouldn't do object distancing
https://bugs.webkit.org/show_bug.cgi?id=184195

Reviewed by Saam Barati.
Source/JavaScriptCore:

This rolls out SecurityKind/SecurityOriginToken, but keeps the TLC infrastructure. It seems
to be a small speed-up.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Sources.txt:
* heap/BlockDirectory.cpp:
(JSC::BlockDirectory::findBlockForAllocation):
(JSC::BlockDirectory::addBlock):
* heap/BlockDirectory.h:
* heap/CellAttributes.cpp:
(JSC::CellAttributes::dump const):
* heap/CellAttributes.h:
(JSC::CellAttributes::CellAttributes):
* heap/LocalAllocator.cpp:
(JSC::LocalAllocator::allocateSlowCase):
(JSC::LocalAllocator::tryAllocateWithoutCollecting):
* heap/MarkedBlock.cpp:
(JSC::MarkedBlock::Handle::didAddToDirectory):
* heap/MarkedBlock.h:
(JSC::MarkedBlock::Handle::securityOriginToken const): Deleted.
* heap/SecurityKind.cpp: Removed.
* heap/SecurityKind.h: Removed.
* heap/SecurityOriginToken.cpp: Removed.
* heap/SecurityOriginToken.h: Removed.
* heap/ThreadLocalCache.cpp:
(JSC::ThreadLocalCache::create):
(JSC::ThreadLocalCache::ThreadLocalCache):
* heap/ThreadLocalCache.h:
(JSC::ThreadLocalCache::securityOriginToken const): Deleted.
* runtime/JSDestructibleObjectHeapCellType.cpp:
(JSC::JSDestructibleObjectHeapCellType::JSDestructibleObjectHeapCellType):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::JSGlobalObject):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::threadLocalCache const): Deleted.
* runtime/JSSegmentedVariableObjectHeapCellType.cpp:
(JSC::JSSegmentedVariableObjectHeapCellType::JSSegmentedVariableObjectHeapCellType):
* runtime/JSStringHeapCellType.cpp:
(JSC::JSStringHeapCellType::JSStringHeapCellType):
* runtime/VM.cpp:
(JSC::VM::VM):
* runtime/VM.h:
* runtime/VMEntryScope.cpp:
(JSC::VMEntryScope::VMEntryScope):
* wasm/js/JSWebAssemblyCodeBlockHeapCellType.cpp:
(JSC::JSWebAssemblyCodeBlockHeapCellType::JSWebAssemblyCodeBlockHeapCellType):

Source/WebCore:

No new tests because no change in behavior.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::JSDOMGlobalObject):
* bindings/js/JSDOMGlobalObject.h:
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::JSDOMWindowBase):
* dom/Document.cpp:
(WebCore::Document::threadLocalCache): Deleted.
* dom/Document.h:
* page/OriginThreadLocalCache.cpp: Removed.
* page/OriginThreadLocalCache.h: Removed.

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

17 months agoGuard against keychain/certificate access outside the network process
bfulgham@apple.com [Tue, 3 Apr 2018 23:50:14 +0000 (23:50 +0000)]
Guard against keychain/certificate access outside the network process
https://bugs.webkit.org/show_bug.cgi?id=184214
<rdar://problem/38734795>

Reviewed by Youenn Fablet.

Use the ProcessPrivilege assertions to guard against accessing the Keychain from
a non-Networking process.

Source/WebCore:

* Modules/webauthn/cocoa/LocalAuthenticator.mm:
(WebCore::LocalAuthenticator::makeCredential): Assert if we access the keychain from
a proces other than the Network or UI process.
(WebCore::LocalAuthenticator::getAssertion): Ditto.
(WebCore::LocalAuthenticator::issueClientCertificate const): Ditto.
* crypto/mac/SerializedCryptoKeyWrapMac.mm:
(WebCore::createAndStoreMasterKey): Ditto.
(WebCore::findMasterKey): Ditto.
(WebCore::deleteDefaultWebCryptoMasterKey): Ditto.
* platform/mac/SSLKeyGeneratorMac.mm:
(WebCore::signedPublicKeyAndChallengeString): Ditto.
* platform/network/cocoa/NetworkStorageSessionCocoa.mm:
(WebCore::createPrivateStorageSession): Ditto.
* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::didReceiveAuthenticationChallenge): Ditto.

Source/WebKit:

* Shared/cf/ArgumentCodersCF.cpp:
(IPC::encode): Assert if we access the keychain from a proces other than the Network or UI process.
(IPC::decode): Ditto.

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

17 months agoNetworkResourceLoader does not need to expose all redirect response headers
youenn@apple.com [Tue, 3 Apr 2018 22:20:21 +0000 (22:20 +0000)]
NetworkResourceLoader does not need to expose all redirect response headers
https://bugs.webkit.org/show_bug.cgi?id=184114
<rdar://problem/39010557>

Reviewed by Ryosuke Niwa.

Source/WebCore:

No JS observable change of behavior.
Behavior change is observable for injected bundles since they will no longer get access to the full response.
List of response headers correspond to the one currently being used/exposed for redirections.

Test: http/wpt/loading/redirect-headers.html

* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setRestrictedHTTPResponseAccess):
(WebCore::RuntimeEnabledFeatures::restrictedHTTPResponseAccess const):
* platform/network/ResourceResponseBase.cpp:
(WebCore::isSafeToKeepRedirectionHeader):
(WebCore::ResourceResponseBase::sanitizeRedirectionHTTPHeaderFields):
* platform/network/ResourceResponseBase.h:

Source/WebKit:

WebProcess instructs NetworkProcess whether to sanitize response headers based on a runtime flag.
We sanitize redirection response headers in case this is not related to a navigation load.
Navigation loads may currently require the full response for content blockers.

* NetworkProcess/NetworkResourceLoadParameters.cpp:
(WebKit::NetworkResourceLoadParameters::encode const):
(WebKit::NetworkResourceLoadParameters::decode):
* NetworkProcess/NetworkResourceLoadParameters.h:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::willSendRedirectedRequest):
(WebKit::NetworkResourceLoader::sanitizeRedirectResponseIfPossible):
(WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
* NetworkProcess/NetworkResourceLoader.h:
* Shared/WebPreferences.yaml:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetRestrictedHTTPResponseAccess):
(WKPreferencesGetRestrictedHTTPResponseAccess):
* UIProcess/API/C/WKPreferencesRef.h:
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
(WebKit::WebLoaderStrategy::loadResourceSynchronously):
(WebKit::WebLoaderStrategy::startPingLoad):
(WebKit::WebLoaderStrategy::preconnectTo):

Tools:

Add an option to dump the number of headers in a response.
This allows validating that filtering does happen or not.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::dumpResponseDescriptionSuitableForTestResult):
(WTR::InjectedBundlePage::responseHeaderCount):
(WTR::InjectedBundlePage::willSendRequestForFrame):
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
* WebKitTestRunner/InjectedBundle/TestRunner.h:
(WTR::TestRunner::dumpAllHTTPRedirectedResponseHeaders):
(WTR::TestRunner::shouldDumpAllHTTPRedirectedResponseHeaders const):
* WebKitTestRunner/InjectedBundle/cocoa/InjectedBundlePageCocoa.mm:
(WTR::InjectedBundlePage::responseHeaderCount):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetPreferencesToConsistentValues):

LayoutTests:

New test verifies that headers are filtered. Witout filtering, 9 headers would be visible to the injected bundle, while 6 headers reamin after filtering.

* http/wpt/loading/redirect-headers-expected.txt: Added.
* http/wpt/loading/redirect-headers.html: Added.
* platform/mac-wk1/TestExpectations: Skipped new test for WK1.

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

17 months agoMake NetworkProcess get ContentBlocker information from UIProcess
youenn@apple.com [Tue, 3 Apr 2018 21:33:54 +0000 (21:33 +0000)]
Make NetworkProcess get ContentBlocker information from UIProcess
https://bugs.webkit.org/show_bug.cgi?id=184205

Reviewed by Alex Christensen.

Make NetworkProcess get content blockers from UIProcess directly.
Before that patch, WebProcess sent content blockers to NetworkProcess for each PingLoad.
Instead, WebProcess sends the content blocker identifier for each PingLoad and NetworkProcess fetches the content blocker once.

This is both more efficient than passing them for each PingLoad and safer in the sense
that a compromised WebProcess will not be able to bypass any of these.
In the future, NetworkProcess should get the content blocker identifier directly from the WebPageID attached to the request.

Covered by existing beacon+content blocker tests.

Did some refactoring to add a typed content blocker identifier.
Once NetworkProcess fetches a given content blocker, the content blocker will send any modification to NetworkProcess.
Introduced NetworkContentRuleListManager to handle the content blockers in NetworkProcess.

* CMakeLists.txt:
* DerivedSources.make:
* NetworkProcess/NetworkLoadChecker.cpp:
(WebKit::NetworkLoadChecker::checkRequest):
(WebKit::NetworkLoadChecker::continueCheckingRequest):
(WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
* NetworkProcess/NetworkLoadChecker.h:
(WebKit::NetworkLoadChecker::setContentExtensionController):
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::didReceiveMessage):
* NetworkProcess/NetworkProcess.h:
(WebKit::NetworkProcess::networkUserContentController):
* NetworkProcess/NetworkResourceLoadParameters.cpp:
(WebKit::NetworkResourceLoadParameters::encode const):
(WebKit::NetworkResourceLoadParameters::decode):
* NetworkProcess/NetworkResourceLoadParameters.h:
* NetworkProcess/NetworkContentRuleListManager.cpp: Added.
(WebKit::NetworkContentRuleListManager::contentExtensionsBackend):
(WebKit::NetworkContentRuleListManager::addContentRuleLists):
(WebKit::NetworkContentRuleListManager::removeContentRuleList):
(WebKit::NetworkContentRuleListManager::removeAllContentRuleLists):
(WebKit::NetworkContentRuleListManager::remove):
* NetworkProcess/NetworkContentRuleListManager.h: Added.
* NetworkProcess/NetworkContentRuleListManager.messages.in: Added.
* NetworkProcess/PingLoad.cpp:
* Scripts/webkit/messages.py:
* Shared/UserContentControllerIdentifier.h: Added.
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* Shared/WebPageGroupData.cpp:
(WebKit::WebPageGroupData::decode):
* Shared/WebPageGroupData.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::~NetworkProcessProxy):
(WebKit::NetworkProcessProxy::contentExtensionRules):
(WebKit::NetworkProcessProxy::didDestroyWebUserContentControllerProxy):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.messages.in:
* UIProcess/UserContent/WebUserContentControllerProxy.cpp:
(WebKit::WebUserContentControllerProxy::get):
(WebKit::WebUserContentControllerProxy::WebUserContentControllerProxy):
(WebKit::WebUserContentControllerProxy::~WebUserContentControllerProxy):
(WebKit::WebUserContentControllerProxy::addProcess):
(WebKit::WebUserContentControllerProxy::removeProcess):
(WebKit::WebUserContentControllerProxy::addUserContentWorldUse):
(WebKit::WebUserContentControllerProxy::removeUserContentWorldUses):
(WebKit::WebUserContentControllerProxy::addUserScript):
(WebKit::WebUserContentControllerProxy::removeUserScript):
(WebKit::WebUserContentControllerProxy::removeAllUserScripts):
(WebKit::WebUserContentControllerProxy::addUserStyleSheet):
(WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
(WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
(WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler):
(WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName):
(WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
(WebKit::WebUserContentControllerProxy::addContentRuleList):
(WebKit::WebUserContentControllerProxy::removeContentRuleList):
(WebKit::WebUserContentControllerProxy::removeAllContentRuleLists):
* UIProcess/UserContent/WebUserContentControllerProxy.h:
(WebKit::WebUserContentControllerProxy::create):
(WebKit::WebUserContentControllerProxy::addNetworkProcess):
(WebKit::WebUserContentControllerProxy::removeNetworkProcess):
(WebKit::WebUserContentControllerProxy::contentExtensionRules):
(WebKit::WebUserContentControllerProxy::identifier const):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::startPingLoad):
* WebProcess/UserContent/WebUserContentController.cpp:
(WebKit::WebUserContentController::getOrCreate):
(WebKit::WebUserContentController::WebUserContentController):
(WebKit::WebUserContentController::~WebUserContentController):
* WebProcess/UserContent/WebUserContentController.h:
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::userContentControllerIdentifier const):

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

17 months agototalPhysicalSize calculation when splitting a range must account for double rounding...
sbarati@apple.com [Tue, 3 Apr 2018 20:41:26 +0000 (20:41 +0000)]
totalPhysicalSize calculation when splitting a range must account for double rounding effects
https://bugs.webkit.org/show_bug.cgi?id=184275

Reviewed by Mark Lam.

The rounding error could happen when we split a range where the
range's total physical size equals the range's total size. The
rounding may cause the left size to lose a byte, and the right
size to gain a byte. This caused the right side to be a byte
large than its size.

* bmalloc/LargeRange.h:
(bmalloc::LargeRange::LargeRange):
(bmalloc::LargeRange::split const):

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

17 months ago[Mac] Prioritize file promises over filenames during drag and drop
aestes@apple.com [Tue, 3 Apr 2018 20:40:12 +0000 (20:40 +0000)]
[Mac] Prioritize file promises over filenames during drag and drop
https://bugs.webkit.org/show_bug.cgi?id=184237
<rdar://problem/38278076>

Reviewed by Wenson Hsieh.

Source/WebCore:

When performing a drag operation where the pasteboard contains both a file path and a file
promise, we have historically preferred to accept the file path. Some versions of Photos.app
will provide both a low-resolution thumbnail as a file path and its high-resolution
counterpart as a file promise when dragging a photo, and our current logic leads us to
choose the low-quality thumbnail.

This patch changes our logic to prefer file promises over file paths. This matches the
behavior of Finder and ensures we accept high-resolution assets from Photos.app.

Covered by existing file promise drag tests. beginDragWithFilePromises() was updated to
write a bogus file path to the pasteboard along with the legitimate file promise.

* platform/mac/DragDataMac.mm:
(WebCore::DragData::asFilenames const):
* platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::read):
(WebCore::Pasteboard::readFilePaths):
* platform/mac/PlatformPasteboardMac.mm:
(WebCore::PlatformPasteboard::numberOfFiles const):

Source/WebKit:

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

Source/WebKitLegacy/mac:

* WebView/WebView.mm:
(-[WebView performDragOperation:]):

Tools:

* DumpRenderTree/mac/EventSendingController.mm:
(-[EventSendingController beginDragWithFilePromises:]):

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

17 months agoFix mis-application of WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION macro.
mark.lam@apple.com [Tue, 3 Apr 2018 20:22:08 +0000 (20:22 +0000)]
Fix mis-application of WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION macro.
https://bugs.webkit.org/show_bug.cgi?id=184276
<rdar://problem/39109543>

Rubber-stamped by Michael Saboff.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):
* bindings/scripts/test/JS/JSInterfaceName.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSMapLike.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestCEReactions.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestCallTracer.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestEventConstructor.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestException.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestIterable.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestNode.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestPluginInterface.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestSerialization.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestStringifier.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
(WebCore::toJSNewlyCreated):

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

17 months agoMake SessionStorage work with process swapping.
beidson@apple.com [Tue, 3 Apr 2018 20:01:27 +0000 (20:01 +0000)]
Make SessionStorage work with process swapping.
https://bugs.webkit.org/show_bug.cgi?id=184270

Reviewed by Andy Estes.

Source/WebKit:

Due to a minor process accounting error, WebPageProxys weren't always being reconnected with their
WebsiteDataStore's StorageManager when doing process swaps.

Fix that error, and SessionStorage "just works."

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::webProcessWillShutDown):
(WebKit::WebPageProxy::processDidTerminate): For NavigationSwap termination, make sure to tell the
  process lifetime tracker that this page was removed.

* UIProcess/WebProcessLifetimeObserver.h:
(WebKit::WebProcessLifetimeObserver::webPageWasInvalidated): Renamed from "webPageWasRemoved"
(WebKit::WebProcessLifetimeObserver::webPageWasRemoved): Deleted.

* UIProcess/WebProcessLifetimeTracker.cpp:
(WebKit::WebProcessLifetimeTracker::webPageLeavingWebProcess): Renamed from "webProcessWillShutDown"
(WebKit::WebProcessLifetimeTracker::pageWasInvalidated):
(WebKit::WebProcessLifetimeTracker::webProcessWillShutDown): Deleted.
* UIProcess/WebProcessLifetimeTracker.h:

* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::webPageWasInvalidated):
(WebKit::WebsiteDataStore::webPageWasRemoved): Deleted.
* UIProcess/WebsiteData/WebsiteDataStore.h:

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
(-[PSONMessageHandler userContentController:didReceiveScriptMessage:]):

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

17 months agoUnreviewed, rolling out r230210.
commit-queue@webkit.org [Tue, 3 Apr 2018 19:58:09 +0000 (19:58 +0000)]
Unreviewed, rolling out r230210.
https://bugs.webkit.org/show_bug.cgi?id=184277

it is breaking internal bots (Requested by youenn on #webkit).

Reverted changeset:

"Make NetworkProcess get ContentBlocker information from
UIProcess"
https://bugs.webkit.org/show_bug.cgi?id=184205
https://trac.webkit.org/changeset/230210

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

17 months ago[Extra zoom mode] Update time picker to use platform view controller
wenson_hsieh@apple.com [Tue, 3 Apr 2018 19:22:53 +0000 (19:22 +0000)]
[Extra zoom mode] Update time picker to use platform view controller
https://bugs.webkit.org/show_bug.cgi?id=184252
<rdar://problem/38804795>

Reviewed by Andy Estes.

Adjust for some small WKTimePickerViewController changes, and remove some files that we no longer need.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView presentViewControllerForCurrentAssistedNode]):
(-[WKContentView textInputController:didCommitText:]): Deleted.
(-[WKContentView textInputController:didCommitText:withSuggestion:]): Deleted.
(-[WKContentView textInputControllerDidRequestDismissal:]): Deleted.
* UIProcess/ios/forms/WKTextFormControlViewController.h: Removed.
* UIProcess/ios/forms/WKTextFormControlViewController.mm: Removed.
* UIProcess/ios/forms/WKTextSuggestionButton.h: Removed.
* UIProcess/ios/forms/WKTextSuggestionButton.mm: Removed.
* WebKit.xcodeproj/project.pbxproj:

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

17 months agoMark http/tests/appcache/interrupted-update.html as flaky.
ryanhaddad@apple.com [Tue, 3 Apr 2018 19:02:59 +0000 (19:02 +0000)]
Mark http/tests/appcache/interrupted-update.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=184061

Unreviewed test gardening.

* TestExpectations:

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

17 months agoMark storage/indexeddb/dont-wedge-private.html as flaky.
ryanhaddad@apple.com [Tue, 3 Apr 2018 19:02:57 +0000 (19:02 +0000)]
Mark storage/indexeddb/dont-wedge-private.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=184058

Unreviewed test gardening.

* TestExpectations:

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

17 months agoMark http/tests/workers/service/service-worker-cache-api.https.html as flaky.
ryanhaddad@apple.com [Tue, 3 Apr 2018 19:02:55 +0000 (19:02 +0000)]
Mark http/tests/workers/service/service-worker-cache-api.https.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=184245

Unreviewed test gardening.

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

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

17 months agoXcode prepends line comments from WTF/Compiler.h to *.sb files
ross.kirsling@sony.com [Tue, 3 Apr 2018 18:14:53 +0000 (18:14 +0000)]
Xcode prepends line comments from WTF/Compiler.h to *.sb files
https://bugs.webkit.org/show_bug.cgi?id=184166

Reviewed by Brent Fulgham.

* DerivedSources.make:
Strip ;-comments from *.sb.in files before preprocessing so we can stop treating Platform.h/Compiler.h as C89.

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

17 months ago[CMake] gperf path should be given when WebCore/css/makevalues.pl is executed
commit-queue@webkit.org [Tue, 3 Apr 2018 18:14:43 +0000 (18:14 +0000)]
[CMake] gperf path should be given when WebCore/css/makevalues.pl is executed
https://bugs.webkit.org/show_bug.cgi?id=184224

Patch by Yousuke Kimoto <yousuke.kimoto@sony.com> on 2018-04-03
Reviewed by Konstantin Tokarev.

When a building evironment doens't include a path to gperf,
WebCore/css/makevalue.pl failes due to failing to execute gperf,
so the full path to gperf should be given like WebCore/css/makeprop.pl.

No new tests, no Web-facing behavior change.

* CMakeLists.txt: gperf path is given to css/makevalues.pl.
* css/makevalues.pl: Add an argument to handle a given gperf path.

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

17 months agoDrop MainFrame class
cdumez@apple.com [Tue, 3 Apr 2018 18:01:41 +0000 (18:01 +0000)]
Drop MainFrame class
https://bugs.webkit.org/show_bug.cgi?id=184191

Reviewed by Darin Adler.

Source/WebCore:

Drop MainFrame class and move contents into Page / Frame since there is a 1:1
relationship between the Page and the MainFrame.

This is ground work for introducing LocalFrame / RemoteFrame concepts.

* Modules/applepay/ApplePaySession.cpp:
(WebCore::ApplePaySession::create):
(WebCore::ApplePaySession::supportsVersion):
(WebCore::ApplePaySession::canMakePayments):
(WebCore::ApplePaySession::canMakePaymentsWithActiveCard):
(WebCore::ApplePaySession::openPaymentSetup):
(WebCore::ApplePaySession::paymentCoordinator const):
* Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
(WebCore::paymentCoordinator):
* Modules/mediastream/MediaDevicesEnumerationRequest.cpp:
* Modules/mediastream/UserMediaRequest.cpp:
* Modules/plugins/QuickTimePluginReplacement.mm:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::mainFrame const):
(WebCore::AccessibilityObject::visiblePositionForBounds const):
* accessibility/AccessibilityObject.h:
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
* bindings/js/ScriptController.cpp:
* bindings/js/ScriptState.cpp:
* contentextensions/ContentExtensionsBackend.cpp:
* css/MediaQueryEvaluator.cpp:
(WebCore::displayModeEvaluate):
* dom/DOMImplementation.cpp:
* dom/Document.cpp:
* dom/DocumentMarkerController.cpp:
* dom/Element.cpp:
(WebCore::Element::removedFromAncestor):
* dom/EventDispatcher.cpp:
* dom/ScriptedAnimationController.cpp:
* editing/Editor.cpp:
(WebCore::Editor::scanSelectionForTelephoneNumbers):
* editing/EditorCommand.cpp:
* editing/SelectionRectGatherer.cpp:
(WebCore::SelectionRectGatherer::Notifier::~Notifier):
* editing/cocoa/WebContentReaderCocoa.mm:
* editing/markup.cpp:
* history/CachedFrame.cpp:
* history/CachedPage.cpp:
* history/PageCache.cpp:
(WebCore::destroyRenderTree):
* html/HTMLMediaElement.cpp:
* html/HTMLPlugInImageElement.cpp:
* html/ImageDocument.cpp:
* html/MediaElementSession.cpp:
(WebCore::isMainContentForPurposesOfAutoplay):
* html/canvas/WebGLRenderingContextBase.cpp:
* inspector/InspectorClient.cpp:
* inspector/InspectorController.cpp:
* inspector/InspectorFrontendClientLocal.cpp:
* inspector/InspectorFrontendHost.cpp:
* inspector/InspectorInstrumentation.cpp:
* inspector/InspectorOverlay.cpp:
* inspector/PageScriptDebugServer.cpp:
* inspector/agents/InspectorApplicationCacheAgent.cpp:
* inspector/agents/InspectorCanvasAgent.cpp:
* inspector/agents/InspectorDOMAgent.cpp:
* inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::mainFrame):
* inspector/agents/InspectorPageAgent.h:
* inspector/agents/page/PageDebuggerAgent.cpp:
* inspector/agents/page/PageRuntimeAgent.cpp:
* loader/DocumentLoader.cpp:
* loader/DocumentWriter.cpp:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadWithDocumentLoader):
(WebCore::FrameLoader::setState):
* loader/HistoryController.cpp:
* loader/NavigationDisabler.h:
* loader/ProgressTracker.cpp:
* loader/ResourceLoadObserver.cpp:
* loader/ResourceLoader.cpp:
* loader/SubframeLoader.cpp:
* loader/SubresourceLoader.cpp:
* loader/appcache/ApplicationCacheHost.cpp:
* loader/archive/mhtml/MHTMLArchive.cpp:
* loader/cache/CachedResource.cpp:
* loader/cache/CachedResourceLoader.cpp:
* page/AutoscrollController.cpp:
* page/Chrome.cpp:
* page/ContextMenuController.cpp:
* page/DOMWindow.cpp:
* page/DebugPageOverlays.cpp:
(WebCore::MouseWheelRegionOverlay::updateRegion):
(WebCore::NonFastScrollableRegionOverlay::updateRegion):
(WebCore::RegionOverlay::create):
(WebCore::RegionOverlay::RegionOverlay):
(WebCore::RegionOverlay::~RegionOverlay):
(WebCore::DebugPageOverlays::ensureRegionOverlayForPage):
(WebCore::DebugPageOverlays::showRegionOverlay):
(WebCore::DebugPageOverlays::hideRegionOverlay):
(WebCore::DebugPageOverlays::regionChanged):
(WebCore::DebugPageOverlays::regionOverlayForPage const):
(WebCore::DebugPageOverlays::updateOverlayRegionVisibility):
(WebCore::DebugPageOverlays::settingsChanged):
* page/DebugPageOverlays.h:
(WebCore::DebugPageOverlays::hasOverlaysForPage const):
(WebCore::DebugPageOverlays::hasOverlays):
(WebCore::DebugPageOverlays::didLayout):
(WebCore::DebugPageOverlays::didChangeEventHandlers):
* page/DragController.cpp:
(WebCore::DragController::performDragOperation):
(WebCore::DragController::tryDHTMLDrag):
(WebCore::DragController::beginDrag):
(WebCore::DragController::doSystemDrag):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMousePressEvent):
(WebCore::EventHandler::mouseMoved):
(WebCore::EventHandler::handleMouseReleaseEvent):
(WebCore::EventHandler::handleWheelEvent):
(WebCore::EventHandler::clearLatchedState):
(WebCore::EventHandler::defaultWheelEventHandler):
* page/FocusController.cpp:
* page/Frame.cpp:
(WebCore::Frame::Frame):
(WebCore::Frame::dropChildren):
(WebCore::Frame::selfOnlyRef):
(WebCore::Frame::selfOnlyDeref):
* page/Frame.h:
(WebCore::Frame::mainFrame const):
* page/FrameTree.cpp:
* page/FrameView.cpp:
(WebCore::FrameView::setFrameRect):
(WebCore::FrameView::setContentsSize):
(WebCore::FrameView::didChangeScrollOffset):
(WebCore::FrameView::setViewExposedRect):
* page/History.cpp:
* page/MainFrame.cpp: Removed.
* page/MainFrame.h: Removed.
* page/MemoryRelease.cpp:
* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::m_applicationManifest):
(WebCore::Page::setDeviceScaleFactor):
(WebCore::Page::latchingState):
(WebCore::Page::pushNewLatchingState):
(WebCore::Page::resetLatchingState):
(WebCore::Page::popLatchingState):
(WebCore::Page::removeLatchingStateForTarget):
(WebCore::Page::setPaymentCoordinator):
* page/Page.h:
(WebCore::Page::mainFrame):
(WebCore::Page::mainFrame const):
(WebCore::Page::wheelEventDeltaFilter):
(WebCore::Page::pageOverlayController):
(WebCore::Page::servicesOverlayController):
(WebCore::Page::paymentCoordinator const):
(WebCore::Page::applicationManifest const):
(WebCore::Page::performanceLogging const):
* page/PageConsoleClient.cpp:
* page/PageDebuggable.cpp:
* page/PageGroup.cpp:
* page/PageGroupLoadDeferrer.cpp:
* page/PageOverlay.cpp:
(WebCore::PageOverlay::controller const):
* page/PageOverlayController.cpp:
(WebCore::PageOverlayController::PageOverlayController):
(WebCore::PageOverlayController::createRootLayersIfNeeded):
(WebCore::PageOverlayController::layerWithDocumentOverlays):
(WebCore::PageOverlayController::layerWithViewOverlays):
(WebCore::PageOverlayController::installPageOverlay):
(WebCore::PageOverlayController::updateForceSynchronousScrollLayerPositionUpdates):
(WebCore::PageOverlayController::didChangeViewExposedRect):
(WebCore::PageOverlayController::updateSettingsForLayer):
(WebCore::PageOverlayController::deviceScaleFactor const):
(WebCore::PageOverlayController::notifyFlushRequired):
(WebCore::PageOverlayController::tiledBackingUsageChanged):
* page/PageOverlayController.h:
* page/PageSerializer.cpp:
* page/PerformanceLogging.cpp:
(WebCore::PerformanceLogging::PerformanceLogging):
(WebCore::PerformanceLogging::didReachPointOfInterest):
* page/PerformanceLogging.h:
* page/PerformanceMonitor.cpp:
* page/ResourceUsageOverlay.cpp:
(WebCore::ResourceUsageOverlay::~ResourceUsageOverlay):
(WebCore::ResourceUsageOverlay::initialize):
* page/SettingsBase.cpp:
* page/SpatialNavigation.cpp:
* page/UserContentProvider.cpp:
* page/ios/FrameIOS.mm:
* page/mac/DragControllerMac.mm:
* page/mac/EventHandlerMac.mm:
(WebCore::latchingIsLockedToPlatformFrame):
(WebCore::latchingIsLockedToAncestorOfThisFrame):
(WebCore::EventHandler::clearOrScheduleClearingLatchedStateIfNeeded):
(WebCore::EventHandler::platformPrepareForWheelEvents):
(WebCore::EventHandler::platformRecordWheelEvent):
(WebCore::EventHandler::platformCompleteWheelEvent):
(WebCore::EventHandler::platformCompletePlatformWidgetWheelEvent):
* page/mac/PageMac.mm:
* page/mac/ServicesOverlayController.h:
(WebCore::ServicesOverlayController::page const):
* page/mac/ServicesOverlayController.mm:
(WebCore::ServicesOverlayController::Highlight::Highlight):
(WebCore::ServicesOverlayController::Highlight::notifyFlushRequired):
(WebCore::ServicesOverlayController::Highlight::deviceScaleFactor const):
(WebCore::ServicesOverlayController::ServicesOverlayController):
(WebCore::ServicesOverlayController::invalidateHighlightsOfType):
(WebCore::ServicesOverlayController::buildPotentialHighlightsIfNeeded):
(WebCore::ServicesOverlayController::remainingTimeUntilHighlightShouldBeShown const):
(WebCore::ServicesOverlayController::buildPhoneNumberHighlights):
(WebCore::ServicesOverlayController::buildSelectionHighlight):
(WebCore::ServicesOverlayController::hasRelevantSelectionServices):
(WebCore::ServicesOverlayController::createOverlayIfNeeded):
(WebCore::ServicesOverlayController::telephoneNumberRangesForFocusedFrame):
(WebCore::ServicesOverlayController::findTelephoneNumberHighlightContainingSelectionHighlight):
(WebCore::ServicesOverlayController::mouseEvent):
(WebCore::ServicesOverlayController::handleClick):
(WebCore::ServicesOverlayController::mainFrame const):
* page/scrolling/AsyncScrollingCoordinator.cpp:
* page/scrolling/ScrollingCoordinator.cpp:
* page/scrolling/ios/ScrollingCoordinatorIOS.mm:
* page/scrolling/mac/ScrollingCoordinatorMac.mm:
* platform/graphics/ca/win/CACFLayerTreeHost.cpp:
* plugins/DOMMimeType.cpp:
* plugins/PluginInfoProvider.cpp:
(WebCore::PluginInfoProvider::refresh):
* rendering/RenderBox.cpp:
* rendering/RenderLayer.cpp:
* rendering/RenderLayerBacking.cpp:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::hasAnyAdditionalCompositedLayers const):
(WebCore::RenderLayerCompositor::updateCompositingLayers):
(WebCore::RenderLayerCompositor::appendDocumentOverlayLayers):
(WebCore::RenderLayerCompositor::attachRootLayer):
(WebCore::RenderLayerCompositor::detachRootLayer):
(WebCore::RenderLayerCompositor::rootLayerAttachmentChanged):
* rendering/RenderObject.cpp:
* replay/UserInputBridge.cpp:
* storage/StorageEventDispatcher.cpp:
* style/StyleTreeResolver.cpp:
(WebCore::Style::suspendMemoryCacheClientCalls):
* svg/SVGSVGElement.cpp:
* svg/graphics/SVGImage.cpp:
* testing/InternalSettings.cpp:
* testing/Internals.cpp:
(WebCore::Internals::Internals):
(WebCore::Internals::installMockPageOverlay):
(WebCore::Internals::pageOverlayLayerTreeAsText const):
* testing/MockPageOverlay.cpp:
* testing/MockPageOverlay.h:
* testing/MockPageOverlayClient.cpp:
(WebCore::MockPageOverlayClient::installOverlay):
(WebCore::MockPageOverlayClient::layerTreeAsText):
* testing/MockPageOverlayClient.h:
* testing/MockPaymentCoordinator.cpp:
(WebCore::MockPaymentCoordinator::MockPaymentCoordinator):
(WebCore::MockPaymentCoordinator::showPaymentUI):
(WebCore::MockPaymentCoordinator::completeMerchantValidation):
(WebCore::MockPaymentCoordinator::changeShippingOption):
(WebCore::MockPaymentCoordinator::changePaymentMethod):
(WebCore::MockPaymentCoordinator::acceptPayment):
(WebCore::MockPaymentCoordinator::cancelPayment):
* testing/MockPaymentCoordinator.h:
* workers/service/context/ServiceWorkerThreadProxy.cpp:

Source/WebKit:

Drop MainFrame class and move contents into Page / Frame since there is a 1:1
relationship between the Page and the MainFrame.

This is ground work for introducing LocalFrame / RemoteFrame concepts.

* Shared/WebRenderLayer.cpp:
* Shared/WebRenderObject.cpp:
* WebProcess/ApplePay/WebPaymentCoordinator.cpp:
(WebKit::WebPaymentCoordinator::paymentCoordinator):
* WebProcess/Automation/WebAutomationSessionProxy.cpp:
* WebProcess/FullScreen/WebFullScreenManager.cpp:
* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageInstallPageOverlay):
(WKBundlePageUninstallPageOverlay):
(WKBundlePageInstallPageOverlayWithAnimation):
(WKBundlePageUninstallPageOverlayWithAnimation):
* WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
* WebProcess/Plugins/PDF/PDFPlugin.mm:
* WebProcess/Plugins/PluginView.cpp:
* WebProcess/Plugins/WebPluginInfoProvider.cpp:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
* WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
* WebProcess/WebCoreSupport/WebInspectorClient.cpp:
(WebKit::WebInspectorClient::~WebInspectorClient):
(WebKit::WebInspectorClient::highlight):
(WebKit::WebInspectorClient::hideHighlight):
(WebKit::WebInspectorClient::showPaintRect):
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
* WebProcess/WebCoreSupport/WebProgressTrackerClient.cpp:
* WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm:
* WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
* WebProcess/WebPage/AcceleratedDrawingArea.cpp:
* WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
* WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
* WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::updateFindUIAfterPageScroll):
(WebKit::FindController::hideFindUI):
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::updatePreferences):
* WebProcess/WebPage/WKAccessibilityWebPageObjectIOS.mm:
* WebProcess/WebPage/WebBackForwardListProxy.cpp:
* WebProcess/WebPage/WebFrame.cpp:
* WebProcess/WebPage/WebInspector.cpp:
* WebProcess/WebPage/WebInspectorFrontendAPIDispatcher.cpp:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::mainFrame const):
(WebKit::WebPage::determinePrimarySnapshottedPlugIn):
(WebKit::WebPage::plugInIntersectsSearchRect):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/atk/WebPageAccessibilityObjectAtk.cpp:
* WebProcess/WebPage/ios/FindControllerIOS.mm:
* WebProcess/WebPage/ios/WebPageIOS.mm:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::updatePreferences):
* WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
* WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
(-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]):
(-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::performImmediateActionHitTestAtLocation):
(WebKit::WebPage::dataDetectorsDidPresentUI):
(WebKit::WebPage::dataDetectorsDidChangeUI):
(WebKit::WebPage::dataDetectorsDidHideUI):
* WebProcess/WebProcess.cpp:
* WebProcess/WebStorage/StorageAreaMap.cpp:

Source/WebKitLegacy/mac:

Drop MainFrame class and move contents into Page / Frame since there is a 1:1
relationship between the Page and the MainFrame.

This is ground work for introducing LocalFrame / RemoteFrame concepts.

* WebCoreSupport/WebDragClient.mm:
* WebCoreSupport/WebFrameLoaderClient.mm:
* WebCoreSupport/WebInspectorClient.mm:
* WebCoreSupport/WebPlatformStrategies.mm:
* WebCoreSupport/WebPluginInfoProvider.mm:
* WebView/WebFrame.mm:
* WebView/WebFrameView.mm:
* WebView/WebHTMLView.mm:
* WebView/WebView.mm:

Source/WebKitLegacy/win:

Drop MainFrame class and move contents into Page / Frame since there is a 1:1
relationship between the Page and the MainFrame.

This is ground work for introducing LocalFrame / RemoteFrame concepts.

* WebCoreSupport/AcceleratedCompositingContext.cpp:
* WebCoreSupport/WebContextMenuClient.cpp:
* WebCoreSupport/WebDragClient.cpp:
* WebDropSource.cpp:
* WebFrame.cpp:
* WebView.cpp:

Tools:

* TestWebKitAPI/Tests/WebCore/cocoa/WebCoreNSURLSession.mm:

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

17 months agoMake NetworkProcess get ContentBlocker information from UIProcess
youenn@apple.com [Tue, 3 Apr 2018 17:58:48 +0000 (17:58 +0000)]
Make NetworkProcess get ContentBlocker information from UIProcess
https://bugs.webkit.org/show_bug.cgi?id=184205

Reviewed by Alex Christensen.

Make NetworkProcess get content blockers from UIProcess directly.
Before that patch, WebProcess sent content blockers to NetworkProcess for each PingLoad.
Instead, WebProcess sends the content blocker identifier for each PingLoad and NetworkProcess fetches the content blocker once.

This is both more efficient than passing them for each PingLoad and safer in the sense
that a compromised WebProcess will not be able to bypass any of these.
In the future, NetworkProcess should get the content blocker identifier directly from the WebPageID attached to the request.

Covered by existing beacon+content blocker tests.

Did some refactoring to add a typed content blocker identifier.
Once NetworkProcess fetches a given content blocker, the content blocker will send any modification to NetworkProcess.
Introduced NetworkContentRuleListManager to handle the content blockers in NetworkProcess.

* CMakeLists.txt:
* DerivedSources.make:
* NetworkProcess/NetworkLoadChecker.cpp:
(WebKit::NetworkLoadChecker::checkRequest):
(WebKit::NetworkLoadChecker::continueCheckingRequest):
(WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
* NetworkProcess/NetworkLoadChecker.h:
(WebKit::NetworkLoadChecker::setContentExtensionController):
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::didReceiveMessage):
* NetworkProcess/NetworkProcess.h:
(WebKit::NetworkProcess::networkUserContentController):
* NetworkProcess/NetworkResourceLoadParameters.cpp:
(WebKit::NetworkResourceLoadParameters::encode const):
(WebKit::NetworkResourceLoadParameters::decode):
* NetworkProcess/NetworkResourceLoadParameters.h:
* NetworkProcess/NetworkContentRuleListManager.cpp: Added.
(WebKit::NetworkContentRuleListManager::contentExtensionsBackend):
(WebKit::NetworkContentRuleListManager::addContentRuleLists):
(WebKit::NetworkContentRuleListManager::removeContentRuleList):
(WebKit::NetworkContentRuleListManager::removeAllContentRuleLists):
(WebKit::NetworkContentRuleListManager::remove):
* NetworkProcess/NetworkContentRuleListManager.h: Added.
* NetworkProcess/NetworkContentRuleListManager.messages.in: Added.
* NetworkProcess/PingLoad.cpp:
* Scripts/webkit/messages.py:
* Shared/UserContentControllerIdentifier.h: Added.
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* Shared/WebPageGroupData.cpp:
(WebKit::WebPageGroupData::decode):
* Shared/WebPageGroupData.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::~NetworkProcessProxy):
(WebKit::NetworkProcessProxy::contentExtensionRules):
(WebKit::NetworkProcessProxy::didDestroyWebUserContentControllerProxy):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.messages.in:
* UIProcess/UserContent/WebUserContentControllerProxy.cpp:
(WebKit::WebUserContentControllerProxy::get):
(WebKit::WebUserContentControllerProxy::WebUserContentControllerProxy):
(WebKit::WebUserContentControllerProxy::~WebUserContentControllerProxy):
(WebKit::WebUserContentControllerProxy::addProcess):
(WebKit::WebUserContentControllerProxy::removeProcess):
(WebKit::WebUserContentControllerProxy::addUserContentWorldUse):
(WebKit::WebUserContentControllerProxy::removeUserContentWorldUses):
(WebKit::WebUserContentControllerProxy::addUserScript):
(WebKit::WebUserContentControllerProxy::removeUserScript):
(WebKit::WebUserContentControllerProxy::removeAllUserScripts):
(WebKit::WebUserContentControllerProxy::addUserStyleSheet):
(WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
(WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
(WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler):
(WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName):
(WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
(WebKit::WebUserContentControllerProxy::addContentRuleList):
(WebKit::WebUserContentControllerProxy::removeContentRuleList):
(WebKit::WebUserContentControllerProxy::removeAllContentRuleLists):
* UIProcess/UserContent/WebUserContentControllerProxy.h:
(WebKit::WebUserContentControllerProxy::create):
(WebKit::WebUserContentControllerProxy::addNetworkProcess):
(WebKit::WebUserContentControllerProxy::removeNetworkProcess):
(WebKit::WebUserContentControllerProxy::contentExtensionRules):
(WebKit::WebUserContentControllerProxy::identifier const):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::startPingLoad):
* WebProcess/UserContent/WebUserContentController.cpp:
(WebKit::WebUserContentController::getOrCreate):
(WebKit::WebUserContentController::WebUserContentController):
(WebKit::WebUserContentController::~WebUserContentController):
* WebProcess/UserContent/WebUserContentController.h:
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::userContentControllerIdentifier const):

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

17 months agoThe referer header is not set after redirect
commit-queue@webkit.org [Tue, 3 Apr 2018 17:15:17 +0000 (17:15 +0000)]
The referer header is not set after redirect
https://bugs.webkit.org/show_bug.cgi?id=182644
<rdar://problem/37479048>

Patch by Sihui Liu <sihui_liu@apple.com> on 2018-04-03
Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Rebaseline some tests for fetch api as they are passing now.

* web-platform-tests/fetch/api/basic/referrer.any-expected.txt:
* web-platform-tests/fetch/api/basic/referrer.any.worker-expected.txt:
* web-platform-tests/fetch/api/redirect/redirect-referrer-expected.txt:
* web-platform-tests/fetch/api/redirect/redirect-referrer-worker-expected.txt:

Source/WebCore:

Update referrer policy and recompute referrer in redirection check, so Referer header would be set after it's removed from cross-origin request.

Add support for Referrer-Policy header, so referrer policy would be changed based on redirect response.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/Document.cpp:
(WebCore::Document::processReferrerPolicy):
* loader/CrossOriginAccessControl.cpp:
(WebCore::updateRequestReferrer):
* loader/CrossOriginAccessControl.h:
* loader/ResourceLoader.h:
(WebCore::ResourceLoader::setReferrerPolicy):
(WebCore::ResourceLoader::referrerPolicy const):
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl):
(WebCore::SubresourceLoader::updateReferrerPolicy):
* loader/SubresourceLoader.h:
* loader/cache/CachedResourceRequest.cpp:
(WebCore::CachedResourceRequest::setAsPotentiallyCrossOrigin):
(WebCore::CachedResourceRequest::updateForAccessControl):
(WebCore::CachedResourceRequest::updateReferrerOriginAndUserAgentHeaders):
* platform/ReferrerPolicy.cpp: Added.
(WebCore::parseReferrerPolicy):
* platform/ReferrerPolicy.h:
* platform/network/HTTPHeaderNames.in:

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

17 months agoMake SecurityOrigin safe to create and use from any thread
cdumez@apple.com [Tue, 3 Apr 2018 16:26:47 +0000 (16:26 +0000)]
Make SecurityOrigin safe to create and use from any thread
https://bugs.webkit.org/show_bug.cgi?id=184216

Reviewed by Youenn Fablet.

We found that we have a decent amount of code constructing and using SecurityOrigin
objects from non-main threads. Unfortunately, this was not safe, mostly due to
SecurityOrigin's reliance on the SchemeRegistry.

This patch makes it safe to construct a SecurityOrigin on any thread A and use
it later on the same thread A. However, developers still need to call isolatedCopy()
if they want to pass such object to another thread B.

* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::canDisplay const):
* page/SecurityOrigin.h:
* page/SecurityPolicy.cpp:
(WebCore::originAccessMapLock):
(WebCore::originAccessMap):
(WebCore::SecurityPolicy::isAccessWhiteListed):
(WebCore::SecurityPolicy::addOriginAccessWhitelistEntry):
(WebCore::SecurityPolicy::removeOriginAccessWhitelistEntry):
(WebCore::SecurityPolicy::resetOriginAccessWhitelists):
* platform/SchemeRegistry.cpp:
(WebCore::schemeRegistryLock):
(WebCore::allBuiltinSchemes):
(WebCore::builtinLocalURLSchemes):
(WebCore::localURLSchemes):
(WebCore::displayIsolatedURLSchemes):
(WebCore::builtinSecureSchemes):
(WebCore::secureSchemes):
(WebCore::builtinSchemesWithUniqueOrigins):
(WebCore::schemesWithUniqueOrigins):
(WebCore::builtinEmptyDocumentSchemes):
(WebCore::emptyDocumentSchemes):
(WebCore::schemesForbiddenFromDomainRelaxation):
(WebCore::builtinCanDisplayOnlyIfCanRequestSchemes):
(WebCore::canDisplayOnlyIfCanRequestSchemes):
(WebCore::notAllowingJavascriptURLsSchemes):
(WebCore::SchemeRegistry::registerURLSchemeAsLocal):
(WebCore::SchemeRegistry::removeURLSchemeRegisteredAsLocal):
(WebCore::schemesAllowingLocalStorageAccessInPrivateBrowsing):
(WebCore::schemesAllowingDatabaseAccessInPrivateBrowsing):
(WebCore::builtinCORSEnabledSchemes):
(WebCore::CORSEnabledSchemes):
(WebCore::ContentSecurityPolicyBypassingSchemes):
(WebCore::cachePartitioningSchemes):
(WebCore::serviceWorkerSchemes):
(WebCore::alwaysRevalidatedSchemes):
(WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal):
(WebCore::SchemeRegistry::registerURLSchemeAsNoAccess):
(WebCore::SchemeRegistry::shouldTreatURLSchemeAsNoAccess):
(WebCore::SchemeRegistry::registerURLSchemeAsDisplayIsolated):
(WebCore::SchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated):
(WebCore::SchemeRegistry::registerURLSchemeAsSecure):
(WebCore::SchemeRegistry::shouldTreatURLSchemeAsSecure):
(WebCore::SchemeRegistry::canDisplayOnlyIfCanRequest):
(WebCore::SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest):
(WebCore::SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy):
(WebCore::SchemeRegistry::removeURLSchemeRegisteredAsBypassingContentSecurityPolicy):
(WebCore::SchemeRegistry::schemeShouldBypassContentSecurityPolicy):
(WebCore::SchemeRegistry::registerURLSchemeAsCachePartitioned):
(WebCore::SchemeRegistry::shouldPartitionCacheForURLScheme):
(WebCore::SchemeRegistry::registerURLSchemeServiceWorkersCanHandle):
(WebCore::SchemeRegistry::canServiceWorkersHandleURLScheme):
(WebCore::SchemeRegistry::isServiceWorkerContainerCustomScheme):
* platform/SchemeRegistry.h:

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

17 months agoFix the managed configurations build
bdakin@apple.com [Tue, 3 Apr 2018 15:51:50 +0000 (15:51 +0000)]
Fix the managed configurations build
https://bugs.webkit.org/show_bug.cgi?id=184253
-and corresponding-
rdar://problem/39078586

Reviewed by Dan Bernstein.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView canPerformActionForWebView:withSender:]):
(-[WKContentView _defineForWebView:]):

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

17 months ago[SOUP] Stop using ResourceHandle to load GResources
carlosgc@webkit.org [Tue, 3 Apr 2018 15:09:10 +0000 (15:09 +0000)]
[SOUP] Stop using ResourceHandle to load GResources
https://bugs.webkit.org/show_bug.cgi?id=184259

Reviewed by Sergio Villar Senin.

GResources are loaded in the WebProcess using ResourceHandle because soup handles them transparently. But now
that we no longer use ResourceHandle, we can add a simple loader for GResources, similar to the one used for
data URLS, since loading a GResource is a matter of calling g_resources_lookup_data() in the end.

* SourcesGTK.txt:
* SourcesWPE.txt:
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::start): Check if resource to load is a GResource and call loadGResource().
* loader/ResourceLoader.h:
* loader/soup/ResourceLoaderSoup.cpp: Added.
(WebCore::ResourceLoader::loadGResource): Load the GResource in a GTask thread.
* platform/SharedBuffer.cpp:
(WebCore::SharedBuffer::DataSegment::data const):
(WebCore::SharedBuffer::DataSegment::size const):
* platform/SharedBuffer.h:
* platform/glib/SharedBufferGlib.cpp:
(WebCore::SharedBuffer::SharedBuffer):
(WebCore::SharedBuffer::create):

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

17 months ago[WPE] Add WPE port to garden-o-matic
cturner@igalia.com [Tue, 3 Apr 2018 13:34:03 +0000 (13:34 +0000)]
[WPE] Add WPE port to garden-o-matic
https://bugs.webkit.org/show_bug.cgi?id=182998

Reviewed by Michael Catanzaro.

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/config.js:
Add WPE as a port to check.
(config.kPlatforms.string_appeared_here._builderApplies): Use less
surprising equality operator.
(config.kPlatforms.string_appeared_here.resultsDirectoryNameFromBuilderName):
Ditto.
(config.kPlatforms.string_appeared_here.resultsDirectoryForBuildNumber):
Ditto.

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

17 months agoUnreviewed, mute the unused parameter compilation warning
tpopela@redhat.com [Tue, 3 Apr 2018 12:51:35 +0000 (12:51 +0000)]
Unreviewed, mute the unused parameter compilation warning

Triggered on the PPC64 machine.

* wtf/ThreadingPthreads.cpp:
(WTF::Thread::signalHandlerSuspendResume):

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

17 months agoUnreviewed, fix the unused variable compilation warning
tpopela@redhat.com [Tue, 3 Apr 2018 12:42:09 +0000 (12:42 +0000)]
Unreviewed, fix the unused variable compilation warning

Move the ucontext_t code under the HAVE(MACHINE_CONTEXT). Triggered
on the PPC64 machine.

* wtf/ThreadingPthreads.cpp:
(WTF::Thread::signalHandlerSuspendResume):

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

17 months ago[GTK][JHBuild] Tools/gtk/install-dependencies: Replace libxfont with libxfont2 in...
aperez@igalia.com [Tue, 3 Apr 2018 11:14:00 +0000 (11:14 +0000)]
[GTK][JHBuild] Tools/gtk/install-dependencies: Replace libxfont with libxfont2 in Arch Linux
https://bugs.webkit.org/show_bug.cgi?id=184258

Reviewed by Carlos Alberto Lopez Perez.

* gtk/install-dependencies: Use libxfont2 on Arch Linux as well.

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

17 months ago[Enchant] Clean up TextCheckerEnchant
carlosgc@webkit.org [Tue, 3 Apr 2018 07:16:45 +0000 (07:16 +0000)]
[Enchant] Clean up TextCheckerEnchant
https://bugs.webkit.org/show_bug.cgi?id=184233

Reviewed by Michael Catanzaro.

Source/WebCore:

Several cleanups and improvements:

* platform/text/enchant/TextCheckerEnchant.cpp:
(WebCore::TextCheckerEnchant::singleton): Make TextCheckerEnchant a singleton since it's always used as a
singleton.
(WebCore::TextCheckerEnchant::EnchantDictDeleter::operator() const):
(WebCore::TextCheckerEnchant::TextCheckerEnchant):
(WebCore::TextCheckerEnchant::ignoreWord): Convert to utf8 once instead of on every loop iteration.
(WebCore::TextCheckerEnchant::learnWord): Ditton.
(WebCore::TextCheckerEnchant::checkSpellingOfWord): m_enchantDictionaries is now a Vector of std::unique_ptr.
(WebCore::TextCheckerEnchant::getGuessesForWord): Convert to utf8 once instead of on every loop iteration.
(WebCore::TextCheckerEnchant::updateSpellCheckingLanguages): Get only the first language instead of building a
vector to get its first item. Use WTFMove to replace m_enchantDictionaries with the new Vector.
(WebCore::TextCheckerEnchant::loadedSpellCheckingLanguages const): Use a lambda to get the list of languages
already converted to String and iterate only once.
(WebCore::TextCheckerEnchant::availableSpellCheckingLanguages const): Ditto.
(WebCore::enchantDictDescribeCallback): Deleted.
(WebCore::TextCheckerEnchant::~TextCheckerEnchant): Deleted.
(WebCore::TextCheckerEnchant::freeEnchantBrokerDictionaries): Deleted.
* platform/text/enchant/TextCheckerEnchant.h:

Source/WebKit:

Use TextCheckerEnchant as a singleton now, instead of implementing the singleton here.

* UIProcess/gtk/TextCheckerGtk.cpp:
(WebKit::TextChecker::checkSpellingOfString):
(WebKit::TextChecker::getGuessesForWord):
(WebKit::TextChecker::learnWord):
(WebKit::TextChecker::ignoreWord):
(WebKit::TextChecker::setSpellCheckingLanguages):
(WebKit::TextChecker::loadedSpellCheckingLanguages):
(WebKit::enchantTextChecker): Deleted.

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

17 months ago[GTK] Segfaults in enchant_broker_free_dict()
carlosgc@webkit.org [Tue, 3 Apr 2018 07:11:04 +0000 (07:11 +0000)]
[GTK] Segfaults in enchant_broker_free_dict()
https://bugs.webkit.org/show_bug.cgi?id=183738

Reviewed by Michael Catanzaro.

Check enchant_broker_request_dict() didn't return nullptr before adding it to the m_enchantDictionaries vector.

* platform/text/enchant/TextCheckerEnchant.cpp:
(WebCore::TextCheckerEnchant::updateSpellCheckingLanguages):

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

17 months ago[GTK] NetworkProcess from WebKitGtk+ 2.19.9x SIGSEVs in NetworkStorageSession (secret...
carlosgc@webkit.org [Tue, 3 Apr 2018 07:09:34 +0000 (07:09 +0000)]
[GTK] NetworkProcess from WebKitGtk+ 2.19.9x SIGSEVs in NetworkStorageSession (secret search callback)
https://bugs.webkit.org/show_bug.cgi?id=183346

Reviewed by Michael Catanzaro.

Source/WebCore:

This might happen if a request is cancelled right after the password request starts and before it finishes. We
should cancel the password search when the network request is cancelled, not only when the NetworkStorageSession
is destroyed.

* platform/network/NetworkStorageSession.h:
* platform/network/soup/NetworkStorageSessionSoup.cpp:
(WebCore::NetworkStorageSession::~NetworkStorageSession):
(WebCore::SecretServiceSearchData::SecretServiceSearchData): Helper struct to keep the request cancellable and
completion handler.
(WebCore::NetworkStorageSession::getCredentialFromPersistentStorage): Create a SecretServiceSearchData for the
request.
* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::ResourceHandle::didReceiveAuthenticationChallenge): Pass the request cancellable to
NetworkStorageSession::getCredentialFromPersistentStorage().

Source/WebKit:

Pass the request cancellable to NetworkStorageSession::getCredentialFromPersistentStorage().

* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::authenticate):

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

17 months agoProcess swapping on navigation needs to handle server redirects.
beidson@apple.com [Tue, 3 Apr 2018 01:03:46 +0000 (01:03 +0000)]
Process swapping on navigation needs to handle server redirects.
<rdar://problem/38690465> and https://bugs.webkit.org/show_bug.cgi?id=184142

Reviewed by Alex Christensen.

Source/WebKit:

The same rules we apply to process swapping for basic navigations need to apply
to server redirects as well.

There's three interesting cases we need to support that are covered by new API tests:
1 - The initial load in a WKWebView redirects cross-origin.
2 - A WKWebView is showing content from a.com, we start a load to b.com, and that redirects to c.com
3 - A WKWebView is showing content from a.com, we start a load to a.com, that that redirects to b.com.

Supporting all 3 of these brought their own little challenges.

By teaching Navigation objects more about redirects I was able to support all 3 cases.

* UIProcess/API/APINavigation.cpp:
(API::Navigation::Navigation):
(API::Navigation::setCurrentRequest):
(API::Navigation::appendRedirectionURL):
(API::Navigation::loggingString const):
(API::Navigation::loggingURL const): Deleted.
* UIProcess/API/APINavigation.h:
(API::Navigation::originalRequest const):
(API::Navigation::currentRequest const):
(API::Navigation::currentRequestProcessIdentifier const):
(API::Navigation::setCurrentRequestIsRedirect):
(API::Navigation::currentRequestIsRedirect const):
(API::Navigation::request const): Deleted.

* UIProcess/API/Cocoa/WKNavigation.mm:
(-[WKNavigation _request]):

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::receivedPolicyDecision):
(WebKit::WebPageProxy::continueNavigationInNewProcess): If this continued navigation is currently in a server
  redirect, save off a lambda to synthesize a "did receive server redirect" callback once the new WebProcess is running.
(WebKit::WebPageProxy::didCreateMainFrame):
(WebKit::WebPageProxy::didStartProvisionalLoadForFrame): Possibly ignore this notification if it is really a
  cross-origin redirect that is just starting back up in a new WebProcess.
(WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
(WebKit::WebPageProxy::didCommitLoadForFrame):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::resetStateAfterProcessExited): Do not clear pageLoadState if the process is exitting for
  a navigation swap, as we will need to pick up where we left off when the load continues in a new WebProcess.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::processForNavigation): If a process has never committed any provisional load, it can always
  be used to continue a navigation.
* UIProcess/WebProcessPool.h:

* UIProcess/WebProcessProxy.h:
(WebKit::WebProcessProxy::didCommitProvisionalLoad):
(WebKit::WebProcessProxy::hasCommittedAnyProvisionalLoads const):

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad):
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
(-[PSONNavigationDelegate webView:didFinishNavigation:]):
(-[PSONNavigationDelegate webView:decidePolicyForNavigationAction:decisionHandler:]):
(-[PSONNavigationDelegate webView:didReceiveServerRedirectForProvisionalNavigation:]):
(-[PSONScheme addRedirectFromURLString:toURLString:]):
(-[PSONScheme webView:startURLSchemeTask:]):

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

17 months ago[Extra zoom mode] Replace video with a placeholder image during fullscreen transition
eric.carlson@apple.com [Tue, 3 Apr 2018 00:50:29 +0000 (00:50 +0000)]
[Extra zoom mode] Replace video with a placeholder image during fullscreen transition
https://bugs.webkit.org/show_bug.cgi?id=184188
<rdar://problem/38940307>

Reviewed by Youenn Fablet.

Source/WebCore:

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::willExitFullscreen):
* html/HTMLMediaElement.h:
* platform/cocoa/VideoFullscreenChangeObserver.h:
* platform/cocoa/VideoFullscreenModelVideoElement.h:
* platform/cocoa/VideoFullscreenModelVideoElement.mm:
(VideoFullscreenModelVideoElement::willExitFullscreen):
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::updateVideoFullscreenInlineImage):
* platform/graphics/MediaPlayer.h:
* platform/graphics/MediaPlayerPrivate.h:
(WebCore::MediaPlayerPrivateInterface::updateVideoFullscreenInlineImage):
* platform/graphics/VideoFullscreenLayerManager.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem):
(WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoFullscreenInlineImage):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastPixelBuffer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage):
(WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenLayer):
* platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h:
* platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm:
(WebCore::VideoFullscreenLayerManagerObjC::setVideoLayer):
(WebCore::VideoFullscreenLayerManagerObjC::updateVideoFullscreenInlineImage):
(WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer):
* platform/ios/VideoFullscreenInterfaceAVKit.h:
* platform/ios/VideoFullscreenInterfaceAVKit.mm:
(VideoFullscreenInterfaceAVKit::exitFullscreen):
(VideoFullscreenInterfaceAVKit::preparedToExitFullscreen):
(VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
* platform/ios/WebVideoFullscreenControllerAVKit.mm:
(VideoFullscreenControllerContext::willExitFullscreen):

Source/WebKit:

* UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
* UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in:
* UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
(WebKit::VideoFullscreenModelContext::willExitFullscreen):
(WebKit::VideoFullscreenManagerProxy::preparedToExitFullscreen):
(WebKit::VideoFullscreenManagerProxy::willExitFullscreen):
* WebProcess/cocoa/VideoFullscreenManager.h:
* WebProcess/cocoa/VideoFullscreenManager.messages.in:
* WebProcess/cocoa/VideoFullscreenManager.mm:
(WebKit::VideoFullscreenManager::willExitFullscreen):

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

17 months ago[Cocoa] Fix some internal builds that consume WebDriver atoms
bburg@apple.com [Tue, 3 Apr 2018 00:11:16 +0000 (00:11 +0000)]
[Cocoa] Fix some internal builds that consume WebDriver atoms
https://bugs.webkit.org/show_bug.cgi?id=184197

Reviewed by Dan Bernstein.

* WebKit.xcodeproj/project.pbxproj:
Use a Run Script phase to copy WebDriver atoms to WebKit.framework
private headers during the installhdrs phase.

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

17 months agoAdd infrastructure to relax SSL for allowed hosts in DumpRenderTree and WebKitTestRunner
dbates@webkit.org [Mon, 2 Apr 2018 23:12:12 +0000 (23:12 +0000)]
Add infrastructure to relax SSL for allowed hosts in DumpRenderTree and WebKitTestRunner
https://bugs.webkit.org/show_bug.cgi?id=184239

Reviewed by Alexey Proskuryakov.

Adds a new optional command line option --allow-any-certificate-for-allowed-hosts (defaults to disabled)
to allow the allowed hosts to accept any HTTPS certificate. You can specify an allowed host
by using the existing command line option --allowed-host.

Currently both DumpRenderTree and WebKitTestRunner relax SSL certificate validation
for 127.0.0.1 and localhost so that we can run HTTPS tests from these hosts using
a self-signed certificate. They do not relax these restrictions for any allowed host,
specified using the optional command line option --allowed-host. For testing purposes
it is useful to be able to run a local HTTPS server with a self-signed certificate and
mimic a non-localhost hostname (by adding an alias(es) for 127.0.0.1 to /etc/hosts).
We should support relaxing SSL restrictions for such testing purposes.

For example, to allow host example.test to present any HTTPS certificate when running
tests you would invoke:

    run-webkit-tests --allowed-host example.test --additional-drt-flag '--allow-any-certificate-for-allowed-hosts'

* DumpRenderTree/mac/DumpRenderTree.mm:
(initializeGlobalsFromCommandLineOptions): Parse the command line option --allow-any-certificate-for-allowed-hosts.
(dumpRenderTree): Allow any HTTPS certificate from each allowed host.
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::didReceiveMessageToPage): Clear out the existing list of allowed hosts
before appending entries to it to avoid growing the list of allowed hosts without bound. Call
platformAllowAnyHTTPSCertificateForAllowedHosts() to apply SSL relaxation for each allowed host.
* WebKitTestRunner/Options.cpp:
(WTR::handleOptionAllowAnyHTTPSCertificateForAllowedHosts): Added.
(WTR::handleOptionAllowedHost): Update code as needed now that Options::allowedHosts is a std::set.
(WTR::OptionsHandler::OptionsHandler):
* WebKitTestRunner/Options.h: Change the data type of allowedHosts from a std::vector to a std::set
so that we can make use of the convenience functon std::set::find() in TestController::canAuthenticateAgainstProtectionSpace().
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
(WTR::TestController::canAuthenticateAgainstProtectionSpace): Allow any HTTPS certificate from each allowed host.
* WebKitTestRunner/TestController.h:

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

17 months agoUnreviewed, rolling out r230174.
ryanhaddad@apple.com [Mon, 2 Apr 2018 23:09:13 +0000 (23:09 +0000)]
Unreviewed, rolling out r230174.

Caused LayoutTests to exit early with assertion failures.

Reverted changeset:

"Process swapping on navigation needs to handle server
redirects."
https://bugs.webkit.org/show_bug.cgi?id=184142
https://trac.webkit.org/changeset/230174

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

17 months agoRemove pre-Network Session code path for allowing any HTTPS certificate on Mac and iOS
dbates@webkit.org [Mon, 2 Apr 2018 23:05:03 +0000 (23:05 +0000)]
Remove pre-Network Session code path for allowing any HTTPS certificate on Mac and iOS
https://bugs.webkit.org/show_bug.cgi?id=184242

Reviewed by Alexey Proskuryakov.

Following r227364 we use the Network Session (NSURLSession) code path by default in
modern WebKit on Mac and iOS. That is, we no longer use {CF, NS}URLConnection in modern
WebKit on these platforms. So, we can remove code that used NSURLRequest SPI to allow
any HTTPS certificate from localhost and 127.0.0.1 when using {CF, NS}URLConnection.
The equivalent functionality is implemented in TestController::canAuthenticateAgainstProtectionSpace().

* WebKitTestRunner/InjectedBundle/ios/InjectedBundleIOS.mm:
(WTR::InjectedBundle::platformInitialize):
* WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm:
(WTR::InjectedBundle::platformInitialize):

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

17 months agoRemove references to internal version of WebKitQuartzCoreAdditions in CMake files.
pvollan@apple.com [Mon, 2 Apr 2018 21:14:09 +0000 (21:14 +0000)]
Remove references to internal version of WebKitQuartzCoreAdditions in CMake files.
https://bugs.webkit.org/show_bug.cgi?id=184246
<rdar://problem/39116563>

Unreviewed build fix.

* Source/PlatformWin.cmake:

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

17 months agobmalloc should compute its own estimate of its footprint
sbarati@apple.com [Mon, 2 Apr 2018 21:09:45 +0000 (21:09 +0000)]
bmalloc should compute its own estimate of its footprint
https://bugs.webkit.org/show_bug.cgi?id=184121

Reviewed by Filip Pizlo.

Source/bmalloc:

This patch makes it so that bmalloc keeps track of its own physical
footprint.

Doing this for IsoHeaps is trivial. It allocates/deallocates fixed
page sizes at a time. IsoHeapImpl just updates a count every time
a page is committed/decommitted.

Making Heap keep its footprint was a bit trickier because of how
LargeRange is constructed. Before this patch, LargeRange kept track
of the amount of physical memory at the start of its range. This
patch extends large range to also keep track of the total physical memory
in the range just for footprint bookkeeping. This was needed to make
Heap's footprint come close to resembling reality, because as we merge and split
large ranges, the start physical size often becomes wildly inaccurate.
The total physical size number stored in LargeRange is still just an
estimate. It's possible that as ranges are split, that the total physical
size split amongst the two ranges doesn't resemble reality. This can
happen when the total physical size is really all in one end of the split,
but we mark it as being proportionally split amongst the resulting two
ranges. In practice, I did not notice this being a problem. The footprint
estimate tracks reality very closely (in my testing, within less than 1MB for
heaps with sizes upwards of 1GB). The other nice thing about total physical
size is that even if it diverges from reality in terms of how memory is
using up physical RAM, it stays internally consistent inside bmalloc's
own data structures.

The main oversight of this patch is how it deals with Wasm memory. All Wasm
memory will be viewed by bmalloc as taking up physical space even when it
may not be. Wasm memory starts off as taking up purely virtual pages. When a
page is first accessed, only then will the OS page it in and cause it to use
physical RAM. I opened a bug to come up with a solution to this problem:
https://bugs.webkit.org/show_bug.cgi?id=184207

* bmalloc.xcodeproj/project.pbxproj:
* bmalloc/AvailableMemory.cpp:
(bmalloc::memoryStatus):
* bmalloc/BPlatform.h:
* bmalloc/Heap.cpp:
(bmalloc::Heap::Heap):
(bmalloc::Heap::freeableMemory):
(bmalloc::Heap::footprint):
(bmalloc::Heap::scavenge):
(bmalloc::Heap::deallocateSmallChunk):
(bmalloc::Heap::allocateSmallPage):
(bmalloc::Heap::splitAndAllocate):
(bmalloc::Heap::tryAllocateLarge):
(bmalloc::Heap::shrinkLarge):
(bmalloc::Heap::deallocateLarge):
(bmalloc::Heap::externalCommit):
(bmalloc::Heap::externalDecommit):
* bmalloc/Heap.h:
* bmalloc/IsoDirectory.h:
* bmalloc/IsoDirectoryInlines.h:
(bmalloc::passedNumPages>::takeFirstEligible):
(bmalloc::passedNumPages>::didDecommit):
(bmalloc::passedNumPages>::freeableMemory):
* bmalloc/IsoHeapImpl.h:
* bmalloc/IsoHeapImplInlines.h:
(bmalloc::IsoHeapImpl<Config>::freeableMemory):
(bmalloc::IsoHeapImpl<Config>::footprint):
(bmalloc::IsoHeapImpl<Config>::didCommit):
(bmalloc::IsoHeapImpl<Config>::didDecommit):
* bmalloc/LargeRange.h:
(bmalloc::LargeRange::LargeRange):
(bmalloc::LargeRange::startPhysicalSize const):
(bmalloc::LargeRange::setStartPhysicalSize):
(bmalloc::LargeRange::totalPhysicalSize const):
(bmalloc::LargeRange::setTotalPhysicalSize):
(bmalloc::merge):
(bmalloc::LargeRange::split const):
(bmalloc::LargeRange::physicalSize const): Deleted.
(bmalloc::LargeRange::setPhysicalSize): Deleted.
* bmalloc/PhysicalPageMap.h: Added.
This class is added for debugging purposes. It's useful when hacking
on the code that calculates the footprint to use this map as a sanity
check. It's just a simple implementation that has a set of all the committed pages.

(bmalloc::PhysicalPageMap::commit):
(bmalloc::PhysicalPageMap::decommit):
(bmalloc::PhysicalPageMap::footprint):
(bmalloc::PhysicalPageMap::forEachPhysicalPage):
* bmalloc/Scavenger.cpp:
(bmalloc::dumpStats):
(bmalloc::Scavenger::scavenge):
(bmalloc::Scavenger::freeableMemory):
This is here just for debugging for now. But we should implement an
efficient version of this to use when driving when to run the
scavenger.

(bmalloc::Scavenger::footprint):
(bmalloc::Scavenger::threadRunLoop):
* bmalloc/Scavenger.h:
* bmalloc/VMAllocate.h:
(bmalloc::physicalPageSizeSloppy):
* bmalloc/VMHeap.cpp:
(bmalloc::VMHeap::tryAllocateLargeChunk):
* bmalloc/bmalloc.cpp:
(bmalloc::api::commitAlignedPhysical):
(bmalloc::api::decommitAlignedPhysical):
* bmalloc/bmalloc.h:

Source/JavaScriptCore:

* heap/IsoAlignedMemoryAllocator.cpp:
(JSC::IsoAlignedMemoryAllocator::~IsoAlignedMemoryAllocator):
(JSC::IsoAlignedMemoryAllocator::tryAllocateAlignedMemory):
(JSC::IsoAlignedMemoryAllocator::freeAlignedMemory):

Source/WTF:

* wtf/FastMalloc.cpp:
(WTF::fastCommitAlignedMemory):
(WTF::fastDecommitAlignedMemory):
* wtf/FastMalloc.h:

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

17 months agoDefine AVKit softlink macro
eric.carlson@apple.com [Mon, 2 Apr 2018 20:34:08 +0000 (20:34 +0000)]
Define AVKit softlink macro
https://bugs.webkit.org/show_bug.cgi?id=184241

Reviewed by Jer Noble.

Source/WebCore:

No new tests, no functional change.

* platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
* platform/ios/PlaybackSessionInterfaceAVKit.mm:
* platform/ios/VideoFullscreenInterfaceAVKit.mm:
* platform/ios/WebAVPlayerController.mm:
* platform/mac/PlaybackSessionInterfaceMac.mm:
* platform/mac/VideoFullscreenInterfaceMac.mm:

Source/WebCore/PAL:

* pal/cf/CoreMediaSoftLink.h:

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

17 months ago[Extra zoom mode] Update date picker UI to latest specifications
wenson_hsieh@apple.com [Mon, 2 Apr 2018 20:27:56 +0000 (20:27 +0000)]
[Extra zoom mode] Update date picker UI to latest specifications
https://bugs.webkit.org/show_bug.cgi?id=184234
<rdar://problem/38804760>

Reviewed by Timothy Hatcher.

Source/WebCore:

Tweak localizable strings. Day, month and year labels should be fully capitalized, and there needs to be a
string for the "Set" button title.

* English.lproj/Localizable.strings:
* platform/LocalizedStrings.cpp:
(WebCore::datePickerSetButtonTitle):
(WebCore::datePickerDayLabelTitle):
(WebCore::datePickerMonthLabelTitle):
(WebCore::datePickerYearLabelTitle):
* platform/LocalizedStrings.h:

Source/WebKit:

Rename WKTextFormControlListViewControllerDelegate to WKTextInputListViewControllerDelegate and adjust for the
new initializer of WKDatePickerViewController.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView presentViewControllerForCurrentAssistedNode]):

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

17 months agoWe should not trash the stack pointer on OSR entry.
mark.lam@apple.com [Mon, 2 Apr 2018 20:07:47 +0000 (20:07 +0000)]
We should not trash the stack pointer on OSR entry.
https://bugs.webkit.org/show_bug.cgi?id=184243
<rdar://problem/39114319>

Reviewed by Filip Pizlo.

In the DFG OSR entry path, we momentarily over-write the stack pointer with
returnValueGPR2.  returnValueGPR2 contains a pointer to a side buffer we malloc'ed.
Hence, this assignment is wrong, and it turns out to be unnecessary as well.
The stack pointer does get corrected later in the thunk (generated by
osrEntryThunkGenerator()) that we jump to.  This is why we don't see ill-effects
so far.

This bug only poses an issue if interrupts use the user stack for their stack
frame (e.g. linux), and when we do stack alignment tests during debugging.

The fix is simply to remove the assignment.

* dfg/DFGThunks.cpp:
(JSC::DFG::osrEntryThunkGenerator):
* jit/JIT.cpp:
(JSC::JIT::emitEnterOptimizationCheck):

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

17 months agoProcess swapping on navigation needs to handle server redirects.
beidson@apple.com [Mon, 2 Apr 2018 20:05:48 +0000 (20:05 +0000)]
Process swapping on navigation needs to handle server redirects.
<rdar://problem/38690465> and https://bugs.webkit.org/show_bug.cgi?id=184142

Reviewed by Alex Christensen.

Source/WebKit:

The same rules we apply to process swapping for basic navigations need to apply
to server redirects as well.

There's three interesting cases we need to support that are covered by new API tests:
1 - The initial load in a WKWebView redirects cross-origin.
2 - A WKWebView is showing content from a.com, we start a load to b.com, and that redirects to c.com
3 - A WKWebView is showing content from a.com, we start a load to a.com, that that redirects to b.com.

Supporting all 3 of these brought their own little challenges.

By teaching Navigation objects more about redirects I was able to support all 3 cases.

* UIProcess/API/APINavigation.cpp:
(API::Navigation::Navigation):
(API::Navigation::setCurrentRequest):
(API::Navigation::appendRedirectionURL):
(API::Navigation::loggingString const):
(API::Navigation::loggingURL const): Deleted.
* UIProcess/API/APINavigation.h:
(API::Navigation::originalRequest const):
(API::Navigation::currentRequest const):
(API::Navigation::currentRequestProcessIdentifier const):
(API::Navigation::setCurrentRequestIsRedirect):
(API::Navigation::currentRequestIsRedirect const):
(API::Navigation::request const): Deleted.

* UIProcess/API/Cocoa/WKNavigation.mm:
(-[WKNavigation _request]):

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::receivedPolicyDecision):
(WebKit::WebPageProxy::continueNavigationInNewProcess): If this continued navigation is currently in a server
  redirect, save off a lambda to synthesize a "did receive server redirect" callback once the new WebProcess is running.
(WebKit::WebPageProxy::didCreateMainFrame):
(WebKit::WebPageProxy::didStartProvisionalLoadForFrame): Possibly ignore this notification if it is really a
  cross-origin redirect that is just starting back up in a new WebProcess.
(WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
(WebKit::WebPageProxy::didCommitLoadForFrame):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::resetStateAfterProcessExited): Do not clear pageLoadState if the process is exitting for
  a navigation swap, as we will need to pick up where we left off when the load continues in a new WebProcess.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::processForNavigation): If a process has never committed any provisional load, it can always
  be used to continue a navigation.
* UIProcess/WebProcessPool.h:

* UIProcess/WebProcessProxy.h:
(WebKit::WebProcessProxy::didCommitProvisionalLoad):
(WebKit::WebProcessProxy::hasCommittedAnyProvisionalLoads const):

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad):
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
(-[PSONNavigationDelegate webView:didFinishNavigation:]):
(-[PSONNavigationDelegate webView:decidePolicyForNavigationAction:decisionHandler:]):
(-[PSONNavigationDelegate webView:didReceiveServerRedirectForProvisionalNavigation:]):
(-[PSONScheme addRedirectFromURLString:toURLString:]):
(-[PSONScheme webView:startURLSchemeTask:]):

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

17 months agoREGRESSION(r228260):WebHTMLView beeps at every keydown for Chinese/Japanese/Korean...
rniwa@webkit.org [Mon, 2 Apr 2018 19:59:42 +0000 (19:59 +0000)]
REGRESSION(r228260):WebHTMLView beeps at every keydown for Chinese/Japanese/Korean Input Method
https://bugs.webkit.org/show_bug.cgi?id=184231

Reviewed by Alexey Proskuryakov.

The bug was caused by EventHandler::internalKeyEvent calling setDefaultHandled and expecting it to stay true
after dispatching the event even though m_defaultHandled is always cleared after r228260. This results in
EventHandler::internalKeyEvent returning false, and resulting in a beep.

Unfortunately, no new tests since there is no facility to detect this case in layout tests, and we can't
easily emulate or trigger a real input method in API tests.

* page/EventHandler.cpp:
(WebCore::EventHandler::internalKeyEvent):

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

17 months agoFollowup(r230063): Add test a layout test for https://bugs.webkit.org/show_bug.cgi...
said@apple.com [Mon, 2 Apr 2018 19:42:18 +0000 (19:42 +0000)]
Followup(r230063): Add test a layout test for https://bugs.webkit.org/show_bug.cgi?id=183972
https://bugs.webkit.org/show_bug.cgi?id=184162

Reviewed by Daniel Bates.

Without r230063, running run-webkit-tests -g for this test will crash.

* svg/dom/animated-tearoff-list-remove-target-expected.txt: Added.
* svg/dom/animated-tearoff-list-remove-target.html: Added.

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

17 months ago[Extra zoom mode] Zoom level is sometimes excessive when zooming to focused form...
wenson_hsieh@apple.com [Mon, 2 Apr 2018 19:06:44 +0000 (19:06 +0000)]
[Extra zoom mode] Zoom level is sometimes excessive when zooming to focused form controls
https://bugs.webkit.org/show_bug.cgi?id=184222
<rdar://problem/39063886>

Reviewed by Timothy Hatcher.

Upon interactively focusing an element, we zoom and scroll to reveal that element. The heuristics introduced in
<https://trac.webkit.org/r168744> work by computing a target scale, and then a point to zoom to given that
scale. Currently, this scale is dependent on the computed font size of the form control, such that the form
control would be scaled to have an effective font size of 16.

However, in extra zoom mode, applying these same heuristics (ironically) results in excessive zoom levels, since
scaling the font up to 16 would cause most form controls to zoom so far in that we lose context of surrounding
elements such as labels and other form controls; the fact that the element is highlighted by the focused form
control overlay makes this even more confusing, since part of the focus overlay highlight rect often ends up
outside the viewport.

To fix this, we make a couple of tweaks to focus rect zooming in extra zoom mode. (1) Instead of computing
target zoom level based on font size, try to zoom such that the focused element rect fills up most of the
viewport (similar to double-tap zooming). This ensures that the focused form control overlay's highlight rect
makes sense in most cases, with few exceptions (e.g. the element frame is larger than the viewport). (2)
Introduce a minimum legible font size of 11, and compute the minimium scale needed such that the form control
font would appear to be at least this legible font size. Then, clamp the target scale chosen by (1) to this
minimum scale.

One additional consideration for (1) is that naively scaling to fit the element rect to the viewport (with some
fixed margins) would cause the viewport scale to always change when moving focus between form controls of
different dimensions, even if the current scale is more or less appropriate for all the focusable elements. To
address this, instead of computing a single target zoom scale for an element rect, compute a range of possible
target zoom scales (where the minimum and maximum values depend on the margin we add around the element rect).
If the current scale already falls within this target scale range, then we won't bother adjusting the scale at
all (unless the font size is too small — see (2)). If the current scale falls outside the target scale range, we
then make the minimal adjustment needed to ensure that the element rect fits well within the viewport without
being too small.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):

Move some logic around so that the target scale is computed after computing the visible size. Also renames some
constants local to this function (WKWebViewStandardFontSize, kMinimumHeightToShowContentAboveKeyboard,
UIWebFormAnimationDuration, CaretOffsetFromWindowEdge) such that they now share a consistent naming style.

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

17 months agoEnable Legacy EME for all WebKit & WebKitLegacy clients
jer.noble@apple.com [Mon, 2 Apr 2018 18:59:59 +0000 (18:59 +0000)]
Enable Legacy EME for all WebKit & WebKitLegacy clients
https://bugs.webkit.org/show_bug.cgi?id=184018
<rdar://problem/34887387>

Reviewed by Eric Carlson.

Source/WebKit:

* Shared/WebPreferences.yaml:
* Shared/WebPreferencesDefaultValues.h:

Source/WebKitLegacy/mac:

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

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

17 months agowebkitpy: Use current environment value for GST_DEBUG(_FILE) and DOT_DIR env vars
commit-queue@webkit.org [Mon, 2 Apr 2018 18:34:35 +0000 (18:34 +0000)]
webkitpy: Use current environment value for GST_DEBUG(_FILE) and DOT_DIR env vars
https://bugs.webkit.org/show_bug.cgi?id=184036

Patch by Thibault Saunier <tsaunier@igalia.com> on 2018-04-02
Reviewed by Philippe Normand.

Those variables are for debug purpose and should not change the behaviour
itself, and developers expect them to have effect.

* Scripts/webkitpy/port/gtk.py:
(GtkPort.setup_environ_for_server):

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

17 months agoRemove Options constructor and use internal linkage for option handlers
dbates@webkit.org [Mon, 2 Apr 2018 18:09:04 +0000 (18:09 +0000)]
Remove Options constructor and use internal linkage for option handlers
https://bugs.webkit.org/show_bug.cgi?id=184229

Reviewed by Andy Estes.

Use C++11 default initializer syntax to remove the need to explicitly have a constructor
for the struct Options. Use internal linkage for option handler functions as these
are never invoked outside the translation unit they are defined in.

* WebKitTestRunner/Options.cpp:
(WTR::handleOptionNoTimeout):
(WTR::handleOptionVerbose):
(WTR::handleOptionGcBetweenTests):
(WTR::handleOptionPixelTests):
(WTR::handleOptionPrintSupportedFeatures):
(WTR::handleOptionComplexText):
(WTR::handleOptionAcceleratedDrawing):
(WTR::handleOptionRemoteLayerTree):
(WTR::handleOptionShowWebView):
(WTR::handleOptionShowTouches):
(WTR::handleOptionAllowedHost):
(WTR::handleOptionUnmatched):
(WTR::Options::Options): Deleted.
* WebKitTestRunner/Options.h:

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

17 months ago[MIPS] Optimize JIT code generated by methods with TrustedImm32 operand
commit-queue@webkit.org [Mon, 2 Apr 2018 17:49:17 +0000 (17:49 +0000)]
[MIPS] Optimize JIT code generated by methods with TrustedImm32 operand
https://bugs.webkit.org/show_bug.cgi?id=183740

Patch by Stanislav Ocovaj <stanislav.ocovaj@rt-rk.com> on 2018-04-02
Reviewed by Yusuke Suzuki.

In many macro assembler methods with TrustedImm32 operand a move imm, immTemp (pseudo)instruction is
first generated and a register operand variant of the same method is called to generate the rest
of the code. If the immediate value can fit in 16 bits then we can skip the move instruction and
generate more efficient code using MIPS instructions with immediate operand.

* assembler/MIPSAssembler.h:
(JSC::MIPSAssembler::slti):
* assembler/MacroAssemblerMIPS.h:
(JSC::MacroAssemblerMIPS::lshift32):
(JSC::MacroAssemblerMIPS::xor32):
(JSC::MacroAssemblerMIPS::branch8):
(JSC::MacroAssemblerMIPS::compare8):
(JSC::MacroAssemblerMIPS::branch32):
(JSC::MacroAssemblerMIPS::branch32WithUnalignedHalfWords):
(JSC::MacroAssemblerMIPS::branchTest32):
(JSC::MacroAssemblerMIPS::mask8OnTest):
(JSC::MacroAssemblerMIPS::branchTest8):
(JSC::MacroAssemblerMIPS::branchAdd32):
(JSC::MacroAssemblerMIPS::branchNeg32):
(JSC::MacroAssemblerMIPS::compare32):
(JSC::MacroAssemblerMIPS::test8):

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

17 months agoREGRESSION (229680): Fullscreen video does not work (youtube, netflix)
jer.noble@apple.com [Mon, 2 Apr 2018 17:45:07 +0000 (17:45 +0000)]
REGRESSION (229680): Fullscreen video does not work (youtube, netflix)
https://bugs.webkit.org/show_bug.cgi?id=184235

Reviewed by Eric Carlson.

Enable the Fullscreen API by default.

* Shared/WebPreferences.yaml:
* Shared/WebPreferencesDefaultValues.h:

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

17 months ago[Win] MSVC can't compile WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPers...
Hironori.Fujii@sony.com [Mon, 2 Apr 2018 17:44:48 +0000 (17:44 +0000)]
[Win] MSVC can't compile WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent
https://bugs.webkit.org/show_bug.cgi?id=184120

Reviewed by Alex Christensen.

It seems that MSVC can't compile the code using `this` in a
generalized lambda capture in another lambda.

In this case, there is no need to copy `protectedThis` for the
inner lambda. Move `protectedThis` of the outer lambda to the
inner as well as `callback`.

* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
Moved `protectedThis` from the outer lambda to the inner.

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

17 months agoBuild fix after r230121
mitz@apple.com [Mon, 2 Apr 2018 17:16:48 +0000 (17:16 +0000)]
Build fix after r230121

* Configurations/WebKit.xcconfig: Disabled framework header postprocessing when building for
  iOS 11.*
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: Reverted r230159.

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

17 months agoFixed the build when BOOL is not bool.
mitz@apple.com [Mon, 2 Apr 2018 16:45:06 +0000 (16:45 +0000)]
Fixed the build when BOOL is not bool.
<rdar://problem/39094484>

Reviewed by Jer Noble.

* UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
(-[WKFullScreenViewController videoControlsManagerDidChange]): Removed the write-only ivar
  _hasControlsManager, the assignment to which was causing the compiler error.

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

17 months agoUnreviewed build fix.
ryanhaddad@apple.com [Mon, 2 Apr 2018 16:41:17 +0000 (16:41 +0000)]
Unreviewed build fix.

* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: Update availability annotation.

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

17 months agoAudioBufferSourceNode start method causes OfflineAudioContext to start running
jer.noble@apple.com [Mon, 2 Apr 2018 15:40:20 +0000 (15:40 +0000)]
AudioBufferSourceNode start method causes OfflineAudioContext to start running
https://bugs.webkit.org/show_bug.cgi?id=181939
<rdar://problem/36755393>

Reviewed by Eric Carlson.

Source/WebCore:

Test: webaudio/offlineaudiocontext-restriction.html

Don't respect playback restrictions for offline AudioContexts.

* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::constructCommon):
* Modules/webaudio/AudioContext.h:
(WebCore::AudioContext::isOfflineContext const):
(WebCore::AudioContext::userGestureRequiredForAudioStart const):
(WebCore::AudioContext::pageConsentRequiredForAudioStart const):
(WebCore::AudioContext::isOfflineContext): Deleted.

LayoutTests:

* webaudio/offlineaudiocontext-restriction-expected.txt: Added.
* webaudio/offlineaudiocontext-restriction.html: Added.

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

17 months agoUnreviewed fixing GTK port X86 32bits compilation after r230152.
alex@webkit.org [Mon, 2 Apr 2018 14:55:48 +0000 (14:55 +0000)]
Unreviewed fixing GTK port X86 32bits compilation after r230152.

* CMakeLists.txt:

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

17 months ago[GTK] DragAndDropHandler.cpp should include GUniquePtrGtk.h
mcatanzaro@igalia.com [Mon, 2 Apr 2018 14:42:33 +0000 (14:42 +0000)]
[GTK] DragAndDropHandler.cpp should include GUniquePtrGtk.h
https://bugs.webkit.org/show_bug.cgi?id=184119

Reviewed by Daniel Bates.

* UIProcess/gtk/DragAndDropHandler.cpp:

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

17 months agoUnreviewed fixing GTK port ARM compilation after r230152.
alex@webkit.org [Mon, 2 Apr 2018 14:33:30 +0000 (14:33 +0000)]
Unreviewed fixing GTK port ARM compilation after r230152.

* CMakeLists.txt: Properly avoid SSE implementations for ARM.

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

17 months agoUnreviewed GTK port dependencies fix after r230152.
alex@webkit.org [Mon, 2 Apr 2018 13:57:40 +0000 (13:57 +0000)]
Unreviewed GTK port dependencies fix after r230152.

Add alsa library dependency for gtk.

* gtk/install-dependencies:

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

17 months agoFix warnings for unused lambda captures in Source/WebKit
fred.wang@free.fr [Mon, 2 Apr 2018 12:45:05 +0000 (12:45 +0000)]
Fix warnings for unused lambda captures in Source/WebKit
https://bugs.webkit.org/show_bug.cgi?id=173555

Patch by Frederic Wang <fwang@igalia.com> on 2018-04-02
Reviewed by Konstantin Tokarev.

When release logs are disabled, several lambda captures are unused, causing compilation
failures with -Wunused-lambda-capture. This patch marks the corresponding variables as unused
in order to fix these warnings.

Based on initial patch by: Konstantin Tokarev  <annulen@yandex.ru>

* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::retrieveCacheEntry):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::fetchWebsiteData):
(WebKit::NetworkProcessProxy::deleteWebsiteData):
(WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::fetchWebsiteData):
(WebKit::WebProcessProxy::deleteWebsiteData):
(WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):

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

17 months ago[GTK] Make libwebrtc backend buildable for GTK port
commit-queue@webkit.org [Mon, 2 Apr 2018 11:29:03 +0000 (11:29 +0000)]
[GTK] Make libwebrtc backend buildable for GTK  port
https://bugs.webkit.org/show_bug.cgi?id=178860

Patch by Alejandro G. Castro <alex@igalia.com> on 2018-04-02
Reviewed by Youenn Fablet.

.:

* Source/CMakeLists.txt: Add the libwebrtc directory to the compilation.
* Source/cmake/OptionsGTK.cmake: Add the USE_LIBWEBRTC option to
allow compilation of the specific code.

Source/ThirdParty/libwebrtc:

Modified the cmake file and added some assembly code to the
boringssl compilation required for the linux compilation generated
by libwebrtc.

* CMakeLists.txt: This cmake file was unused so we have modified
it completely to make it work for our port. It was originally
generated from the libwebrtc json file but not anymore. We could
change its structure at some point but current one seems a good
option for the moment.
* Source/webrtc/base/task_queue_libevent.cc: We use system
libevent for the moment so we needed to adapt the includes in this file.
* Source/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc:
Readded lines removed by mistake in a previous commit.

Source/WebCore:

This is the first step to add webrtc support to the GTK port using
the libwebrtc backend.

No new tests, no new feature added, it should be tested by current
tests.

* CMakeLists.txt: Add the new files to the compilation and set the
new includes in the libwebrtc library.
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
Reorder the includes alphabetically and add some that are missing.
* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
Ditto.
* Sources.txt: Add new file to the compilation.
* platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.cpp:
Added. Initial implementation for GTK and WPE.
* platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.h:
Added. Ditto.
* platform/mediastream/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.cpp:
Added. Ditto.
* platform/mediastream/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.h:
Added. Ditto.
* platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp:
Added. Ditto.
* platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.h:
Added. Ditto.
* platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.cpp:
Added. Ditto.
* platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.h:
Added. Ditto.
* platform/mediastream/libwebrtc/LibWebRTCProviderGlib.cpp: Added includes
for the compilation.
* platform/mediastream/libwebrtc/LibWebRTCProviderGlib.h: Added, inherit from
the LibWebRTCProvider to adapt for glib.

Source/WebKit:

* CMakeLists.txt: Add RTC network classes to the compilation and
the libwebrtc includes.
* PlatformGTK.cmake: Add the libwebrtc directory.
* SourcesGTK.txt: Add RTC files to the compilation.

Tools:

* gstreamer/jhbuild.modules: Modified the libvpx module for the
libwebrtc compilation.
* gtk/install-dependencies: Add libevent as a system requirement.
* Scripts/webkitpy/style/checker.py: Added libwebrtc to the list of third
party libraries with reduced style checks.

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

17 months agoRemove deprecated Buildbot 0.8 code from Perf syncing scripts
aakash_jain@apple.com [Mon, 2 Apr 2018 09:09:08 +0000 (09:09 +0000)]
Remove deprecated Buildbot 0.8 code from Perf syncing scripts
https://bugs.webkit.org/show_bug.cgi?id=183915

Reviewed by Ryosuke Niwa.

* server-tests/resources/mock-data.js:
(MockData.buildbotBuildersURLDeprecated): Deleted.
(MockData.mockBuildbotBuildersDeprecated): Deleted.
(MockData.pendingBuildDeprecated): Deleted.
(MockData.runningBuildDeprecated): Deleted.
(MockData.finishedBuildDeprecated): Deleted.
* tools/js/buildbot-syncer.js:
(BuildbotBuildEntryDeprecated): Deleted.
(BuildbotBuildEntryDeprecated.prototype.initialize): Deleted.
(BuildbotBuildEntryDeprecated.prototype.url): Deleted.
(BuildbotSyncer.prototype.scheduleBuildOnBuildbotDeprecated): Deleted.
(BuildbotSyncer.prototype._pullRecentBuildsDeprecated): Deleted.
(BuildbotSyncer.prototype.pathForPendingBuildsJSONDeprecated): Deleted.
(BuildbotSyncer.prototype.pathForBuildJSONDeprecated): Deleted.
(BuildbotSyncer.prototype.pathForForceBuildDeprecated): Deleted.
(BuildbotSyncer.prototype.url): Deleted.
(BuildbotSyncer.prototype.urlForBuildNumberDeprecated): Deleted.
* tools/js/buildbot-triggerable.js:
(BuildbotTriggerable.prototype.getBuilderNameToIDMapDeprecated): Deleted.
* unit-tests/buildbot-syncer-tests.js:
(smallPendingBuildDeprecated): Deleted.
(smallInProgressBuildDeprecated): Deleted.
(smallFinishedBuildDeprecated): Deleted.
(samplePendingBuildRequestDeprecated): Deleted.
(sampleInProgressBuildDeprecated): Deleted.
(sampleFinishedBuildDeprecated): Deleted.

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

17 months ago[DFG] More aggressive removal of duplicate 32bit DFG code
utatane.tea@gmail.com [Mon, 2 Apr 2018 07:51:17 +0000 (07:51 +0000)]
[DFG] More aggressive removal of duplicate 32bit DFG code
https://bugs.webkit.org/show_bug.cgi?id=184089

Reviewed by Saam Barati.

This patch more aggressively removes duplicate 32bit DFG code
by leveraging JSValueRegs and meta-programmed callOperation.

* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileGetByValWithThis):
(JSC::DFG::SpeculativeJIT::compileArithMinMax):
(JSC::DFG::SpeculativeJIT::compileNewArray):
(JSC::DFG::SpeculativeJIT::compileCheckCell):
(JSC::DFG::SpeculativeJIT::compileGetGlobalVariable):
(JSC::DFG::SpeculativeJIT::compilePutGlobalVariable):
(JSC::DFG::SpeculativeJIT::compileGetClosureVar):
(JSC::DFG::SpeculativeJIT::compilePutClosureVar):
(JSC::DFG::SpeculativeJIT::compileGetByOffset):
(JSC::DFG::SpeculativeJIT::compilePutByOffset):
(JSC::DFG::SpeculativeJIT::compileGetExecutable):
(JSC::DFG::SpeculativeJIT::compileNewArrayBuffer):
(JSC::DFG::SpeculativeJIT::compileToThis):
(JSC::DFG::SpeculativeJIT::compileIdentity):
* dfg/DFGSpeculativeJIT.h:
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):

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

17 months agoWeb Inspector: Remove dead TabBrowser/TabContentView code
mattbaker@apple.com [Mon, 2 Apr 2018 05:59:28 +0000 (05:59 +0000)]
Web Inspector: Remove dead TabBrowser/TabContentView code
https://bugs.webkit.org/show_bug.cgi?id=184104

Reviewed by Devin Rousso.

* UserInterface/Base/Main.js:
(WI._tryToRestorePendingTabs):
* UserInterface/Views/NewTabContentView.js:
(WI.NewTabContentView.prototype.shown):
(WI.NewTabContentView.prototype.hidden):
* UserInterface/Views/TabBrowser.js:
(WI.TabBrowser.prototype.addTabForContentView):
(WI.TabBrowser.prototype.showTabForContentView):
(WI.TabBrowser._tabBarItemRemoved):
* UserInterface/Views/TabContentView.js:
(WI.TabContentView.prototype.get parentTabBrowser): Deleted.
(WI.TabContentView.prototype.set parentTabBrowser): Deleted.

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

17 months ago[LayoutReloaded] Use containing block's contentBox left edge when the float is to...
zalan@apple.com [Mon, 2 Apr 2018 05:03:57 +0000 (05:03 +0000)]
[LayoutReloaded] Use containing block's contentBox left edge when the float is to the right.
https://bugs.webkit.org/show_bug.cgi?id=184230

Reviewed by Antti Koivisto.

* LayoutReloaded/FormattingContext/InlineFormatting/InlineFormattingContext.js:
(InlineFormattingContext.prototype._mapFloatingPosition):
(InlineFormattingContext):
* LayoutReloaded/test/index.html:
* LayoutReloaded/test/inline-formatting-context-with-floats2.html: Added.

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

17 months agoUse WTF::Lock instead of GMutex
utatane.tea@gmail.com [Mon, 2 Apr 2018 03:18:50 +0000 (03:18 +0000)]
Use WTF::Lock instead of GMutex
https://bugs.webkit.org/show_bug.cgi?id=184227

Reviewed by Saam Barati.

Prefer WTF::Lock over GMutex since these locks are just protecting WebKit C++ fields.

No behavior change.

* platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
(WebCore::AudioSourceProviderGStreamer::AudioSourceProviderGStreamer):
(WebCore::AudioSourceProviderGStreamer::~AudioSourceProviderGStreamer):
(WebCore::AudioSourceProviderGStreamer::provideInput):
(WebCore::AudioSourceProviderGStreamer::handleAudioBuffer):
(WebCore::AudioSourceProviderGStreamer::clearAdapters):
* platform/audio/gstreamer/AudioSourceProviderGStreamer.h:
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
(WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
(WebCore::MediaPlayerPrivateGStreamerBase::naturalSize const):
(WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
(WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
(WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer):
(WebCore::MediaPlayerPrivateGStreamerBase::paint):
(WebCore::MediaPlayerPrivateGStreamerBase::copyVideoTextureToPlatformTexture):
(WebCore::MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
* platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
* platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:

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

17 months agoShow punycode if URL contains hyphen character
bfulgham@apple.com [Mon, 2 Apr 2018 02:04:05 +0000 (02:04 +0000)]
Show punycode if URL contains hyphen character
https://bugs.webkit.org/show_bug.cgi?id=184221
<rdar://problem/38044633>

Reviewed by Darin Adler.

Source/WebCore:

Revise our "lookalike character" logic to include the hyphen,
non-breaking hyphen, and minus sign.

Test: fast/url/host.html

* platform/mac/WebCoreNSURLExtras.mm:
(WebCore::isLookalikeCharacter):

LayoutTests:

* fast/url/host-expected.txt:
* fast/url/host.html:

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

17 months agoRaise the for-call inlining threshold to 190 to fix JetStream/richards regression
fpizlo@apple.com [Sun, 1 Apr 2018 19:46:05 +0000 (19:46 +0000)]
Raise the for-call inlining threshold to 190 to fix JetStream/richards regression
https://bugs.webkit.org/show_bug.cgi?id=184228

Reviewed by Yusuke Suzuki.

* runtime/Options.h:

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

17 months agoJSObject shouldn't do index masking
fpizlo@apple.com [Sun, 1 Apr 2018 17:57:53 +0000 (17:57 +0000)]
JSObject shouldn't do index masking
https://bugs.webkit.org/show_bug.cgi?id=184194

Reviewed by Yusuke Suzuki.
Source/JavaScriptCore:

Remove index masking, because it's not the way we'll mitigate Spectre.

* API/tests/JSObjectGetProxyTargetTest.cpp:
(testJSObjectGetProxyTarget):
* b3/B3LowerToAir.cpp:
* b3/B3Validate.cpp:
* b3/B3WasmBoundsCheckValue.cpp:
(JSC::B3::WasmBoundsCheckValue::WasmBoundsCheckValue):
(JSC::B3::WasmBoundsCheckValue::dumpMeta const):
* b3/B3WasmBoundsCheckValue.h:
(JSC::B3::WasmBoundsCheckValue::bounds const):
(JSC::B3::WasmBoundsCheckValue::pinnedIndexingMask const): Deleted.
* b3/testb3.cpp:
(JSC::B3::testWasmBoundsCheck):
(JSC::B3::run):
* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGArgumentsEliminationPhase.cpp:
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGNodeType.h:
* dfg/DFGPredictionPropagationPhase.cpp:
* dfg/DFGSSALoweringPhase.cpp:
(JSC::DFG::SSALoweringPhase::handleNode):
* dfg/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::SpeculativeJIT):
(JSC::DFG::SpeculativeJIT::emitAllocateRawObject):
(JSC::DFG::SpeculativeJIT::loadFromIntTypedArray):
(JSC::DFG::SpeculativeJIT::compileGetByValOnIntTypedArray):
(JSC::DFG::SpeculativeJIT::compileGetByValOnFloatTypedArray):
(JSC::DFG::SpeculativeJIT::compileNewFunctionCommon):
(JSC::DFG::SpeculativeJIT::compileCreateActivation):
(JSC::DFG::SpeculativeJIT::compileCreateDirectArguments):
(JSC::DFG::SpeculativeJIT::compileArraySlice):
(JSC::DFG::SpeculativeJIT::compileNewStringObject):
(JSC::DFG::SpeculativeJIT::compileNewTypedArrayWithSize):
(JSC::DFG::SpeculativeJIT::compileNewRegexp):
(JSC::DFG::SpeculativeJIT::compileCreateThis):
(JSC::DFG::SpeculativeJIT::compileNewObject):
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::emitAllocateJSObject):
(JSC::DFG::SpeculativeJIT::emitAllocateJSObjectWithKnownSize):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
(JSC::DFG::SpeculativeJIT::compileAllocateNewArrayWithSize):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
(JSC::DFG::SpeculativeJIT::compileAllocateNewArrayWithSize):
* ftl/FTLAbstractHeapRepository.h:
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileAtomicsReadModifyWrite):
(JSC::FTL::DFG::LowerDFGToB3::compileGetByVal):
(JSC::FTL::DFG::LowerDFGToB3::compileCreateActivation):
(JSC::FTL::DFG::LowerDFGToB3::compileNewFunction):
(JSC::FTL::DFG::LowerDFGToB3::compileCreateDirectArguments):
(JSC::FTL::DFG::LowerDFGToB3::compileNewStringObject):
(JSC::FTL::DFG::LowerDFGToB3::compileNewTypedArray):
(JSC::FTL::DFG::LowerDFGToB3::compileMaterializeNewObject):
(JSC::FTL::DFG::LowerDFGToB3::compileMaterializeCreateActivation):
(JSC::FTL::DFG::LowerDFGToB3::compileNewRegexp):
(JSC::FTL::DFG::LowerDFGToB3::allocateObject):
(JSC::FTL::DFG::LowerDFGToB3::allocateVariableSizedObject):
(JSC::FTL::DFG::LowerDFGToB3::allocateJSArray):
(JSC::FTL::DFG::LowerDFGToB3::pointerIntoTypedArray):
(JSC::FTL::DFG::LowerDFGToB3::compileGetArrayMask): Deleted.
(JSC::FTL::DFG::LowerDFGToB3::maskedIndex): Deleted.
(JSC::FTL::DFG::LowerDFGToB3::computeButterflyIndexingMask): Deleted.
* jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::emitAllocateJSObject):
(JSC::AssemblyHelpers::emitAllocateJSObjectWithKnownSize):
(JSC::AssemblyHelpers::emitAllocateVariableSizedJSObject):
(JSC::AssemblyHelpers::emitAllocateDestructibleObject):
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_new_object):
(JSC::JIT::emit_op_create_this):
* jit/JITOperations.cpp:
* jit/JITPropertyAccess.cpp:
(JSC::JIT::emitDoubleLoad):
(JSC::JIT::emitContiguousLoad):
(JSC::JIT::emitArrayStorageLoad):
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
* runtime/Butterfly.h:
(JSC::ContiguousData::at const):
(JSC::ContiguousData::at):
(JSC::Butterfly::computeIndexingMask const): Deleted.
* runtime/ButterflyInlines.h:
(JSC::ContiguousData<T>::at const): Deleted.
(JSC::ContiguousData<T>::at): Deleted.
* runtime/ClonedArguments.cpp:
(JSC::ClonedArguments::createEmpty):
* runtime/JSArray.cpp:
(JSC::JSArray::tryCreateUninitializedRestricted):
(JSC::JSArray::appendMemcpy):
(JSC::JSArray::setLength):
(JSC::JSArray::pop):
(JSC::JSArray::shiftCountWithAnyIndexingType):
(JSC::JSArray::unshiftCountWithAnyIndexingType):
(JSC::JSArray::fillArgList):
(JSC::JSArray::copyToArguments):
* runtime/JSArrayBufferView.cpp:
(JSC::JSArrayBufferView::JSArrayBufferView):
* runtime/JSArrayInlines.h:
(JSC::JSArray::pushInline):
* runtime/JSFixedArray.h:
* runtime/JSGenericTypedArrayViewInlines.h:
(JSC::JSGenericTypedArrayView<Adaptor>::slowDownAndWasteMemory):
* runtime/JSObject.cpp:
(JSC::JSObject::getOwnPropertySlotByIndex):
(JSC::JSObject::putByIndex):
(JSC::JSObject::createInitialUndecided):
(JSC::JSObject::createInitialInt32):
(JSC::JSObject::createInitialDouble):
(JSC::JSObject::createInitialContiguous):
(JSC::JSObject::createArrayStorage):
(JSC::JSObject::convertUndecidedToInt32):
(JSC::JSObject::convertUndecidedToDouble):
(JSC::JSObject::convertUndecidedToContiguous):
(JSC::JSObject::convertUndecidedToArrayStorage):
(JSC::JSObject::convertInt32ToDouble):
(JSC::JSObject::convertInt32ToArrayStorage):
(JSC::JSObject::convertDoubleToContiguous):
(JSC::JSObject::convertDoubleToArrayStorage):
(JSC::JSObject::convertContiguousToArrayStorage):
(JSC::JSObject::createInitialForValueAndSet):
(JSC::JSObject::deletePropertyByIndex):
(JSC::JSObject::getOwnPropertyNames):
(JSC::JSObject::putByIndexBeyondVectorLengthWithoutAttributes):
(JSC::JSObject::countElements):
(JSC::JSObject::increaseVectorLength):
(JSC::JSObject::ensureLengthSlow):
(JSC::JSObject::reallocateAndShrinkButterfly):
(JSC::JSObject::getEnumerableLength):
* runtime/JSObject.h:
(JSC::JSObject::canGetIndexQuickly):
(JSC::JSObject::getIndexQuickly):
(JSC::JSObject::tryGetIndexQuickly const):
(JSC::JSObject::setIndexQuickly):
(JSC::JSObject::initializeIndex):
(JSC::JSObject::initializeIndexWithoutBarrier):
(JSC::JSObject::butterflyOffset):
(JSC::JSObject::setButterfly):
(JSC::JSObject::nukeStructureAndSetButterfly):
(JSC::JSObject::JSObject):
(JSC::JSObject::butterflyIndexingMaskOffset): Deleted.
(JSC::JSObject::butterflyIndexingMask const): Deleted.
(JSC::JSObject::setButterflyWithIndexingMask): Deleted.
* runtime/JSObjectInlines.h:
(JSC::JSObject::prepareToPutDirectWithoutTransition):
(JSC::JSObject::putDirectInternal):
* runtime/RegExpMatchesArray.h:
(JSC::tryCreateUninitializedRegExpMatchesArray):
* runtime/Structure.cpp:
(JSC::Structure::flattenDictionaryStructure):
* wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::B3IRGenerator):
(JSC::Wasm::B3IRGenerator::restoreWebAssemblyGlobalState):
(JSC::Wasm::B3IRGenerator::emitCheckAndPreparePointer):
(JSC::Wasm::B3IRGenerator::load):
(JSC::Wasm::B3IRGenerator::store):
(JSC::Wasm::B3IRGenerator::addCallIndirect):
* wasm/WasmBinding.cpp:
(JSC::Wasm::wasmToWasm):
* wasm/WasmInstance.h:
(JSC::Wasm::Instance::updateCachedMemory):
(JSC::Wasm::Instance::offsetOfCachedMemorySize):
(JSC::Wasm::Instance::offsetOfCachedIndexingMask): Deleted.
* wasm/WasmMemory.cpp:
(JSC::Wasm::Memory::Memory):
(JSC::Wasm::Memory::grow):
* wasm/WasmMemory.h:
(JSC::Wasm::Memory::size const):
(JSC::Wasm::Memory::offsetOfSize):
(JSC::Wasm::Memory::indexingMask): Deleted.
(JSC::Wasm::Memory::offsetOfIndexingMask): Deleted.
* wasm/WasmMemoryInformation.cpp:
(JSC::Wasm::PinnedRegisterInfo::get):
(JSC::Wasm::PinnedRegisterInfo::PinnedRegisterInfo):
* wasm/WasmMemoryInformation.h:
(JSC::Wasm::PinnedRegisterInfo::toSave const):
* wasm/js/JSToWasm.cpp:
(JSC::Wasm::createJSToWasmWrapper):

Source/WebCore:

No new tests because no new behavior.

* bindings/js/JSDOMConvertSequences.h:
(WebCore::Detail::NumericSequenceConverter::convertArray):
(WebCore::Detail::SequenceConverter::convertArray):

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

17 months agoJSC crash in JIT code with for-of loop and Array/Set iterators
fpizlo@apple.com [Sun, 1 Apr 2018 17:08:39 +0000 (17:08 +0000)]
JSC crash in JIT code with for-of loop and Array/Set iterators
https://bugs.webkit.org/show_bug.cgi?id=183174

Reviewed by Saam Barati.

JSTests:

* microbenchmarks/hoist-get-by-offset-tower-with-inferred-types.js: Added. This test shows that fixing the bug didn't break hoisting of GetByOffset with inferred types. I confirmed that if I did break it, this test slows down by >7x.
(foo):
* stress/hoist-get-by-offset-with-control-dependent-inferred-type.js: Added. This test shows that the bug is fixed.
(f):

Source/JavaScriptCore:

* dfg/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute): Fix the bug by making GetByOffset and friends verify that they are getting the type proof they want at the desired hoisting site.

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

17 months ago[LayoutReloaded] Right floating box reduces available line width.
zalan@apple.com [Sun, 1 Apr 2018 16:47:59 +0000 (16:47 +0000)]
[LayoutReloaded] Right floating box reduces available line width.
https://bugs.webkit.org/show_bug.cgi?id=184226

Reviewed by Antti Koivisto.

* LayoutReloaded/FormattingContext/InlineFormatting/InlineFormattingContext.js:
(InlineFormattingContext.prototype._createNewLine):
* LayoutReloaded/test/index.html:
* LayoutReloaded/test/inline-with-floats-right-left-simple.html: Added.

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

17 months ago[LayoutReloaded] Floating box reduces line with in inline formatting context
zalan@apple.com [Sun, 1 Apr 2018 05:37:20 +0000 (05:37 +0000)]
[LayoutReloaded] Floating box reduces line with in inline formatting context
https://bugs.webkit.org/show_bug.cgi?id=184223

Reviewed by Antti Koivisto.

* LayoutReloaded/FormattingContext/FloatingContext.js:
(FloatingContext.prototype.left):
(FloatingContext.prototype.right):
(FloatingContext.prototype._mapDisplayMarginBoxToFormattingRoot):
(FloatingContext.prototype._mapBorderBoxToFormattingRoot):
(FloatingContext.prototype._mapContentBoxToFormattingRoot):
(FloatingContext.prototype.formattingRoot):
(FloatingContext.prototype._floatingState):
(FloatingContext.prototype._formattingRoot): Deleted.
* LayoutReloaded/FormattingContext/InlineFormatting/InlineFormattingContext.js:
(InlineFormattingContext.prototype._createNewLine):
(InlineFormattingContext.prototype._mapFloatingPosition):
(InlineFormattingContext):
* LayoutReloaded/FormattingState/FormattingState.js:
(FormattingState.prototype.displayBox):
(FormattingState):
* LayoutReloaded/test/index.html:
* LayoutReloaded/test/inline-formatting-context-with-floats.html: Added.

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

17 months ago[LayoutReloaded] InlineFormattingState should inherit the floating state from its...
zalan@apple.com [Sun, 1 Apr 2018 03:07:26 +0000 (03:07 +0000)]
[LayoutReloaded] InlineFormattingState should inherit the floating state from its parent formatting state
https://bugs.webkit.org/show_bug.cgi?id=184220

Reviewed by Antti Koivisto.

If the block container box that initiates an inline formatting context also establishes a block context,
create a new float state, otherwise use the existing one.

* LayoutReloaded/FormattingContext/BlockFormatting/BlockFormattingContext.js:
(BlockFormattingContext.prototype._contentHeight):
* LayoutReloaded/FormattingState/InlineFormattingState.js:
(InlineFormattingState):
* LayoutReloaded/LayoutState.js:
(LayoutState.prototype.establishedFormattingState):
(LayoutState.prototype.formattingStateForBox):
(LayoutState.prototype.formattingState): Deleted.
* LayoutReloaded/Utils.js:

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

17 months ago[LayoutReloaded] FloatingContext does not need a parent formatting context.
zalan@apple.com [Sun, 1 Apr 2018 02:44:49 +0000 (02:44 +0000)]
[LayoutReloaded] FloatingContext does not need a parent formatting context.
https://bugs.webkit.org/show_bug.cgi?id=184219

Reviewed by Antti Koivisto.

We don't need the formatting context in the FloatingContext now that margins are moved over to Display.Box.
This is in preparation for being able to create a FloatingContext for an inline formatting context,
when the inline context actually inherits the floating state from its formatting root.

* LayoutReloaded/FormattingContext/FloatingContext.js:
(FloatingContext):
(FloatingContext.prototype._availableSpace):
(FloatingContext.prototype._adjustedFloatingPosition):
(FloatingContext.prototype._addFloatingBox):
(FloatingContext.prototype._formattingContext): Deleted.
* LayoutReloaded/FormattingContext/FormattingContext.js:
(FormattingContext):

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