WebKit-https.git
8 months ago[Mac] WebInspectorUI.framework does not need to be soft-linked anymore
bburg@apple.com [Thu, 14 Feb 2019 22:32:21 +0000 (22:32 +0000)]
[Mac] WebInspectorUI.framework does not need to be soft-linked anymore
https://bugs.webkit.org/show_bug.cgi?id=194411
<rdar://problem/47787614>

Reviewed by Joseph Pecoraro.

Source/WebKit:

* Configurations/WebKit.xcconfig:
Conditionalize weak linking to WebInspectorUI.framework for Mac only.

* UIProcess/mac/WebInspectorProxyMac.mm:
(WebKit::WebInspectorProxy::inspectorPageURL):
(WebKit::WebInspectorProxy::inspectorTestPageURL):
(WebKit::WebInspectorProxy::inspectorBaseURL):
* WebProcess/WebPage/mac/WebInspectorUIMac.mm:
(WebKit::webInspectorUILocalizedStringsURL):
Rewrite uses of the bundle to exit early if bundle couldn't be loaded.

Source/WebKitLegacy/mac:

* Configurations/WebKitLegacy.xcconfig:
Conditionalize weak linking to WebInspectorUI.framework for Mac only.

* WebCoreSupport/WebInspectorClient.mm:
(WebInspectorFrontendClient::localizedStringsURL):
(-[WebInspectorWindowController inspectorPagePath]):
(-[WebInspectorWindowController inspectorTestPagePath]):
Rewrite uses of the bundle to exit early if bundle couldn't be loaded.

Source/WTF:

* wtf/cocoa/SoftLinking.h:
Remove macro that now has no uses.

Tools:

Remove unnecessary soft linking macro usage.

* DumpRenderTree/mac/TestRunnerMac.mm:
(TestRunner::inspectorTestStubURL):
(SOFT_LINK_STAGED_FRAMEWORK): Deleted.
* WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm:
(WTR::TestRunner::inspectorTestStubURL):

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

8 months ago[GTK] WebKitGTK+ -> WebKitGTK
mcatanzaro@igalia.com [Thu, 14 Feb 2019 22:11:19 +0000 (22:11 +0000)]
[GTK] WebKitGTK+ -> WebKitGTK
https://bugs.webkit.org/show_bug.cgi?id=194658

Reviewed by Alex Christensen.

This renames WebKitGTK+ to WebKitGTK in a few user-visible places: the API documentation,
the pkg-config, and an error message.

In a couple places where it's exposed in WPE documentation, WPE is now mentioned, or the
reference to "WebKitGTK+" is changed to just "WebKit."

* UIProcess/API/glib/WebKitSettings.cpp:
(webkit_settings_class_init):
* UIProcess/API/glib/WebKitWebView.cpp:
* UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivateGtk.h:
* gtk/webkit2gtk-web-extension.pc.in:
* gtk/webkit2gtk.pc.in:

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

8 months ago[ews-app] status bubble should fetch builder name info from BuilderMapping table
aakash_jain@apple.com [Thu, 14 Feb 2019 22:10:37 +0000 (22:10 +0000)]
[ews-app] status bubble should fetch builder name info from BuilderMapping table
https://bugs.webkit.org/show_bug.cgi?id=194599

Reviewed by Lucas Forschler.

* BuildSlaveSupport/ews-app/ews/views/statusbubble.py:
(StatusBubble._build_bubble):

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

8 months ago[ews-app] Set Foreign Key in Django build model
aakash_jain@apple.com [Thu, 14 Feb 2019 22:08:58 +0000 (22:08 +0000)]
[ews-app] Set Foreign Key in Django build model
https://bugs.webkit.org/show_bug.cgi?id=194667

Reviewed by Lucas Forschler.

* BuildSlaveSupport/ews-app/ews/models/build.py:
(Build):

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

8 months ago[JSC] Non-JIT entrypoints should share NativeJITCode per entrypoint type
ysuzuki@apple.com [Thu, 14 Feb 2019 21:35:14 +0000 (21:35 +0000)]
[JSC] Non-JIT entrypoints should share NativeJITCode per entrypoint type
https://bugs.webkit.org/show_bug.cgi?id=194659

Reviewed by Mark Lam.

Non-JIT entrypoints create NativeJITCode every time it is called. But it is meaningless since these entry point code are identical.
We should create one per entrypoint type (for function, we should have CodeForCall and CodeForConstruct) and continue to use them.
And we use NativeJITCode instead of DirectJITCode if it does not have difference between usual entrypoint and arity check entrypoint.

* dfg/DFGJITCode.h:
* dfg/DFGJITFinalizer.cpp:
(JSC::DFG::JITFinalizer::finalize):
(JSC::DFG::JITFinalizer::finalizeFunction):
* jit/JITCode.cpp:
(JSC::DirectJITCode::initializeCodeRefForDFG):
(JSC::DirectJITCode::initializeCodeRef): Deleted.
(JSC::NativeJITCode::initializeCodeRef): Deleted.
* jit/JITCode.h:
* llint/LLIntEntrypoint.cpp:
(JSC::LLInt::setFunctionEntrypoint):
(JSC::LLInt::setEvalEntrypoint):
(JSC::LLInt::setProgramEntrypoint):
(JSC::LLInt::setModuleProgramEntrypoint): Retagged is removed since the tag is the same.

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

8 months ago[WTF] Add environment variable helpers
ross.kirsling@sony.com [Thu, 14 Feb 2019 20:03:28 +0000 (20:03 +0000)]
[WTF] Add environment variable helpers
https://bugs.webkit.org/show_bug.cgi?id=192405

Reviewed by Michael Catanzaro.

Source/JavaScriptCore:

* inspector/remote/glib/RemoteInspectorGlib.cpp:
(Inspector::RemoteInspector::RemoteInspector):
(Inspector::RemoteInspector::start):
* jsc.cpp:
(startTimeoutThreadIfNeeded):
* runtime/Options.cpp:
(JSC::overrideOptionWithHeuristic):
(JSC::Options::overrideAliasedOptionWithHeuristic):
(JSC::Options::initialize):
* runtime/VM.cpp:
(JSC::enableAssembler):
(JSC::VM::VM):
* tools/CodeProfiling.cpp:
(JSC::CodeProfiling::notifyAllocator):
Utilize WTF::Environment where possible.

Source/WebCore:

* platform/NotImplemented.h:
* platform/cocoa/SystemVersion.mm:
(WebCore::createSystemMarketingVersion):
* platform/graphics/gstreamer/GStreamerCommon.cpp:
(WebCore::initializeGStreamer):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
* platform/graphics/nicosia/NicosiaPaintingEngine.cpp:
(Nicosia::PaintingEngine::create):
* platform/graphics/texmap/TextureMapperFPSCounter.cpp:
(WebCore::TextureMapperFPSCounter::TextureMapperFPSCounter):
* platform/graphics/x11/PlatformDisplayX11.cpp:
(WebCore::PlatformDisplayX11::create):
* platform/gtk/RenderThemeWidget.cpp:
(WebCore::RenderThemeScrollbar::RenderThemeScrollbar):
* platform/gtk/ScrollbarThemeGtk.cpp:
(WebCore::ScrollbarThemeGtk::ScrollbarThemeGtk):
* platform/network/curl/CurlContext.cpp:
(WebCore::CurlContext::CurlContext):
(WebCore::EnvironmentVariableReader::read): Deleted.
(WebCore::EnvironmentVariableReader::defined): Deleted.
(WebCore::EnvironmentVariableReader::readAs): Deleted.
(WebCore::EnvironmentVariableReader::sscanTemplate): Deleted.
(WebCore::EnvironmentVariableReader::sscanTemplate<signed>): Deleted.
(WebCore::EnvironmentVariableReader::sscanTemplate<unsigned>): Deleted.
* platform/network/curl/NetworkStorageSessionCurl.cpp:
(WebCore::defaultCookieJarPath):
* platform/network/playstation/CurlSSLHandlePlayStation.cpp:
(WebCore::getCACertPathEnv):
* platform/network/win/CurlSSLHandleWin.cpp:
(WebCore::getCACertPathEnv):
* platform/text/hyphen/HyphenationLibHyphen.cpp:
(WebCore::topLevelPath):
(WebCore::webkitBuildDirectory):
* platform/unix/LoggingUnix.cpp:
(WebCore::logLevelString):
* platform/win/LoggingWin.cpp:
(WebCore::logLevelString):
Utilize WTF::Environment where possible.

Source/WebCore/PAL:

* pal/unix/LoggingUnix.cpp:
(PAL::logLevelString):
* pal/win/LoggingWin.cpp:
(PAL::logLevelString):
Utilize WTF::Environment where possible.

Source/WebKit:

* NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp:
(main):
* Platform/unix/EnvironmentUtilities.cpp:
(WebKit::EnvironmentUtilities::stripValuesEndingWithString):
* Platform/unix/LoggingUnix.cpp:
(WebKit::logLevelString):
* Platform/win/LoggingWin.cpp:
(WebKit::logLevelString):
* PluginProcess/mac/PluginProcessMac.mm:
(WebKit::shouldCallRealDebugger):
* Shared/Plugins/unix/PluginSearchPath.cpp:
(WebKit::pluginsDirectories):
* Shared/glib/ProcessExecutablePathGLib.cpp:
(WebKit::findWebKitProcess):
* UIProcess/API/glib/WebKitSettings.cpp:
(webKitSettingsConstructed):
(webKitSettingsSetProperty):
* UIProcess/API/glib/WebKitWebContext.cpp:
(injectedBundleDirectory):
(webkitWebContextConstructed):
* UIProcess/API/gtk/WebKitWebViewGtk.cpp:
(webkitWebViewMaximizeWindow):
(webkitWebViewRestoreWindow):
* UIProcess/API/wpe/WPEView.cpp:
(WKWPE::m_backend):
* UIProcess/AuxiliaryProcessProxy.cpp:
(WebKit::AuxiliaryProcessProxy::getLaunchOptions):
* UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
(WebKit::XDGDBusProxyLauncher::launch):
(WebKit::bindDBusSession):
(WebKit::bindX11):
(WebKit::bindWayland):
(WebKit::bindPulse):
(WebKit::bindPathVar):
(WebKit::bindGStreamerData):
(WebKit::bubblewrapSpawn):
* UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
(WebKit::ProcessLauncher::launchProcess):
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::systemDirectoryPath):
(WebKit::ProcessLauncher::launchProcess):
* UIProcess/glib/WebProcessPoolGLib.cpp:
(WebKit::memoryPressureMonitorDisabled):
(WebKit::WebProcessPool::platformInitialize):
(WebKit::WebProcessPool::platformInitializeWebProcess):
* UIProcess/gtk/HardwareAccelerationManager.cpp:
(WebKit::HardwareAccelerationManager::HardwareAccelerationManager):
* WebProcess/EntryPoint/unix/WebProcessMain.cpp:
(main):
* WebProcess/gtk/WebProcessMainGtk.cpp:
* WebProcess/wpe/WebProcessMainWPE.cpp:
Utilize WTF::Environment where possible.

Source/WebKitLegacy/ios:

* Misc/WebUIKitSupport.mm:
(WebKitPlatformSystemRootDirectory):
Utilize WTF::Environment where possible.

Source/WebKitLegacy/mac:

* WebView/WebView.mm:
(-[WebView _initWithFrame:frameName:groupName:]):
Utilize WTF::Environment where possible.

Source/WTF:

Create a new Environment API as a platform-independent, thread-safe(r)
way to get and set environment variables.

* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/Environment.h: Added.
* wtf/PlatformGTK.cmake:
* wtf/PlatformJSCOnly.cmake:
* wtf/PlatformMac.cmake:
* wtf/PlatformPlayStation.cmake:
* wtf/PlatformWPE.cmake:
* wtf/PlatformWin.cmake:
* wtf/posix/EnvironmentPOSIX.cpp: Added.
* wtf/win/EnvironmentWin.cpp: Added.
Introduce WTF::Environment.

* wtf/Threading.cpp:
(WTF::threadingIsInitialized):
(WTF::initializeThreading):
* wtf/Threading.h:
Introduce WTF::threadingIsInitialized() so that we can ASSERT that it's
false before setting an environment variable through the new API.

* wtf/DataLog.cpp:
(WTF::initializeLogFileOnce):
* wtf/NumberOfCores.cpp:
(WTF::numberOfProcessorCores):
* wtf/posix/FileSystemPOSIX.cpp:
(WTF::FileSystemImpl::openTemporaryFile):
Utilize WTF::Environment where possible.

Tools:

* DumpRenderTree/mac/DumpRenderTree.mm:
(libraryPathForDumpRenderTree):
* DumpRenderTree/win/DumpRenderTree.cpp:
(libraryPathForDumpRenderTree):
* TestRunnerShared/IOSLayoutTestCommunication.cpp:
(setUpIOSLayoutTestCommunication):
* TestWebKitAPI/Tests/WebKit/EnvironmentUtilitiesTest.cpp:
(TestWebKitAPI::strip):
* TestWebKitAPI/Tests/WebKitGLib/TestAutomationSession.cpp:
(beforeAll):
* TestWebKitAPI/glib/WebKitGLib/TestMain.cpp:
(main):
* TestWebKitAPI/glib/WebKitGLib/WebKitTestBus.cpp:
(WebKitTestBus::run):
* WebKitTestRunner/InjectedBundle/gtk/ActivateFontsGtk.cpp:
(WTR::getOutputDir):
(WTR::initializeFontConfigSetting):
* WebKitTestRunner/InjectedBundle/gtk/InjectedBundleGtk.cpp:
(WTR::InjectedBundle::platformInitialize):
* WebKitTestRunner/InjectedBundle/gtk/InjectedBundleUtilities.cpp:
(WTR::topLevelPath):
* WebKitTestRunner/InjectedBundle/wpe/ActivateFontsWPE.cpp:
(WTR::topLevelPath):
(WTR::getOutputDir):
(WTR::activateFonts):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::libraryPathForTesting):
(WTR::TestController::generateContextConfiguration const):
(WTR::TestController::generatePageConfiguration):
(WTR::TestController::decideDestinationWithSuggestedFilename):
(WTR::TestController::platformAdjustContext):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::cocoaPlatformInitialize):
(WTR::TestController::platformAdjustContext):
* WebKitTestRunner/gtk/main.cpp:
(main):
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::configureContentExtensionForTest):
* WebKitTestRunner/wpe/main.cpp:
(main):
Utilize WTF::Environment where possible.

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

8 months agoHandle _WKNavigationActionPolicyAllowWithoutTryingAppLink for LoadOptimizer
jiewen_tan@apple.com [Thu, 14 Feb 2019 19:54:19 +0000 (19:54 +0000)]
Handle _WKNavigationActionPolicyAllowWithoutTryingAppLink for LoadOptimizer
https://bugs.webkit.org/show_bug.cgi?id=194640
<rdar://problem/48064140>

Reviewed by Brent Fulgham.

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

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

8 months ago[JSC] Should have default NativeJITCode
ysuzuki@apple.com [Thu, 14 Feb 2019 19:10:15 +0000 (19:10 +0000)]
[JSC] Should have default NativeJITCode
https://bugs.webkit.org/show_bug.cgi?id=194634

Reviewed by Mark Lam.

In JSC_useJIT=false mode, we always create identical NativeJITCode for call and construct when we create NativeExecutable.
This is meaningless since we do not modify NativeJITCode after the creation. This patch adds singleton used as a default one.
Since NativeJITCode (& JITCode) is ThreadSafeRefCounted, we can just share it in a whole process level. This removes 446 NativeJITCode
allocations, which takes 14KB.

* runtime/VM.cpp:
(JSC::jitCodeForCallTrampoline):
(JSC::jitCodeForConstructTrampoline):
(JSC::VM::getHostFunction):

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

8 months ago[PSON] Introduce a WebContent Process cache
cdumez@apple.com [Thu, 14 Feb 2019 19:06:12 +0000 (19:06 +0000)]
[PSON] Introduce a WebContent Process cache
https://bugs.webkit.org/show_bug.cgi?id=194594
<rdar://problem/46793397>

Reviewed by Geoff Garen.

Source/WebCore:

Update localizable strings.

* en.lproj/Localizable.strings:

Source/WebKit:

Introduce a WebContent Process cache to reduce the number of process launches when
process swap on navigation is enabled, and to reduce the power cost of the feature.

If a WebProcess loaded pages from a single registrable domain then it is eligible
for the cache. When process-swapping on navigation to a new registrable domain, we
now attempt to retrieve a process from the cache for the domain in question instead
of always launching a new one.

The WebProcess cache currently has the following attributes:
- It may contains 4 processes per GB of RAM the machine has, up to 30 processes.
- WebProcesses automatically get evicted from the cache after 30 minutes.
- If the application is no longer the active app, then the cache will get cleared
  after 5 minutes.
- WebProcesses that are in the cache are reported as "(Cached)" in Activity Monitor.

The WebProcess cache is currently disabled by default and can by enabled by the
client via SPI.

* Shared/WebBackForwardListItem.cpp:
(WebKit::WebBackForwardListItem::WebBackForwardListItem):
* Shared/WebBackForwardListItem.h:
(WebKit::WebBackForwardListItem::lastProcessIdentifier const):
(WebKit::WebBackForwardListItem::setLastProcessIdentifier):
Add new lastProcessIdentifier data member that reflects which process this item
was last loaded in. It is normally identical to the identifier of the process
that created the item but it gets overriden in case of cross-site client-side
redirect, since a new process takes over the item in this case.

* Sources.txt:
Add new source file.

* UIProcess/API/APIProcessPoolConfiguration.cpp:
(API::ProcessPoolConfiguration::copy):
* UIProcess/API/APIProcessPoolConfiguration.h:
* UIProcess/API/C/WKContextConfigurationRef.cpp:
(WKContextConfigurationUsesWebProcessCache):
(WKContextConfigurationSetUsesWebProcessCache):
* UIProcess/API/C/WKContextConfigurationRef.h:
* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
(-[_WKProcessPoolConfiguration setUsesWebProcessCache:]):
(-[_WKProcessPoolConfiguration usesWebProcessCache]):
Add new SPI to enable the WebProcess cache.

* UIProcess/API/Cocoa/WKProcessPool.mm:
(-[WKProcessPool _webProcessCountIgnoringPrewarmedAndCached]):
* UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
Add new SPI for testing which returns the number of WebProcesses ignoring
both prewarmed and cached ones.

* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::registerNotificationObservers):
(WebKit::WebProcessPool::unregisterNotificationObservers):
Add application active state observers as the WebProcess cache gets cleared
when the application resigns active state for more than 5 minutes.

* UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::loadRequest):
When doing a load in a new process with the BackForwardList locked (i.e. client-side
redirect), make sure we update the last process identifier for the BackForwardListItem.
This is important because the logic in WebProcessPool::processForNavigation() relies on
this identifier to select which process to do the history navigation into, and we want
to do the load in the post-redirect process, not the pre-redirect one.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
Tell the WebProcess whenever a main frame provisional load is started, providing the URL.

* UIProcess/WebProcessCache.cpp: Added.
(WebKit::WebProcessCache::WebProcessCache):
(WebKit::WebProcessCache::addProcess):
(WebKit::WebProcessCache::takeProcess):
(WebKit::WebProcessCache::updateMaximumSize):
(WebKit::WebProcessCache::clear):
(WebKit::WebProcessCache::setApplicationIsActive):
(WebKit::WebProcessCache::evictProcess):
(WebKit::WebProcessCache::CachedProcess::CachedProcess):
(WebKit::WebProcessCache::CachedProcess::~CachedProcess):
(WebKit::WebProcessCache::CachedProcess::takeProcess):
(WebKit::WebProcessCache::CachedProcess::evictionTimerFired):
* UIProcess/WebProcessCache.h: Added.
(WebKit::WebProcessCache::maximumSize):
(WebKit::WebProcessCache::size const):
(WebKit::WebProcessCache::CachedProcess::process):
Add process cache implementation.

* UIProcess/WebProcessPool.cpp:
(WebKit::m_webProcessCache):
WebProcessCache is stored on the WebProcessPool via m_webProcessCache data member.

(WebKit::WebProcessPool::~WebProcessPool):
Clear the WebProcess cache in the destructor.

(WebKit::WebProcessPool::setApplicationIsActive):
Notify the WebProcessCache whenever the application's active state changes.

(WebKit::WebProcessPool::createWebPage):
If the state of PSON changes via the experimental features menu, dynamically
update the WebProcessCache's size. This is needed because the cache is disabled
when PSON is disabled.

(WebKit::WebProcessPool::handleMemoryPressureWarning):
Clear the WebProcess cache on memory pressure.

(WebKit::WebProcessPool::processForNavigationInternal):
Query the WebProcessCache before attempting to create a new WebProcess for a cross-site
navigation.

(WebKit::WebProcessPool::findReusableSuspendedPageProcess):
This logic was split out of processForNavigationInternal() to reduce the size
of the method.

* UIProcess/WebProcessPool.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::setIsInProcessCache):
Update the isInProcessCache flag on the WebProcessProxy and send an IPC to the WebContent
process so that it can update its name in Activity Monitor.
We also need to stop holding a strong reference to the WebProcessPool whenever the process
is in the cache, similarly to what we do for pre-warmed processes, given that such processes
should not keep the process pool alive.

(WebKit::WebProcessProxy::addExistingWebPage):
Assert that we never try to add a page to a cached process, it should be taken out of the
cache before use.

(WebKit::WebProcessProxy::hasProvisionalPageWithID const):
(WebKit::WebProcessProxy::isAllowedToUpdateBackForwardItem const):
(WebKit::WebProcessProxy::updateBackForwardItem):
In case of client-side redirects, the previous process would sometimes send an IPC causing
the UIProcess' backforward list item to get updated with the pre-redirect URL after we've
already redirected. This previously would be unlikely to occur because we do not suspend
client-redirect pages and their process would normally exit before getting a chance to send
the IPC. However, with the process cache, the bug became obvious as the process would stay
alive and send up the "bad" IPC. To address the issue, we now only let the IPC update the
item if the item's page is (still) associated with the process. In the future, we may want
to update the IPC so that it gets sent to the WebPageProxy instead of the WebProcessProxy.

(WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
If a cached WebProcess crashes, remove it from the cache so that we do not attempt to use
it for a load later.

(WebKit::WebProcessProxy::canBeAddedToWebProcessCache const):
Only cache WebProcesses that have loaded a single registrable domain. Also prevent caching
for service worker and inspector processes.

(WebKit::WebProcessProxy::maybeShutDown):
If the process is cacheable, add it to the cache instead of shutting it down right away.

(WebKit::WebProcessProxy::canTerminateAuxiliaryProcess):
Make sure we do not attempt to terminate a processes that is in the cache.

(WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame):
Whenever a main frame provisional load starts, make sure we update the process's associated
registrable domain. nullopt indicates that there is no associated domain yet. Null string
indicates that the process is associated with several registrable domain and is therefore
not eligible for caching.

* UIProcess/WebProcessProxy.h:
(WebKit::WebProcessProxy::registrableDomain const):
(WebKit::WebProcessProxy::isInProcessCache const):
(WebKit::WebProcessProxy::provisionalPageCount const):
Add convenience getters.

* WebKit.xcodeproj/project.pbxproj:
Add new files to project.

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::setIsInProcessCache):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::updateProcessName):
Update the WebProcess' name in Activity Monitor whenever it goes into or out of the WebProcess
cache.

Tools:

Update API tests to turn on the WebContent Process cache.

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:

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

8 months ago[iOS] Open sandbox for certain calls.
pvollan@apple.com [Thu, 14 Feb 2019 18:55:22 +0000 (18:55 +0000)]
[iOS] Open sandbox for certain calls.
https://bugs.webkit.org/show_bug.cgi?id=194626

Reviewed by Brent Fulgham.

Reporting shows that certain calls needs to be allowed in the sandbox.

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

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

8 months agoUnreviewed, build fix after r241480
jiewen_tan@apple.com [Thu, 14 Feb 2019 18:47:38 +0000 (18:47 +0000)]
Unreviewed, build fix after r241480

* TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm:
(-[DragAndDropSimulator initWithWebViewFrame:configuration:]):
(-[DragAndDropSimulator initWithWebView:]):

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

8 months agogenerateUnlinkedCodeBlockForFunctions shouldn't need to create a FunctionExecutable...
tzagallo@apple.com [Thu, 14 Feb 2019 18:12:23 +0000 (18:12 +0000)]
generateUnlinkedCodeBlockForFunctions shouldn't need to create a FunctionExecutable just to get its source code
https://bugs.webkit.org/show_bug.cgi?id=194576

Reviewed by Saam Barati.

Extract a new function, `linkedSourceCode` from UnlinkedFunctionExecutable::link
and use it in `generateUnlinkedCodeBlockForFunctions` instead.

* bytecode/UnlinkedFunctionExecutable.cpp:
(JSC::UnlinkedFunctionExecutable::linkedSourceCode const):
(JSC::UnlinkedFunctionExecutable::link):
* bytecode/UnlinkedFunctionExecutable.h:
* runtime/CodeCache.cpp:
(JSC::generateUnlinkedCodeBlockForFunctions):

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

8 months ago[l10n] Updated Italian translation of WebKitGTK+
mcatanzaro@igalia.com [Thu, 14 Feb 2019 18:12:19 +0000 (18:12 +0000)]
[l10n] Updated Italian translation of WebKitGTK+
https://bugs.webkit.org/show_bug.cgi?id=194652

Patch by Milo Casagrande <milo@milo.name> on 2019-02-14
Rubber-stamped by Michael Catanzaro.

* it.po:

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

8 months agoCachedBitVector's size must be converted from bits to bytes
tzagallo@apple.com [Thu, 14 Feb 2019 17:37:23 +0000 (17:37 +0000)]
CachedBitVector's size must be converted from bits to bytes
https://bugs.webkit.org/show_bug.cgi?id=194441

Reviewed by Saam Barati.

CachedBitVector used its size in bits for memcpy. That didn't cause any
issues when encoding, since the size in bits was also used in the allocation,
but would overflow the actual BitVector buffer when decoding.

* runtime/CachedTypes.cpp:
(JSC::CachedBitVector::encode):
(JSC::CachedBitVector::decode const):

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

8 months agoAX: ARIA Reflection was disabled in error
cfleizach@apple.com [Thu, 14 Feb 2019 17:27:19 +0000 (17:27 +0000)]
AX: ARIA Reflection was disabled in error
https://bugs.webkit.org/show_bug.cgi?id=194647
<rdar://problem/48068336>

Reviewed by Ryosuke Niwa.

Source/WebKit:

* Shared/WebPreferences.yaml:

Tools:

Remove test override now that this feature should be enabled by default.

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetPreferencesToConsistentValues):

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

8 months agoUnreviewed, rolling out r241486.
commit-queue@webkit.org [Thu, 14 Feb 2019 17:10:13 +0000 (17:10 +0000)]
Unreviewed, rolling out r241486.
https://bugs.webkit.org/show_bug.cgi?id=194655

causing API failures in builds (Requested by ShawnRoberts on
#webkit).

Reverted changeset:

"[Cocoa] Media elements will restart network buffering just
before suspending"
https://bugs.webkit.org/show_bug.cgi?id=193691
https://trac.webkit.org/changeset/241486

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

8 months agoWeb Inspector: don't include accessibility role in DOM.Node object payloads
bburg@apple.com [Thu, 14 Feb 2019 17:06:03 +0000 (17:06 +0000)]
Web Inspector: don't include accessibility role in DOM.Node object payloads
https://bugs.webkit.org/show_bug.cgi?id=194623
<rdar://problem/36384037>

Reviewed by Devin Rousso.

Source/JavaScriptCore:

Remove property of DOM.Node that is no longer being sent.

* inspector/protocol/DOM.json:

Source/WebCore:

Accessibility properties are complicated to fetch at all the points where we want to build and push nodes immediately.
Turning on AX often indirectly causes style recalc and layout. This is bad because we are often building nodes in the
first place due to a DOM node tree update (i.e., NodeInserted).

It turns out that DOM.getAccessibilityPropertiesForNode is called every time we display
the computed role in the Elements Tab > Nodes Sidebar > Accessibility Section. So it is not
necessary to collect this information in a problematic way when initially pushing the node, as
it will be updated anyway.

No new tests, no change in behavior.

* inspector/agents/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::buildObjectForNode):

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

8 months ago[LFC][BFC][MarginCollapse] Replaced boxes don't collapse through their margins
zalan@apple.com [Thu, 14 Feb 2019 16:44:41 +0000 (16:44 +0000)]
[LFC][BFC][MarginCollapse] Replaced boxes don't collapse through their margins
https://bugs.webkit.org/show_bug.cgi?id=194622

Reviewed by Antti Koivisto.

Source/WebCore:

Ensure that block replaced boxes don't collapse through their vertical margins.

Test: fast/block/block-only/block-replaced-with-vertical-margins.html

* layout/blockformatting/BlockMarginCollapse.cpp:
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough):
* page/FrameViewLayoutContext.cpp:
(WebCore::layoutUsingFormattingContext):

Tools:

* LayoutReloaded/misc/LFC-passing-tests.txt:

LayoutTests:

* fast/block/block-only/block-replaced-with-vertical-margins-expected.html: Added.
* fast/block/block-only/block-replaced-with-vertical-margins.html: Added.

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

8 months ago[LFC] Shrink-to-fit-width should be constrained by min/max width
zalan@apple.com [Thu, 14 Feb 2019 16:32:55 +0000 (16:32 +0000)]
[LFC] Shrink-to-fit-width should be constrained by min/max width
https://bugs.webkit.org/show_bug.cgi?id=194653

Reviewed by Antti Koivisto.

Source/WebCore:

Use the fixed value of min-width/max-width to constrain the computed preferred width.

* layout/FormattingContext.h:
* layout/FormattingContextGeometry.cpp:
(WebCore::Layout::FormattingContext::Geometry::constrainByMinMaxWidth):
* layout/blockformatting/BlockFormattingContextGeometry.cpp:
(WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):

Tools:

* LayoutReloaded/misc/LFC-passing-tests.txt:

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

8 months agoDo not add a caches to its engine if the salt cannot be initialized
youenn@apple.com [Thu, 14 Feb 2019 15:51:47 +0000 (15:51 +0000)]
Do not add a caches to its engine if the salt cannot be initialized
https://bugs.webkit.org/show_bug.cgi?id=194604

Reviewed by Antti Koivisto.

This is a follow-up to https://bugs.webkit.org/show_bug.cgi?id=194588.
We should return early if initialize fails.

* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::readCachesFromDisk):

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

8 months ago[GTK] Use a scrolled window for script alerts text
carlosgc@webkit.org [Thu, 14 Feb 2019 10:11:11 +0000 (10:11 +0000)]
[GTK] Use a scrolled window for script alerts text
https://bugs.webkit.org/show_bug.cgi?id=184875

Reviewed by Michael Catanzaro.

To ensure long text doesn't make the dialog bigger.

* UIProcess/API/gtk/WebKitScriptDialogImpl.cpp:
(webkitScriptDialogImplConstructed): Use PANGO_ELLIPSIZE_END for the title and add a scrolled window for the body.
(webkitScriptDialogImplSetText): Helper function to set the dialog body, ensuring the scrolled window fills the
dialog available size.
(webkitScriptDialogImplNew): It now receives the maximum size and uses webkitScriptDialogImplSetText().
* UIProcess/API/gtk/WebKitScriptDialogImpl.h:
* UIProcess/API/gtk/WebKitWebViewGtk.cpp:
(webkitWebViewScriptDialog): Pass the 80% of the web view size as the maximum size of script dialogs.

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

8 months agoCrash in WKBundleFrameGetParentFrame when called inside didRemoveFrameFromHierarchy
rniwa@webkit.org [Thu, 14 Feb 2019 06:47:32 +0000 (06:47 +0000)]
Crash in WKBundleFrameGetParentFrame when called inside didRemoveFrameFromHierarchy
https://bugs.webkit.org/show_bug.cgi?id=194641

Reviewed by Geoffrey Garen.

Source/WebKit:

Fixed the bug by adding a null check to WebFrame::parentFrame.

* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::parentFrame const):

Tools:

Added a call to WKBundleFrameGetParentFrame to an existing test for didRemoveFrameFromHierarchy
so that the test would fail without this fix.

* TestWebKitAPI/Tests/WebKit/DidRemoveFrameFromHiearchyInPageCache_Bundle.cpp:
(TestWebKitAPI::didRemoveFrameFromHierarchyCallback):

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

8 months agoCrash in DOMTimer::fired
rniwa@webkit.org [Thu, 14 Feb 2019 06:43:13 +0000 (06:43 +0000)]
Crash in DOMTimer::fired
https://bugs.webkit.org/show_bug.cgi?id=194638

Reviewed by Brent Fulgham.

Source/WebCore:

This patch continues the saga of hunting down timer related crashes after r239814, r225985, r227934.

The crash was caused by the bug that we don't remove a DOMTimer from NestedTimersMap if a DOMTimer
is created & installed inside another DOMTimer's callback (via execute call in DOMTimer::fired).

Fixed the crash by using a Ref in NestedTimersMap. This will keep the timer alive until we exit
from DOMTimer::fired. Because DOMTimer::fired always calls stopTracking() which clears the map
we would not leak these DOM timers.

We could, alternatively, use WeakPtr in NestedTimersMap but that would unnecessarily increase the
size of DOMTimer for a very marginal benefit of DOMTimer objcets being deleted slightly earlier.
Deleting itself in DOMTimer's destructor involves more logic & house keeping in the timer code,
and is no longer the preferred approach when dealing with these classes of bugs in WebKit.

Test: fast/dom/timer-destruction-during-firing.html

* page/DOMTimer.cpp:
(WebCore::NestedTimersMap::add):
(WebCore::DOMTimer::install):
(WebCore::DOMTimer::fired):

LayoutTests:

Added a regression test. It needs debug assertions without the fix.

* fast/dom/timer-destruction-during-firing-expected.txt: Added.
* fast/dom/timer-destruction-during-firing.html: Added.

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

8 months agoAllow some deprecations in WKDrawingView.
timothy@apple.com [Thu, 14 Feb 2019 05:33:04 +0000 (05:33 +0000)]
Allow some deprecations in WKDrawingView.
https://bugs.webkit.org/show_bug.cgi?id=194636

Reviewed by Wenson Hsieh.

* UIProcess/ios/WKDrawingView.mm:
(-[WKDrawingView PNGRepresentation]):
(-[WKDrawingView loadDrawingFromPNGRepresentation:]):
(-[WKDrawingView _canvasViewWillBeginDrawing:]):
(-[WKDrawingView didChangeInk:]):

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

8 months agoWeb Inspector: Styles: valid values in style attributes are reported as unsupported...
nvasilyev@apple.com [Thu, 14 Feb 2019 05:32:37 +0000 (05:32 +0000)]
Web Inspector: Styles: valid values in style attributes are reported as unsupported property values
https://bugs.webkit.org/show_bug.cgi?id=194619
<rdar://problem/47917373>

Reviewed by Devin Rousso.

Source/WebInspectorUI:

Payload of inline styles may contain `range` that doesn't match
the actual text of the payload - it has an extra empty line at the end.
Mismatching ranges caused data corruption.

* UserInterface/Models/DOMNodeStyles.js:
(WI.DOMNodeStyles.prototype._parseStylePropertyPayload):

LayoutTests:

* inspector/css/modify-inline-style-expected.txt: Added.
* inspector/css/modify-inline-style.html: Added.

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

8 months agoWeb Inspector: Update combined and minified copyright header for 2018-2019
commit-queue@webkit.org [Thu, 14 Feb 2019 03:47:31 +0000 (03:47 +0000)]
Web Inspector: Update combined and minified copyright header for 2018-2019
https://bugs.webkit.org/show_bug.cgi?id=194635

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2019-02-13
Reviewed by Devin Rousso.

* Scripts/copy-user-interface-resources.pl:

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

8 months agoWeb Inspector: Crash when inspecting an element that constantly changes visibility
commit-queue@webkit.org [Thu, 14 Feb 2019 03:38:40 +0000 (03:38 +0000)]
Web Inspector: Crash when inspecting an element that constantly changes visibility
https://bugs.webkit.org/show_bug.cgi?id=194632
<rdar://problem/48060258>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2019-02-13
Reviewed by Matt Baker and Devin Rousso.

* inspector/agents/InspectorDOMAgent.h:
* inspector/agents/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::processAccessibilityChildren):
(WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
Don't use rvalue-references as that was taking ownership and deleting
the object we want to keep around. Instead simplify this to just use
references so no ref counting changes happen.

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

8 months agoAX: Crash in handleMenuOpen
cfleizach@apple.com [Thu, 14 Feb 2019 03:27:13 +0000 (03:27 +0000)]
AX: Crash in handleMenuOpen
https://bugs.webkit.org/show_bug.cgi?id=194627

Reviewed by Zalan Bujtas.

Tests run under libGuardMalloc will cause crashes.

This list of objects is a Node list, not an Element list, so we were
not removing some nodes when they were being deallocated.

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::remove):

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

8 months agoWe should only make rope strings when concatenating strings long enough.
ysuzuki@apple.com [Thu, 14 Feb 2019 03:01:25 +0000 (03:01 +0000)]
We should only make rope strings when concatenating strings long enough.
https://bugs.webkit.org/show_bug.cgi?id=194465

Reviewed by Mark Lam.

Source/JavaScriptCore:

This patch stops us from allocating a rope string if the resulting
rope would be smaller than the size of the JSRopeString object we
would need to allocate.

This patch also adds paths so that we don't unnecessarily allocate
JSString cells for primitives we are going to concatenate with a
string anyway.

The important change from the previous one is that we do not apply
the above rule to JSRopeStrings generated by JSStrings. If we convert
it to JSString, comparison of memory consumption becomes the following,
because JSRopeString does not have StringImpl until it is resolved.

    sizeof(JSRopeString) v.s. sizeof(JSString) + sizeof(StringImpl) + content

Since sizeof(JSString) + sizeof(StringImpl) is larger than sizeof(JSRopeString),
resolving eagerly increases memory footprint. The point is that we need to
account newly created JSString and JSRopeString from the operands. This is the
reason why this patch adds different thresholds for each jsString functions.

This patch also avoids concatenation for ropes conservatively. Many ropes are
temporary cells. So we do not resolve eagerly if one of operands is already a
rope.

In CLI execution, this change is performance neutral in JetStream2 (run 6 times, 1 for warming up and average in latter 5.).

    Before: 159.3778
    After:  160.72340000000003

* dfg/DFGOperations.cpp:
* runtime/CommonSlowPaths.cpp:
(JSC::SLOW_PATH_DECL):
* runtime/JSString.h:
(JSC::JSString::isRope const):
* runtime/Operations.cpp:
(JSC::jsAddSlowCase):
* runtime/Operations.h:
(JSC::jsString):
(JSC::jsAddNonNumber):
(JSC::jsAdd):

Source/WTF:

* wtf/text/StringImpl.h:
(WTF::StringImpl::headerSize):

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

8 months ago[Mac] PiP window can get "stuck" if PiP is closed while Safari window is minimized.
jer.noble@apple.com [Thu, 14 Feb 2019 02:28:48 +0000 (02:28 +0000)]
[Mac] PiP window can get "stuck" if PiP is closed while Safari window is minimized.
https://bugs.webkit.org/show_bug.cgi?id=194621
<rdar://problem/48002560>

Reviewed by Eric Carlson.

When Safari is minimized, no rAF() requests are executed. Don't gate responding to presentation
change events in the media-controller.js on rAF().

* Modules/modern-media-controls/media/media-controller.js:
(MediaController.prototype._returnMediaLayerToInlineIfNeeded):

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

8 months agoUnreviewed GTK test gardening
aboya@igalia.com [Thu, 14 Feb 2019 02:28:20 +0000 (02:28 +0000)]
Unreviewed GTK test gardening
https://bugs.webkit.org/show_bug.cgi?id=194631

* platform/gtk/TestExpectations:
* platform/gtk/editing/pasteboard/smart-paste-007-expected.txt:
* platform/gtk/editing/pasteboard/smart-paste-008-expected.txt:

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

8 months agoIgnore Ad Click Attribution where source and destination are same-site
wilander@apple.com [Thu, 14 Feb 2019 01:36:28 +0000 (01:36 +0000)]
Ignore Ad Click Attribution where source and destination are same-site
https://bugs.webkit.org/show_bug.cgi?id=194620
<rdar://problem/47890018>

Reviewed by Jiewen Tan.

Source/WebCore:

Updated the existing test.

We should not accept Ad Click Attribution requests where the site of the
anchor tag and its addestination attribute are same-site. Such attributions
don’t make sense (the site can track intra-site clicks through better means)
and would just lead to increased memory use where are the pending
attributions are stored.

For ports that don't have access to the Public Suffix List, this patch
only checks that the hosts don't match, i.e. not just eTLD+1.

* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::parseAdClickAttribution const):
    Now returns WTF::nullopt if the current document and the
    addestination are same site. Also fixed a console message
    typo.

LayoutTests:

Same-site test added and test results updated.

* http/tests/adClickAttribution/anchor-tag-attributes-validation-expected.txt:
* http/tests/adClickAttribution/anchor-tag-attributes-validation.html:
* platform/ios-wk2/http/tests/adClickAttribution/anchor-tag-attributes-validation-expected.txt:

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

8 months agogetUserMedia with an ideal deviceId constraint doesn't always select the correct...
youenn@apple.com [Thu, 14 Feb 2019 01:25:39 +0000 (01:25 +0000)]
getUserMedia with an ideal deviceId constraint doesn't always select the correct device
https://bugs.webkit.org/show_bug.cgi?id=193614

Source/WebCore:

Reviewed by Eric Carlson.

Compute a fitness score based on constraints.
For each constraint, a fitness score is computed from the distance.
The smaller the distance, the higher the score.
Fitness scores are then summed to give a device fitness score.
Matching devices are then sorted according the fitness score.

For important constraints, deviceId and facingMode, add a more important weight.
This ensures that should any of these ideal constraints are set, they will be respected.

Restrict our automatic setting of default constraints to not add a default ideal facingMode in case of existing deviceId constraint.
Do not set a default ideal frameRate if width and height are already set.

Covered by updated test.

* platform/mediastream/MediaConstraints.cpp:
(WebCore::FlattenedConstraint::set):
(WebCore::MediaConstraints::setDefaultVideoConstraints):
* platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::fitnessDistance):
(WebCore::RealtimeMediaSource::selectSettings):
(WebCore::RealtimeMediaSource::supportsConstraints):
(WebCore::RealtimeMediaSource::applyConstraints):
* platform/mediastream/RealtimeMediaSource.h:
* platform/mediastream/RealtimeMediaSourceCenter.cpp:
(WebCore::RealtimeMediaSourceCenter::validateRequestConstraints):

LayoutTests:

Reviewed by Eric Carlson.

* fast/mediastream/get-user-media-device-id-expected.txt:
* fast/mediastream/get-user-media-device-id.html:

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

8 months ago[ews-app] Change log level for a log statement
aakash_jain@apple.com [Thu, 14 Feb 2019 00:31:23 +0000 (00:31 +0000)]
[ews-app] Change log level for a log statement

Unreviewed minor fix.

* BuildSlaveSupport/ews-app/ews/models/patch.py:
(Patch.save_patch):

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

8 months ago[iOS] Add a hack to work around buggy video control library
eric.carlson@apple.com [Thu, 14 Feb 2019 00:28:55 +0000 (00:28 +0000)]
[iOS] Add a hack to work around buggy video control library
https://bugs.webkit.org/show_bug.cgi?id=194615
<rdar://problem/46146946>

Reviewed by Jer Noble.

Source/WebCore:

Test: media/ios/video-volume-ios-quirk.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setVolume): Change m_volume for one turn of the runloop.
(WebCore::HTMLMediaElement::cancelPendingTasks): Clear the task queue used to restore m_volume.
(WebCore::HTMLMediaElement::closeTaskQueues): Close it.
* html/HTMLMediaElement.h:

LayoutTests:

* media/ios/video-volume-ios-quirk-expected.txt: Added.
* media/ios/video-volume-ios-quirk.html: Added.

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

8 months ago[Cocoa] Media elements will restart network buffering just before suspending
jer.noble@apple.com [Thu, 14 Feb 2019 00:21:47 +0000 (00:21 +0000)]
[Cocoa] Media elements will restart network buffering just before suspending
https://bugs.webkit.org/show_bug.cgi?id=193691

Reviewed by Eric Carlson.

Source/WebCore:

API Test: WebKit.ProcessSuspendMediaBuffering

Allow the Page to suspend all media buffering in its child Documents.

* dom/Document.cpp:
(WebCore::Document::suspendAllMediaBuffering):
(WebCore::Document::resumeAllMediaBuffering):
* dom/Document.h:
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::dataBufferingPermitted const):
(WebCore::MediaElementSession::suspendBuffering):
(WebCore::MediaElementSession::resumeBuffering):
(WebCore::MediaElementSession::bufferingSuspended const):
* html/MediaElementSession.h:
* page/Page.cpp:
(WebCore::Page::suspendAllMediaBuffering):
(WebCore::Page::resumeAllMediaBuffering):
* page/Page.h:
(WebCore::Page::mediaPlaybackIsSuspended const):
(WebCore::Page::mediaBufferingIsSuspended const):
(WebCore::Page::mediaPlaybackIsSuspended): Deleted.
* platform/audio/PlatformMediaSession.h:
(WebCore::PlatformMediaSession::suspendBuffering):
(WebCore::PlatformMediaSession::resumeBuffering):
* platform/audio/PlatformMediaSessionManager.cpp:
(WebCore::PlatformMediaSessionManager::suspendAllMediaBufferingForDocument):
(WebCore::PlatformMediaSessionManager::resumeAllMediaBufferingForDocument):
* platform/audio/PlatformMediaSessionManager.h:

Source/WebKit:

When the WebProcess receives a notification that the process is about to become
suspended, it tells the MemoryPressureHandler to release all critical memory. This
has the side effect of causing AVFoundation-backed media elements to dump their
in-memory caches and start downloading media data again. Instead, media elements
should all stop buffering media data during suspension. Add new testing SPI to
simulate suspension and resume messages.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _processWillSuspendImminentlyForTesting]):
(-[WKWebView _processDidResumeForTesting]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/WebProcessProxy.h:
* UIProcess/ios/WKInkPickerView.mm:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::suspendAllMediaBuffering):
(WebKit::WebPage::resumeAllMediaBuffering):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::actualPrepareToSuspend):
(WebKit::WebProcess::cancelPrepareToSuspend):
(WebKit::WebProcess::processDidResume):
(WebKit::WebProcess::suspendAllMediaBuffering):
(WebKit::WebProcess::resumeAllMediaBuffering):
* WebProcess/WebProcess.h:

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/ProcessSuspendMediaBuffering.mm: Added.
(TEST):

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

8 months ago[ews-app] Fetch builder id to name mapping
aakash_jain@apple.com [Thu, 14 Feb 2019 00:16:16 +0000 (00:16 +0000)]
[ews-app] Fetch builder id to name mapping
https://bugs.webkit.org/show_bug.cgi?id=194355

Reviewed by Lucas Forschler.

* BuildSlaveSupport/ews-app/ews/common/buildbot.py:
(Buildbot.get_builder_id_to_name_mapping):
(Buildbot._get_display_name_from_builder_name):

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

8 months agoEntering fullscreen inside a shadow root will not set fullscreen pseudoclasses outsid...
jer.noble@apple.com [Thu, 14 Feb 2019 00:11:52 +0000 (00:11 +0000)]
Entering fullscreen inside a shadow root will not set fullscreen pseudoclasses outside of root
https://bugs.webkit.org/show_bug.cgi?id=194516
<rdar://problem/44678353>

Reviewed by Antoine Quint.

Source/WebCore:

Test: fast/shadow-dom/fullscreen-in-shadow-full-screen-ancestor.html

When walking up the element ancestor chain, use parentElementInComposedTree() to
walk past the shadow root boundary.

* dom/Element.cpp:
(WebCore::parentCrossingFrameBoundaries):

LayoutTests:

* fast/shadow-dom/fullscreen-in-shadow-full-screen-ancestor-expected.txt: Added.
* fast/shadow-dom/fullscreen-in-shadow-full-screen-ancestor.html: Added.
* platform/ios-wk2/TestExpectations:

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

8 months ago[iOS] Fix sandbox violation during media playback
pvollan@apple.com [Thu, 14 Feb 2019 00:03:07 +0000 (00:03 +0000)]
[iOS] Fix sandbox violation during media playback
https://bugs.webkit.org/show_bug.cgi?id=194616
<rdar://problem/48049264>

Reviewed by Brent Fulgham.

Mach lookup to "com.apple.coremedia.figcontentkeysession.xpc" should be allowed.

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

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

8 months agoUnreviewed, update localizable strings.
cdumez@apple.com [Wed, 13 Feb 2019 23:14:55 +0000 (23:14 +0000)]
Unreviewed, update localizable strings.

Source/WebCore:

* en.lproj/Localizable.strings:

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:

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

8 months agoEncrypted PDFs inside <embed> or <object> crash the Web Content process
timothy_horton@apple.com [Wed, 13 Feb 2019 23:08:26 +0000 (23:08 +0000)]
Encrypted PDFs inside <embed> or <object> crash the Web Content process
https://bugs.webkit.org/show_bug.cgi?id=194605
<rdar://problem/19894818>

Reviewed by Andy Estes.

Source/WebKit:

* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::createPasswordEntryForm):
Don't try to create a password form field if we can't make form fields.

This means you will be left with a useless embedded PDF, but at least
the Web Content process won't crash.

We'll need to find an alternative implementation of PDF embedded form
fields that is compatible with <embed> and <object> if we want to support
this. Currently we piggy-back off the fact that we can just insert
<input>s into the PluginDocument's DOM, but we can't do that if there
is no PluginDocument, just a main document, like in the <embed> case.

LayoutTests:

* fast/replaced/encrypted-pdf-as-object-and-embed-expected.txt: Added.
* fast/replaced/encrypted-pdf-as-object-and-embed.html: Added.
* fast/replaced/resources/encrypted-image.pdf: Added.
Add a test ensuring that we don't crash with encrypted PDF in <object> or <embed>.

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

8 months agoFurther restricting webarchive loads
jiewen_tan@apple.com [Wed, 13 Feb 2019 23:07:13 +0000 (23:07 +0000)]
Further restricting webarchive loads
https://bugs.webkit.org/show_bug.cgi?id=194567
<rdar://problem/47610130>

Reviewed by Youenn Fablet.

Source/WebCore:

This patch futher restricts main frame webarchive loads to the followings:
1) loaded by clients;
2) loaded by drag;
3) reloaded from any of the previous two.

It moves setAlwaysAllowLocalWebarchive, which is used for testing only, from Document
to FrameLoader such that the option is remembered during redirections.

Covered by API tests.

* dom/Document.h:
(WebCore::Document::setAlwaysAllowLocalWebarchive): Deleted.
(WebCore::Document::alwaysAllowLocalWebarchive const): Deleted.
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::disallowWebArchive const):
* loader/DocumentLoader.h:
(WebCore::DocumentLoader::setAllowsWebArchiveForMainFrame):
(WebCore::DocumentLoader::allowsWebArchiveForMainFrame):
* loader/FrameLoadRequest.h:
(WebCore::FrameLoadRequest::setIsRequestFromClientOrUserInput):
(WebCore::FrameLoadRequest::isRequestFromClientOrUserInput):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::load):
(WebCore::FrameLoader::reload):
* loader/FrameLoader.h:
(WebCore::FrameLoader::setAlwaysAllowLocalWebarchive):
(WebCore::FrameLoader::alwaysAllowLocalWebarchive const):
* page/DragController.cpp:
(WebCore::DragController::performDragOperation):
* testing/Internals.cpp:
(WebCore::Internals::setAlwaysAllowLocalWebarchive const):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::loadRequest):
Set a flag to indicate a load is started from clients.

Tools:

Besides adding API tests, this patch also enhances DragAndDropSimulator to allow
navigations on drop.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/mac/LoadWebArchive.mm: Added.
(-[TestLoadWebArchiveNavigationDelegate webView:didFinishNavigation:]):
(-[TestLoadWebArchiveNavigationDelegate webView:didFailProvisionalNavigation:withError:]):
(-[TestLoadWebArchiveNavigationDelegate webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:]):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/helloworld.webarchive: Added.
* TestWebKitAPI/Tests/mac/load-web-archive-1.html: Added.
* TestWebKitAPI/Tests/mac/load-web-archive-2.html: Added.
* TestWebKitAPI/cocoa/DragAndDropSimulator.h:
* TestWebKitAPI/mac/DragAndDropSimulatorMac.mm:
(-[DragAndDropSimulator initWithWebViewFrame:configuration:]):
(-[DragAndDropSimulator _webView:dragDestinationActionMaskForDraggingInfo:]):

LayoutTests:

* platform/mac/fast/loader/webarchive-encoding-respected.html:
* webarchive/loading/cache-expired-subresource.html:
* webarchive/loading/javascript-url-iframe-crash.html:
* webarchive/loading/mainresource-null-mimetype-crash.html:
* webarchive/loading/missing-data.html:
* webarchive/loading/object.html:
* webarchive/loading/test-loading-archive-subresource-null-mimetype.html:
* webarchive/loading/test-loading-archive-subresource.html:
* webarchive/loading/test-loading-archive.html:
* webarchive/loading/test-loading-top-archive.html:
* webarchive/loading/video-in-webarchive.html:

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

8 months agoNull-deref crash at SourceBufferPrivateAVFObjC::outputObscuredDueToInsufficientExtern...
jer.noble@apple.com [Wed, 13 Feb 2019 22:59:08 +0000 (22:59 +0000)]
Null-deref crash at SourceBufferPrivateAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged()
https://bugs.webkit.org/show_bug.cgi?id=194613
<rdar://problem/48023912>

Reviewed by Eric Carlson.

* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):

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

8 months agoAirIRGenerator::addSwitch switch patchpoint needs to model clobbering the scratch...
sbarati@apple.com [Wed, 13 Feb 2019 22:36:36 +0000 (22:36 +0000)]
AirIRGenerator::addSwitch switch patchpoint needs to model clobbering the scratch register
https://bugs.webkit.org/show_bug.cgi?id=194610

Reviewed by Michael Saboff.

BinarySwitch might use the scratch register. We must model the
effects of that properly. This is already caught by our br-table
tests on arm64.

* wasm/WasmAirIRGenerator.cpp:
(JSC::Wasm::AirIRGenerator::addSwitch):

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

8 months ago[WPE][GTK] Merge WebProcessPoolWPE.cpp and WebProcessPoolGtk.cpp
mcatanzaro@igalia.com [Wed, 13 Feb 2019 22:35:16 +0000 (22:35 +0000)]
[WPE][GTK] Merge WebProcessPoolWPE.cpp and WebProcessPoolGtk.cpp
https://bugs.webkit.org/show_bug.cgi?id=194551

Reviewed by Carlos Garcia Campos.

* SourcesGTK.txt:
* SourcesWPE.txt:
* UIProcess/glib/WebProcessPoolGLib.cpp: Renamed from Source/WebKit/UIProcess/gtk/WebProcessPoolGtk.cpp.
(WebKit::initializeRemoteInspectorServer):
(WebKit::memoryPressureMonitorDisabled):
(WebKit::WebProcessPool::platformInitialize):
(WebKit::WebProcessPool::platformInitializeWebProcess):
(WebKit::WebProcessPool::platformInvalidateContext):
(WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
* UIProcess/wpe/WebProcessPoolWPE.cpp: Removed.

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

8 months agoUnreviewed, fix unused variable warnings after r241148/r241251
mcatanzaro@igalia.com [Wed, 13 Feb 2019 22:23:52 +0000 (22:23 +0000)]
Unreviewed, fix unused variable warnings after r241148/r241251
https://bugs.webkit.org/show_bug.cgi?id=194348
<rdar://problem/47566449>

* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::sourceBufferPrivateDidReceiveRenderingError):
(WebCore::SourceBuffer::evictCodedFrames):
(WebCore::SourceBuffer::provideMediaData):

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

8 months agoREGRESSION: [ Mac Debug WK2 ] Layout Test storage/indexeddb/key-type-infinity-private...
sihui_liu@apple.com [Wed, 13 Feb 2019 21:32:44 +0000 (21:32 +0000)]
REGRESSION: [ Mac Debug WK2 ] Layout Test storage/indexeddb/key-type-infinity-private.html is a flaky crash
https://bugs.webkit.org/show_bug.cgi?id=194413
<rdar://problem/47897254>

Reviewed by Brady Eidson.

IDB clients expected transaction operations to be executed in order, but in
UniqueIDBDatabase::immediateCloseForUserDelete, callbacks in callback map were errored out randomly.
This patch added a callback queue to UniqueIDBDatabase to make sure callbacks will be called in the same order
as IDB Server receives the request.

* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::storeCallbackOrFireError):
(WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete):
(WebCore::IDBServer::UniqueIDBDatabase::performErrorCallback):
(WebCore::IDBServer::UniqueIDBDatabase::performKeyDataCallback):
(WebCore::IDBServer::UniqueIDBDatabase::performGetResultCallback):
(WebCore::IDBServer::UniqueIDBDatabase::performGetAllResultsCallback):
(WebCore::IDBServer::UniqueIDBDatabase::performCountCallback):
(WebCore::IDBServer::UniqueIDBDatabase::forgetErrorCallback):
* Modules/indexeddb/server/UniqueIDBDatabase.h:

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

8 months agoFix -Wformat warning from r241401
mcatanzaro@igalia.com [Wed, 13 Feb 2019 21:10:10 +0000 (21:10 +0000)]
Fix -Wformat warning from r241401
https://bugs.webkit.org/show_bug.cgi?id=194584
<rdar://problem/47761293>

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setActivityState):

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

8 months agoMake WebRTCUnifiedPlanEnabled true by default
youenn@apple.com [Wed, 13 Feb 2019 20:49:06 +0000 (20:49 +0000)]
Make WebRTCUnifiedPlanEnabled true by default
https://bugs.webkit.org/show_bug.cgi?id=194595

Reviewed by Eric Carlson.

* Shared/WebPreferences.yaml:

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

8 months agoStore Ad Click Attribution requests in the network process
wilander@apple.com [Wed, 13 Feb 2019 20:47:00 +0000 (20:47 +0000)]
Store Ad Click Attribution requests in the network process
https://bugs.webkit.org/show_bug.cgi?id=194510
<rdar://problem/47650118>

Reviewed by Alex Christensen and Daniel Bates.

Source/WebCore:

Test: http/tests/adClickAttribution/store-ad-click-attribution.html

This patch adds support functions for validation and storage of
WebCore::AdClickAttribution objects. It also adds WTF::HashTraits so that
WebCore::AdClickAttribution::Source and WebCore::AdClickAttribution::Destination
can be used in a HashMap.

* loader/AdClickAttribution.cpp:
(WebCore::AdClickAttribution::toString const):
* loader/AdClickAttribution.h:
(WebCore::AdClickAttribution::Source::operator== const):
(WebCore::AdClickAttribution::Source::deletedValue):
(WebCore::AdClickAttribution::Source::constructDeletedValue):
(WebCore::AdClickAttribution::Source::deleteValue):
(WebCore::AdClickAttribution::Source::isDeletedValue const):
(WebCore::AdClickAttribution::SourceHash::hash):
(WebCore::AdClickAttribution::SourceHash::equal):
(WebCore::AdClickAttribution::Destination::operator== const):
(WebCore::AdClickAttribution::Destination::matches const):
    This convenience function allows matching of a WTF::URL object.
(WebCore::AdClickAttribution::Destination::deletedValue):
(WebCore::AdClickAttribution::Destination::constructDeletedValue):
(WebCore::AdClickAttribution::Destination::deleteValue):
(WebCore::AdClickAttribution::Destination::isDeletedValue const):
(WebCore::AdClickAttribution::DestinationHash::hash):
(WebCore::AdClickAttribution::DestinationHash::equal):
(WebCore::AdClickAttribution::source const):
(WebCore::AdClickAttribution::destination const):
    Getters added to support mapped storage based on source and destination.
(WTF::HashTraits<WebCore::AdClickAttribution::Source>::emptyValue):
(WTF::HashTraits<WebCore::AdClickAttribution::Source>::constructDeletedValue):
(WTF::HashTraits<WebCore::AdClickAttribution::Source>::isDeletedValue):
(WTF::HashTraits<WebCore::AdClickAttribution::Destination>::emptyValue):
(WTF::HashTraits<WebCore::AdClickAttribution::Destination>::constructDeletedValue):
(WTF::HashTraits<WebCore::AdClickAttribution::Destination>::isDeletedValue):
* loader/NavigationAction.h:
(WebCore::NavigationAction::adClickAttribution const):
(WebCore::NavigationAction::adClickAttribution): Deleted.
    Corrected the constness of this function.

Source/WebKit:

With this patch, WebPageProxy::didCommitLoadForFrame() now looks for
an AdClickAttribution object in its navigation state. If there is an
attribution, it sends it to the network process where the
WebKit::NetworkSession stores it in an object of a new class,
WebKit::NetworkAdClickAttribution.

This patch also covers test infrastructure to support two new
TestRunner functions:
- dumpAdClickAttribution()
- clearAdClickAttribution()

* NetworkProcess/Cookies/WebCookieManager.cpp:
    Added missing header include.
* NetworkProcess/Downloads/DownloadManager.cpp:
    Added missing header include.
* NetworkProcess/NetworkAdClickAttribution.cpp: Added.
(WebKit::NetworkAdClickAttribution::ensureDestinationMapForSource):
(WebKit::NetworkAdClickAttribution::store):
(WebKit::NetworkAdClickAttribution::clear):
(WebKit::NetworkAdClickAttribution::toString const):
* NetworkProcess/NetworkAdClickAttribution.h: Added.
    Stores WebCore::AdClickAttribution objects in a map structure.
* NetworkProcess/NetworkLoad.cpp:
    Added missing header includes.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::storeAdClickAttribution):
(WebKit::NetworkProcess::dumpAdClickAttribution):
(WebKit::NetworkProcess::clearAdClickAttribution):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::NetworkSession):
(WebKit::NetworkSession::storeAdClickAttribution):
(WebKit::NetworkSession::dumpAdClickAttribution):
(WebKit::NetworkSession::clearAdClickAttribution):
* NetworkProcess/NetworkSession.h:
* NetworkProcess/soup/RemoteNetworkingContextSoup.cpp:
    Added missing header include.
* Sources.txt:
    Added NetworkProcess/NetworkAdClickAttribution.cpp.
* UIProcess/API/APINavigation.h:
(API::Navigation::adClickAttribution const):
* UIProcess/API/C/WKPage.cpp:
(WKPageDumpAdClickAttribution):
(WKPageClearAdClickAttribution):
    Test infrastructure.
* UIProcess/API/C/WKPagePrivate.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::dumpAdClickAttribution):
(WebKit::NetworkProcessProxy::clearAdClickAttribution):
    Test infrastructure.
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
    This is where pending Ad Click Attributions are forwarded to the
    network process.
(WebKit::WebPageProxy::dumpAdClickAttribution):
(WebKit::WebPageProxy::clearAdClickAttribution):
    Test infrastructure.
* UIProcess/WebPageProxy.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::dumpAdClickAttribution):
(WebKit::WebProcessPool::clearAdClickAttribution):
    Test infrastructure.
* UIProcess/WebProcessPool.h:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
    Added missing data copying from navigationAction to navigationActionData.

Tools:

This patch adds two TestRunner functions:
- dumpAdClickAttribution()
- clearAdClickAttribution()

They call into the network process to dump and clear Ad Click
Attribution state, respectively.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::dumpAdClickAttribution):
(WTR::TestRunner::clearAdClickAttribution):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetStateToConsistentValues):
(WTR::AdClickAttributionStringResultCallbackContext::AdClickAttributionStringResultCallbackContext):
(WTR::adClickAttributionStringResultCallback):
(WTR::TestController::dumpAdClickAttribution):
(WTR::AdClickAttributionVoidCallbackContext::AdClickAttributionVoidCallbackContext):
(WTR::adClickAttributionVoidCallback):
(WTR::TestController::clearAdClickAttribution):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::dumpResults):
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
(WTR::TestInvocation::dumpAdClickAttribution):
* WebKitTestRunner/TestInvocation.h:

LayoutTests:

* TestExpectations:
    Marked "Skip" because the feature is not applicable to WK1.
* http/tests/adClickAttribution/store-ad-click-attribution-expected.txt: Added.
* http/tests/adClickAttribution/store-ad-click-attribution.html: Added.
* platform/wk2/TestExpectations:
    Marked "Pass."

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

8 months agoRevert r240434
eric.carlson@apple.com [Wed, 13 Feb 2019 20:34:55 +0000 (20:34 +0000)]
Revert r240434
https://bugs.webkit.org/show_bug.cgi?id=194600
<rdar://problem/48044566>

Reviewed by Brent Fulgham.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setVolume):
(WebCore::HTMLMediaElement::mediaPlayerVolumeChanged):
(WebCore::HTMLMediaElement::updateVolume):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::setVolume):

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

8 months agoCreate a randomized free list for new StructureIDs on StructureIDTable resize.
mark.lam@apple.com [Wed, 13 Feb 2019 20:34:19 +0000 (20:34 +0000)]
Create a randomized free list for new StructureIDs on StructureIDTable resize.
https://bugs.webkit.org/show_bug.cgi?id=194566
<rdar://problem/47975502>

Reviewed by Michael Saboff.

Also isolate 32-bit implementation of StructureIDTable out more so the 64-bit
implementation is a little easier to read.

This patch appears to be perf neutral on JetStream2 (as run from the command line).

* runtime/StructureIDTable.cpp:
(JSC::StructureIDTable::StructureIDTable):
(JSC::StructureIDTable::makeFreeListFromRange):
(JSC::StructureIDTable::resize):
(JSC::StructureIDTable::allocateID):
(JSC::StructureIDTable::deallocateID):
* runtime/StructureIDTable.h:
(JSC::StructureIDTable::get):
(JSC::StructureIDTable::deallocateID):
(JSC::StructureIDTable::allocateID):
(JSC::StructureIDTable::flushOldTables):

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

8 months agoCrash in WebKit::CacheStorage::Engine::cachesRootPath
antti@apple.com [Wed, 13 Feb 2019 19:24:52 +0000 (19:24 +0000)]
Crash in WebKit::CacheStorage::Engine::cachesRootPath
https://bugs.webkit.org/show_bug.cgi?id=194588
<rdar://problem/46363997>

Reviewed by Youenn Fablet.

* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::cachesRootPath):

Salt may have not been initialized yet when the Engine is destroyed.

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

8 months agoVariableLengthObject::allocate<T> should initialize objects
tzagallo@apple.com [Wed, 13 Feb 2019 19:16:36 +0000 (19:16 +0000)]
VariableLengthObject::allocate<T> should initialize objects
https://bugs.webkit.org/show_bug.cgi?id=194534

Reviewed by Michael Saboff.

`buffer()` should not be called for empty VariableLengthObjects, but
these cases were not being caught due to the objects not being properly
initialized. Fix it so that allocate calls the constructor and fix the
assertion failues.

* runtime/CachedTypes.cpp:
(JSC::CachedObject::operator new):
(JSC::VariableLengthObject::allocate):
(JSC::CachedVector::encode):
(JSC::CachedVector::decode const):
(JSC::CachedUniquedStringImpl::decode const):
(JSC::CachedBitVector::encode):
(JSC::CachedBitVector::decode const):
(JSC::CachedArray::encode):
(JSC::CachedArray::decode const):
(JSC::CachedImmutableButterfly::CachedImmutableButterfly):
(JSC::CachedBigInt::decode const):

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

8 months agoVersioning.
alancoon@apple.com [Wed, 13 Feb 2019 19:11:43 +0000 (19:11 +0000)]
Versioning.

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

8 months agoStop using setDefersLoading from WebCore
achristensen@apple.com [Wed, 13 Feb 2019 19:00:30 +0000 (19:00 +0000)]
Stop using setDefersLoading from WebCore
https://bugs.webkit.org/show_bug.cgi?id=194315

Reviewed by Jer Noble.

That is what CompletionHandlers are for.

* loader/MediaResourceLoader.cpp:
(WebCore::MediaResource::responseReceived):
(WebCore::MediaResource::setDefersLoading): Deleted.
* loader/MediaResourceLoader.h:
* platform/graphics/PlatformMediaResourceLoader.h:
(WebCore::PlatformMediaResourceClient::responseReceived):
(WebCore::PlatformMediaResource::stop):
(WebCore::PlatformMediaResource::setDefersLoading): Deleted.
* platform/network/cocoa/WebCoreNSURLSession.mm:
(WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived):
(-[WebCoreNSURLSessionDataTask resource:receivedResponse:completionHandler:]):
(-[WebCoreNSURLSessionDataTask _setDefersLoading:]): Deleted.
(-[WebCoreNSURLSessionDataTask resource:receivedResponse:]): Deleted.

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

8 months ago[ews-app] Generate status-bubble
aakash_jain@apple.com [Wed, 13 Feb 2019 18:54:32 +0000 (18:54 +0000)]
[ews-app] Generate status-bubble
https://bugs.webkit.org/show_bug.cgi?id=194572

Reviewed by Lucas Forschler.

* BuildSlaveSupport/ews-app/ews/views/statusbubble.py:
(StatusBubble._build_bubble):
(StatusBubble._should_show_bubble_for):
(StatusBubble._build_bubbles_for_patch):

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

8 months agoCodeBlocks read from disk should not be re-written
tzagallo@apple.com [Wed, 13 Feb 2019 18:50:20 +0000 (18:50 +0000)]
CodeBlocks read from disk should not be re-written
https://bugs.webkit.org/show_bug.cgi?id=194535

Reviewed by Michael Saboff.

Keep track of which CodeBlocks have been read from disk or have already
been serialized in CodeCache.

* runtime/CodeCache.cpp:
(JSC::CodeCache::write):
* runtime/CodeCache.h:
(JSC::SourceCodeValue::SourceCodeValue):
(JSC::CodeCacheMap::fetchFromDiskImpl):

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

8 months agoRemove legacy sync messaging in some IPC code
achristensen@apple.com [Wed, 13 Feb 2019 18:35:20 +0000 (18:35 +0000)]
Remove legacy sync messaging in some IPC code
https://bugs.webkit.org/show_bug.cgi?id=194561

Reviewed by Geoffrey Garen.

Changing some LegacySync messages to Delayed messages.  We should probably rename Delayed to Sync.
There are too many ways to send messages.  Let's work to get rid of the old one.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::setAllowsAnySSLCertificateForWebSocket):
(WebKit::NetworkProcess::processWillSuspendImminently):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* PluginProcess/PluginControllerProxy.cpp:
(WebKit::PluginControllerProxy::handleWheelEvent):
(WebKit::PluginControllerProxy::handleMouseEnterEvent):
(WebKit::PluginControllerProxy::handleMouseLeaveEvent):
(WebKit::PluginControllerProxy::handleKeyboardEvent):
(WebKit::PluginControllerProxy::handleEditingCommand):
(WebKit::PluginControllerProxy::isEditingCommandEnabled):
(WebKit::PluginControllerProxy::handlesPageScaleFactor):
(WebKit::PluginControllerProxy::requiresUnifiedScaleFactor):
(WebKit::PluginControllerProxy::paintEntirePlugin):
(WebKit::PluginControllerProxy::supportsSnapshotting):
(WebKit::PluginControllerProxy::snapshot):
(WebKit::PluginControllerProxy::getPluginScriptableNPObject):
(WebKit::PluginControllerProxy::getFormValue):
* PluginProcess/PluginControllerProxy.h:
* PluginProcess/PluginControllerProxy.messages.in:
* Shared/Plugins/NPObjectMessageReceiver.cpp:
(WebKit::NPObjectMessageReceiver::deallocate):
(WebKit::NPObjectMessageReceiver::hasMethod):
(WebKit::NPObjectMessageReceiver::invoke):
(WebKit::NPObjectMessageReceiver::invokeDefault):
(WebKit::NPObjectMessageReceiver::hasProperty):
(WebKit::NPObjectMessageReceiver::getProperty):
(WebKit::NPObjectMessageReceiver::setProperty):
(WebKit::NPObjectMessageReceiver::removeProperty):
(WebKit::NPObjectMessageReceiver::enumerate):
(WebKit::NPObjectMessageReceiver::construct):
* Shared/Plugins/NPObjectMessageReceiver.h:
* Shared/Plugins/NPObjectMessageReceiver.messages.in:
* UIProcess/mac/SecItemShimProxy.cpp:
(WebKit::SecItemShimProxy::secItemRequest):
* UIProcess/mac/SecItemShimProxy.h:
* UIProcess/mac/SecItemShimProxy.messages.in:

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

8 months ago[ews-app] Add status bubble html template
aakash_jain@apple.com [Wed, 13 Feb 2019 18:30:13 +0000 (18:30 +0000)]
[ews-app] Add status bubble html template
https://bugs.webkit.org/show_bug.cgi?id=194571

Reviewed by Lucas Forschler.

* BuildSlaveSupport/ews-app/ews/templates: Added.
* BuildSlaveSupport/ews-app/ews/templates/statusbubble.html: Copied from QueueStatusServer/templates/statusbubble.html.

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

8 months ago[Cocoa] Switch to CVPixelBufferGetBytesPerRow() for calculating CVPixelBuffer base...
jer.noble@apple.com [Wed, 13 Feb 2019 17:45:23 +0000 (17:45 +0000)]
[Cocoa] Switch to CVPixelBufferGetBytesPerRow() for calculating CVPixelBuffer base address size.
https://bugs.webkit.org/show_bug.cgi?id=194580
<rdar://problem/42727739>

Reviewed by Eric Carlson.

* platform/cocoa/CoreVideoSoftLink.cpp:
* platform/cocoa/CoreVideoSoftLink.h:
* platform/graphics/cv/PixelBufferConformerCV.cpp:
(WebCore::CVPixelBufferGetBytePointerCallback):
(WebCore::PixelBufferConformerCV::createImageFromPixelBuffer):

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

8 months agoAdd two regression tests for reference cycle in IndexedDB
sihui_liu@apple.com [Wed, 13 Feb 2019 17:12:57 +0000 (17:12 +0000)]
Add two regression tests for reference cycle in IndexedDB
https://bugs.webkit.org/show_bug.cgi?id=194527

Reviewed by Geoffrey Garen.

* fast/dom/reference-cycle-leaks.html:
* platform/win/TestExpectations:
The added tests are failing on win bots for unknown reasons, propably related to webkit.org/b/193540. Skip them
on win.

* storage/indexeddb/resources/result-request-cycle.js: Added.
(prepareDatabase):
* storage/indexeddb/resources/value-cursor-cycle.js: Added.
(prepareDatabase):
(onOpen.cursorRequest.onsuccess):
* storage/indexeddb/result-request-cycle-expected.txt: Added.
* storage/indexeddb/result-request-cycle.html: Added.
* storage/indexeddb/value-cursor-cycle-expected.txt: Added.
* storage/indexeddb/value-cursor-cycle.html: Added.

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

8 months agoUnreviewed, rolling out r241433.
tsavell@apple.com [Wed, 13 Feb 2019 16:55:05 +0000 (16:55 +0000)]
Unreviewed, rolling out r241433.

Broke internal builds.

Reverted changeset:

"Move
UIWebTouchEventsGestureRecognizer.activeTouchesByIdentifier to
SPI"
https://bugs.webkit.org/show_bug.cgi?id=194531
https://trac.webkit.org/changeset/241433

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

8 months agoMove UIWebTouchEventsGestureRecognizer.activeTouchesByIdentifier to SPI
graouts@webkit.org [Wed, 13 Feb 2019 13:46:58 +0000 (13:46 +0000)]
Move UIWebTouchEventsGestureRecognizer.activeTouchesByIdentifier to SPI
https://bugs.webkit.org/show_bug.cgi?id=194531
<rdar://problem/47714562>

Reviewed by Dean Jackson.

* Platform/spi/ios/UIKitSPI.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView cancelPointersForGestureRecognizer:]): We update the referenced Radar since we need to keep the call
to respondsToSelector until the SPI has shipped for OpenSource builds to work.

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

8 months agoSupport simulated mouse events on iOS based on a PlatformTouchEvent
graouts@webkit.org [Wed, 13 Feb 2019 13:34:43 +0000 (13:34 +0000)]
Support simulated mouse events on iOS based on a PlatformTouchEvent
https://bugs.webkit.org/show_bug.cgi?id=194501
<rdar://problem/46910790>

Reviewed by Dean Jackson.

Source/WebCore:

Add support for two new internal runtime flags to control whether simulated mouse events should be dipatched along with touch events and
whether simulated mousemove events dispatched should automatically trigger the behavior preventDefault() would also trigger. To facilitate
that, we allow for a MouseEvent to be created, much like a PointerEvent, based on a PlatformTouchEvent. Then, we set a flag on Event within
EventTarget::innerInvokeEventListeners() to see whether any page code has been evaluated as a result of a mousemove event being dispatched.
Finally, we also track mouse events when invalidating touch regions provided the required internal runtime flag is on.

Test: fast/events/touch/ios/mouse-events-dispatch-with-touch.html

* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/Event.cpp:
* dom/Event.h:
(WebCore::Event::hasEncounteredListener const):
(WebCore::Event::setHasEncounteredListener):
* dom/EventNames.h:
(WebCore::EventNames::isTouchRelatedEventType const):
(WebCore::EventNames::touchRelatedEventNames const):
(WebCore::EventNames::extendedTouchRelatedEventNames const):
(WebCore::EventNames::isTouchEventType const): Deleted.
(WebCore::EventNames::touchAndPointerEventNames const): Deleted.
* dom/EventTarget.cpp:
(WebCore::EventTarget::innerInvokeEventListeners):
* dom/MouseEvent.h:
* dom/Node.cpp:
(WebCore::Node::moveNodeToNewDocument):
(WebCore::tryAddEventListener):
(WebCore::tryRemoveEventListener):
(WebCore::Node::defaultEventHandler):
* dom/ios/MouseEventIOS.cpp: Added.
(WebCore::mouseEventType):
(WebCore::MouseEvent::create):
* dom/ios/PointerEventIOS.cpp:
(WebCore::pointerEventType):
(WebCore::PointerEvent::create):
(WebCore::eventType): Deleted.
* page/DOMWindow.cpp:
(WebCore::DOMWindow::addEventListener):
(WebCore::DOMWindow::removeEventListener):
* page/EventHandler.h:
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::mouseEventsSimulationEnabled const):
(WebCore::RuntimeEnabledFeatures::setMouseEventsSimulationEnabled):
(WebCore::RuntimeEnabledFeatures::mousemoveEventHandlingPreventsDefaultEnabled const):
(WebCore::RuntimeEnabledFeatures::setMousemoveEventHandlingPreventsDefaultEnabled):

Source/WebKit:

Add two new internal runtime flags to control whether simulated mouse events should be dipatched along with touch events and whether
simulated mousemove events dispatched should automatically trigger the behavior preventDefault() would also trigger. We also ensure
that we correctly create touch tracking regions for mouse events.

* Shared/WebPreferences.yaml:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::updateTouchEventTracking):

LayoutTests:

Add a new test to check that we correctly dispatch mouse events as touches occur.

* fast/events/touch/ios/mouse-events-dispatch-with-touch-expected.txt: Added.
* fast/events/touch/ios/mouse-events-dispatch-with-touch.html: Added.
* pointerevents/utils.js:
(prototype.handleEvent):
(prototype._handlePointerEvent):
(prototype._handleMouseEvent):

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

8 months agoSourceCode should be copied when generating bytecode for functions
tzagallo@apple.com [Wed, 13 Feb 2019 12:21:00 +0000 (12:21 +0000)]
SourceCode should be copied when generating bytecode for functions
https://bugs.webkit.org/show_bug.cgi?id=194536

Reviewed by Saam Barati.

The FunctionExecutable might be collected while generating the bytecode
for nested functions, in which case the SourceCode reference would no
longer be valid.

* runtime/CodeCache.cpp:
(JSC::generateUnlinkedCodeBlockForFunctions):

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

8 months ago[GTK][WPE] Don't use DumpJSConsoleLogInStdErr expectation in platform TestExpectations
Hironori.Fujii@sony.com [Wed, 13 Feb 2019 10:12:27 +0000 (10:12 +0000)]
[GTK][WPE] Don't use DumpJSConsoleLogInStdErr expectation in platform TestExpectations
https://bugs.webkit.org/show_bug.cgi?id=194587

Unreviewed gardening.

* platform/gtk/TestExpectations: Removed DumpJSConsoleLogInStdErr markers which are marked in top TestExpectations.
* platform/wpe/TestExpectations: Ditto.

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

8 months ago[FreeType] Unable to render some Hebrew characters
carlosgc@webkit.org [Wed, 13 Feb 2019 09:10:13 +0000 (09:10 +0000)]
[FreeType] Unable to render some Hebrew characters
https://bugs.webkit.org/show_bug.cgi?id=194498

Reviewed by Michael Catanzaro.

We are failing to find a font for some of the combining character sequences because normalization is failing due
to overflow error. In case of overflow, normalize returns the required length for the normalized characters, so
we should handle that case to resize the output buffer and try again.

* platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
(WebCore::FontCascade::fontForCombiningCharacterSequence const):

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

8 months agoCrash in Page::setActivityState because m_page is null
rniwa@webkit.org [Wed, 13 Feb 2019 09:07:23 +0000 (09:07 +0000)]
Crash in Page::setActivityState because m_page is null
https://bugs.webkit.org/show_bug.cgi?id=194584

Reviewed by Antti Koivisto.

Add a null check to avoid the crash. Also add a debug assertion to help diagnose this in the future.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setActivityState):

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

8 months agoRelease assert in PolicyCheckIdentifier::isValidFor via WebFrameLoaderClient::dispatc...
rniwa@webkit.org [Wed, 13 Feb 2019 09:01:49 +0000 (09:01 +0000)]
Release assert in PolicyCheckIdentifier::isValidFor via WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction
https://bugs.webkit.org/show_bug.cgi?id=194582

Reviewed by Antti Koivisto.

Source/WebCore:

Check the zero-ness of m_policyCheck first so that we can differentiate process ID being wrong
from the non-generated identifier being sent to us as it was the case in this failure.

* loader/PolicyChecker.cpp:
(WebCore::PolicyCheckIdentifier::isValidFor):

Source/WebKit:

The bug was caused by WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction invoking the callback
with responseIdentifier even when we had failed to send the policy check IPC. Clearly, responseIdentifier
is invalid in that case, and we should be using requestIdentifier instead.

Unfortunately no new tests since I'm not aware of a way to make sendSync fail in this case.

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

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

8 months agoResponsiveness timers are too expensive for frequent events
benjamin@webkit.org [Wed, 13 Feb 2019 08:41:22 +0000 (08:41 +0000)]
Responsiveness timers are too expensive for frequent events
https://bugs.webkit.org/show_bug.cgi?id=194003

Reviewed by Geoffrey Garen.

With each event, we set a responsivness timer to check if the WebProcess
is responsive, and reset the timer when the WebProcess sends an answer.

For frequent events (e.g. wheel events, mouse force events, etc),
we are spamming the kernel with hundreds of timers per second.
That is a bit inefficient.

Another source of inefficiency comes from the timer implementation
itself. Stopping a RunLoop::Timer removes the timer from every mode
and invalidate the timer. It becomes costly since we do it a lot.

With this patch, I tweak ResponsivenessTimer and its use to minimize
how often we schedule system timers.

The first change is to not stop the timer when we get the stop()
calls if we expect more events to come in. Instead, we keep track
if we care about the timeout or not in the attribute "m_waitingForTimer".
When the next event starts, we can reschedule the timer without ever
having told the kernel about the stop.
If there are no next events, the timeout fires but m_waitingForTimer
is false. To avoid idle wake up, the lazy stop is only used when having
following events is common.

The second improvements comes from not even rescheduling the timer
when restarted. Instead of changing the timer, we let the original timer
fire and re-shedule a new one with the missing time.

For more context, also see patches r240759 and r240944.

* UIProcess/ResponsivenessTimer.cpp:
(WebKit::ResponsivenessTimer::ResponsivenessTimer):
(WebKit::ResponsivenessTimer::invalidate):
(WebKit::ResponsivenessTimer::timerFired):
(WebKit::ResponsivenessTimer::start):
(WebKit::ResponsivenessTimer::startWithLazyStop):
(WebKit::ResponsivenessTimer::stop):
(WebKit::ResponsivenessTimer::processTerminated):
(WebKit::ResponsivenessTimer::~ResponsivenessTimer): Deleted.
* UIProcess/ResponsivenessTimer.h:
(WebKit::ResponsivenessTimer::hasActiveTimer const):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::processNextQueuedMouseEvent):
(WebKit::WebPageProxy::sendWheelEvent):
(WebKit::WebPageProxy::handleKeyboardEvent):
(WebKit::WebPageProxy::handleGestureEvent):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::isResponsiveWithLazyStop):
* UIProcess/WebProcessProxy.h:

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

8 months agoUnreviewed, rolling out r241273.
commit-queue@webkit.org [Wed, 13 Feb 2019 08:26:23 +0000 (08:26 +0000)]
Unreviewed, rolling out r241273.
https://bugs.webkit.org/show_bug.cgi?id=194579

This change is causing a flaky assertion failure crash in High
Sierra Debug (Requested by ShawnRoberts on #webkit).

Reverted changeset:

"Stop using setDefersLoading from WebCore"
https://bugs.webkit.org/show_bug.cgi?id=194315
https://trac.webkit.org/changeset/241273

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

8 months agoNull deref in userInterfaceLayoutDirection under ViewGestureController::handleSwipeGe...
timothy_horton@apple.com [Wed, 13 Feb 2019 07:36:30 +0000 (07:36 +0000)]
Null deref in userInterfaceLayoutDirection under ViewGestureController::handleSwipeGesture
https://bugs.webkit.org/show_bug.cgi?id=194569
<rdar://problem/46711049>

Reviewed by Wenson Hsieh.

* UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::ViewGestureController::handleSwipeGesture):
It is conceivable that we could get here if the client closes the page
e.g. in the callback from willEndSwipeGesture. We already guarded against
this ... one line too late! Rearrange the lines so we don't call into
WebPageProxy at all if we don't have a drawing area (which is a strict subset
of the time that isValid would return true). This is a speculative fix,
since I can no longer reproduce the crash on demand.

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

8 months agoRemove unnecessary null check in bindings.
mark.lam@apple.com [Wed, 13 Feb 2019 07:13:07 +0000 (07:13 +0000)]
Remove unnecessary null check in bindings.
https://bugs.webkit.org/show_bug.cgi?id=194581

Reviewed by Yusuke Suzuki.

It is always safe to call visitor.containsOpaqueRoot(root) with a null root pointer.
It will just return false.  Since we don't expect the root pointer to be null in
the common case, having a null check here is also not optimal.  We'll remove this
unneeded null check.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):
* bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
(WebCore::JSTestGenerateIsReachableOwner::isReachableFromOpaqueRoots):

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

8 months agoJSScript needs to retain its cache path NSURL*
sbarati@apple.com [Wed, 13 Feb 2019 06:34:44 +0000 (06:34 +0000)]
JSScript needs to retain its cache path NSURL*
https://bugs.webkit.org/show_bug.cgi?id=194577

Reviewed by Tim Horton.

* API/JSScript.mm:
(+[JSScript scriptFromASCIIFile:inVirtualMachine:withCodeSigning:andBytecodeCache:]):
(-[JSScript dealloc]):

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

8 months agoWebServiceWorkerProvider::handleFetch no longer needs a CachedResource parameter
youenn@apple.com [Wed, 13 Feb 2019 05:24:52 +0000 (05:24 +0000)]
WebServiceWorkerProvider::handleFetch no longer needs a CachedResource parameter
https://bugs.webkit.org/show_bug.cgi?id=194548

Reviewed by Alex Christensen.

* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::scheduleLoad):
* WebProcess/Storage/WebServiceWorkerProvider.cpp:
(WebKit::WebServiceWorkerProvider::handleFetch):
* WebProcess/Storage/WebServiceWorkerProvider.h:

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

8 months agoRemove WKLegacyPDFView
timothy_horton@apple.com [Wed, 13 Feb 2019 05:04:36 +0000 (05:04 +0000)]
Remove WKLegacyPDFView
https://bugs.webkit.org/show_bug.cgi?id=194559

Reviewed by Andy Estes.

Source/WebKit:

* Platform/spi/ios/CorePDFSPI.h: Removed.
* SourcesCocoa.txt:
* UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
(-[WKWebViewContentProviderRegistry initWithConfiguration:]):
* UIProcess/ios/WKLegacyPDFView.h: Removed.
* UIProcess/ios/WKLegacyPDFView.mm: Removed.
* WebKit.xcodeproj/project.pbxproj:

Source/WTF:

* wtf/FeatureDefines.h:

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

8 months agoRegression(PSON) MESSAGE_CHECK() hit under WebPageProxy::didFailProvisionalLoadForFra...
cdumez@apple.com [Wed, 13 Feb 2019 02:32:24 +0000 (02:32 +0000)]
Regression(PSON) MESSAGE_CHECK() hit under WebPageProxy::didFailProvisionalLoadForFrameShared()
https://bugs.webkit.org/show_bug.cgi?id=194568
<rdar://problem/47944490>

Reviewed by Ryosuke Niwa.

Source/WebKit:

When the provisional process crashes, it is unsafe to call ProvisionalPageProxy::cancel() because
the WebProcessProxy clears its frame map as soon as the process crashes. Calling cancel() after
that would call WebPageProxy::didFailProvisionalLoadForFrameShared(), which would try to look up
the frame by ID and MESSAGE_CHECK() that the frame is not null. We would fail this check since
the frame has been removed from the WebProcessProxy at this point.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _provisionalWebProcessIdentifier]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
(WebKit::WebPageProxy::provisionalProcessDidTerminate):

Tools:

Add API test coverage.

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
(-[PSONNavigationDelegate webView:didStartProvisionalNavigation:]):

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

8 months agoMake B3Value::returnsBool() more precise
rmorisset@apple.com [Wed, 13 Feb 2019 02:30:13 +0000 (02:30 +0000)]
Make B3Value::returnsBool() more precise
https://bugs.webkit.org/show_bug.cgi?id=194457

Reviewed by Saam Barati.

It is currently used repeatedly in B3ReduceStrength, as well as once in B3LowerToAir.
It has a needlessly complex rule for BitAnd, and has no rule for other easy cases such as BitOr or Select.
No new tests added as this should be indirectly tested by the already existing tests.

* b3/B3Value.cpp:
(JSC::B3::Value::returnsBool const):

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

8 months agoAlign with Fetch on data: URLs
commit-queue@webkit.org [Wed, 13 Feb 2019 01:33:55 +0000 (01:33 +0000)]
Align with Fetch on data: URLs
https://bugs.webkit.org/show_bug.cgi?id=182325

Patch by Rob Buis <rbuis@igalia.com> on 2019-02-12
Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Update improved test expectations.

* web-platform-tests/fetch/data-urls/processing.any-expected.txt:
* web-platform-tests/fetch/data-urls/processing.any.worker-expected.txt:

Source/WebCore:

The MIME type part of the data url should be serialized as
specified in step 3 under "data" [1].

Test: web-platform-tests/fetch/data-urls/processing.any.js

[1] https://fetch.spec.whatwg.org/#concept-scheme-fetch

* platform/network/DataURLDecoder.cpp:
(WebCore::DataURLDecoder::parseMediaType):

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

8 months ago[iOS] Youtube fails to play.
pvollan@apple.com [Wed, 13 Feb 2019 01:32:56 +0000 (01:32 +0000)]
[iOS] Youtube fails to play.
https://bugs.webkit.org/show_bug.cgi?id=194565
<rdar://problem/47974770>

Reviewed by Geoffrey Garen.

This is caused by sandbox violations and was introduced in r240500.

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

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

8 months agoBuild fix after r241320
achristensen@apple.com [Wed, 13 Feb 2019 01:05:43 +0000 (01:05 +0000)]
Build fix after r241320
https://bugs.webkit.org/show_bug.cgi?id=194271

* page/Frame.cpp:
(WebCore::Frame::requestDOMPasteAccess):

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

8 months agoRemove firing assertion after r241317
achristensen@apple.com [Wed, 13 Feb 2019 01:01:59 +0000 (01:01 +0000)]
Remove firing assertion after r241317
https://bugs.webkit.org/show_bug.cgi?id=194506

* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::setDefersLoading):
The creation of a PageGroupLoadDeferrer in Chrome.cpp tries to defer loading.
See comments in Chrome::runJavaScriptAlert et al.
This was necessary with WebKitLegacy, so keep it, but it doesn't need to do anything in modern WebKit.

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

8 months agowebkitpy: Remove bug_dummy from parsed test expectations
jbedard@apple.com [Wed, 13 Feb 2019 00:45:39 +0000 (00:45 +0000)]
webkitpy: Remove bug_dummy from parsed test expectations
https://bugs.webkit.org/show_bug.cgi?id=194562
<rdar://problem/47853999>

Reviewed by Lucas Forschler.

* Scripts/webkitpy/layout_tests/models/test_expectations.py:
(TestExpectationParser):
(TestExpectationParser.expectation_for_skipped_test): Remove DUMMY_BUG_MODIFIER from
skipped tests.
* Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py:

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

8 months ago[WebGPU] Remove WebGPUBufferDescriptor/Usage and use GPU versions
justin_fan@apple.com [Wed, 13 Feb 2019 00:23:10 +0000 (00:23 +0000)]
[WebGPU] Remove WebGPUBufferDescriptor/Usage and use GPU versions
https://bugs.webkit.org/show_bug.cgi?id=194552

Reviewed by Dean Jackson.

WebGPUBufferDescriptor/Usage have been renamed to GPUBufferDescriptor/Usage in the Web GPU API.
Source/WebCore:

Consolidate the two versions of these classes in our implementation.

Affected layout tests updated with new names. No change in behavior.

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/webgpu/GPUBufferDescriptor.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBufferDescriptor.idl.
* Modules/webgpu/GPUBufferUsage.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBufferUsage.idl.
* Modules/webgpu/WebGPUBufferUsage.h: Removed.
* Modules/webgpu/WebGPUDevice.cpp:
(WebCore::WebGPUDevice::createBuffer const):
* Modules/webgpu/WebGPUDevice.h:
* Modules/webgpu/WebGPUDevice.idl:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:
* platform/graphics/gpu/GPUBufferDescriptor.h: Moved out GPUBufferUsage.
* platform/graphics/gpu/GPUBufferUsage.h: Moved from GPUBufferDescriptor.h.

LayoutTests:

Update affected tests to match.

* webgpu/bind-groups.html:
* webgpu/buffer-resource-triangles.html:
* webgpu/buffers.html:
* webgpu/depth-enabled-triangle-strip.html:
* webgpu/vertex-buffer-triangle-strip.html:

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

8 months agoUnreviewed, try to fix the internal iOS build after r241321
wenson_hsieh@apple.com [Wed, 13 Feb 2019 00:19:04 +0000 (00:19 +0000)]
Unreviewed, try to fix the internal iOS build after r241321

* accessibility/mac/WebAccessibilityObjectWrapperBase.mm:

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

8 months ago[ews-app] Add method to fetch patch
aakash_jain@apple.com [Wed, 13 Feb 2019 00:02:23 +0000 (00:02 +0000)]
[ews-app] Add method to fetch patch
https://bugs.webkit.org/show_bug.cgi?id=194518

Reviewed by Lucas Forschler.

* BuildSlaveSupport/ews-app/ews/models/patch.py:
(Patch.get_patch):

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

8 months agoWeb Inspector: Experimental setting for CPU Usage Timeline improvements
commit-queue@webkit.org [Wed, 13 Feb 2019 00:00:25 +0000 (00:00 +0000)]
Web Inspector: Experimental setting for CPU Usage Timeline improvements
https://bugs.webkit.org/show_bug.cgi?id=194556

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2019-02-12
Reviewed by Matt Baker.

* UserInterface/Main.html:
* UserInterface/Views/LegacyCPUTimelineView.css: Added.
* UserInterface/Views/LegacyCPUTimelineView.js: Added.
Copy of CPUTimelineView.js/css to be used when the setting is not set.

* UserInterface/Views/ContentView.js:
(WI.ContentView.createFromRepresentedObject):
ContentView to create based on the setting.

* UserInterface/Base/Setting.js:
* UserInterface/Views/SettingsTabContentView.js:
(WI.SettingsTabContentView.prototype._createExperimentalSettingsView):
Experimental switch.

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

8 months ago[LFC] Expand tests coverage (60 new tests -> 860)
zalan@apple.com [Tue, 12 Feb 2019 23:59:51 +0000 (23:59 +0000)]
[LFC] Expand tests coverage (60 new tests -> 860)

Unreviewed test gardening (run-singly, --child-processes=1).

* LayoutReloaded/misc/LFC-passing-tests.txt:

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

8 months agoFind on Page shouldn't zoom in on matches
timothy_horton@apple.com [Tue, 12 Feb 2019 23:33:23 +0000 (23:33 +0000)]
Find on Page shouldn't zoom in on matches
https://bugs.webkit.org/show_bug.cgi?id=194557
<rdar://problem/42087017>

Reviewed by Wenson Hsieh.

* UIProcess/ios/SmartMagnificationController.h:
* UIProcess/ios/SmartMagnificationController.messages.in:
* UIProcess/ios/SmartMagnificationController.mm:
(WebKit::SmartMagnificationController::scrollToRect):
* WebProcess/WebPage/ios/FindControllerIOS.mm:
(WebKit::FindController::updateFindIndicator):
Only scroll to reveal the find result, do not zoom in.

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

8 months agoAllow pages to trigger programmatic paste from script on iOS
wenson_hsieh@apple.com [Tue, 12 Feb 2019 23:18:30 +0000 (23:18 +0000)]
Allow pages to trigger programmatic paste from script on iOS
https://bugs.webkit.org/show_bug.cgi?id=194271
<rdar://problem/47808810>

Reviewed by Tim Horton.

Source/WebCore:

Tests: editing/pasteboard/ios/dom-paste-confirmation.html
       editing/pasteboard/ios/dom-paste-consecutive-confirmations.html
       editing/pasteboard/ios/dom-paste-rejection.html
       editing/pasteboard/ios/dom-paste-requires-user-gesture.html

* dom/UserGestureIndicator.cpp:
(WebCore::UserGestureIndicator::~UserGestureIndicator):

Reset a gesture token's DOM paste access when exiting the scope of a user gesture. This prevents DOM paste
access permissions from leaking into `setTimeout()` callbacks when we forward user gesture tokens.

* dom/UserGestureIndicator.h:
(WebCore::UserGestureToken::resetDOMPasteAccess):

Source/WebKit:

Cancel the pending DOM paste access handler when the menu is about to hide, rather than when the hiding
animation has completed. This ensures that if the page (on behalf of the user) requests DOM paste again during
user interaction before the callout bar has finished fading after the previous DOM paste, we won't automatically
cancel the incoming DOM paste access request because the callout bar animation finished.

This scenario is exercised in the layout test editing/pasteboard/ios/dom-paste-consecutive-confirmations.html.

* Platform/spi/ios/UIKitSPI.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setupInteraction]):
(-[WKContentView _willHideMenu:]):
(-[WKContentView _didHideMenu:]):

Tools:

Add support for interacting with the callout bar on iOS during layout tests. See below for more detail.

* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::platformSetDidShowMenuCallback):
(WTR::UIScriptController::platformSetDidHideMenuCallback):
(WTR::UIScriptController::rectForMenuAction const):

Add new mechanisms to make it possible to interact with and query the state of the callout menu on iOS. This
includes determining the rect (in content view coordinates) of the menu's controls, and callbacks to register
for when the menu is shown or hidden.

* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptContext.h:
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::setDidShowMenuCallback):
(WTR::UIScriptController::didShowMenuCallback const):
(WTR::UIScriptController::setDidHideMenuCallback):
(WTR::UIScriptController::didHideMenuCallback const):
(WTR::UIScriptController::platformSetDidShowMenuCallback):
(WTR::UIScriptController::platformSetDidHideMenuCallback):
(WTR::UIScriptController::rectForMenuAction const):
* TestRunnerShared/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetPreferencesToConsistentValues):
(WTR::updateTestOptionsFromTestHeader):
* WebKitTestRunner/TestOptions.h:

Add a new test option to determine whether DOM paste is enabled. DOM paste is currently enabled everywhere by
default, but these new programmatic paste tests require it to be disabled in order for confirmation UI to show.

(WTR::TestOptions::hasSameInitializationOptions const):
* WebKitTestRunner/UIScriptControllerCocoa.mm:
(WTR::UIScriptController::calendarType const):
(WTR::UIScriptController::platformUndoManager const):
* WebKitTestRunner/cocoa/TestRunnerWKWebView.h:
* WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
(-[TestRunnerWKWebView initWithFrame:configuration:]):
(-[TestRunnerWKWebView dealloc]):
(-[TestRunnerWKWebView _didShowMenu]):
(-[TestRunnerWKWebView _didHideMenu]):

Listen to when the callout bar is presented and dismissed, and invoke testing callbacks as needed.

* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::handleMenuWillHideNotification):
(WTR::handleMenuDidHideNotification):
(WTR::TestController::platformInitialize):
(WTR::TestController::platformDestroy):
(WTR::TestController::platformResetStateToConsistentValues):

Additionally ensure that any callout menu presented by a previous layout test is dismissed before running the
next test by hiding the callout bar if necessary, and then waiting for the "DidHide" notification.

* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::forEachViewInHierarchy):
(WTR::findViewInHierarchyOfType):

Move `forEachViewInHierarchy` so that we can use it throughout the file, and then add some additional helper
functions that dig through a given view's hierarchy in search of a view of a given class.

(WTR::UIScriptController::selectionStartGrabberViewRect const):
(WTR::UIScriptController::selectionEndGrabberViewRect const):
(WTR::UIScriptController::selectionCaretViewRect const):
(WTR::UIScriptController::selectionRangeViewRects const):
(WTR::UIScriptController::platformSetDidShowMenuCallback):
(WTR::UIScriptController::platformSetDidHideMenuCallback):

Tweak these to use `platformContentView` instead of grabbing the content view from WKWebView directly.

(WTR::UIScriptController::rectForMenuAction const):

Add a new UIScriptController method to get the rect of the action in the contextual menu (on iOS, this is the
callout bar) whose label matches the given string.

(WTR::UIScriptController::platformContentView const):

Add a `platformContentView()` helper on UIScriptController so that we can stop grabbing the value for key
"_currentContentView" from various places in this file. Additionally, rewrite `platformUndoManager()` in terms
of this new helper, and move the code out from iOS/macOS-specific files into UIScriptControllerCocoa.

(WTR::UIScriptController::platformUndoManager const): Deleted.
* WebKitTestRunner/mac/UIScriptControllerMac.mm:
(WTR::UIScriptController::platformContentView const):
(WTR::UIScriptController::platformUndoManager const): Deleted.

LayoutTests:

Add new tests to exercise programmatic pasting.

* TestExpectations:
* editing/pasteboard/ios/dom-paste-confirmation-expected.txt: Added.
* editing/pasteboard/ios/dom-paste-confirmation.html: Added.

Verify that the user can tap "Paste" to allow programmatic pasting.

* editing/pasteboard/ios/dom-paste-consecutive-confirmations-expected.txt: Added.
* editing/pasteboard/ios/dom-paste-consecutive-confirmations.html: Added.

Verify that DOM paste access isn't carried over when using `setTimeout` in a user gesture event handler.

* editing/pasteboard/ios/dom-paste-rejection-expected.txt: Added.
* editing/pasteboard/ios/dom-paste-rejection.html: Added.

Verify that resigning first responder dismisses the callout bar and does not allow programmatic pasting.

* editing/pasteboard/ios/dom-paste-requires-user-gesture-expected.txt: Added.
* editing/pasteboard/ios/dom-paste-requires-user-gesture.html: Added.

Verify that user gesture is required to present the callout menu for a programmatic paste request.

* editing/pasteboard/ios/resources/dom-paste-helper.js: Added.
(return.new.Promise.):
(async._waitForOrTriggerPasteMenu):
(async.triggerPasteMenuAfterTapAt):
(async.waitForPasteMenu):

Add helpers to summon, wait for, and interact with the callout bar when the page attempts to trigger a paste.

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

Skip editing/pasteboard/ios by default, and enable it only in the modern WebKit port of iOS.

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

8 months agoAX: IsolatedTree: Implement more attributes
cfleizach@apple.com [Tue, 12 Feb 2019 22:55:33 +0000 (22:55 +0000)]
AX: IsolatedTree: Implement more attributes
https://bugs.webkit.org/show_bug.cgi?id=193911
<rdar://problem/47599217>

Reviewed by Daniel Bates.

Source/WebCore:

Make use of new HIServices SPI to use a secondary AX thread.
Store root node/focused node status in IsolatedTree rather than on the element.
Implement the following attributes: children, parent, isIgnored, isTree, isTreeItem, relativeFrame, speechHint, title, description.
Implement hit-testing using relative-frames.
Ensure that WKAccessibilityWebPageObject queries happen on main thread when they need to.

* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::generateIsolatedAccessibilityTree):
* accessibility/AXObjectCache.h:
(WebCore::AXObjectCache::focusedUIElementForPage):
* accessibility/AccessibilityAttachment.cpp:
(WebCore::AccessibilityAttachment::accessibilityText const):
(WebCore::AccessibilityAttachment::accessibilityText): Deleted.
* accessibility/AccessibilityAttachment.h:
* accessibility/AccessibilityImageMapLink.cpp:
(WebCore::AccessibilityImageMapLink::accessibilityText const):
(WebCore::AccessibilityImageMapLink::accessibilityText): Deleted.
* accessibility/AccessibilityImageMapLink.h:
* accessibility/AccessibilityMediaControls.cpp:
(WebCore::AccessibilityMediaControl::accessibilityText const):
(WebCore::AccessibilityMediaControl::accessibilityText): Deleted.
* accessibility/AccessibilityMediaControls.h:
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::accessibilityText const):
(WebCore::AccessibilityNodeObject::accessibilityText): Deleted.
* accessibility/AccessibilityNodeObject.h:
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::convertFrameToSpace const):
(WebCore::AccessibilityObject::relativeFrame const):
(WebCore::AccessibilityObject::elementAccessibilityHitTest const):
(WebCore::AccessibilityObject::focusedUIElement const):
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::accessibilityText const):
(WebCore::AccessibilityObject::isLink const): Deleted.
(WebCore::AccessibilityObject::isImage const): Deleted.
(WebCore::AccessibilityObject::isAttachment const): Deleted.
(WebCore::AccessibilityObject::isFileUploadButton const): Deleted.
(WebCore::AccessibilityObject::isImageMapLink const): Deleted.
(WebCore::AccessibilityObject::isMediaControlLabel const): Deleted.
(WebCore::AccessibilityObject::isTree const): Deleted.
(WebCore::AccessibilityObject::isTreeItem const): Deleted.
(WebCore::AccessibilityObject::isScrollbar const): Deleted.
(WebCore::AccessibilityObject::accessibilityHitTest const): Deleted.
(WebCore::AccessibilityObject::accessibilityText): Deleted.
(WebCore::AccessibilityObject::roleValue const): Deleted.
(WebCore::AccessibilityObject::wrapper const): Deleted.
* accessibility/AccessibilityObjectInterface.h: Replaced.
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::isTabItemSelected const):
(WebCore::AccessibilityRenderObject::remoteSVGElementHitTest const):
(WebCore::AccessibilityRenderObject::elementAccessibilityHitTest const):
(WebCore::AccessibilityRenderObject::accessibilityHitTest const):
(WebCore::AccessibilityRenderObject::selectedChildren):
* accessibility/AccessibilityRenderObject.h:
* accessibility/AccessibilitySVGElement.cpp:
(WebCore::AccessibilitySVGElement::accessibilityText const):
(WebCore::AccessibilitySVGElement::accessibilityText): Deleted.
* accessibility/AccessibilitySVGElement.h:
* accessibility/AccessibilityScrollView.cpp:
(WebCore::AccessibilityScrollView::accessibilityHitTest const):
* accessibility/AccessibilityScrollView.h:
* accessibility/ios/AccessibilityObjectIOS.mm:
(WebCore::AccessibilityObject::fileUploadButtonReturnsValueInTitle const):
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper fileUploadButtonReturnsValueInTitle]): Deleted.
* accessibility/isolatedtree: Replaced.
* accessibility/isolatedtree/AXIsolatedTree.cpp: Added.
(WebCore::AXIsolatedTree::treePageCache):
(WebCore::AXIsolatedTree::AXIsolatedTree):
(WebCore::AXIsolatedTree::nodeInTreeForID):
(WebCore::AXIsolatedTree::nodeForID const):
(WebCore::AXIsolatedTree::focusedUIElement):
(WebCore::AXIsolatedTree::setRootNodeID):
(WebCore::AXIsolatedTree::setFocusedNodeID):
(WebCore::AXIsolatedTree::setInitialRequestInProgress):
(WebCore::AXIsolatedTree::applyPendingChanges):
* accessibility/isolatedtree/AXIsolatedTree.h: Added.
* accessibility/isolatedtree/AXIsolatedTreeNode.cpp: Added.
(WebCore::AXIsolatedTreeNode::AXIsolatedTreeNode):
(WebCore::AXIsolatedTreeNode::~AXIsolatedTreeNode):
(WebCore::AXIsolatedTreeNode::initializeAttributeData):
(WebCore::AXIsolatedTreeNode::setProperty):
(WebCore::AXIsolatedTreeNode::setParent):
(WebCore::AXIsolatedTreeNode::setTreeIdentifier):
(WebCore::AXIsolatedTreeNode::focusedUIElement const):
(WebCore::AXIsolatedTreeNode::parentObjectInterfaceUnignored const):
(WebCore::AXIsolatedTreeNode::accessibilityHitTest const):
(WebCore::AXIsolatedTreeNode::tree const):
(WebCore::AXIsolatedTreeNode::rectAttributeValue const):
(WebCore::AXIsolatedTreeNode::stringAttributeValue const):
* accessibility/isolatedtree/AXIsolatedTreeNode.h: Added.
* accessibility/mac/AXObjectCacheMac.mm:
(WebCore::AXObjectCache::associateIsolatedTreeNode):
* accessibility/mac/AccessibilityObjectBase.mm: Added.
(WebCore::AccessibilityObject::speechHintAttributeValue const):
(WebCore::AccessibilityObject::descriptionAttributeValue const):
(WebCore::AccessibilityObject::titleAttributeValue const):
(WebCore::AccessibilityObject::helpTextAttributeValue const):
* accessibility/mac/AccessibilityObjectMac.mm:
(WebCore::AccessibilityObject::fileUploadButtonReturnsValueInTitle const):
* accessibility/mac/WebAccessibilityObjectWrapperBase.h:
* accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
(addChildToArray):
(convertToNSArray):
(-[WebAccessibilityObjectWrapperBase isolatedTreeNode]):
(-[WebAccessibilityObjectWrapperBase detach]):
(-[WebAccessibilityObjectWrapperBase updateObjectBackingStore]):
(-[WebAccessibilityObjectWrapperBase accessibilityObject]):
(-[WebAccessibilityObjectWrapperBase baseAccessibilityTitle]):
(-[WebAccessibilityObjectWrapperBase axBackingObject]):
(-[WebAccessibilityObjectWrapperBase baseAccessibilityDescription]):
(-[WebAccessibilityObjectWrapperBase baseAccessibilitySpeechHint]):
(-[WebAccessibilityObjectWrapperBase baseAccessibilityHelpText]):
(convertPathToScreenSpaceFunction):
(-[WebAccessibilityObjectWrapperBase convertRectToSpace:space:]):
(-[WebAccessibilityObjectWrapperBase ariaLandmarkRoleDescription]):
(-[WebAccessibilityObjectWrapperBase titleTagShouldBeUsedInDescriptionField]): Deleted.
(-[WebAccessibilityObjectWrapperBase fileUploadButtonReturnsValueInTitle]): Deleted.
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper IGNORE_WARNINGS_END]):
(-[WebAccessibilityObjectWrapper childrenVectorSize]):
(-[WebAccessibilityObjectWrapper childrenVectorArray]):
(-[WebAccessibilityObjectWrapper position]):
(-[WebAccessibilityObjectWrapper subrole]):
(-[WebAccessibilityObjectWrapper roleDescription]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
(-[WebAccessibilityObjectWrapper accessibilityFocusedUIElement]):
(-[WebAccessibilityObjectWrapper accessibilityHitTest:]):
(-[WebAccessibilityObjectWrapper accessibilityIndexOfChild:]):
(-[WebAccessibilityObjectWrapper accessibilityArrayAttributeCount:]):
(-[WebAccessibilityObjectWrapper accessibilityArrayAttributeValues:index:maxCount:]):

Source/WebCore/PAL:

* pal/spi/mac/HIServicesSPI.h:

Source/WebKit:

* Platform/spi/mac/AccessibilityPrivSPI.h: Added.
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.h:
* WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
(-[WKAccessibilityWebPageObjectBase clientSupportsIsolatedTree]):
(-[WKAccessibilityWebPageObjectBase isolatedTreeRootObject]):
(-[WKAccessibilityWebPageObjectBase accessibilityRootObjectWrapper]):
* WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
(-[WKAccessibilityWebPageObject IGNORE_WARNINGS_END]):
(-[WKAccessibilityWebPageObject convertScreenPointToRootView:]):
(-[WKAccessibilityWebPageObject accessibilityAttributeValue:]):
(-[WKAccessibilityWebPageObject accessibilityAttributeSizeValue]):
(-[WKAccessibilityWebPageObject accessibilityAttributePositionValue]):
(-[WKAccessibilityWebPageObject accessibilityDataDetectorValue:point:]):
(-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]):
(-[WKAccessibilityWebPageObject accessibilityHitTest:]):

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

8 months agoAllow pages to trigger programmatic paste from script on iOS
wenson_hsieh@apple.com [Tue, 12 Feb 2019 22:37:48 +0000 (22:37 +0000)]
Allow pages to trigger programmatic paste from script on iOS
https://bugs.webkit.org/show_bug.cgi?id=194271
<rdar://problem/47808810>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Add support for allowing script to trigger programmatic paste commands. Currently on macOS and iOS, the ability
to trigger programmatic paste (i.e. `document.execCommand('Paste');`) is disabled by default, such that
execCommand is simply a no-op that returns false. This policy is a privacy measure (common among other major
browsers) that prevents untrusted web content from sniffing content from the system pasteboard (even on user
interaction, since unintended user interaction occasionally happens as well!).

In order to make it possible for web pages to programmatically paste without opening the door to privacy and
security issues, we make paste commands triggered from bindings present platform UI on iOS, in the form of a
callout bar with the single option to paste. This UI is dismissed upon any user interaction; furthermore, any
user interaction short of explicitly triggering the "Paste" action subsequently prevents the page from executing
the paste (and causes execCommand to return false). However, if the paste action is chosen by the user, we
instead follow through with the programmatic paste command.

New tests to come in a followup patch.

* WebCore.xcodeproj/project.pbxproj:
* dom/DOMPasteAccessPolicy.h: Added.
* dom/UserGestureIndicator.h:
(WebCore::UserGestureToken::domPasteAccessPolicy const):
(WebCore::UserGestureToken::didRequestDOMPasteAccess):

Add helpers on UserGestureToken to update and query the current DOM paste access policy. The access policies are
"NotRequestedYet" (i.e. pending a response from the user), "Granted" (the user has granted DOM paste access to
the page), or "Denied" (the user has prevented the page from reading the contents of the clipboard). When DOM
paste access is granted or rejected, make this decision sticky until the end of the current user gesture.

* editing/EditorCommand.cpp:
(WebCore::executePaste):
(WebCore::executePasteAndMatchStyle):
(WebCore::executePasteAsPlainText):
(WebCore::executePasteAsQuotation):

When executing a paste command where the source is DOM bindings, request DOM paste if needed before proceeding
with the paste.

(WebCore::supportedPaste):
* loader/EmptyClients.cpp:
* page/EditorClient.h:
* page/Frame.cpp:
(WebCore::Frame::requestDOMPasteAccess):

Add a helper method that requests access to the clipboard on behalf of script when pasting.

* page/Frame.h:
* page/Settings.yaml:

Introduce a new WebCore setting, used to gate DOM paste access requests.

Source/WebKit:

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

Add an internal setting to enable or disable DOM paste access requests. This is on by default in iOS only
(excluding watchOS and Apple TV), and is additionally disabled on macOS.

* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::requestDOMPasteAccess):
* UIProcess/API/gtk/PageClientImpl.h:
* UIProcess/API/wpe/PageClientImpl.cpp:
(WebKit::PageClientImpl::requestDOMPasteAccess):

Plumb DOM paste access requests from the web process (WebEditorClient) to the view (WKContentView). As per the
usual, this involves WebEditorClient, WebPage, WebPageProxy, PageClient and finally WKContentView.

* UIProcess/API/wpe/PageClientImpl.h:
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::requestDOMPasteAccess):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::requestDOMPasteAccess):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setupInteraction]):
(-[WKContentView cleanupInteraction]):
(-[WKContentView resignFirstResponderForWebView]):
(-[WKContentView _webTouchEventsRecognized:]):

Bail from any pending DOM paste access handler the moment we start handling touches on the web view, or if the
web view resigns first responder, or if the web process crashes.

(-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):

Reject text selection gestures while waiting for DOM paste access.

(-[WKContentView canPerformAction:withSender:]):
(-[WKContentView canPerformActionForWebView:withSender:]):

If we're handling a DOM paste, always return YES to allow the callout bar to show the "Paste" option.

(-[WKContentView _didHideMenu:]):

If the menu is programmatically hidden by the app while handling a DOM paste request, immediately reject the DOM
paste request.

(-[WKContentView pasteForWebView:]):

Adjust -pasteForWebView: on WKContentView to first check whether there's an outstanding DOM paste completion
handler to invoke, instead of telling the page to execute a paste command.

(-[WKContentView _handleDOMPasteRequestWithResult:]):

Add a helper to take and invoke the current DOM paste completion handler (if it exists) with the given result,
and then dismiss the shared callout bar. Returns whether or not the paste completion handler exists. Invoked
from various sources of user interaction or significant state changes (e.g. following a web process crash in
-cleanupInteraction).

(-[WKContentView _willPerformAction:sender:]):
(-[WKContentView _didPerformAction:sender:]):

Add hooks to detect when WKContentView is executing an editing action. This is to ensure that the page doesn't
get stuck in a bad state in the case where WKWebView has been subclassed, overrides `-paste:`, and does not
invoke the superclass method (which calls back into `-[WKContentView pasteForWebView:]`). There are a few
possibilities here:
1. WKWebView's `-paste:` action is not overridden. In this case, we will call back into `-pasteForWebView:`,
   which will notice that we have a pending paste completion handler and invoke it.
2. WKWebView's `-paste:` action is overridden and does not call back into the content view. In this case, we
   will invoke the paste completion handler in `-_didPerformAction:sender:`.
3. WKWebView's `-canPerformAction:withSender:` is overridden to include additional actions. In this case, we may
   get a call to invoke a different action selector while waiting for a potential paste action. If this happens,
   prevent the DOM paste in `-_willPerformAction:sender:` prior to handling the other action.

(-[WKContentView handleKeyWebEvent:withCompletionHandler:]):

Dismiss DOM paste UI upon handling any key event.

(-[WKContentView showGlobalMenuControllerInRect:]):
(-[WKContentView hideGlobalMenuController]):

Helper methods to present and dismiss the global UIMenuController, that accounts for available platform APIs for
presenting or dismissing the menu controller on iOS.

(-[WKContentView _requestDOMPasteAccessWithElementRect:completionHandler:]):

Attempt to find a good target presentation rect when showing the callout menu. First, we will try to use the
rect of the element the user has interacted with when triggering the paste. If such an element is too large or
does not exist, we fall back to presenting the callout menu near the user's last touch location (with a small
amount of margin, such that the action doesn't overlap with the user's finger, stylus, etc.).

(-[WKContentView _resetShowingTextStyle:]): Deleted.

Rename this to `-_didHideMenu:`.

* UIProcess/mac/PageClientImplMac.h:
* UIProcess/win/PageClientImpl.cpp:
(WebKit::PageClientImpl::requestDOMPasteAccess):
* UIProcess/win/PageClientImpl.h:
* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::requestDOMPasteAccess):
* WebProcess/WebCoreSupport/WebEditorClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::requestDOMPasteAccess):

Add more plumbing and method stubs.

(WebKit::WebPage::updateCurrentModifierState):
(WebKit::WebPage::rectForElementAtInteractionLocation const):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::rectForElementAtInteractionLocation const):
(WebKit::WebPage::rectForElementAtInteractionLocation): Deleted.

Mark this method as const, add a platform-agnostic stub, and adopt it for the purposes of determining where to
position the callout bar when pasting.

Source/WebKitLegacy/mac:

See WebCore and WebKit ChangeLogs for more details.

* WebCoreSupport/WebEditorClient.h:

Source/WebKitLegacy/win:

* WebCoreSupport/WebEditorClient.h:

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

8 months agoSource/WebCore:
dino@apple.com [Tue, 12 Feb 2019 21:57:48 +0000 (21:57 +0000)]
Source/WebCore:
Remove setDefersLoading infrastructure from WebKit2
https://bugs.webkit.org/show_bug.cgi?id=194506

Patch by Alex Christensen <achristensen@webkit.org> on 2019-02-12
Reviewed by Brady Eidson.

setDefersLoading is inherently racy from WebCore to the NetworkProcess,
it adds unwanted complexity to the initialization and use of network objects,
and it has led to many unrecoverable hang bugs over the years.
We needed to force it into WebKit2 to transition some existing clients who relied on it,
but we have recently finished transitioning those clients to other solutions, mostly
completion handlers.

* inspector/PageScriptDebugServer.cpp:
(WebCore::PageScriptDebugServer::setJavaScriptPaused):

LayoutTests:
BitmapRenderer should handle existing ImageBuffers
https://bugs.webkit.org/show_bug.cgi?id=194555
<rdar://problem/47857150>

Reviewed by Tim Horton.

Test that creates a canvas, triggers an ImageBuffer to be created, then
creates the bitmaprenderer context.

* fast/canvas/bitmaprenderer-created-after-toBlob-expected.txt: Added.
* fast/canvas/bitmaprenderer-created-after-toBlob.html: Added.

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

8 months agowebkitpy: No option to only show unexpected failures in results.html for iPad
jbedard@apple.com [Tue, 12 Feb 2019 21:53:00 +0000 (21:53 +0000)]
webkitpy: No option to only show unexpected failures in results.html for iPad
https://bugs.webkit.org/show_bug.cgi?id=194554
<rdar://problem/47922442>

Rubber-stamped by Aakash Jain.

Just because a TestExpecations file does not exist for a specific platform does not mean that
TestExpecations are not being used, given that platforms inherit test expectations.

* Scripts/webkitpy/port/base.py:
(Port.uses_test_expectations_file): Check all possible locations of a TestExpectations file.
* Scripts/webkitpy/port/base_unittest.py:
(PortTest.test_uses_test_expectations_file):

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

8 months agoRemove setDefersLoading infrastructure from WebKit2
achristensen@apple.com [Tue, 12 Feb 2019 21:49:39 +0000 (21:49 +0000)]
Remove setDefersLoading infrastructure from WebKit2
https://bugs.webkit.org/show_bug.cgi?id=194506

Reviewed by Brady Eidson.

Source/WebCore:

setDefersLoading is inherently racy from WebCore to the NetworkProcess,
it adds unwanted complexity to the initialization and use of network objects,
and it has led to many unrecoverable hang bugs over the years.
We needed to force it into WebKit2 to transition some existing clients who relied on it,
but we have recently finished transitioning those clients to other solutions, mostly
completion handlers.

* inspector/PageScriptDebugServer.cpp:
(WebCore::PageScriptDebugServer::setJavaScriptPaused):

Source/WebKit:

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::setDefersLoading): Deleted.
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkDataTask.h:
* NetworkProcess/NetworkDataTaskBlob.cpp:
(WebKit::NetworkDataTaskBlob::suspend): Deleted.
* NetworkProcess/NetworkDataTaskBlob.h:
* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::initialize):
(WebKit::NetworkLoad::setDefersLoading): Deleted.
* NetworkProcess/NetworkLoad.h:
* NetworkProcess/NetworkLoadParameters.h:
* NetworkProcess/NetworkResourceLoadParameters.cpp:
(WebKit::NetworkResourceLoadParameters::encode const):
(WebKit::NetworkResourceLoadParameters::decode):
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::start):
(WebKit::NetworkResourceLoader::startNetworkLoad):
(WebKit::NetworkResourceLoader::setDefersLoading): Deleted.
* NetworkProcess/NetworkResourceLoader.h:
* NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::suspend): Deleted.
* NetworkProcess/curl/NetworkDataTaskCurl.cpp:
(WebKit::NetworkDataTaskCurl::suspend): Deleted.
* NetworkProcess/curl/NetworkDataTaskCurl.h:
* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::suspend): Deleted.
* NetworkProcess/soup/NetworkDataTaskSoup.h:
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
(WebKit::WebLoaderStrategy::setDefersLoading):

Tools:

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setDefersLoading): Deleted.
* WebKitTestRunner/InjectedBundle/TestRunner.h:

LayoutTests:

* platform/wk2/TestExpectations:

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

8 months agoUnreviewed, fix build warnings after content extensions enablement
mcatanzaro@igalia.com [Tue, 12 Feb 2019 21:35:59 +0000 (21:35 +0000)]
Unreviewed, fix build warnings after content extensions enablement
https://bugs.webkit.org/show_bug.cgi?id=193622
<rdar://problem/47982850>

Source/WebCore:

* contentextensions/DFABytecode.h:
(WebCore::ContentExtensions::instructionSizeWithArguments):
* contentextensions/DFABytecodeCompiler.h:
* contentextensions/URLFilterParser.cpp:
(WebCore::ContentExtensions::URLFilterParser::statusString):

Source/WebKit:

* UIProcess/API/C/WKUserContentExtensionStoreRef.cpp:
(toResult):

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

8 months agoWeb Inspector: Timeline.prototype.recordsInTimeRange uses a property most records...
commit-queue@webkit.org [Tue, 12 Feb 2019 21:21:56 +0000 (21:21 +0000)]
Web Inspector: Timeline.prototype.recordsInTimeRange uses a property most records do not have
https://bugs.webkit.org/show_bug.cgi?id=194549

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2019-02-12
Reviewed by Devin Rousso.

* UserInterface/Models/Timeline.js:
(WI.Timeline.prototype.recordsInTimeRange):

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

8 months agoUnreviewed, fix -Wimplicit-fallthrough warning after r241140
mcatanzaro@igalia.com [Tue, 12 Feb 2019 21:17:47 +0000 (21:17 +0000)]
Unreviewed, fix -Wimplicit-fallthrough warning after r241140
https://bugs.webkit.org/show_bug.cgi?id=194399
<rdar://problem/47889777>

* dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):

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

8 months agoSwitching focus from a UITextField to an editable WKWebView causes the keyboard to...
timothy_horton@apple.com [Tue, 12 Feb 2019 20:30:20 +0000 (20:30 +0000)]
Switching focus from a UITextField to an editable WKWebView causes the keyboard to dance
https://bugs.webkit.org/show_bug.cgi?id=194524
<rdar://problem/35481797>

Reviewed by Wenson Hsieh.

* Platform/spi/ios/UIKitSPI.h:
* UIProcess/ios/InputViewUpdateDeferrer.h:
* UIProcess/ios/InputViewUpdateDeferrer.mm:
(WebKit::InputViewUpdateDeferrer::InputViewUpdateDeferrer):
(WebKit::InputViewUpdateDeferrer::~InputViewUpdateDeferrer):
Make use of the per-responder and much safer input view pinning mechanism.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView becomeFirstResponderForWebView]):
(-[WKContentView _singleTapCommited:]):
(-[WKContentView _attemptClickAtLocation:modifierFlags:]):
Always temporarily pin input views when becoming first responder; there are
many paths (such as through the text interaction assistant) that can
focus us on tap, trying to cover them all is a fool's errand. We'll
just get out the big hammer and call it in becomeFirstResponder.
This also means we can remove it from _singleTapCommitted and _attemptClick...

(-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
Don't release the input view pinning until we return from _elementDidFocus;
it does the rebuilding synchronously, so we need to have actually updated
all of the prerequisites of -inputView before depinning.

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