Incorrect log message in NetworkSession when creating NetworkDataTask
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-08-10  Sihui Liu  <sihui_liu@apple.com>
2
3         Incorrect log message in NetworkSession when creating NetworkDataTask
4         https://bugs.webkit.org/show_bug.cgi?id=188463
5
6         Reviewed by Chris Dumez.
7
8         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
9         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
10
11 2018-08-09  Ben Richards  <benton_richards@apple.com>
12
13         We should cache the compiled sandbox profile in a data vault
14         https://bugs.webkit.org/show_bug.cgi?id=184991
15
16         Reviewed by Ryosuke Niwa.
17
18         This patch changes a few things (note: data vaults and sandbox entitlements are only used in internal builds):
19         (1) Instead of compiling a sandbox every time a process is launched, processes now look for a cached sandbox
20             in a process specific data vault on macOS platforms. (ChildProcessMac.mm)
21         (2) If a valid cached sandbox is not found, a process will create the data vault (or ensure that it exists),
22             compile a sandbox, and cache it.
23         (3) In order to create process specific data vaults, each process now has their own <process name>-OSX-sandbox.entitlements
24             file which contains an entitlement with a process specific "storage class" which ensures that each process
25             can only ever access its own data vault. (See the article on confluence "Data Vaults and Restricted Files" for more info)
26         (4) The sandbox entitlements file for the Network, WebContent and Plugin services are loaded dynamically
27             through Scripts/<process name>-process-entitlements.sh which is triggered in a new build phase for each service.
28             The Storage process sandbox entitlements are loaded directly in Configurations/StorageService.xcconfig.
29             The reason that the sandbox entitlements are applied dynamically is so that these sandbox entitlements
30             are only applied when WK_USE_RESTRICTED_ENTITLEMENTS is YES. This means that open source builds will still work.
31
32         * Configurations/Network-OSX-sandbox.entitlements: Added.
33         * Configurations/Storage-OSX-sandbox.entitlements: Added.
34         * Configurations/StorageService.xcconfig:
35         * Configurations/WebContent-OSX-sandbox.entitlements: Added.
36         * Configurations/WebKit.xcconfig:
37         * NetworkProcess/NetworkProcess.h:
38         * PluginProcess/PluginProcess.h:
39         * Scripts/process-network-sandbox-entitlements.sh: Added.
40         * Scripts/process-webcontent-sandbox-entitlements.sh: Added.
41         * Shared/ChildProcess.h:
42         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
43         (WebKit::XPCServiceInitializer):
44         * Shared/SandboxInitializationParameters.h:
45         (WebKit::SandboxInitializationParameters::setOverrideSandboxProfilePath):
46         (WebKit::SandboxInitializationParameters::overrideSandboxProfilePath const):
47         (WebKit::SandboxInitializationParameters::setSandboxProfile):
48         (WebKit::SandboxInitializationParameters::sandboxProfile const):
49         (): Deleted.
50         * Shared/mac/ChildProcessMac.mm:
51         (WebKit::SandboxProfileDeleter::operator()):
52         (WebKit::SandboxParametersDeleter::operator()):
53         (WebKit::SandboxInfo::SandboxInfo):
54         (WebKit::fileContents):
55         (WebKit::processStorageClass):
56         (WebKit::setAndSerializeSandboxParameters):
57         (WebKit::sandboxDataVaultParentDirectory):
58         (WebKit::sandboxDirectory):
59         (WebKit::sandboxFilePath):
60         (WebKit::ensureSandboxCacheDirectory):
61         (WebKit::writeSandboxDataToCacheFile):
62         (WebKit::compileAndCacheSandboxProfile):
63         (WebKit::tryApplyCachedSandbox):
64         (WebKit::webKit2Bundle):
65         (WebKit::sandboxProfilePath):
66         (WebKit::compileAndApplySandboxSlowCase):
67         (WebKit::applySandbox):
68         (WebKit::initializeSandboxParameters):
69         (WebKit::ChildProcess::initializeSandbox):
70         * Shared/mac/SandboxInitialiationParametersMac.mm:
71         (WebKit::SandboxInitializationParameters::SandboxInitializationParameters):
72         * StorageProcess/StorageProcess.h:
73         * WebKit.xcodeproj/project.pbxproj:
74         * WebProcess/WebProcess.h:
75
76 2018-08-09  Jer Noble  <jer.noble@apple.com>
77
78         Video playback is using more power
79         https://bugs.webkit.org/show_bug.cgi?id=188452
80
81         Reviewed by Eric Carlson.
82
83         * UIProcess/API/Cocoa/WKPreferences.mm:
84         (-[WKPreferences _setLowPowerVideoAudioBufferSizeEnabled:]):
85         (-[WKPreferences _lowPowerVideoAudioBufferSizeEnabled]):
86
87 2018-08-09  Alex Christensen  <achristensen@webkit.org>
88
89         Fix URLSchemeHandler.SyncXHR API test after r234735.
90         https://bugs.webkit.org/show_bug.cgi?id=188358
91
92         * UIProcess/WebURLSchemeTask.cpp:
93         (WebKit::WebURLSchemeTask::didReceiveData):
94         Return after appending data for synchronous loads.  We used to send unused messages.
95
96 2018-08-09  Alex Christensen  <achristensen@webkit.org>
97
98         REGRESSION(234640) Loading stalls in environments without SafariSafeBrowsing framework
99         https://bugs.webkit.org/show_bug.cgi?id=188453
100         <rdar://problem/43102553>
101
102         Reviewed by Chris Dumez.
103
104         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
105         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
106
107 2018-08-09  Alex Christensen  <achristensen@webkit.org>
108
109         WKURLSchemeHandler crashes when sent errors with sync XHR
110         https://bugs.webkit.org/show_bug.cgi?id=188358
111
112         Reviewed by Chris Dumez.
113
114         * UIProcess/WebURLSchemeTask.cpp:
115         (WebKit::WebURLSchemeTask::didReceiveData):
116         (WebKit::WebURLSchemeTask::didComplete):
117         * UIProcess/WebURLSchemeTask.h:
118
119 2018-08-09  Sihui Liu  <sihui_liu@apple.com>
120
121         REGRESSION (r232083): WKWebView loses first-party cookies on iOS
122         https://bugs.webkit.org/show_bug.cgi?id=188443
123         <rdar://problem/42991584>
124
125         Reviewed by Chris Dumez.
126
127         Revert the change to set sharedCookieStorage for iOS as it is breaking Kayak.
128
129         * NetworkProcess/NetworkProcess.h:
130         * NetworkProcess/NetworkProcessCreationParameters.cpp:
131         (WebKit::NetworkProcessCreationParameters::encode const):
132         (WebKit::NetworkProcessCreationParameters::decode):
133         * NetworkProcess/NetworkProcessCreationParameters.h:
134         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
135         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
136         * Shared/WebProcessCreationParameters.cpp:
137         (WebKit::WebProcessCreationParameters::encode const):
138         (WebKit::WebProcessCreationParameters::decode):
139         * Shared/WebProcessCreationParameters.h:
140         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
141         (WebKit::WebProcessPool::platformInitializeWebProcess):
142         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
143
144 2018-08-09  Per Arne Vollan  <pvollan@apple.com>
145
146         DisplayRefreshMonitorMac should hold a weak pointer to WebPage.
147         https://bugs.webkit.org/show_bug.cgi?id=186683
148
149         Reviewed by Brent Fulgham.
150
151         Instead of DisplayRefreshMonitorMac having a RefPtr to WebPage, it should have a weak pointer.
152         Having a RefPtr could in theory create reference cycles. This potential problem has not been
153         observed in practice, but it is safer to use a weak pointer.
154
155         * WebProcess/WebPage/WebPage.h:
156         * WebProcess/WebPage/mac/DrawingAreaMac.cpp:
157         (WebKit::DisplayRefreshMonitorMac::DisplayRefreshMonitorMac):
158         (WebKit::DisplayRefreshMonitorMac::~DisplayRefreshMonitorMac):
159         (WebKit::DisplayRefreshMonitorMac::requestRefreshCallback):
160
161 2018-08-09  Ali Juma  <ajuma@chromium.org>
162
163         Import WPTs for IntersectionObserver
164         https://bugs.webkit.org/show_bug.cgi?id=188416
165
166         Reviewed by Simon Fraser.
167
168         Make IntersectionObserver an experimental feature, so that it is enabled in
169         WebKitTestRunner.
170
171         * Shared/WebPreferences.yaml:
172
173 2018-08-08  Tim Horton  <timothy_horton@apple.com>
174
175         Yet more crashes in MobileSafari under -[WKFormInputSession setSuggestions:]
176         https://bugs.webkit.org/show_bug.cgi?id=188427
177         <rdar://problem/43064672>
178
179         Reviewed by Wenson Hsieh.
180
181         Speculatively fix more crashes seen under setSuggestions.
182
183         * UIProcess/ios/WKContentViewInteraction.mm:
184         (-[WKFormInputSession isValid]):
185         (-[WKFormInputSession setSuggestions:]):
186         (-[WKFormInputSession invalidate]):
187         Belt-and-suspenders fix: use WeakObjCPtr for WKFormInputSession's WKContentView reference.
188
189         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
190         Invalidate the WKFormInputSession before replacing it; we theorize that
191         there is a path in which we get here without having previously called stopAssistingNode.
192         Most of the code is OK with this, but this leaves WKFormInputSession
193         with a raw reference to WKContentView which can later become stale.
194
195 2018-08-08  Don Olmstead  <don.olmstead@sony.com>
196
197         [Curl] Surface additional NetworkLoadMetrics
198         https://bugs.webkit.org/show_bug.cgi?id=188391
199
200         Reviewed by Joseph Pecoraro.
201
202         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
203         (WebKit::NetworkDataTaskCurl::curlDidReceiveResponse):
204
205 2018-08-08  Alex Christensen  <achristensen@webkit.org>
206
207         Fix possible null dereference in WebBackForwardList::restoreFromState
208         https://bugs.webkit.org/show_bug.cgi?id=188418
209         <rdar://problem/42531726>
210
211         Reviewed by Chris Dumez.
212
213         * UIProcess/WebBackForwardList.cpp:
214         (WebKit::WebBackForwardList::restoreFromState):
215         Null-check m_page like we do everywhere else in this file because it can be set to null when closing the page.
216
217 2018-08-08  Commit Queue  <commit-queue@webkit.org>
218
219         Unreviewed, rolling out r234314, r234320, and r234321.
220         https://bugs.webkit.org/show_bug.cgi?id=188414
221
222         Caused email sign in issue (Requested by ryanhaddad on
223         #webkit).
224
225         Reverted changesets:
226
227         "Remove unused WKNavigationDelegatePrivate
228         decidePolicyForNavigationAction SPI"
229         https://bugs.webkit.org/show_bug.cgi?id=188077
230         https://trac.webkit.org/changeset/234314
231
232         "Fix API tests after r234314"
233         https://bugs.webkit.org/show_bug.cgi?id=188077
234         https://trac.webkit.org/changeset/234320
235
236         "Fix API tests after r234314"
237         https://bugs.webkit.org/show_bug.cgi?id=188077
238         https://trac.webkit.org/changeset/234321
239
240 2018-08-08  Simon Fraser  <simon.fraser@apple.com>
241
242         Add a WebKit2 logging channel for ActivityState
243         https://bugs.webkit.org/show_bug.cgi?id=188411
244
245         Reviewed by Tim Horton.
246         
247         Add logging for ActivityState changes and the entrypoints that affect ActivityState.
248
249         * Platform/Logging.h:
250         * UIProcess/Cocoa/WebViewImpl.mm:
251         (WebKit::WebViewImpl::windowDidOrderOffScreen):
252         (WebKit::WebViewImpl::windowDidOrderOnScreen):
253         (WebKit::WebViewImpl::windowDidChangeOcclusionState):
254         (WebKit::WebViewImpl::viewDidMoveToWindow):
255         (WebKit::WebViewImpl::viewDidHide):
256         (WebKit::WebViewImpl::viewDidUnhide):
257         (WebKit::WebViewImpl::activeSpaceDidChange):
258         * UIProcess/WebPageProxy.cpp:
259         (WebKit::WebPageProxy::activityStateDidChange):
260         (WebKit::WebPageProxy::dispatchActivityStateChange):
261         * UIProcess/mac/PageClientImplMac.mm:
262         (WebKit::PageClientImpl::isViewVisible):
263         * WebProcess/WebPage/WebPage.cpp:
264         (WebKit::WebPage::setActivityState):
265
266 2018-08-05  Darin Adler  <darin@apple.com>
267
268         [Cocoa] More tweaks and refactoring to prepare for ARC
269         https://bugs.webkit.org/show_bug.cgi?id=188245
270
271         Reviewed by Dan Bernstein.
272
273         * Platform/cocoa/WKCrashReporter.mm:
274         (WebKit::setCrashLogMessage): Refactor into a separate function for clarity.
275         (WebKit::setCrashReportApplicationSpecificInformation): Use a bridging cast.
276
277         * Shared/mac/PasteboardTypes.mm:
278         (WebKit::PasteboardTypes::forEditing): Use a bridging cast.
279
280         * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
281         (WebKit::convertToNPNNString): Added. Uses CFStringRef rather than NSString so we can
282         manually manage the autoreleasing.
283         (WebKit::initializeKeyboardEvent): Use convertToNPNNString.
284         (WebKit::NetscapePlugin::sendComplexTextInput): Ditto.
285
286         * WebProcess/Plugins/PDF/PDFPlugin.mm: Use __unsafe_unretained explicitly
287         for a parent pointer. We could consider moving to __weak after switching to ARC.
288
289 2018-08-07  Ben Richards  <benton_richards@apple.com>
290
291         Add SPI for launching WebContent process with pre-linked injected bundle
292         https://bugs.webkit.org/show_bug.cgi?id=188367
293
294         Reviewed by Ryosuke Niwa.
295
296         Added SPI to allow applications to set a "customWebContentServiceBundleIdentifier" which will be launched instead of the default WebContent XPC service.
297         The "customWebContentServiceBundleIdentifier" should be the bundle identifier for an XPC service that calls [WKProcessPool _webContentProcessXPCMain].
298         The new XPC service should be hard linked to the application's injected bundle in order to receive the intended performance benefit.
299
300         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
301         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
302         (WebKit::XPCServiceMain):
303         (main):
304         * UIProcess/API/APIProcessPoolConfiguration.h:
305         * UIProcess/API/C/WKContext.cpp:
306         (WKContextSetCustomWebContentServiceBundleIdentifier):
307         * UIProcess/API/C/WKContext.h:
308         * UIProcess/API/Cocoa/WKProcessPool.mm:
309         (+[WKProcessPool _webContentProcessXPCMain]):
310         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
311         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
312         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
313         (-[_WKProcessPoolConfiguration customWebContentServiceBundleIdentifier]):
314         (-[_WKProcessPoolConfiguration setCustomWebContentServiceBundleIdentifier:]):
315         * UIProcess/Launcher/ProcessLauncher.h:
316         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
317         (WebKit::ProcessLauncher::launchProcess):
318         * UIProcess/WebProcessPool.cpp:
319         (WebKit::WebProcessPool::setCustomWebContentServiceBundleIdentifier):
320         * UIProcess/WebProcessPool.h:
321         * UIProcess/WebProcessProxy.cpp:
322         (WebKit::WebProcessProxy::getLaunchOptions):
323         * WebKit.xcodeproj/project.pbxproj:
324
325 2018-08-07  Chris Dumez  <cdumez@apple.com>
326
327         StorageManager should stop ref'ing IPC::Connections as this is leak-prone
328         https://bugs.webkit.org/show_bug.cgi?id=188380
329
330         Reviewed by Alex Christensen.
331
332         StorageManager should stop ref'ing IPC::Connections as this is leak-prone. Instead, assign a unique identifier
333         to each IPC::Connection and store this identifier intead of a RefPtr<IPC::Connection>. When the StorageManager
334         needs an actual IPC::Connection, it can look it up from the identifier.
335
336         * Platform/IPC/Connection.cpp:
337         (IPC::Connection::Connection):
338         (IPC::Connection::~Connection):
339         (IPC::Connection::connection):
340         * Platform/IPC/Connection.h:
341         (IPC::Connection::uniqueID const):
342         * UIProcess/WebStorage/StorageManager.cpp:
343         (WebKit::StorageManager::StorageArea::addListener):
344         (WebKit::StorageManager::StorageArea::removeListener):
345         (WebKit::StorageManager::StorageArea::hasListener const):
346         (WebKit::StorageManager::StorageArea::setItem):
347         (WebKit::StorageManager::StorageArea::removeItem):
348         (WebKit::StorageManager::StorageArea::clear):
349         (WebKit::StorageManager::StorageArea::dispatchEvents const):
350         (WebKit::StorageManager::SessionStorageNamespace::allowedConnection const):
351         (WebKit::StorageManager::SessionStorageNamespace::setAllowedConnection):
352         (WebKit::StorageManager::setAllowedSessionStorageNamespaceConnection):
353         (WebKit::StorageManager::processDidCloseConnection):
354         (WebKit::StorageManager::createLocalStorageMap):
355         (WebKit::StorageManager::createTransientLocalStorageMap):
356         (WebKit::StorageManager::createSessionStorageMap):
357         (WebKit::StorageManager::destroyStorageMap):
358         (WebKit::StorageManager::setItem):
359         (WebKit::StorageManager::removeItem):
360         (WebKit::StorageManager::clear):
361         (WebKit::StorageManager::applicationWillTerminate):
362         (WebKit::StorageManager::findStorageArea const):
363         * UIProcess/WebStorage/StorageManager.h:
364
365 2018-08-07  Eric Carlson  <eric.carlson@apple.com>
366
367         NotReadableError when calling getUserMedia
368         https://bugs.webkit.org/show_bug.cgi?id=188309
369         <rdar://problem/42916838>
370
371         Reviewed by Brent Fulgham.
372
373         * UIProcess/UserMediaProcessManager.cpp:
374         (WebKit::UserMediaProcessManager::willCreateMediaStream): Deal with audio and video sandbox
375         extensions being issued at different times. Use new ProcessState methods.
376         (WebKit::UserMediaProcessManager::endedCaptureSession): Use new ProcessState methods.
377
378 2018-08-07  Wenson Hsieh  <wenson_hsieh@apple.com>
379
380         REGRESSION (r233778): Text selection sometimes cannot be extended in iframes
381         https://bugs.webkit.org/show_bug.cgi?id=188374
382         <rdar://problem/42928657>
383
384         Reviewed by Simon Fraser.
385
386         rangeForPoint contains logic for converting a selection handle location in root view coordinates to an updated
387         selection. In doing so, we first convert the selection handle location to content coordinates; however, the call
388         site to EventHandler::hitTestResultAtPoint still hit-tests using the location in root view coordinates rather
389         than content coordinates, which means that when the focused frame is a subframe, hit-testing will fail to find
390         nodes within the subframe under the selection handle. This manifests in behaviors such as snapping to a single
391         character when selecting text in subframes.
392
393         To fix this, we just need to pass in the point in the frame's content coordinates when hit-testing.
394
395         Tests:  editing/selection/ios/selection-handles-in-iframe.html
396                 editing/selection/ios/selection-handles-in-readonly-input.html
397
398         * WebProcess/WebPage/ios/WebPageIOS.mm:
399         (WebKit::rangeForPointInRootViewCoordinates):
400
401         Make a couple of other minor adjustments:
402         1.  Take a Frame& instead of a Frame*, since Frame& is assumed to be non-null here.
403         2.  Rename rangeForPoint to rangeForPointInRootViewCoordinates, as well as the point argument to
404             pointInRootViewCoordinates.
405
406         (WebKit::WebPage::updateSelectionWithTouches):
407         (WebKit::rangeForPoint): Deleted.
408
409 2018-08-07  Alex Christensen  <achristensen@webkit.org>
410
411         Fix things after r234640
412         https://bugs.webkit.org/show_bug.cgi?id=188133
413
414         * UIProcess/WebFramePolicyListenerProxy.cpp:
415         (WebKit::WebFramePolicyListenerProxy::use):
416         (WebKit::WebFramePolicyListenerProxy::download):
417         (WebKit::WebFramePolicyListenerProxy::ignore):
418         Fix assertions as I had in r234552.  Also fix a possible race condition with fragment navigations by only keeping the first "use" response.
419         * config.h:
420         Fix IOSMAC build.
421
422 2018-08-07  Per Arne Vollan  <pvollan@apple.com>
423
424         [macOS] Scrollbars are not visible when using 3rd party mouse
425         https://bugs.webkit.org/show_bug.cgi?id=188372
426
427         Reviewed by Simon Fraser.
428
429         The scrollbars are not visible because they are not updated with the recommended scroller style
430         when a 3rd party mouse is used. They still have the overlay style, but the system is
431         recommending the legacy style in this case. The UI process is currently notifying the WebProcess
432         about changes in the scroller style, but the current style is not set in the WebProcess on
433         startup. This patch sets the initial scroller style in the WebProcess by passing it as part of
434         the WebProcess creation parameters. Also, to make sure hot-plugging of a 3rd party mouse is
435         is visually changing the scroller style of the current page, a class method in NSScrollerImpPair
436         is called to update all NSScrollerImpPairs with the new recommended style. This method was
437         previously called by AppKit, but after blocking WindowServer access, AppKit is no longer calling
438         this method. This has been manually tested by using a 3rd party mouse.
439
440         * Shared/WebProcessCreationParameters.cpp:
441         (WebKit::WebProcessCreationParameters::encode const):
442         (WebKit::WebProcessCreationParameters::decode):
443         * Shared/WebProcessCreationParameters.h:
444         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
445         (WebKit::WebProcessPool::platformInitializeWebProcess):
446         * WebProcess/cocoa/WebProcessCocoa.mm:
447         (WebKit::WebProcess::platformInitializeWebProcess):
448         (WebKit::WebProcess::scrollerStylePreferenceChanged):
449
450 2018-08-06  Andy Estes  <aestes@apple.com>
451
452         [Wi-Fi Assertions] suspendWiFiAssertions() should be able to delay sending ProcessReadyToSuspend
453         https://bugs.webkit.org/show_bug.cgi?id=188373
454         <rdar://problem/42857398>
455
456         Reviewed by Tim Horton.
457
458         * NetworkProcess/NetworkProcess.cpp:
459         (WebKit::NetworkProcess::actualPrepareToSuspend):
460         * NetworkProcess/NetworkProcess.h:
461         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
462         (WebKit::NetworkProcess::platformPrepareToSuspend):
463         (WebKit::NetworkProcess::platformProcessDidTransitionToBackground):
464         * NetworkProcess/curl/NetworkProcessCurl.cpp:
465         (WebKit::NetworkProcess::platformPrepareToSuspend):
466         * NetworkProcess/soup/NetworkProcessSoup.cpp:
467         (WebKit::NetworkProcess::platformPrepareToSuspend):
468
469 2018-08-06  Alex Christensen  <achristensen@webkit.org>
470
471         Check with SafeBrowsing during navigation in WKWebView
472         https://bugs.webkit.org/show_bug.cgi?id=188133
473
474         Reviewed by Chris Dumez.
475
476         This turns WebFramePolicyListenerProxy into an object that now listens for the results
477         of two processes happening in parallel: the API::NavigationClient's decidePolicyForNavigation{Action, Response}
478         (which it was already waiting for) and, on platforms that support it, the SafariSafeBrowsing framework's check.
479         The first result is stored as it waits for the second result unless the first result is the API::NavigationClient
480         saying to cancel or convert the navigation to a download, in which cases we don't care what the safe browsing
481         framework results are because we won't show the URL in the browser.
482
483         Nothing is done with the safe browsing results yet.
484
485         * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm: Added.
486         (WebKit::SafeBrowsingResult::SafeBrowsingResult):
487         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
488         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
489         * UIProcess/SafeBrowsingResult.h: Added.
490         (WebKit::SafeBrowsingResult::provider const):
491         (WebKit::SafeBrowsingResult::isPhishing const):
492         (WebKit::SafeBrowsingResult::isMalware const):
493         (WebKit::SafeBrowsingResult::isUnwantedSoftware const):
494         (WebKit::SafeBrowsingResult::isKnownToBeUnsafe const):
495         * UIProcess/WebFramePolicyListenerProxy.cpp:
496         (WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy):
497         (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
498         (WebKit::WebFramePolicyListenerProxy::use):
499         (WebKit::WebFramePolicyListenerProxy::download):
500         (WebKit::WebFramePolicyListenerProxy::ignore):
501         * UIProcess/WebFramePolicyListenerProxy.h:
502         (WebKit::WebFramePolicyListenerProxy::create):
503         * UIProcess/WebFrameProxy.cpp:
504         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
505         * UIProcess/WebFrameProxy.h:
506         * UIProcess/WebPageProxy.cpp:
507         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
508         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
509         (WebKit::WebPageProxy::decidePolicyForResponse):
510         * UIProcess/WebPageProxy.h:
511         * WebKit.xcodeproj/project.pbxproj:
512
513 2018-08-06  Chris Dumez  <cdumez@apple.com>
514
515         Regression(NetworkLoadChecker): CORS preflights are no longer able to deal with client certificate authentication
516         https://bugs.webkit.org/show_bug.cgi?id=188355
517         <rdar://problem/42546319>
518
519         Reviewed by Alex Christensen.
520
521         Before we started using the NetworkLoadChecker to do CORS-preflighting in the Network process, challenges would
522         use the NetworkLoad::completeAuthenticationChallenge() code path with isAllowedToAskUserForCredentials to set
523         to false. This would call:
524         1. completionHandler(AuthenticationChallengeDisposition::UseCredential, { }); for TLS handshakes (server trust
525            evaluation & client certification authentication)
526         2. NetworkProcess::singleton().authenticationManager().didReceiveAuthenticationChallenge() otherwise
527
528         However, NetworkCORSPreflightChecker::didReceiveChallenge() was behaving differently and calling:
529         1. completionHandler(AuthenticationChallengeDisposition::RejectProtectionSpace, { }); for server trust evaluations
530         2. completionHandler(AuthenticationChallengeDisposition::Cancel, { }); otherwise
531
532         Restore previous behavior by aligning NetworkCORSPreflightChecker::didReceiveChallenge() with
533         NetworkLoad::completeAuthenticationChallenge() when isAllowedToAskUserForCredentials is set to false. This means
534         we end up asking the AuthenticationManager for client certificate authentication instead or cancelling the
535         preflight.
536
537         This fixes CORS-preflighting on some internal sites.
538
539         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
540         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
541         * NetworkProcess/NetworkCORSPreflightChecker.h:
542         * NetworkProcess/NetworkLoadChecker.cpp:
543         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
544         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
545         * NetworkProcess/NetworkLoadChecker.h:
546         * NetworkProcess/NetworkResourceLoader.cpp:
547         * NetworkProcess/PingLoad.cpp:
548         (WebKit::PingLoad::PingLoad):
549
550 2018-08-06  Alex Christensen  <achristensen@webkit.org>
551
552         Use enum classes and OptionSets for PaintPhase and PaintBehavior
553         https://bugs.webkit.org/show_bug.cgi?id=188323
554
555         Reviewed by Simon Fraser.
556
557         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
558         (WebKit::imageForRect):
559         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
560         (WebKit::InjectedBundleRangeHandle::renderedImage):
561         * WebProcess/Plugins/PluginView.cpp:
562         (WebKit::PluginView::shouldCreateTransientPaintingSnapshot const):
563
564 2018-08-06  Ryan Haddad  <ryanhaddad@apple.com>
565
566         Unreviewed, rolling out r234552.
567
568         Introduced 2 layout test failures on High Sierra.
569
570         Reverted changeset:
571
572         "Check with SafeBrowsing during navigation in WKWebView"
573         https://bugs.webkit.org/show_bug.cgi?id=188133
574         https://trac.webkit.org/changeset/234552
575
576 2018-08-06  Ryan Haddad  <ryanhaddad@apple.com>
577
578         Unreviewed, rolling out r234569.
579
580         Breaks internal builds.
581
582         Reverted changeset:
583
584         "We should cache the compiled sandbox profile in a data vault"
585         https://bugs.webkit.org/show_bug.cgi?id=184991
586         https://trac.webkit.org/changeset/234569
587
588 2018-08-06  Chris Dumez  <cdumez@apple.com>
589
590         Fix IPC::Connection leak in StorageManager
591         https://bugs.webkit.org/show_bug.cgi?id=188321
592         <rdar://problem/42748485>
593
594         Reviewed by Alex Christensen.
595
596         When a StorageMap is destroyed on WebContent process side, StorageManager::destroyStorageMap()
597         gets called via IPC with a (IPC::Connection, StorageMapID) pair. Normally, it removes this
598         pair from m_storageAreasByConnection. However, if this is a *transient* StorageMap (sessionStorage),
599         then we keep the pair in the map and we merely remove the StorageMapID as a listener from the
600         StorageArea. We do this so that:
601         1. The StorageArea stays alive so that it can be reused later on for the same security origin, on
602            the same IPC::Connection (logic for this is in StorageManager::createTransientLocalStorageMap()
603         2. Removing the StorageMapID as a listener from the StorageArea is important because
604            StorageArea::m_eventListeners holds a strong reference to the IPC::Connection in a std::pair
605            with the StorageMapID (HashSet<std::pair<RefPtr<IPC::Connection>, uint64_t>> m_eventListeners).
606
607         As mentioned in 1 above, in StorageManager::createTransientLocalStorageMap(), there is logic to
608         check if there is already an existing StorageArea for the given IPC::Connection that is transient
609         and is for the same security origin. In this case, we could avoid constructing a new StorageArea
610         and we would:
611         1. Add a new entry to m_storageAreasByConnection with the key (connection, newStorageMapID), using
612            same same StorageArea as value.
613         2. Remove the previous (connection, oldStorageMapID) key from m_storageAreasByConnection.
614
615         Step 2 here is wrong and is updated in this patch. It is only safe to remove the previous 
616         (connection, oldStorageMapID) if this oldStorageMapID no longer exists (i.e. destroyStorageMap()
617         was already called for it). This patch thus adds a check before removing (connection, oldStorageMapID)
618         from the HashMap to make sure that the oldStorageMapID is no longer a listener of the StorageArea).
619
620         This would cause leaks in the following case:
621         1. We construct a StorageArea for (connection1, storageMapId1)
622         2. We ask for a StorageArea for (connection1, storageMapId2) and decide to reuse the existing StorageArea
623            since it has the same SecurityOrigin.
624         3. As a result of step2, we would remove (connection1, storageMapId1) from m_storageAreasByConnection
625            and add (connection1, storageMapId2), even though there is still a StorageMap with storageMapId1
626            on WebContent process side.
627         4. Later on, we would try to call destroyStorageMap(connection1, storageMap1), it would fail to find
628            it in m_storageAreasByConnection and return early. It would therefore fail to remove storageMapId1
629            as a listener of the StorageArea which still exists.
630         -> This would leak the IPC::Connection that there would be a std::pair<RefPtr<IPC::Connection>, StorageMapID>
631            with value (connection1, storageMap1) which would get leaked and it would ref the IPC::Connection.
632
633         This code should really be refactored to be less leak prone but I have kept the patch minimal for now
634         to facilitate cherry-picking.
635
636         Note that this would reproduce very easily on sina.com.cn, when clicking bold links at the top, which
637         opens new tabs to different pages in the same WebContent process. When closing all Safari windows, the
638         IPC::Connection for this WebContent process would stay alive.
639
640         * UIProcess/WebStorage/StorageManager.cpp:
641         (WebKit::StorageManager::StorageArea::hasListener const):
642         (WebKit::StorageManager::createTransientLocalStorageMap):
643
644 2018-08-06  Alex Christensen  <achristensen@webkit.org>
645
646         Make BlendMode an enum class
647         https://bugs.webkit.org/show_bug.cgi?id=188325
648
649         Reviewed by Darin Adler.
650
651         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
652         (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
653
654 2018-08-06  Wenson Hsieh  <wenson_hsieh@apple.com>
655
656         [iOS] Caret disappears after resigning and becoming first responder if active focus state is retained
657         https://bugs.webkit.org/show_bug.cgi?id=188322
658         <rdar://problem/42455270>
659
660         Reviewed by Tim Horton.
661
662         Prior to r230745, when a user selects a word in non-editable web content without a prior selection, we would
663         always try to activate the text interaction assistant, creating a selection view (a UITextSelectionView). After
664         the long press is recognized, this text selection view is configured for "highlight mode", which is a special
665         mode for presenting selection UI where the grabber handles at the start and end of the selection are suppressed.
666         UIKit then prepares to show the selection by asking WKContentView for the number of selection rects; if this
667         number is zero, the UITextSelectionView is removed from the superview, and state that keeps track of whether the
668         selection view is in "highlight mode" is reset.
669
670         In the case where there's no prior selection, our cached EditorState in the UI process will not be up to date
671         yet when the gesture is recognized. This means that when UIKit asks us for the number of selection rects, we'll
672         return 0, which causes any state tracking "highlight mode" for the selection to be reset, subsequently resulting
673         in selection handles showing up before the user has ended the initial loupe gesture.
674
675         r230745 addressed this bug by removing logic to activate the text selection when becoming first responder,
676         instead deferring until the next `-_selectionChanged` call with post-layout editor state data to activate the
677         selection. While this does ensure that selection handles don't erroneously appear, it also means that clients
678         that call -becomeFirstResponder to show selection UI and the keyboard in a web view while an element is already
679         focused will not have an active selection assistant (i.e. the selection view will still be hidden). One way this
680         happens is when Safari uses `-_retainActiveFocusedState` in combination with `-resignFirstResponder` and
681         `-becomeFirstResponder` to temporarily switch focus away from the web view when the URL bar is tapped.
682
683         To fix both the inactive selection after `-becomeFirstResponder` as well as the selection handles showing up
684         when performing a loupe gesture, we simply make the check in `-becomeFirstResponderForWebView` more nuanced.
685         Instead of always activating the selection or never activating the selection, only activate the selection if the
686         current editor state has information about a selection to avoid causing the selection view to be immediately
687         removed and "highlight mode" to be reset when selecting a word via loupe gesture for the first time.
688
689         Tests:  KeyboardInputTests.CaretSelectionRectAfterRestoringFirstResponder
690                 KeyboardInputTests.RangedSelectionRectAfterRestoringFirstResponder
691                 editing/selection/ios/selection-handles-after-touch-end.html
692
693         * UIProcess/ios/WKContentViewInteraction.mm:
694         (-[WKContentView becomeFirstResponderForWebView]):
695         (-[WKContentView canShowNonEmptySelectionView]):
696
697 2018-08-06  Zan Dobersek  <zdobersek@igalia.com>
698
699         [Nicosia] Add Nicosia::Scene
700         https://bugs.webkit.org/show_bug.cgi?id=188340
701
702         Reviewed by Carlos Garcia Campos.
703
704         CompositingCoordinator spawns a Nicosia::Scene object that it shares
705         with the CoordinatedGraphicsSceneState instance. All the
706         Nicosia::CompositionLayer objects indirectly managed by
707         CompositingCoordinator are now stored in a local Nicosia::Scene::State
708         member object. Upon each flush that requires frame synchronization the
709         Nicosia::Scene object is updated in a thread-safe manner, increasing
710         the scene ID value as well as copying the local HashSet and root layer
711         values into the shared Scene object, allowing for the consumer (which
712         currently is the related CoordinatedGraphicsScene instance) to update
713         its output accordingly.
714
715         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
716         (WebKit::CompositingCoordinator::CompositingCoordinator):
717         (WebKit::CompositingCoordinator::flushPendingLayerChanges):
718         (WebKit::CompositingCoordinator::initializeRootCompositingLayerIfNeeded):
719         (WebKit::CompositingCoordinator::createGraphicsLayer):
720         (WebKit::CompositingCoordinator::detachLayer):
721         (WebKit::CompositingCoordinator::attachLayer):
722         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
723
724 2018-08-05  Yusuke Suzuki  <utatane.tea@gmail.com>
725
726         Add support for microtasks in workers
727         https://bugs.webkit.org/show_bug.cgi?id=188246
728
729         Reviewed by Darin Adler.
730
731         Rename JSMainThreadExecState.h to JSExecState.h.
732
733         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMAttr.cpp:
734         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMBlob.cpp:
735         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCDATASection.cpp:
736         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRule.cpp:
737         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRuleList.cpp:
738         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleDeclaration.cpp:
739         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleSheet.cpp:
740         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSValue.cpp:
741         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCharacterData.cpp:
742         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.cpp:
743         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.cpp:
744         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMComment.cpp:
745         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMImplementation.cpp:
746         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMSelection.cpp:
747         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMTokenList.cpp:
748         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.cpp:
749         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDeprecated.cpp:
750         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentFragment.cpp:
751         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp:
752         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentType.cpp:
753         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElementGtk.cpp:
754         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMEvent.cpp:
755         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMFile.cpp:
756         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMFileList.cpp:
757         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAnchorElement.cpp:
758         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAppletElement.cpp:
759         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAreaElement.cpp:
760         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBRElement.cpp:
761         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBaseElement.cpp:
762         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBodyElement.cpp:
763         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLButtonElement.cpp:
764         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLCanvasElement.cpp:
765         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLCollection.cpp:
766         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDListElement.cpp:
767         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDirectoryElement.cpp:
768         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDivElement.cpp:
769         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDocument.cpp:
770         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLElement.cpp:
771         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLEmbedElement.cpp:
772         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFieldSetElement.cpp:
773         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFontElement.cpp:
774         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFormElement.cpp:
775         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameElement.cpp:
776         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameSetElement.cpp:
777         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHRElement.cpp:
778         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHeadElement.cpp:
779         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHeadingElement.cpp:
780         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHtmlElement.cpp:
781         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLIFrameElement.cpp:
782         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLImageElement.cpp:
783         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLInputElement.cpp:
784         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLIElement.cpp:
785         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLabelElement.cpp:
786         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLegendElement.cpp:
787         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLinkElement.cpp:
788         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMapElement.cpp:
789         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMarqueeElement.cpp:
790         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMenuElement.cpp:
791         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMetaElement.cpp:
792         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLModElement.cpp:
793         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOListElement.cpp:
794         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLObjectElement.cpp:
795         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptGroupElement.cpp:
796         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptionElement.cpp:
797         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptionsCollection.cpp:
798         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLParagraphElement.cpp:
799         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLParamElement.cpp:
800         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLPreElement.cpp:
801         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLQuoteElement.cpp:
802         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLScriptElement.cpp:
803         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLSelectElement.cpp:
804         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLStyleElement.cpp:
805         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableCaptionElement.cpp:
806         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableCellElement.cpp:
807         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableColElement.cpp:
808         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableElement.cpp:
809         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableRowElement.cpp:
810         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableSectionElement.cpp:
811         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTextAreaElement.cpp:
812         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTitleElement.cpp:
813         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLUListElement.cpp:
814         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMKeyboardEvent.cpp:
815         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMediaList.cpp:
816         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMouseEvent.cpp:
817         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNamedNodeMap.cpp:
818         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeGtk.cpp:
819         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeIterator.cpp:
820         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeList.cpp:
821         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMProcessingInstruction.cpp:
822         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMRange.cpp:
823         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMStyleSheet.cpp:
824         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMStyleSheetList.cpp:
825         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMText.cpp:
826         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMTreeWalker.cpp:
827         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMUIEvent.cpp:
828         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMWheelEvent.cpp:
829         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathExpression.cpp:
830         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathNSResolver.cpp:
831         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathResult.cpp:
832
833 2018-08-03  Ben Richards  <benton_richards@apple.com>
834
835         We should cache the compiled sandbox profile in a data vault
836         https://bugs.webkit.org/show_bug.cgi?id=184991
837
838         Reviewed by Ryosuke Niwa.
839
840         This patch changes a few things (note: data vaults and sandbox entitlements are only used in internal builds):
841         (1) Instead of compiling a sandbox every time a process is launched, processes now look for a cached sandbox
842             in a process specific data vault on macOS platforms. (ChildProcessMac.mm)
843         (2) If a valid cached sandbox is not found, a process will create the data vault (or ensure that it exists),
844             compile a sandbox, and cache it.
845         (3) In order to create process specific data vaults, each process now has their own <process name>-OSX-sandbox.entitlements
846             file which contains an entitlement with a process specific "storage class" which ensures that each process
847             can only ever access its own data vault. (See the article on confluence "Data Vaults and Restricted Files" for more info)
848         (4) The sandbox entitlements file for the Network, WebContent and Plugin services are loaded dynamically
849             through Scripts/<process name>-process-entitlements.sh which is triggered in a new build phase for each service.
850             The Storage process sandbox entitlements are loaded directly in Configurations/StorageService.xcconfig.
851             The reason that the sandbox entitlements are applied dynamically is so that these sandbox entitlements
852             are only applied when WK_USE_RESTRICTED_ENTITLEMENTS is YES. This means that open source builds will still work.
853
854         * Configurations/Network-OSX-sandbox.entitlements: Added.
855         * Configurations/Plugin-OSX-sandbox.entitlements: Added.
856         * Configurations/Storage-OSX-sandbox.entitlements: Added.
857         * Configurations/StorageService.xcconfig:
858         * Configurations/WebContent-OSX-sandbox.entitlements: Added.
859         * Configurations/WebKit.xcconfig:
860         * NetworkProcess/NetworkProcess.h:
861         * PluginProcess/PluginProcess.h:
862         * Scripts/process-network-entitlements.sh: Added.
863         * Scripts/process-plugin-entitlements.sh: Added.
864         * Scripts/process-webcontent-entitlements.sh:
865         * Shared/ChildProcess.h:
866         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
867         (WebKit::XPCServiceInitializer):
868         * Shared/SandboxInitializationParameters.h:
869         (WebKit::SandboxInitializationParameters::setOverrideSandboxProfilePath):
870         (WebKit::SandboxInitializationParameters::overrideSandboxProfilePath const):
871         (WebKit::SandboxInitializationParameters::setSandboxProfile):
872         (WebKit::SandboxInitializationParameters::sandboxProfile const):
873         (): Deleted.
874         * Shared/mac/ChildProcessMac.mm:
875         (WebKit::SandboxProfileDeleter::operator()):
876         (WebKit::SandboxParametersDeleter::operator()):
877         (WebKit::SandboxInfo::SandboxInfo):
878         (WebKit::fileContents):
879         (WebKit::processStorageClass):
880         (WebKit::setAndSerializeSandboxParameters):
881         (WebKit::getUserCacheDirectory):
882         (WebKit::sandboxDataVaultParentDirectory):
883         (WebKit::sandboxDirectory):
884         (WebKit::sandboxFilePath):
885         (WebKit::ensureSandboxCacheDirectory):
886         (WebKit::writeSandboxDataToCacheFile):
887         (WebKit::compileAndCacheSandboxProfile):
888         (WebKit::tryApplyCachedSandbox):
889         (WebKit::webKit2Bundle):
890         (WebKit::sandboxProfilePath):
891         (WebKit::compileAndApplySandboxSlowCase):
892         (WebKit::applySandbox):
893         (WebKit::initializeSandboxParameters):
894         (WebKit::ChildProcess::initializeSandbox):
895         * Shared/mac/SandboxInitialiationParametersMac.mm:
896         (WebKit::SandboxInitializationParameters::SandboxInitializationParameters):
897         * StorageProcess/StorageProcess.h:
898         * WebKit.xcodeproj/project.pbxproj:
899         * WebProcess/WebProcess.h:
900
901 2018-08-03  Alex Christensen  <achristensen@webkit.org>
902
903         Fix spelling of "overridden"
904         https://bugs.webkit.org/show_bug.cgi?id=188315
905
906         Reviewed by Darin Adler.
907
908         * Platform/IPC/mac/ConnectionMac.mm:
909         (IPC::Connection::receiveSourceEventHandler):
910         * Shared/WebPreferencesStore.cpp:
911         (WebKit::WebPreferencesStore::encode const):
912         (WebKit::WebPreferencesStore::decode):
913         (WebKit::valueForKey):
914         (WebKit::setValueForKey):
915         (WebKit::WebPreferencesStore::setStringValueForKey):
916         (WebKit::WebPreferencesStore::getStringValueForKey const):
917         (WebKit::WebPreferencesStore::setBoolValueForKey):
918         (WebKit::WebPreferencesStore::getBoolValueForKey const):
919         (WebKit::WebPreferencesStore::setUInt32ValueForKey):
920         (WebKit::WebPreferencesStore::getUInt32ValueForKey const):
921         (WebKit::WebPreferencesStore::setDoubleValueForKey):
922         (WebKit::WebPreferencesStore::getDoubleValueForKey const):
923         (WebKit::WebPreferencesStore::setOverrideDefaultsStringValueForKey):
924         (WebKit::WebPreferencesStore::setOverrideDefaultsBoolValueForKey):
925         (WebKit::WebPreferencesStore::setOverrideDefaultsUInt32ValueForKey):
926         (WebKit::WebPreferencesStore::setOverrideDefaultsDoubleValueForKey):
927         * Shared/WebPreferencesStore.h:
928         * UIProcess/ios/WKContentViewInteraction.mm:
929         (-[WKContentView dragInteraction:previewForLiftingItem:session:]):
930         (-[WKContentView dragInteraction:previewForCancellingItem:withDefault:]):
931         * UIProcess/ios/WKScrollView.mm:
932         (-[WKScrollView _systemContentInset]):
933
934 2018-08-03  David Fenton  <david_fenton@apple.com>
935
936         Unreviewed, rolling out r234517.
937
938         Caused API test failures on iOS
939
940         Reverted changeset:
941
942         "[Cocoa] setCookie API fails to set session cookies for
943         defaultDataStore if processPool created but not used"
944         https://bugs.webkit.org/show_bug.cgi?id=188209
945         https://trac.webkit.org/changeset/234517
946
947 2018-08-03  Ben Richards  <benton_richards@apple.com>
948
949         Add configuration for automatic process pre-warming
950         https://bugs.webkit.org/show_bug.cgi?id=187108
951
952         Reviewed by Ryosuke Niwa.
953
954         Added configurations to allow setting the maximum number of processes that should be automatically prewarmed.
955
956         * UIProcess/API/APIProcessPoolConfiguration.cpp:
957         (API::ProcessPoolConfiguration::copy):
958         * UIProcess/API/APIProcessPoolConfiguration.h:
959         * UIProcess/API/C/WKContext.cpp:
960         (WKContextSetMaximumNumberOfPrewarmedProcesses):
961         * UIProcess/API/C/WKContextPrivate.h:
962         * UIProcess/API/Cocoa/WKProcessPool.mm:
963         (-[WKProcessPool _setMaximumNumberOfPrewarmedProcesses:]):
964         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
965         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
966         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
967         (-[_WKProcessPoolConfiguration setMaximumPrewarmedProcessCount:]):
968         (-[_WKProcessPoolConfiguration maximumPrewarmedProcessCount]):
969         * UIProcess/WebPageProxy.cpp:
970         (WebKit::WebPageProxy::didFinishLoadForFrame): Moved call to notifyProcessPoolToPrewarm from didFirstVisuallyNonEmptyLayoutForFrame to here.
971         This is to try to ensure that frame loading and prewarming don't happen at the same time as this would be heavy for some devices.
972         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
973         * UIProcess/WebProcessPool.cpp:
974         (WebKit::WebProcessPool::setMaximumNumberOfProcesses): Condition changed so that calling setMaximumNumberOfProcesses after warmInitialProcess
975         doesn't result in a crash.
976         (WebKit::WebProcessPool::setMaximumNumberOfPrewarmedProcesses):
977         (WebKit::WebProcessPool::warmInitialProcess):
978         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
979         * UIProcess/WebProcessPool.h:
980
981 2018-08-03  Alex Christensen  <achristensen@webkit.org>
982
983         Check with SafeBrowsing during navigation in WKWebView
984         https://bugs.webkit.org/show_bug.cgi?id=188133
985
986         Reviewed by Chris Dumez.
987
988         This turns WebFramePolicyListenerProxy into an object that now listens for the results
989         of two processes happening in parallel: the API::NavigationClient's decidePolicyForNavigation{Action, Response}
990         (which it was already waiting for) and, on platforms that support it, the SafariSafeBrowsing framework's check.
991         The first result is stored as it waits for the second result unless the first result is the API::NavigationClient
992         saying to cancel or convert the navigation to a download, in which cases we don't care what the safe browsing
993         framework results are because we won't show the URL in the browser.
994
995         Nothing is done with the safe browsing results yet.
996
997         * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm: Added.
998         (WebKit::SafeBrowsingResult::SafeBrowsingResult):
999         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1000         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
1001         * UIProcess/SafeBrowsingResult.h: Added.
1002         (WebKit::SafeBrowsingResult::provider const):
1003         (WebKit::SafeBrowsingResult::isPhishing const):
1004         (WebKit::SafeBrowsingResult::isMalware const):
1005         (WebKit::SafeBrowsingResult::isUnwantedSoftware const):
1006         (WebKit::SafeBrowsingResult::isKnownToBeUnsafe const):
1007         * UIProcess/WebFramePolicyListenerProxy.cpp:
1008         (WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy):
1009         (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
1010         (WebKit::WebFramePolicyListenerProxy::use):
1011         (WebKit::WebFramePolicyListenerProxy::download):
1012         (WebKit::WebFramePolicyListenerProxy::ignore):
1013         * UIProcess/WebFramePolicyListenerProxy.h:
1014         (WebKit::WebFramePolicyListenerProxy::create):
1015         * UIProcess/WebFrameProxy.cpp:
1016         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
1017         * UIProcess/WebFrameProxy.h:
1018         * UIProcess/WebPageProxy.cpp:
1019         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1020         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
1021         (WebKit::WebPageProxy::decidePolicyForResponse):
1022         * UIProcess/WebPageProxy.h:
1023         * WebKit.xcodeproj/project.pbxproj:
1024
1025 2018-08-03  Ryan Haddad  <ryanhaddad@apple.com>
1026
1027         Unreviewed, rolling out r234513.
1028
1029         14 API tests fail the assertions added in this change.
1030
1031         Reverted changeset:
1032
1033         "Check with SafeBrowsing during navigation in WKWebView"
1034         https://bugs.webkit.org/show_bug.cgi?id=188133
1035         https://trac.webkit.org/changeset/234513
1036
1037 2018-08-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1038
1039         [WPE] WebDriver: add support for action commands
1040         https://bugs.webkit.org/show_bug.cgi?id=188301
1041
1042         Reviewed by Žan Doberšek.
1043
1044         WPE doesn't support action commands because the platform specific code for handling events is not implemented.
1045
1046         * SourcesWPE.txt: Add new file to compilation.
1047         * UIProcess/API/glib/WebKitUIClient.cpp: Use the drawing area size as window size in WPE.
1048         * UIProcess/API/wpe/PageClientImpl.cpp:
1049         (WebKit::PageClientImpl::viewBackend): Return the WPE backend of the view.
1050         * UIProcess/API/wpe/PageClientImpl.h:
1051         * UIProcess/Automation/WebAutomationSession.cpp:
1052         (WebKit::WebAutomationSession::performMouseInteraction):
1053         (WebKit::WebAutomationSession::performKeyboardInteractions):
1054         (WebKit::WebAutomationSession::performInteractionSequence):
1055         (WebKit::WebAutomationSession::cancelInteractionSequence):
1056         * UIProcess/Automation/wpe/WebAutomationSessionWPE.cpp: Added.
1057         (WebKit::modifiersToEventState):
1058         (WebKit::mouseButtonToWPEButton):
1059         (WebKit::stateModifierForWPEButton):
1060         (WebKit::doMouseEvent):
1061         (WebKit::doMotionEvent):
1062         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
1063         (WebKit::doKeyStrokeEvent):
1064         (WebKit::keyCodeForVirtualKey):
1065         (WebKit::modifiersForKeyCode):
1066         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
1067         (WebKit::WebAutomationSession::platformSimulateKeySequence):
1068         * UIProcess/WebPageProxy.h:
1069         * UIProcess/wpe/WebPageProxyWPE.cpp:
1070         (WebKit::WebPageProxy::viewBackend): Return the WPE backend.
1071
1072 2018-08-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1073
1074         [WPE] Implement MouseEvent.buttons
1075         https://bugs.webkit.org/show_bug.cgi?id=187998
1076
1077         Reviewed by Žan Doberšek.
1078
1079         Pass buttons currently pressed to WebMouseEvent.
1080
1081         * Shared/wpe/WebEventFactory.cpp:
1082         (WebKit::pressedMouseButtons): Helper to get the pressed buttons mask for the WPE modifiers.
1083         (WebKit::WebEventFactory::createWebMouseEvent): Use pressedMouseButtons().
1084         * UIProcess/API/wpe/PageClientImpl.cpp:
1085         (WebKit::PageClientImpl::doneWithTouchEvent): Update the event modifiers.
1086
1087 2018-08-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1088
1089         [WPE] Use WPE key symbols and new API instead of xkbcommon and the key mapper
1090         https://bugs.webkit.org/show_bug.cgi?id=188093
1091
1092         Reviewed by Žan Doberšek.
1093
1094         * Shared/WebEvent.h: Add WebKeyboardEvent constructor for WPE.
1095         * Shared/WebKeyboardEvent.cpp:
1096         (WebKit::WebKeyboardEvent::WebKeyboardEvent): WebKeyboardEvent constructor for WPE.
1097         * Shared/wpe/WebEventFactory.cpp:
1098         (WebKit::isWPEKeyCodeFromKeyPad): Helper tpo check if a key symbols is from key pad.
1099         (WebKit::WebEventFactory::createWebKeyboardEvent): Use PlatformKeyboardEvent API to provide key code, hardware
1100         key code, key identifier and windows key code to WebKeyboardEvent.
1101         * UIProcess/API/wpe/WPEView.cpp:
1102         (WKWPE::m_backend): Use WPE key symbols.
1103
1104 2018-08-02  Tim Horton  <timothy_horton@apple.com>
1105
1106         PDFPlugin: Context menus in RTL are left-aligned
1107         https://bugs.webkit.org/show_bug.cgi?id=188292
1108         <rdar://problem/32293787>
1109
1110         Reviewed by Simon Fraser.
1111
1112         * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h:
1113         Add some SPI.
1114
1115         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1116         (WebKit::PDFPlugin::handleContextMenuEvent):
1117         Translate UI layout direction back into the platform enum, and pass it to PDFKit.
1118
1119         * WebProcess/WebPage/WebPage.h:
1120         (WebKit::WebPage::userInterfaceLayoutDirection const):
1121         Add a getter for UI layout direction.
1122
1123 2018-08-02  Chris Dumez  <cdumez@apple.com>
1124
1125         Regression(r234486): assertion hit in ~CallbackAggregator()
1126         https://bugs.webkit.org/show_bug.cgi?id=188283
1127         <rdar://problem/42851342>
1128
1129         Reviewed by Alex Christensen.
1130
1131         [NSHTTPCookieStorage _saveCookies:] SPI may call its completion block on the background queue
1132         so we need to make sure we dispatch back to the main thread before calling our completion
1133         handler.
1134
1135         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1136         (WebKit::saveCookies):
1137         (WebKit::NetworkProcess::platformSyncAllCookies):
1138
1139 2018-08-02  Alex Christensen  <achristensen@webkit.org>
1140
1141         Fix some builds after r234516
1142         ​https://bugs.webkit.org/show_bug.cgi?id=188250
1143
1144         * Platform/IPC/ArgumentCoders.h:
1145         This assertion was comparing integers of different signs.
1146         Since we don't allow exception throwing in WebKit, valueless_by_exception won't be true,
1147         so this assertion will always be true.  I'll just remove it.
1148
1149 2018-08-02  Sihui Liu  <sihui_liu@apple.com>
1150
1151         httpCookieStore.getAllCookies() does not always call completion block
1152         https://bugs.webkit.org/show_bug.cgi?id=188242
1153
1154         Reviewed by Chris Dumez.
1155
1156         Take background assertion for network process to keep it alive during cookieStore API calls.
1157
1158         * UIProcess/GenericCallback.h:
1159         * UIProcess/WebCookieManagerProxy.cpp:
1160         (WebKit::WebCookieManagerProxy::getHostnamesWithCookies):
1161         (WebKit::WebCookieManagerProxy::deleteCookie):
1162         (WebKit::WebCookieManagerProxy::deleteAllCookiesModifiedSince):
1163         (WebKit::WebCookieManagerProxy::setCookie):
1164         (WebKit::WebCookieManagerProxy::setCookies):
1165         (WebKit::WebCookieManagerProxy::getAllCookies):
1166         (WebKit::WebCookieManagerProxy::getCookies):
1167         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
1168         (WebKit::WebCookieManagerProxy::getHTTPCookieAcceptPolicy):
1169
1170 2018-08-02  Sihui Liu  <sihui_liu@apple.com>
1171
1172         [Cocoa] setCookie API fails to set session cookies for defaultDataStore if processPool created but not used
1173         https://bugs.webkit.org/show_bug.cgi?id=188209
1174
1175         Reviewed by Geoffrey Garen.
1176
1177         If defaultDataStore is already created when launching network process, it means user 
1178         probably set cookies for default session via API, so we should update m_websiteDataStore to 
1179         make sure pendingCookies is passed to network process.
1180
1181         * UIProcess/WebProcessPool.cpp:
1182         (WebKit::WebProcessPool::ensureNetworkProcess):
1183
1184 2018-08-02  Alex Christensen  <achristensen@webkit.org>
1185
1186         Use WTF::Variant for WebPreferencesStore::Value
1187         https://bugs.webkit.org/show_bug.cgi?id=188250
1188
1189         Reviewed by Sam Weinig.
1190
1191         It was conceptually a variant. This just uses an actual WTF::Variant.
1192         Since it's encoded and decoded, I wrote variadic template encoders and decoders
1193         like we have for other types (Expected, std::tuple, KeyValuePair, etc.)
1194
1195         * Platform/IPC/ArgumentCoders.h:
1196         (IPC::VariantCoder::encode):
1197         (IPC::VariantCoder::decode):
1198         Introduce ArgumentCoder<Variant>, which encodes which type the Variant currently
1199         holds followed by the encoding of the current type.
1200         * Platform/IPC/Decoder.cpp:
1201         (IPC::Decoder::Decoder):
1202         * Platform/IPC/Decoder.h:
1203         * Platform/IPC/mac/ConnectionMac.mm:
1204         (IPC::createMessageDecoder):
1205         Use move semantics to prevent an unnecessary copy of the Vector<Attachment>
1206         * Scripts/PreferencesTemplates/WebPreferencesStoreDefaultsMap.cpp.erb:
1207         * Shared/WebPreferencesStore.cpp:
1208         (WebKit::WebPreferencesStore::decode):
1209         Use modern std::optional-based decoding supported by the new Variant decoding.
1210         (WebKit::valueForKey):
1211         Use WTF::get and WTF::holds_alternative instead of custom type checks.
1212         (WebKit::WebPreferencesStore::Value::encode const): Deleted.
1213         (WebKit::WebPreferencesStore::Value::decode): Deleted.
1214         (WebKit::as<String>): Deleted.
1215         (WebKit::as<bool>): Deleted.
1216         (WebKit::as<uint32_t>): Deleted.
1217         (WebKit::as<double>): Deleted.
1218         * Shared/WebPreferencesStore.h:
1219         (WebKit::WebPreferencesStore::Value::Value): Deleted.
1220         (WebKit::WebPreferencesStore::Value::operator=): Deleted.
1221         (WebKit::WebPreferencesStore::Value::~Value): Deleted.
1222         (WebKit::WebPreferencesStore::Value::type const): Deleted.
1223         (WebKit::WebPreferencesStore::Value::asString const): Deleted.
1224         (WebKit::WebPreferencesStore::Value::asBool const): Deleted.
1225         (WebKit::WebPreferencesStore::Value::asUInt32 const): Deleted.
1226         (WebKit::WebPreferencesStore::Value::asDouble const): Deleted.
1227         (WebKit::WebPreferencesStore::Value::destroy): Deleted.
1228         (): Deleted.
1229         Use WTF::Variant instead of a custom type/union pair.
1230
1231 2018-08-02  Alex Christensen  <achristensen@webkit.org>
1232
1233         Check with SafeBrowsing during navigation in WKWebView
1234         https://bugs.webkit.org/show_bug.cgi?id=188133
1235
1236         Reviewed by Chris Dumez.
1237
1238         This turns WebFramePolicyListenerProxy into an object that now listens for the results
1239         of two processes happening in parallel: the API::NavigationClient's decidePolicyForNavigation{Action, Response}
1240         (which it was already waiting for) and, on platforms that support it, the SafariSafeBrowsing framework's check.
1241         The first result is stored as it waits for the second result unless the first result is the API::NavigationClient
1242         saying to cancel or convert the navigation to a download, in which cases we don't care what the safe browsing
1243         framework results are because we won't show the URL in the browser.
1244
1245         Nothing is done with the safe browsing results yet.
1246
1247         * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm: Added.
1248         (WebKit::SafeBrowsingResult::SafeBrowsingResult):
1249         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1250         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
1251         * UIProcess/SafeBrowsingResult.h: Added.
1252         (WebKit::SafeBrowsingResult::provider const):
1253         (WebKit::SafeBrowsingResult::isPhishing const):
1254         (WebKit::SafeBrowsingResult::isMalware const):
1255         (WebKit::SafeBrowsingResult::isUnwantedSoftware const):
1256         (WebKit::SafeBrowsingResult::isKnownToBeUnsafe const):
1257         * UIProcess/WebFramePolicyListenerProxy.cpp:
1258         (WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy):
1259         (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
1260         (WebKit::WebFramePolicyListenerProxy::use):
1261         (WebKit::WebFramePolicyListenerProxy::download):
1262         (WebKit::WebFramePolicyListenerProxy::ignore):
1263         * UIProcess/WebFramePolicyListenerProxy.h:
1264         (WebKit::WebFramePolicyListenerProxy::create):
1265         * UIProcess/WebFrameProxy.cpp:
1266         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
1267         * UIProcess/WebFrameProxy.h:
1268         * UIProcess/WebPageProxy.cpp:
1269         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1270         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
1271         (WebKit::WebPageProxy::decidePolicyForResponse):
1272         * UIProcess/WebPageProxy.h:
1273         * WebKit.xcodeproj/project.pbxproj:
1274
1275 2018-08-02  Wenson Hsieh  <wenson_hsieh@apple.com>
1276
1277         [iOS] Keyboard becomes unresponsive after pressing delete while pressing down on a character key with accents
1278         https://bugs.webkit.org/show_bug.cgi?id=188251
1279         <rdar://problem/37842108>
1280
1281         Reviewed by Tim Horton.
1282
1283         Fixes a bug in key event handling where invoking -handleKeyWebEvent:withCompletionHandler: from within the
1284         completion callback of a previous call to -handleKeyWebEvent:withCompletionHandler: would cause the completion
1285         callback to be cleared out prematurely. In some cases (as described in the title of this bug), UIKit exercises
1286         this codepath and subsequently hangs due to their completion block never getting invoked by WebKit.
1287
1288         Test: KeyboardInputTests.CanHandleKeyEventInCompletionHandler
1289
1290         * UIProcess/ios/WKContentViewInteraction.h:
1291         * UIProcess/ios/WKContentViewInteraction.mm:
1292         (-[WKContentView handleKeyWebEvent:withCompletionHandler:]):
1293         (-[WKContentView _didHandleKeyEvent:eventWasHandled:]):
1294
1295 2018-08-01  Dan Bernstein  <mitz@apple.com>
1296
1297         Optionally expose Attr::style to JavaScript
1298         https://bugs.webkit.org/show_bug.cgi?id=188226
1299         <rdar://problem/42818113>
1300
1301         Reviewed by Darin Adler.
1302
1303         * Shared/WebProcessCreationParameters.cpp:
1304         (WebKit::WebProcessCreationParameters::encode const): Encode new attrStyleEnabled member.
1305         (WebKit::WebProcessCreationParameters::decode): Decode new attrStyleEnabled member.
1306         * Shared/WebProcessCreationParameters.h: Define new attrStyleEnabled member, initialized to
1307           false.
1308
1309         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1310         (API::ProcessPoolConfiguration::copy): Copy new m_attrStyleEnabled member.
1311         * UIProcess/API/APIProcessPoolConfiguration.h: Define new m_attrStyleEnabled member.
1312
1313         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: Declare new attrStyleEnabled boolean
1314           property.
1315         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1316         (-[_WKProcessPoolConfiguration attrStyleEnabled]): New accessor.
1317         (-[_WKProcessPoolConfiguration setAttrStyleEnabled:]): Ditto.
1318
1319         * UIProcess/WebProcessPool.cpp:
1320         (WebKit::WebProcessPool::initializeNewWebProcess): Initialize parameters.attrStyleEnabled
1321           from the configuration.
1322
1323         * WebProcess/WebProcess.cpp:
1324         (WebKit::WebProcess::initializeWebProcess): Set the attrStyleEnabled runtime feature based
1325           on the creation parameters.
1326
1327 2018-08-02  David Fenton  <david_fenton@apple.com>
1328
1329         Unreviewed, rolling out r234489.
1330
1331         Caused 50+ crashes and 60+ API failures on iOS
1332
1333         Reverted changeset:
1334
1335         "[WTF] Rename String::format to String::deprecatedFormat"
1336         https://bugs.webkit.org/show_bug.cgi?id=188191
1337         https://trac.webkit.org/changeset/234489
1338
1339 2018-08-01  Tomas Popela  <tpopela@redhat.com>
1340
1341         [WTF] Rename String::format to String::deprecatedFormat
1342         https://bugs.webkit.org/show_bug.cgi?id=188191
1343
1344         Reviewed by Darin Adler.
1345
1346         It should be replaced with string concatenation.
1347
1348         * NetworkProcess/soup/NetworkProcessSoup.cpp:
1349         (WebKit::buildAcceptLanguages):
1350         * Platform/IPC/win/ConnectionWin.cpp:
1351         (IPC::Connection::createServerAndClientIdentifiers):
1352         * Shared/WebMemorySampler.cpp:
1353         (WebKit::WebMemorySampler::writeHeaders):
1354         * Shared/win/WebEventFactory.cpp:
1355         (WebKit::keyIdentifierFromEvent):
1356         * Shared/wpe/WebEventFactory.cpp:
1357         (WebKit::identifierStringForKeyEvent):
1358         * UIProcess/API/APINavigation.cpp:
1359         (API::Navigation::loggingString const):
1360         * UIProcess/API/glib/IconDatabase.cpp:
1361         (WebKit::IconDatabase::performURLImport):
1362         * UIProcess/Cocoa/ViewGestureController.cpp:
1363         (WebKit::ViewGestureController::SnapshotRemovalTracker::startWatchdog):
1364         * UIProcess/SuspendedPageProxy.cpp:
1365         (WebKit::SuspendedPageProxy::loggingString const):
1366         * UIProcess/WebBackForwardList.cpp:
1367         (WebKit::WebBackForwardList::loggingString):
1368         * UIProcess/WebInspectorUtilities.cpp:
1369         (WebKit::inspectorPageGroupIdentifierForPage):
1370         * UIProcess/WebProcessPool.cpp:
1371         (WebKit::WebProcessPool::processDidFinishLaunching):
1372         (WebKit::WebProcessPool::startMemorySampler):
1373         * UIProcess/gtk/InputMethodFilter.cpp:
1374         (WebKit::InputMethodFilter::logHandleKeyboardEventForTesting):
1375         (WebKit::InputMethodFilter::logHandleKeyboardEventWithCompositionResultsForTesting):
1376         (WebKit::InputMethodFilter::logConfirmCompositionForTesting):
1377         (WebKit::InputMethodFilter::logSetPreeditForTesting):
1378
1379 2018-08-01  Tim Horton  <timothy_horton@apple.com>
1380
1381         Using the keyboard arrow keys to scroll a webpage is very slow, not smooth, takes too long
1382         https://bugs.webkit.org/show_bug.cgi?id=188239
1383         <rdar://problem/22997654>
1384
1385         Reviewed by Simon Fraser.
1386
1387         Instead of depending on key repeat to drive scrolling with arrow keys held down,
1388         run a display link that animates the scroll. We still do a single discrete scroll
1389         first (so that you can tap the key and shift by line/page), but then on the first
1390         repeat we ramp up to a constant velocity determined by the desired increment,
1391         stopping when the key is lifted or a different key is pressed.
1392
1393         * UIProcess/API/Cocoa/WKWebView.mm:
1394         (-[WKWebView _scrollByContentOffset:animated:]):
1395         (-[WKWebView _scrollByContentOffset:]): Deleted.
1396         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1397         Add animated parameter to scrollByContentOffset, and plumb it through to UIScrollView.
1398
1399         * UIProcess/ios/WKContentViewInteraction.h:
1400         Add a WKKeyboardScrollingAnimator member.
1401         Conform to WKKeyboardScrollable.
1402
1403         * UIProcess/ios/WKContentViewInteraction.mm:
1404         (-[WKContentView setupInteraction]):
1405         Install the WKKeyboardScrollingAnimator.
1406
1407         (-[WKContentView cleanupInteraction]):
1408         Uninstall the WKKeyboardScrollingAnimator.
1409
1410         (-[WKContentView unscaledView]):
1411         Fix a stupid style nit.
1412
1413         (-[WKContentView handleKeyWebEvent:]):
1414         Give WKKeyboardScrollingAnimator the first shot at incoming keyboard events.
1415         It will only consume events here if it's already performing a scrolling animation
1416         (because otherwise they should go straight through to the page).
1417
1418         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
1419         Give WKKeyboardScrollingAnimator a shot at handling keyboard events that
1420         the web content did not handle. We will only start a scrolling animation
1421         if the page did not handle an event that would start a scroll.
1422
1423         (-[WKContentView isKeyboardScrollable]):
1424         Part of WKKeyboardScrollable; only report ourselves as scrollable if
1425         we would previously have allowed scrolling from keyboard events (if
1426         we're not in contenteditable, and don't have a <select> focused).
1427
1428         (-[WKContentView distanceForScrollingIncrement:]):
1429         Part of WKKeyboardScrollable; compute the distance for each scrolling increment.
1430
1431         (-[WKContentView scrollByContentOffset:animated:]):
1432         Part of WKKeyboardScrollable; plumb scrolls up to WKWebView.
1433
1434         (-[WKContentView _scrollOffsetForEvent:]): Moved to WKKeyboardScrollingAnimator.mm.
1435
1436         * UIProcess/ios/WKKeyboardScrollingAnimator.h: Added.
1437         * UIProcess/ios/WKKeyboardScrollingAnimator.mm: Added.
1438         (-[WKKeyboardScrollingAnimator init]):
1439         (-[WKKeyboardScrollingAnimator initWithScrollable:]):
1440         (-[WKKeyboardScrollingAnimator invalidate]):
1441         (-[WKKeyboardScrollingAnimator _scrollOffsetForEvent:]):
1442         Compute the scroll offset given a particular event. This is moved from WKContentView;
1443         otherwise the primary change is that it now asks the WKKeyboardScrollable
1444         for the distance instead of computing it directly.
1445
1446         (-[WKKeyboardScrollingAnimator beginWithEvent:]):
1447         If we're currently in the initial state (WaitingForFirstEvent), and
1448         a given event should start a scroll, transition into WaitingForRepeat,
1449         and do a single animated scroll of the appropriate distance.
1450
1451         (-[WKKeyboardScrollingAnimator handleKeyEvent:]):
1452         If this key event should terminate a scroll (because it is either a keyup
1453         or a non-scrolling keydown), shut down any running animations.
1454
1455         If this is the first key repeat after the initial scroll, start a scrolling
1456         animation.
1457
1458         Eat the event if it either started or continued a scroll.
1459
1460         (-[WKKeyboardScrollingAnimator startAnimatedScroll]):
1461         (-[WKKeyboardScrollingAnimator stopAnimatedScroll]):
1462         Helpers to start and stop the display link and do some bookkeeping.
1463
1464         (-[WKKeyboardScrollingAnimator displayLinkFired:]):
1465         Ask the WKKeyboardScrollable to scroll the content based on the frame time,
1466         an acceleration curve, and the current animation's scrolling increment.
1467
1468         * WebKit.xcodeproj/project.pbxproj:
1469
1470 2018-08-01  Chris Dumez  <cdumez@apple.com>
1471
1472         Make sure cookies get flushed to disk before exiting or suspending the network process
1473         https://bugs.webkit.org/show_bug.cgi?id=188241
1474         <rdar://problem/42831831>
1475
1476         Reviewed by Alex Christensen and Geoffrey Garen.
1477
1478         Make sure cookies get flushed to disk before exiting or suspending the network process,
1479         to make sure they do not get lost.
1480
1481         * NetworkProcess/NetworkProcess.cpp:
1482         (WebKit::NetworkProcess::didClose):
1483         (WebKit::NetworkProcess::actualPrepareToSuspend):
1484         (WebKit::NetworkProcess::platformSyncAllCookies):
1485         * NetworkProcess/NetworkProcess.h:
1486         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1487         (WebKit::NetworkProcess::syncAllCookies):
1488         (WebKit::NetworkProcess::platformSyncAllCookies):
1489         * Shared/ChildProcess.cpp:
1490         (WebKit::ChildProcess::didClose):
1491         (WebKit::callExitNow):
1492         (WebKit::callExitSoon):
1493         (WebKit::ChildProcess::initialize):
1494         (WebKit::didCloseOnConnectionWorkQueue): Deleted.
1495         * Shared/ChildProcess.h:
1496         (WebKit::ChildProcess::shouldCallExitWhenConnectionIsClosed const):
1497
1498 2018-08-01  Alex Christensen  <achristensen@webkit.org>
1499
1500         Move all calls to ResourceLoader::start to WebKitLegacy
1501         https://bugs.webkit.org/show_bug.cgi?id=184946
1502
1503         Reviewed by Andy Estes.
1504
1505         * WebProcess/Network/WebLoaderStrategy.cpp:
1506         (WebKit::WebLoaderStrategy::setDefersLoading):
1507         * WebProcess/Network/WebLoaderStrategy.h:
1508
1509 2018-08-01  Nan Wang  <n_wang@apple.com>
1510
1511         AX: AOM: Add ARIA IDL Attribute Reflection
1512         https://bugs.webkit.org/show_bug.cgi?id=184676
1513         <rdar://problem/39476882>
1514
1515         Added ARIA property string reflection on Element, behind
1516         a new runtime flag. 
1517         Spec: https://w3c.github.io/aria/#idl-interface
1518
1519         Reviewed by Chris Fleizach.
1520
1521         * Shared/WebPreferences.yaml:
1522         * UIProcess/API/C/WKPreferences.cpp:
1523         (WKPreferencesSetAriaReflectionEnabled):
1524         (WKPreferencesGetAriaReflectionEnabled):
1525         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1526
1527 2018-08-01  Alex Christensen  <achristensen@webkit.org>
1528
1529         Allow WebFramePolicyListenerProxy to be used multiple times
1530         https://bugs.webkit.org/show_bug.cgi?id=188229
1531
1532         Reviewed by Chris Dumez.
1533
1534         This fixes a regression from r234210 in clients that misuse the API.
1535
1536         * UIProcess/WebFramePolicyListenerProxy.cpp:
1537         (WebKit::WebFramePolicyListenerProxy::use):
1538         (WebKit::WebFramePolicyListenerProxy::download):
1539         (WebKit::WebFramePolicyListenerProxy::ignore):
1540
1541 2018-08-01  Aditya Keerthi  <akeerthi@apple.com>
1542
1543         [iOS] Color picker should have a border when presented in a popover
1544         https://bugs.webkit.org/show_bug.cgi?id=188207
1545
1546         Reviewed by Wenson Hsieh.
1547
1548         The color picker should have a border when presented in a popover. This matches
1549         the behavior of color pickers in other parts of iOS.
1550
1551         Since the popover will resize its view to fill its size, we first place the
1552         color picker in a container view. The container view can then fill the popover,
1553         while the smaller color picker is centered in it's container - creating the
1554         appearance of a border.
1555
1556         * UIProcess/ios/forms/WKFormColorControl.mm:
1557         (-[WKColorPopover initWithView:]):
1558         * UIProcess/ios/forms/WKFormColorPicker.mm:
1559
1560 2018-08-01  Commit Queue  <commit-queue@webkit.org>
1561
1562         Unreviewed, rolling out r234443 and r234445.
1563         https://bugs.webkit.org/show_bug.cgi?id=188224
1564
1565         Revision caused 3 api failures across all platforms.
1566         (Requested by Truitt on #webkit).
1567
1568         Reverted changesets:
1569
1570         "Add configuration for automatic process pre-warming"
1571         https://bugs.webkit.org/show_bug.cgi?id=187108
1572         https://trac.webkit.org/changeset/234443
1573
1574         "Add configuration for automatic process pre-warming"
1575         https://bugs.webkit.org/show_bug.cgi?id=187108
1576         https://trac.webkit.org/changeset/234445
1577
1578 2018-08-01  Aditya Keerthi  <akeerthi@apple.com>
1579
1580         [iOS] WKColorPicker's selection indicator doesn't always cover the selected swatch
1581         https://bugs.webkit.org/show_bug.cgi?id=188124
1582
1583         Reviewed by Wenson Hsieh.
1584
1585         - On iPhone, the size of an individual color swatch can change on rotation. In
1586         this case, we should resize the selection indicator along with the swatch. Added
1587         a new delegate method to WKColorMatrixViewDelegate to notify the color picker if
1588         the matrix was redrawn. We then resize the selection indicator to match the
1589         selected swatch's size.
1590
1591         - On iPad, the selection indicator should have rounded corners if it's at the
1592         corner of the color picker. Otherwise, part of the indicator will be hidden by
1593         the popover. The selected swatch's position is checked before drawing the
1594         indicator. If it's at one of the four corners of the picker, the appropriate mask
1595         is applied to the color selection indicator's border.
1596
1597         * UIProcess/ios/forms/WKFormColorPicker.h:
1598         * UIProcess/ios/forms/WKFormColorPicker.mm:
1599         (-[WKColorMatrixView layoutSubviews]):
1600         (-[WKColorPicker initWithView:]):
1601         (-[WKColorPicker drawSelectionIndicatorForColorButton:]):
1602         (-[WKColorPicker colorMatrixViewDidLayoutSubviews:]):
1603         (-[WKColorPicker colorMatrixView:didTapColorButton:]):
1604         (-[WKColorPicker didPanColors:]):
1605
1606 2018-08-01  Zan Dobersek  <zdobersek@igalia.com>
1607
1608         [CoordGraphics] Move CoordinatedBackingStore to WebCore
1609         https://bugs.webkit.org/show_bug.cgi?id=188158
1610
1611         Reviewed by Carlos Garcia Campos.
1612
1613         Move the CoordinatedBackingStore class from WebKit to WebCore. It has no
1614         dependency on anything in the WebKit layer, and it's more suitable to
1615         future needs to keep it in the WebCore layer.
1616
1617         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1618         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
1619         * SourcesGTK.txt:
1620         * SourcesWPE.txt:
1621
1622 2018-07-31  Alex Christensen  <achristensen@webkit.org>
1623
1624         REGRESSION (r231107): MoviStar+ launches to a blank black screen
1625         https://bugs.webkit.org/show_bug.cgi?id=188139
1626
1627         Reviewed by Brent Fulgham.
1628
1629         Add infrastructure to check UIProcess SDK from the WebProcess and NetworkProcess for linked-on-or-after checks.
1630
1631         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1632         (WebKit::NetworkProcessCreationParameters::encode const):
1633         (WebKit::NetworkProcessCreationParameters::decode):
1634         * NetworkProcess/NetworkProcessCreationParameters.h:
1635         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1636         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1637         * Shared/WebProcessCreationParameters.cpp:
1638         (WebKit::WebProcessCreationParameters::encode const):
1639         (WebKit::WebProcessCreationParameters::decode):
1640         * Shared/WebProcessCreationParameters.h:
1641         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1642         (WebKit::WebProcessPool::platformInitializeWebProcess):
1643         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1644         * WebProcess/cocoa/WebProcessCocoa.mm:
1645         (WebKit::WebProcess::platformInitializeWebProcess):
1646
1647 2018-07-31  Ryosuke Niwa  <rniwa@webkit.org>
1648
1649         Add configuration for automatic process pre-warming
1650         https://bugs.webkit.org/show_bug.cgi?id=187108
1651
1652         Reviewed by Ryosuke Niwa.
1653
1654         Added the missing availability macros.
1655
1656         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1657
1658 2018-07-31  Ben Richards  <benton_richards@apple.com>
1659
1660         Add configuration for automatic process pre-warming
1661         https://bugs.webkit.org/show_bug.cgi?id=187108
1662
1663         Reviewed by Ryosuke Niwa.
1664
1665         Added configurations to allow setting the maximum number of processes that should be automatically prewarmed.
1666
1667         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1668         (API::ProcessPoolConfiguration::copy):
1669         * UIProcess/API/APIProcessPoolConfiguration.h:
1670         * UIProcess/API/C/WKContext.cpp:
1671         (WKContextSetMaximumNumberOfPrewarmedProcesses):
1672         * UIProcess/API/C/WKContextPrivate.h:
1673         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1674         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1675         (-[_WKProcessPoolConfiguration setMaximumPrewarmedProcessCount:]):
1676         (-[_WKProcessPoolConfiguration maximumPrewarmedProcessCount]):
1677         * UIProcess/WebPageProxy.cpp:
1678         (WebKit::WebPageProxy::didFinishLoadForFrame): Moved call to notifyProcessPoolToPrewarm from didFirstVisuallyNonEmptyLayoutForFrame to here.
1679         This is to try to ensure that frame loading and prewarming don't happen at the same time as this would be heavy for some devices.
1680         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
1681         * UIProcess/WebProcessPool.cpp:
1682         (WebKit::WebProcessPool::setMaximumNumberOfProcesses): Condition changed so that calling setMaximumNumberOfProcesses after warmInitialProcess
1683         doesn't result in a crash.
1684         (WebKit::WebProcessPool::setMaximumNumberOfPrewarmedProcesses):
1685         (WebKit::WebProcessPool::warmInitialProcess):
1686         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
1687         * UIProcess/WebProcessPool.h:
1688
1689 2018-07-31  Stephan Szabo  <stephan.szabo@sony.com>
1690
1691         [WinCairo] <select> elements do not popup options
1692         https://bugs.webkit.org/show_bug.cgi?id=188172
1693
1694         Reviewed by Fujii Hironori.
1695
1696         * PlatformWin.cmake: Add WebPopupMenuProxyWin
1697         * Shared/PlatformPopupMenuData.cpp:
1698         (WebKit::PlatformPopupMenuData::encode const): Encode
1699         windows parameters
1700         (WebKit::PlatformPopupMenuData::decode): Decode windows
1701         parameters
1702         * Shared/PlatformPopupMenuData.h: Add the windows specific
1703         parameters (based on removed Windows implementation)
1704         * UIProcess/win/PageClientImpl.cpp:
1705         (WebKit::PageClientImpl::createPopupMenuProxy):
1706         * UIProcess/win/WebPopupMenuProxyWin.cpp: Added. (based on
1707         removed Windows implementation plus some fixes/api changes
1708         since the removal)
1709         (WebKit::isASCIIPrintable):
1710         (WebKit::translatePoint):
1711         (WebKit::WebPopupMenuProxyWin::WebPopupMenuProxyWndProc):
1712         (WebKit::WebPopupMenuProxyWin::wndProc):
1713         (WebKit::WebPopupMenuProxyWin::registerWindowClass):
1714         (WebKit::WebPopupMenuProxyWin::WebPopupMenuProxyWin):
1715         (WebKit::WebPopupMenuProxyWin::~WebPopupMenuProxyWin):
1716         (WebKit::WebPopupMenuProxyWin::showPopupMenu):
1717         (WebKit::WebPopupMenuProxyWin::hidePopupMenu):
1718         (WebKit::WebPopupMenuProxyWin::calculatePositionAndSize):
1719         (WebKit::WebPopupMenuProxyWin::clientRect const):
1720         (WebKit::WebPopupMenuProxyWin::invalidateItem):
1721         (WebKit::WebPopupMenuProxyWin::scrollSize const):
1722         (WebKit::WebPopupMenuProxyWin::setScrollOffset):
1723         (WebKit::WebPopupMenuProxyWin::visibleSize const):
1724         (WebKit::WebPopupMenuProxyWin::contentsSize const):
1725         (WebKit::WebPopupMenuProxyWin::scrollableAreaBoundingBox const):
1726         (WebKit::WebPopupMenuProxyWin::scrollTo):
1727         (WebKit::WebPopupMenuProxyWin::invalidateScrollbarRect):
1728         (WebKit::WebPopupMenuProxyWin::onMouseActivate):
1729         (WebKit::WebPopupMenuProxyWin::onSize):
1730         (WebKit::WebPopupMenuProxyWin::onKeyDown):
1731         (WebKit::WebPopupMenuProxyWin::onChar):
1732         (WebKit::WebPopupMenuProxyWin::onMouseMove):
1733         (WebKit::WebPopupMenuProxyWin::onLButtonDown):
1734         (WebKit::WebPopupMenuProxyWin::onLButtonUp):
1735         (WebKit::WebPopupMenuProxyWin::onMouseWheel):
1736         (WebKit::WebPopupMenuProxyWin::onPaint):
1737         (WebKit::WebPopupMenuProxyWin::onPrintClient):
1738         (WebKit::WebPopupMenuProxyWin::down):
1739         (WebKit::WebPopupMenuProxyWin::up):
1740         (WebKit::WebPopupMenuProxyWin::paint):
1741         (WebKit::WebPopupMenuProxyWin::setFocusedIndex):
1742         (WebKit::WebPopupMenuProxyWin::visibleItems const):
1743         (WebKit::WebPopupMenuProxyWin::listIndexAtPoint const):
1744         (WebKit::WebPopupMenuProxyWin::focusedIndex const):
1745         (WebKit::WebPopupMenuProxyWin::focusFirst):
1746         (WebKit::WebPopupMenuProxyWin::focusLast):
1747         (WebKit::WebPopupMenuProxyWin::incrementWheelDelta):
1748         (WebKit::WebPopupMenuProxyWin::reduceWheelDelta):
1749         (WebKit::WebPopupMenuProxyWin::scrollToRevealSelection):
1750         * UIProcess/win/WebPopupMenuProxyWin.h: Added. (based on
1751         removed Windows implementation plus some fixes/api changes
1752         since then)
1753         (WebKit::WebPopupMenuProxyWin::create):
1754         (WebKit::WebPopupMenuProxyWin::hide):
1755         (WebKit::WebPopupMenuProxyWin::scrollbar const):
1756         (WebKit::WebPopupMenuProxyWin::itemHeight const):
1757         (WebKit::WebPopupMenuProxyWin::windowRect const):
1758         (WebKit::WebPopupMenuProxyWin::wheelDelta const):
1759         (WebKit::WebPopupMenuProxyWin::setWasClicked):
1760         (WebKit::WebPopupMenuProxyWin::wasClicked const):
1761         (WebKit::WebPopupMenuProxyWin::scrollbarCapturingMouse const):
1762         (WebKit::WebPopupMenuProxyWin::setScrollbarCapturingMouse):
1763         * WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp:
1764         (WebKit::WebPopupMenu::setUpPlatformData): Make the data to
1765         pass between processes.
1766
1767 2018-07-31  John Wilander  <wilander@apple.com>
1768
1769         Resource Load Statistics: Remove partitioned cookies for reduced complexity, lower memory footprint, and ability to support more platforms
1770         https://bugs.webkit.org/show_bug.cgi?id=188109
1771         <rdar://problem/42664391>
1772
1773         Reviewed by Brent Fulgham, Chris Dumez, and Alex Christensen.
1774
1775         This patch removes cookie partitioning which reduces the model to just
1776         blocked cookies (in third-party contexts) and first-party cookie access.
1777
1778         Several of the changes are renaming to reflect that there are no more
1779         cookie partitions. However, the compile-time check remains for now since
1780         this change is not ready to ship.
1781
1782         The API changes are mostly in C APIs used for layout tests. The slight
1783         change in Cocoa API is that there no longer is a functionality to
1784         "enable" cookie partitioning. The boolean member is still there but it
1785         no longer does anything.
1786
1787         The functional changes are in WebKit::ResourceLoadStatisticsMemoryStore
1788         and WebKit::NetworkDataTaskCocoa where cookie partitioning used to be
1789         managed and applied respectively. The IPC communication has changed to
1790         reflect this.
1791
1792         * NetworkProcess/NetworkProcess.cpp:
1793         (WebKit::NetworkProcess::updatePrevalentDomainsToBlockCookiesFor):
1794             Name change from updatePrevalentDomainsToPartitionOrBlockCookies().
1795             No longer supports the partitioned category.
1796         (WebKit::NetworkProcess::removeAllStorageAccess):
1797             Now supports a completion handler. This change was made to address
1798             flakiness that came after layout test changes that were needed because
1799             of the removal of partitioned cookies.
1800         (WebKit::NetworkProcess::updatePrevalentDomainsToPartitionOrBlockCookies): Deleted.
1801         * NetworkProcess/NetworkProcess.h:
1802         * NetworkProcess/NetworkProcess.messages.in:
1803             Partitioning removed from message name.
1804             RemoveAllStorageAccess message now supports a completion handler
1805             as explained above
1806         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1807         (WebKit::NetworkProcessCreationParameters::encode const):
1808             Removed parameter cookieStoragePartitioningEnabled.
1809         (WebKit::NetworkProcessCreationParameters::decode):
1810             Removed parameter cookieStoragePartitioningEnabled.
1811         * NetworkProcess/NetworkProcessCreationParameters.h:
1812         * NetworkProcess/NetworkResourceLoader.cpp:
1813         (WebKit::NetworkResourceLoader::logCookieInformation):
1814             No longer takes partitioning into account.
1815         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1816         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1817         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
1818             Now only applies cookie blocking.
1819         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
1820             Now only applies cookie blocking.
1821         (WebKit::NetworkDataTaskCocoa::applyCookiePartitioningPolicy): Deleted.
1822         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1823         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1824             Removed the call to setCookieStoragePartitioningEnabled().
1825         (WebKit::NetworkProcess::setCookieStoragePartitioningEnabled): Deleted.
1826         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1827         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
1828         (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
1829             WebCore::NetworkStorageSession::shouldBlockCookies() now takes a
1830             frame ID and page ID to resolve cookie access with the Storage
1831             Access API. This was previously handled by
1832             WebCore::NetworkStorageSession::cookieStoragePartition().
1833         * UIProcess/API/C/WKCookieManager.cpp:
1834         (WKCookieManagerSetCookieStoragePartitioningEnabled): Deleted.
1835         * UIProcess/API/C/WKCookieManager.h:
1836         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1837         (WKWebsiteDataStoreStatisticsUpdateCookieBlocking):
1838         (WKWebsiteDataStoreSetStatisticsHasHadNonRecentUserInteraction): Deleted.
1839             There is no longer a difference between recent and non-recent
1840             user interaction so this test function was removed.
1841         (WKWebsiteDataStoreSetStatisticsTimeToLiveCookiePartitionFree): Deleted.
1842         (WKWebsiteDataStoreStatisticsUpdateCookiePartitioning): Deleted.
1843         (WKWebsiteDataStoreSetStatisticsShouldPartitionCookiesForHost): Deleted.
1844             Deleted because partitioning is no longer a thing.
1845         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1846         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1847             Deprecated _isCookieStoragePartitioningEnabled() and
1848             _setCookieStoragePartitioningEnabled() via WK_API_DEPRECATED.
1849         * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm:
1850         (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):
1851             Removed support for ResourceLoadStatisticsTimeToLiveCookiePartitionFree.
1852         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1853         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1854             No longer sets a parameter based on cookieStoragePartitioningEnabled().
1855         (WebKit::WebProcessPool::setCookieStoragePartitioningEnabled):
1856             Added a FIXME comment that this setter no longer does anything meaningful.
1857             Removed the IPC call to the network process to propagate the setting.
1858         * UIProcess/Network/NetworkProcessProxy.cpp:
1859         (WebKit::NetworkProcessProxy::clearCallbackStates):
1860             Name change from m_updatePartitionOrBlockCookiesCallbackMap to
1861             m_updateBlockCookiesCallbackMap.
1862         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor):
1863             Name change plus it now just takes one vector of strings named domainsToBlock.
1864         (WebKit::NetworkProcessProxy::didUpdateBlockCookies):
1865             Name change from didUpdatePartitionOrBlockCookies().
1866         (WebKit::NetworkProcessProxy::storageAccessRequestResult):
1867             Just moved to its right place.
1868         (WebKit::NetworkProcessProxy::removeAllStorageAccess):
1869             Now take a completion handler.
1870         (WebKit::NetworkProcessProxy::didRemoveAllStorageAccess):
1871             To call the completion handler.
1872         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToPartitionOrBlockCookies): Deleted.
1873             Name change.
1874         (WebKit::NetworkProcessProxy::didUpdatePartitionOrBlockCookies): Deleted.
1875             Name change.
1876         * UIProcess/Network/NetworkProcessProxy.h:
1877         * UIProcess/Network/NetworkProcessProxy.messages.in:
1878             Name change and added completion handler message for removeAllStorageAccess().
1879         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
1880         (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess):
1881         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
1882         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener):
1883         (WebKit::ResourceLoadStatisticsMemoryStore::scheduleStatisticsProcessingRequestIfNecessary):
1884         (WebKit::ResourceLoadStatisticsMemoryStore::logUserInteraction):
1885         (WebKit::ResourceLoadStatisticsMemoryStore::mergeWithDataFromDecoder):
1886         (WebKit::ResourceLoadStatisticsMemoryStore::clear):
1887         (WebKit::ResourceLoadStatisticsMemoryStore::wasAccessedAsFirstPartyDueToUserInteraction const):
1888         (WebKit::ResourceLoadStatisticsMemoryStore::shouldBlockAndKeepCookies):
1889         (WebKit::ResourceLoadStatisticsMemoryStore::shouldBlockAndPurgeCookies):
1890         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking):
1891         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlockingForDomains):
1892         (WebKit::ResourceLoadStatisticsMemoryStore::clearBlockingStateForDomains):
1893         (WebKit::ResourceLoadStatisticsMemoryStore::resetCookieBlockingState):
1894         (WebKit::ResourceLoadStatisticsMemoryStore::removeAllStorageAccess):
1895         (WebKit::ResourceLoadStatisticsMemoryStore::logNonRecentUserInteraction): Deleted.
1896             There is no longer a difference between recent and non-recent
1897             user interaction so this test function was removed.
1898         (WebKit::ResourceLoadStatisticsMemoryStore::setTimeToLiveCookiePartitionFree): Deleted.
1899         (WebKit::ResourceLoadStatisticsMemoryStore::shouldPartitionCookies): Deleted.
1900         (WebKit::ResourceLoadStatisticsMemoryStore::shouldBlockCookies): Deleted.
1901             Now split into shouldBlockAndKeepCookies() and shouldBlockAndPurgeCookies().
1902         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookiePartitioning): Deleted.
1903         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookiePartitioningForDomains): Deleted.
1904         (WebKit::ResourceLoadStatisticsMemoryStore::clearPartitioningStateForDomains): Deleted.
1905         (WebKit::ResourceLoadStatisticsMemoryStore::resetCookiePartitioningState): Deleted.
1906         * UIProcess/ResourceLoadStatisticsMemoryStore.h:
1907         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
1908         (WebKit::ResourceLoadStatisticsPersistentStorage::startMonitoringDisk):
1909             Added an empty completion handler to the m_memoryStore.clear() call.
1910         * UIProcess/WebCookieManagerProxy.cpp:
1911         (WebKit::WebCookieManagerProxy::setCookieStoragePartitioningEnabled): Deleted.
1912         * UIProcess/WebCookieManagerProxy.h:
1913         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1914         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
1915         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
1916             Now has a completion handler.
1917         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdate):
1918         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdateForDomains):
1919         (WebKit::WebResourceLoadStatisticsStore::scheduleClearBlockingStateForDomains):
1920         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingStateReset):
1921         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemory):
1922             Now supports a completion handler for removeAllStorageAccess().
1923         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
1924         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler):
1925         (WebKit::WebResourceLoadStatisticsStore::logNonRecentUserInteraction): Deleted.
1926             There is no longer a difference between recent and non-recent
1927             user interaction so this test function was removed.
1928         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdate): Deleted.
1929             Renamed to scheduleCookieBlockingUpdate().
1930         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdateForDomains): Deleted.
1931             Renamed to scheduleCookieBlockingUpdateForDomains().
1932         (WebKit::WebResourceLoadStatisticsStore::scheduleClearPartitioningStateForDomains): Deleted.
1933             Renamed to scheduleClearBlockingStateForDomains().
1934         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningStateReset): Deleted.
1935             Renamed to scheduleCookieBlockingStateReset().
1936         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree): Deleted.
1937         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToPartitionOrBlockCookiesHandler): Deleted.
1938             Renamed callUpdatePrevalentDomainsToBlockCookiesForHandler().
1939         * UIProcess/WebResourceLoadStatisticsStore.h:
1940         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1941         (WebKit::WebsiteDataStore::updatePrevalentDomainsToBlockCookiesFor):
1942         (WebKit::WebsiteDataStore::removeAllStorageAccessHandler):
1943             Now supports a completion handler for removeAllStorageAccess().
1944         (WebKit::WebsiteDataStore::networkProcessDidCrash):
1945             Name change in function called to get rid of "partitioning."
1946         (WebKit::WebsiteDataStore::updatePrevalentDomainsToPartitionOrBlockCookies): Deleted.
1947             Renamed updatePrevalentDomainsToBlockCookiesFor().
1948         * UIProcess/WebsiteData/WebsiteDataStore.h:
1949
1950 2018-07-31  Rob Buis  <rbuis@igalia.com>
1951
1952         Remove ResourceResponse::cacheBodyKey API
1953         https://bugs.webkit.org/show_bug.cgi?id=188192
1954
1955         Reviewed by Frédéric Wang.
1956
1957         Remove unused API.
1958
1959         * NetworkProcess/cache/NetworkCacheEntry.cpp:
1960         (WebKit::NetworkCache::Entry::decodeStorageRecord):
1961
1962 2018-07-30  Sihui Liu  <sihui_liu@apple.com>
1963
1964         Add support for fetching and remove type  _WKWebsiteDataTypeHSTSCache
1965         https://bugs.webkit.org/show_bug.cgi?id=187379
1966         <rdar://problem/41879559>
1967
1968         WKWebsiteDataStore should support _WKWebsiteDataTypeHSTSCache so Safari could list HSTS cache entries
1969         and be able to remove them on a per-domain basis.
1970
1971         Reviewed by Geoffrey Garen.
1972
1973         * NetworkProcess/NetworkProcess.cpp:
1974         (WebKit::NetworkProcess::fetchWebsiteData):
1975         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
1976         * NetworkProcess/NetworkProcess.h:
1977         * NetworkProcess/NetworkProcess.messages.in:
1978         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1979         (WebKit::filterPreloadHSTSEntry):
1980         (WebKit::NetworkProcess::getHostNamesWithHSTSCache):
1981         (WebKit::NetworkProcess::deleteHSTSCacheForHostNames):
1982         * Shared/WebsiteData/WebsiteData.cpp:
1983         (WebKit::WebsiteData::encode const):
1984         (WebKit::WebsiteData::decode):
1985         * Shared/WebsiteData/WebsiteData.h:
1986         * UIProcess/Network/NetworkProcessProxy.cpp:
1987         (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
1988         * UIProcess/Network/NetworkProcessProxy.h:
1989         * UIProcess/WebsiteData/WebsiteDataRecord.cpp:
1990         (WebKit::WebsiteDataRecord::displayNameForCookieHostName):
1991         (WebKit::WebsiteDataRecord::displayNameForHostName):
1992         (WebKit::WebsiteDataRecord::addHSTSCacheHostname):
1993         (WebKit::WebsiteDataRecord::displayNameForPluginDataHostName): Deleted.
1994         * UIProcess/WebsiteData/WebsiteDataRecord.h:
1995         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1996         (WebKit::WebsiteDataStore::fetchDataAndApply):
1997         (WebKit::WebsiteDataStore::removeData):
1998
1999 2018-07-30  Simon Fraser  <simon.fraser@apple.com>
2000
2001         Shrink GraphicsLayerCA
2002         https://bugs.webkit.org/show_bug.cgi?id=188141
2003
2004         Reviewed by Zalan Bujtas.
2005
2006         Shrink GraphicsLayerCA from 1040 to 880 bytes by:
2007         * moving all the clone-related stuff into the lazily-allocated m_layerClones
2008         * moving all the animation-related stuff into the lazily-allocated m_animations
2009         * making enums be 8-bit
2010         * re-ordering data members
2011
2012         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
2013         (WebKit::updateCustomAppearance):
2014         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
2015         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
2016         (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
2017         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
2018         (WebKit::PlatformCALayerRemote::requiresCustomAppearanceUpdateOnBoundsChange const):
2019
2020 2018-07-30  Wenson Hsieh  <wenson_hsieh@apple.com>
2021
2022         REGRESSION (r230817): Terrible performance when selecting text on Stash code review
2023         https://bugs.webkit.org/show_bug.cgi?id=188144
2024         <rdar://problem/42642489>
2025
2026         Reviewed by Darin Adler.
2027
2028         After r230817, mouse events were serially dispatched to the web process and handled before the subsequent mouse
2029         event. However, this resulted in rapid-fire mouse move events filling up the mouse event queue in the case where
2030         mouse move events were being handled by the web process at a slower rate than the UI process was enqueueing
2031         them. To mitigate this, r231511 introduced a mechanism for replacing the most recently enqueued mouse move event
2032         with an incoming mouse move event.
2033
2034         However, when a user with a force-click-enabled trackpad performs a mouse drag, a rapid stream of
2035         "mouseforcechanged" events is interleaved alongside the stream of "mousemove" events. This renders r231511
2036         ineffective, since the most recently queued event is often a "mouseforcechanged" event instead of a "mousemove".
2037         On the stash code review page, this can result in hundreds of mouse events being backed up in the mouse event
2038         queue, causing perceived slowness when selecting text.
2039
2040         To fix this, we extend the mechanism introduced in r231511, such that it is capable of replacing both
2041         "mouseforcechanged" and "mousemove" events in the queue. Rather than consider only the most recently queued
2042         item, we instead find the most recently queued event that matches the type of the incoming event, remove it from
2043         the queue, and then append the incoming event to the end of the queue. To avoid the risk of removing the only
2044         "mousemove" or "mouseforcechanged" event in the middle of a mouse down and mouse up, we also bail when searching
2045         backwards for an event to replace if we come across any event that is neither of these types.
2046
2047         This effectively throttles the rate at which mouseforcechanged or mousemove events are dispatched when a user
2048         with force-click-enabled hardware clicks and drags the mouse across the page.
2049
2050         * UIProcess/WebPageProxy.cpp:
2051         (WebKit::removeOldRedundantEvent):
2052         (WebKit::WebPageProxy::handleMouseEvent):
2053
2054 2018-07-30  Devin Rousso  <webkit@devinrousso.com>
2055
2056         Add missing CoreGraphics SPI
2057         https://bugs.webkit.org/show_bug.cgi?id=188177
2058
2059         Reviewed by Joseph Pecoraro.
2060
2061         * WebProcess/cocoa/WebProcessCocoa.mm:
2062
2063 2018-07-30  Rob Buis  <rbuis@igalia.com>
2064
2065         https://bugs.webkit.org/show_bug.cgi?id=188137
2066         Merge PlatformCookieJar functions into NetworkStorageSession
2067
2068         Adapt callsites to use NetworkStorageSession instead of CookieJar functions.
2069
2070         Reviewed by Alex Christensen.
2071
2072         * NetworkProcess/Cookies/WebCookieManager.cpp:
2073         (WebKit::WebCookieManager::getHostnamesWithCookies):
2074         (WebKit::WebCookieManager::deleteCookiesForHostname):
2075         (WebKit::WebCookieManager::deleteAllCookies):
2076         (WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
2077         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2078         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
2079         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
2080         (WebKit::NetworkConnectionToWebProcess::cookiesEnabled):
2081         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
2082         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
2083         (WebKit::NetworkConnectionToWebProcess::deleteCookie):
2084         * NetworkProcess/NetworkProcess.cpp:
2085         (WebKit::NetworkProcess::fetchWebsiteData):
2086         (WebKit::NetworkProcess::deleteWebsiteData):
2087         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
2088         * NetworkProcess/NetworkResourceLoader.cpp:
2089         (WebKit::logCookieInformationInternal):
2090         * NetworkProcess/cache/NetworkCache.cpp:
2091         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
2092
2093 2018-07-30  Alex Christensen  <achristensen@webkit.org>
2094
2095         Add RefCounted CompletionHandler wrapping abstraction for sending policy decisions back to WebProcess
2096         https://bugs.webkit.org/show_bug.cgi?id=188089
2097
2098         Reviewed by Geoffrey Garen and Said Abou-Hallawa.
2099
2100         This will be necessary for when I add an asynchronous parallel step to decidePolicyForNavigationAction.
2101         We will want to wait for that asynchronous step for decidePolicyForNavigationActionSync but not for a client.
2102
2103         No change in behavior.
2104
2105         * UIProcess/WebPageProxy.cpp:
2106         (WebKit::WebPageProxy::PolicyDecisionSender::create):
2107         (WebKit::WebPageProxy::PolicyDecisionSender::operator()):
2108         (WebKit::WebPageProxy::PolicyDecisionSender::PolicyDecisionSender):
2109         (WebKit::WebPageProxy::receivedPolicyDecision):
2110         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
2111         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2112         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
2113         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
2114         (WebKit::WebPageProxy::decidePolicyForResponse):
2115         * UIProcess/WebPageProxy.h:
2116         * UIProcess/WebPageProxy.messages.in:
2117         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2118         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2119
2120 2018-07-30  David Fenton  <david_fenton@apple.com>
2121
2122         Unreviewed, rolling out r234327.
2123
2124         Caused 2 crashes on macOS and iOS debug API tests
2125
2126         Reverted changeset:
2127
2128         "Add RefCounted CompletionHandler wrapping abstraction for
2129         sending policy decisions back to WebProcess"
2130         https://bugs.webkit.org/show_bug.cgi?id=188089
2131         https://trac.webkit.org/changeset/234327
2132
2133 2018-07-30  Chris Dumez  <cdumez@apple.com>
2134
2135         Potential null dereference under WebPage::applicationDidBecomeActive()
2136         https://bugs.webkit.org/show_bug.cgi?id=188170
2137         <rdar://problem/37493418>
2138
2139         Reviewed by Wenson Hsieh.
2140
2141         WebPage::m_page gets nulled out when the page is closed but the WebPage object may receive IPC
2142         until it gets destroyed. Therefore, we need to null-check m_page before using it in IPC message
2143         handlers.
2144
2145         * WebProcess/WebPage/ios/WebPageIOS.mm:
2146         (WebKit::WebPage::applicationDidEnterBackground):
2147         (WebKit::WebPage::applicationWillEnterForeground):
2148         (WebKit::WebPage::applicationDidBecomeActive):
2149
2150 2018-07-29  Wenson Hsieh  <wenson_hsieh@apple.com>
2151
2152         Fix incorrect guards around a method declaration in PageClient.h
2153         https://bugs.webkit.org/show_bug.cgi?id=188153
2154
2155         Reviewed by Tim Horton.
2156
2157         `WebCore::DragItem` is forward declared under `ENABLE(DRAG_SUPPORT)`, but `startDrag` is declared under
2158         `PLATFORM(COCOA)`. If `ENABLE(DRAG_SUPPORT)` is off but `PLATFORM(COCOA)` is on, the build breaks.
2159
2160         We fix this by moving `startDrag` under `ENABLE(DRAG_SUPPORT)`.
2161
2162         * UIProcess/PageClient.h:
2163         (WebKit::PageClient::startDrag):
2164
2165 2018-07-28  Andy Estes  <aestes@apple.com>
2166
2167         [Wi-Fi Assertions] Pass a ResumptionReason to resumeWiFiAssertions
2168         https://bugs.webkit.org/show_bug.cgi?id=188142
2169         <rdar://problem/42628842>
2170
2171         Reviewed by Darin Adler.
2172
2173         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2174         (WebKit::NetworkProcess::platformProcessDidResume):
2175         (WebKit::NetworkProcess::platformProcessDidTransitionToForeground):
2176
2177 2018-07-28  Darin Adler  <darin@apple.com>
2178
2179         [Cocoa] Update more WebCore Objective-C code to be ARC compatible
2180         https://bugs.webkit.org/show_bug.cgi?id=188140
2181
2182         Reviewed by Sam Weinig.
2183
2184         * UIProcess/mac/WKFullScreenWindowController.mm:
2185         (-[WKFullScreenWindowController enterFullScreen:]): Removed the call to
2186         setAction: since the full screen placeholder view now always uses the
2187         cancelOperation: method.
2188
2189         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2190         (WebKit::PDFPlugin::lookupTextAtLocation): Updated to use the new
2191         DictionaryLookup function that returns a tuple instead of using an out argument.
2192         * WebProcess/WebPage/mac/WebPageMac.mm:
2193         (WebKit::WebPage::performDictionaryLookupAtLocation): Ditto.
2194         (WebKit::WebPage::performDictionaryLookupForSelection): Ditto.
2195
2196 2018-07-27  Chris Dumez  <cdumez@apple.com>
2197
2198         Fix thread-safety issues related to RealtimeMediaSource::audioSamplesAvailable()
2199         https://bugs.webkit.org/show_bug.cgi?id=188097
2200         <rdar://problem/42558823>
2201
2202         Reviewed by Eric Carlson.
2203
2204         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
2205
2206 2018-07-27  Alex Christensen  <achristensen@webkit.org>
2207
2208         Don't include WebPageProxy.h just for UndoOrRedo
2209         https://bugs.webkit.org/show_bug.cgi?id=188086
2210
2211         Reviewed by Saam Barati.
2212
2213         * Shared/UndoOrRedo.h: Added.
2214         * UIProcess/Cocoa/WebViewImpl.h:
2215         * UIProcess/Cocoa/WebViewImpl.mm:
2216         (WebKit::WebViewImpl::registerEditCommand):
2217         * UIProcess/PageClient.h:
2218         * UIProcess/WebEditCommandProxy.cpp:
2219         (WebKit::WebEditCommandProxy::unapply):
2220         (WebKit::WebEditCommandProxy::reapply):
2221         * UIProcess/WebPageProxy.cpp:
2222         (WebKit::WebPageProxy::registerEditCommandForUndo):
2223         (WebKit::WebPageProxy::canUndoRedo):
2224         (WebKit::WebPageProxy::executeUndoRedo):
2225         (WebKit::WebPageProxy::canUndo):
2226         (WebKit::WebPageProxy::canRedo):
2227         * UIProcess/WebPageProxy.h:
2228         * UIProcess/WebPageProxy.messages.in:
2229         * UIProcess/ios/PageClientImplIOS.h:
2230         * UIProcess/ios/PageClientImplIOS.mm:
2231         (WebKit::PageClientImpl::registerEditCommand):
2232         (WebKit::PageClientImpl::canUndoRedo):
2233         (WebKit::PageClientImpl::executeUndoRedo):
2234         * UIProcess/mac/PageClientImplMac.h:
2235         * UIProcess/mac/PageClientImplMac.mm:
2236         (WebKit::PageClientImpl::registerEditCommand):
2237         (WebKit::PageClientImpl::canUndoRedo):
2238         (WebKit::PageClientImpl::executeUndoRedo):
2239         * UIProcess/mac/WebContextMenuProxyMac.mm:
2240         * WebKit.xcodeproj/project.pbxproj:
2241         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
2242         (WebKit::WebEditorClient::canUndo const):
2243         (WebKit::WebEditorClient::canRedo const):
2244         (WebKit::WebEditorClient::undo):
2245         (WebKit::WebEditorClient::redo):
2246
2247 2018-07-27  Alex Christensen  <achristensen@webkit.org>
2248
2249         Make CompletionHandler more const correct
2250         https://bugs.webkit.org/show_bug.cgi?id=186543
2251
2252         Reviewed by Saam Barati.
2253
2254         * NetworkProcess/PingLoad.cpp:
2255         (WebKit::PingLoad::willPerformHTTPRedirection):
2256         * NetworkProcess/cache/CacheStorageEngine.cpp:
2257         (WebKit::CacheStorage::Engine::clearAllCaches):
2258         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
2259         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
2260         * UIProcess/Automation/WebAutomationSession.cpp:
2261         (WebKit::WebAutomationSession::simulateMouseInteraction):
2262         (WebKit::WebAutomationSession::simulateKeyboardInteraction):
2263         * UIProcess/Cocoa/AutomationSessionClient.mm:
2264         (WebKit::AutomationSessionClient::requestNewPageWithOptions):
2265         (WebKit::AutomationSessionClient::requestSwitchToPage):
2266         (WebKit::AutomationSessionClient::requestHideWindowOfPage):
2267         (WebKit::AutomationSessionClient::requestRestoreWindowOfPage):
2268         * UIProcess/Cocoa/UIDelegate.mm:
2269         (WebKit::UIDelegate::ContextMenuClient::menuFromProposedMenu):
2270         (WebKit::UIDelegate::UIClient::createNewPage):
2271         (WebKit::UIDelegate::UIClient::runJavaScriptAlert):
2272         (WebKit::UIDelegate::UIClient::runJavaScriptConfirm):
2273         (WebKit::UIDelegate::UIClient::runJavaScriptPrompt):
2274         (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm):
2275         (WebKit::UIDelegate::UIClient::decidePolicyForGeolocationPermissionRequest):
2276         (WebKit::UIDelegate::UIClient::runBeforeUnloadConfirmPanel):
2277         (WebKit::UIDelegate::UIClient::decidePolicyForNotificationPermissionRequest):
2278         (WebKit::UIDelegate::UIClient::runOpenPanel):
2279         * UIProcess/WebPageProxy.cpp:
2280         (WebKit::WebPageProxy::createNewPage):
2281         (WebKit::WebPageProxy::webGLPolicyForURL):
2282         (WebKit::WebPageProxy::resolveWebGLPolicyForURL):
2283         (WebKit::WebPageProxy::getWindowFrame):
2284         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2285         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
2286         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
2287         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
2288         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning):
2289
2290 2018-07-27  Simon Fraser  <simon.fraser@apple.com>
2291
2292         Be more conservative with compositing layer creation when memory is low
2293         https://bugs.webkit.org/show_bug.cgi?id=187866
2294         rdar://problem/42366345
2295
2296         Reviewed by Zalan Bujtas.
2297         
2298         When process physical footprint is above a fraction of the jetsam limit, be more conservative in making
2299         compositing layers. We avoid compositing for these situations:
2300         1. Layers with 3D transforms which are affine (like translateZ(0)).
2301         2. Layers with will-change
2302         3. Layers for canvases (other than WebGL/WebGPU)
2303         
2304         We reuse some macOS code in MemoryPressureHandler() but choose different thresholds for iOS,
2305         falling into "conservative mode" at 50% of jetsam limit, and "strict mode" at 65%.
2306         Compositing chooses to be more conservative in either "conservative" or "strict" memory modes.
2307         
2308         Plumb through a "compositingPolicyOverride" both so that on-device testing isn't
2309         flakily falling into a different mode, and so that we can impose the conservative
2310         mode for testing.
2311
2312         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2313         (WKBundlePageSetCompositingPolicyOverride):
2314         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
2315
2316 2018-07-27  Alex Christensen  <achristensen@webkit.org>
2317
2318         Add RefCounted CompletionHandler wrapping abstraction for sending policy decisions back to WebProcess
2319         https://bugs.webkit.org/show_bug.cgi?id=188089
2320
2321         Reviewed by Geoffrey Garen.
2322
2323         This will be necessary for when I add an asynchronous parallel step to decidePolicyForNavigationAction.
2324         We will want to wait for that asynchronous step for decidePolicyForNavigationActionSync but not for a client.
2325
2326         No change in behavior.
2327
2328         * UIProcess/WebPageProxy.cpp:
2329         (WebKit::WebPageProxy::PolicyDecisionSender::create):
2330         (WebKit::WebPageProxy::PolicyDecisionSender::operator()):
2331         (WebKit::WebPageProxy::PolicyDecisionSender::PolicyDecisionSender):
2332         (WebKit::WebPageProxy::receivedPolicyDecision):
2333         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
2334         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2335         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
2336         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
2337         (WebKit::WebPageProxy::decidePolicyForResponse):
2338         * UIProcess/WebPageProxy.h:
2339         * UIProcess/WebPageProxy.messages.in:
2340         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2341         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2342
2343 2018-07-27  Saam Barati  <sbarati@apple.com>
2344
2345         Use SPI to compute the jetsam limit on iOS instead of hardcoding 840MB
2346         https://bugs.webkit.org/show_bug.cgi?id=188091
2347         <rdar://problem/42647697>
2348
2349         Reviewed by Simon Fraser.
2350
2351         Give the Network/Storage/WebContent process the com.apple.private.memorystatus
2352         entitlement. This allows them to read the process jetsam limit.
2353
2354         * Configurations/Databases-iOS.entitlements:
2355         * Configurations/Network-iOS.entitlements:
2356         * Configurations/WebContent-iOS.entitlements:
2357
2358 2018-07-03  David Fenton  <david_fenton@apple.com>
2359
2360         Unreviewed, rolling out r233461.
2361
2362         assertions triggered on ios11 Debug wk2
2363
2364         Reverted changeset:
2365
2366         "[iOS] Add assert to catch improper use of WebCore::Timer in
2367         UI Process"
2368         https://bugs.webkit.org/show_bug.cgi?id=185330
2369         https://trac.webkit.org/changeset/233461
2370
2371 2018-07-27  Alex Christensen  <achristensen@webkit.org>
2372
2373         Remove unused WKNavigationDelegatePrivate decidePolicyForNavigationAction SPI
2374         https://bugs.webkit.org/show_bug.cgi?id=188077
2375
2376         Reviewed by Darin Adler.
2377
2378         The one client has moved to the version with userInfo, and it never used the SPI
2379         on old operating systems.
2380
2381         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
2382         * UIProcess/Cocoa/NavigationState.h:
2383         * UIProcess/Cocoa/NavigationState.mm:
2384         (WebKit::NavigationState::setNavigationDelegate):
2385         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2386
2387 2018-07-27  Alex Christensen  <achristensen@webkit.org>
2388
2389         Begin making WKWebViewConfiguration a wrapper around an API::PageConfiguration
2390         https://bugs.webkit.org/show_bug.cgi?id=188030
2391
2392         Reviewed by Sam Weinig.
2393
2394         Eventually WKWebViewConfiguration should become just a API::ObjectStorage<API::PageConfiguration>.
2395         The transition includes adding fields that exist in WKWebViewConfiguration to API::PageConfiguration
2396         and making WKWebViewConfiguration's getters and setters just call API::PageConfiguration's corresponding methods
2397         instead of having an ivar for each value then copying it to an API::PageConfiguration we construct in
2398         the WKWebView constructor.  To transition incrementally, I've added a RefPtr<API::PageConfiguration> ivar to
2399         WKWebViewConfiguration and moved a few ivars to use the values stored in that API::PageConfiguration instead.
2400         I've arbitrarily chosen _treatsSHA1SignedCertificatesAsInsecure and _urlSchemeHandlers as the first two 
2401         properties to transition, and I'll continue transitioning each ivar in small, easy-to-review bunches.
2402
2403         * UIProcess/API/APIPageConfiguration.cpp:
2404         (API::PageConfiguration::copy const):
2405         (API::PageConfiguration::urlSchemeHandlerForURLScheme):
2406         (API::PageConfiguration::setURLSchemeHandlerForURLScheme):
2407         * UIProcess/API/APIPageConfiguration.h:
2408         (API::PageConfiguration::urlSchemeHandlers):
2409         * UIProcess/API/Cocoa/WKWebView.mm:
2410         (-[WKWebView _initializeWithConfiguration:]):
2411         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2412         (-[WKWebViewConfiguration init]):
2413         (-[WKWebViewConfiguration copyWithZone:]):
2414         (-[WKWebViewConfiguration setURLSchemeHandler:forURLScheme:]):
2415         (-[WKWebViewConfiguration urlSchemeHandlerForURLScheme:]):
2416         (-[WKWebViewConfiguration copyPageConfiguration]):
2417         (-[WKWebViewConfiguration _treatsSHA1SignedCertificatesAsInsecure]):
2418         (-[WKWebViewConfiguration _setTreatsSHA1SignedCertificatesAsInsecure:]):
2419         (-[WKWebViewConfiguration _urlSchemeHandlers]): Deleted.
2420         * UIProcess/API/Cocoa/WKWebViewConfigurationInternal.h:
2421
2422 2018-07-27  Chris Dumez  <cdumez@apple.com>
2423
2424         Loading a file URL and then issuing a reload right away causes the load to fail due to sandboxing
2425         https://bugs.webkit.org/show_bug.cgi?id=188078
2426         <rdar://problem/42562493>
2427
2428         Unreviewed, follow-up fix after r234290 to address assertion hits on the bots. Make the fix
2429         specific to reloads as we know the existing provisional sandbox extension is for the same
2430         URL then.
2431
2432         * WebProcess/WebPage/WebPage.cpp:
2433         (WebKit::WebPage::reload):
2434         (WebKit::WebPage::SandboxExtensionTracker::beginLoad):
2435         (WebKit::WebPage::SandboxExtensionTracker::beginReload):
2436         * WebProcess/WebPage/WebPage.h:
2437
2438 2018-07-26  Andy VanWagoner  <andy@vanwagoner.family>
2439
2440         [INTL] Remove INTL sub-feature compile flags
2441         https://bugs.webkit.org/show_bug.cgi?id=188081
2442
2443         Reviewed by Michael Catanzaro.
2444
2445         * Configurations/FeatureDefines.xcconfig:
2446
2447 2018-07-26  Chris Dumez  <cdumez@apple.com>
2448
2449         Loading a file URL and then issuing a reload right away causes the load to fail due to sandboxing
2450         https://bugs.webkit.org/show_bug.cgi?id=188078
2451         <rdar://problem/42562493>
2452
2453         Reviewed by Geoff Garen.
2454
2455         When WebPageProxy::loadFile() is called, we create a SandboxExtension::Handle for the resource path provided
2456         by the caller and pass it to the WebProcess. WebPage::loadRequest() then calls SandboxExtensionTracker::beginLoad()
2457         to store this handle in m_provisionalSandboxExtension for later consumption.
2458
2459         If a reload is issued before this sandbox extension has been consumed, then the following happens:
2460         1. WebPageProxy::reload() does NOT create a SandboxExtension::Handle because it has already issued one earlier.
2461            maybeInitializeSandboxExtensionHandle() returns early due to m_process->hasAssumedReadAccessToURL(url) check.
2462         2. WebPage::reload() then calls SandboxExtensionTracker::beginLoad() with a null handle, which overwrites the
2463            previous m_provisionalSandboxExtension its needs.
2464         3. The load fails because the WebContent process is missing the sandbox extension.
2465
2466         To address the issue, SandboxExtensionTracker::beginLoad() is updated to only overwrite m_provisionalSandboxExtension
2467         if the new handle is not null. This avoids inadvertently clearing a valid sandbox extension we may need for the load,
2468         since the UIProcess sends us a null handle if it previously sent us a sandbox extension for the path in question.
2469
2470         * WebProcess/WebPage/WebPage.cpp:
2471         (WebKit::WebPage::SandboxExtensionTracker::beginLoad):
2472
2473 2018-07-26  Chris Dumez  <cdumez@apple.com>
2474
2475         It should be possible to use WTF::CallbackAggregator from a background thread
2476         https://bugs.webkit.org/show_bug.cgi?id=188084
2477
2478         Reviewed by Alex Christensen.
2479
2480         This code was passing CallbackAggregator objects for background thread and not being
2481         careful on which thread the CallbackAggregator gets destroyed. This patch fixes this
2482         since the CallbackAggregator destructor no longer takes care of dispatching to the
2483         main thread.
2484
2485         * NetworkProcess/cache/CacheStorageEngine.cpp:
2486         (WebKit::CacheStorage::Engine::clearAllCaches):
2487         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
2488
2489 2018-07-26  Ross Kirsling  <ross.kirsling@sony.com>
2490
2491         String(View) should have a splitAllowingEmptyEntries function instead of a flag parameter
2492         https://bugs.webkit.org/show_bug.cgi?id=187963
2493
2494         Reviewed by Alex Christensen.
2495
2496         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
2497         (WebKit::CacheStorage::updateVaryInformation):
2498         * NetworkProcess/capture/NetworkCaptureManager.cpp:
2499         (WebKit::NetworkCapture::Manager::fuzzyMatchURLs):
2500         * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
2501         (WebKit::getPluginInfoFromPropertyLists):
2502         (WebKit::PluginVersion::parse):
2503         * Shared/Plugins/Netscape/unix/NetscapePluginModuleUnix.cpp:
2504         (WebKit::NetscapePluginModule::parseMIMEDescription):
2505         * Shared/Plugins/unix/PluginSearchPath.cpp:
2506         (WebKit::pluginsDirectories):
2507         * Shared/mac/ChildProcessMac.mm:
2508         (WebKit::ChildProcess::initializeSandbox):
2509         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
2510         * UIProcess/Automation/WebAutomationSession.cpp:
2511         (WebKit::fileCanBeAcceptedForUpload):
2512         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
2513         (WebKit::ProcessLauncher::launchProcess):
2514         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2515         (WebKit::ProcessLauncher::launchProcess):
2516         * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
2517         (WebKit::PluginProcessProxy::scanPlugin):
2518         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
2519         (WebKit::isTransparentSilverlightBackgroundValue):
2520         Update split/splitAllowingEmptyEntries usage.
2521
2522 2018-07-26  Alex Christensen  <achristensen@webkit.org>
2523
2524         Fix assertions introduced in r234210
2525         https://bugs.webkit.org/show_bug.cgi?id=188074
2526
2527         Reviewed by Chris Dumez.
2528
2529         There is a client that uses WKFramePolicyListenerUseWithPolicies to send website policies as
2530         a response to the WKPageNavigationClient's decidePolicyForNavigationResponse.  That is wasting
2531         effort to generate policies that don't change anything. Once that client adopts WKWebView
2532         they won't be able to do this any more, so temporarily remove the assertion.
2533         Also, make the assertion about process swapping a release assert to prevent that client
2534         from adopting WKFramePolicyListenerUseInNewProcessWithPolicies for navigation responses.
2535         It should only be used for navigation actions.
2536
2537         * UIProcess/WebPageProxy.cpp:
2538         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
2539         (WebKit::WebPageProxy::decidePolicyForResponse):
2540
2541 2018-07-26  Commit Queue  <commit-queue@webkit.org>
2542
2543         Unreviewed, rolling out r234181 and r234189.
2544         https://bugs.webkit.org/show_bug.cgi?id=188075
2545
2546         These are not needed right now (Requested by thorton on
2547         #webkit).
2548
2549         Reverted changesets:
2550
2551         "Enable Web Content Filtering on watchOS"
2552         https://bugs.webkit.org/show_bug.cgi?id=187979
2553         https://trac.webkit.org/changeset/234181
2554
2555         "HAVE(PARENTAL_CONTROLS) should be true on watchOS"
2556         https://bugs.webkit.org/show_bug.cgi?id=187985
2557         https://trac.webkit.org/changeset/234189
2558
2559 2018-07-26  Chris Dumez  <cdumez@apple.com>
2560
2561         ERROR: Unhandled web process message 'WebPage:SetUseDarkAppearance' when browsing in dark mode
2562         https://bugs.webkit.org/show_bug.cgi?id=188028
2563
2564         Reviewed by Wenson Hsieh.
2565
2566         The issue was that the WebViewImpl constructor was calling setUseDarkAppearance() *before* calling
2567         initializeWebPage(), which would cause us to send IPC the WebContent process for a pageID that does
2568         not exist on WebProcess side yet.
2569
2570         To address the issue, the WebViewImpl constructor no longer calls setUseDarkAppearance() and WebPageProxy
2571         no longer holds a flag indicates is dark appearance is used. Instead, the WebPageProxy asks the WebView
2572         for the value whenever it needs to, via the PageClient.
2573
2574         * UIProcess/Cocoa/WebViewImpl.h:
2575         * UIProcess/Cocoa/WebViewImpl.mm:
2576         (WebKit::WebViewImpl::WebViewImpl):
2577         (WebKit::WebViewImpl::effectiveAppearanceDidChange):
2578         (WebKit::WebViewImpl::setUseDarkAppearance): Deleted.
2579         * UIProcess/PageClient.h:
2580         * UIProcess/WebPageProxy.cpp:
2581         (WebKit::WebPageProxy::creationParameters):
2582         (WebKit::WebPageProxy::useDarkAppearance const):
2583         (WebKit::WebPageProxy::effectiveAppearanceDidChange):
2584         (WebKit::WebPageProxy::showPlaybackTargetPicker):
2585         (WebKit::WebPageProxy::setUseDarkAppearance): Deleted.
2586         * UIProcess/WebPageProxy.h:
2587         (WebKit::WebPageProxy::useDarkAppearance const): Deleted.
2588         * UIProcess/mac/PageClientImplMac.h:
2589         * UIProcess/mac/PageClientImplMac.mm:
2590         (WebKit::PageClientImpl::effectiveAppearanceIsDark const):
2591
2592 2018-07-26  Sihui Liu  <sihui_liu@apple.com>
2593
2594         Remove a forward protocol declaration of '_WKWebViewPrintProvider'
2595         https://bugs.webkit.org/show_bug.cgi?id=188012
2596         <rdar://problem/42309526>
2597
2598         Reviewed by Darin Adler.
2599
2600         @procotol() expressions emit invalid protocol metadata when used with forward @protocol declarations. 
2601         Clang is going to make it an error for using a forward-declared protocol in a @protocol expression, so
2602         we need to stop doing this.
2603
2604         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2605
2606 2018-07-26  Chris Dumez  <cdumez@apple.com>
2607
2608         Disable Dark Mode in the Plugin process to avoid rendering issues
2609         https://bugs.webkit.org/show_bug.cgi?id=188059
2610         <rdar://problem/42369281>
2611
2612         Reviewed by Tim Horton.
2613
2614         Plugins generally do not support dark mode and this causes rendering issues so
2615         disable dark mode in the plugin process.
2616
2617         * PluginProcess/mac/PluginProcessMac.mm:
2618         (WebKit::PluginProcess::platformInitializePluginProcess):
2619
2620 2018-07-26  Chris Dumez  <cdumez@apple.com>
2621
2622         WebSiteData-related methods should take in CompletionHandlers instead of Functions
2623         https://bugs.webkit.org/show_bug.cgi?id=188027
2624
2625         Reviewed by Alex Christensen.
2626
2627         WebSiteData-related methods should take in CompletionHandlers instead of Functions since
2628         they are need to be called and are only called once.
2629
2630         * UIProcess/Network/NetworkProcessProxy.cpp:
2631         (WebKit::NetworkProcessProxy::fetchWebsiteData):
2632         (WebKit::NetworkProcessProxy::deleteWebsiteData):
2633         (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
2634         * UIProcess/Network/NetworkProcessProxy.h:
2635         * UIProcess/Plugins/PluginProcessProxy.cpp:
2636         (WebKit::PluginProcessProxy::fetchWebsiteData):
2637         (WebKit::PluginProcessProxy::deleteWebsiteData):
2638         (WebKit::PluginProcessProxy::deleteWebsiteDataForHostNames):
2639         * UIProcess/Plugins/PluginProcessProxy.h:
2640         * UIProcess/Storage/StorageProcessProxy.cpp:
2641         (WebKit::StorageProcessProxy::fetchWebsiteData):
2642         (WebKit::StorageProcessProxy::deleteWebsiteData):
2643         (WebKit::StorageProcessProxy::deleteWebsiteDataForOrigins):
2644         * UIProcess/Storage/StorageProcessProxy.h:
2645         * UIProcess/WebProcessProxy.cpp:
2646         (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
2647         (WebKit::WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData):
2648         (WebKit::WebProcessProxy::fetchWebsiteData):
2649         (WebKit::WebProcessProxy::deleteWebsiteData):
2650         (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
2651         * UIProcess/WebProcessProxy.h:
2652
2653 2018-07-26  Miguel Gomez  <magomez@igalia.com>
2654
2655         [GTK][WPE] Improve the way request displayRefresh notifications
2656         https://bugs.webkit.org/show_bug.cgi?id=188005
2657
2658         Reviewed by Žan Doberšek.
2659
2660         Add a new interface ThreadedDisplayRefreshMonitor::Client and use it to pipe the the
2661         requestDisplayRefreshMonitorUpdate and handleDisplayRefreshMonitorUpdate to the
2662         ThreadedCoordinatedLayerTreeHost.
2663
2664         In response to requestDisplayRefreshMonitorUpdate, the LayerTreeHost will force a layer
2665         flush that in the end causes a repaint, which generates the requested display refresh
2666         event.
2667
2668         In response to handleDisplayRefreshMonitorUpdate, the call to renderNextFrame will happen,
2669         and if the DisplayRefreshMonitor has been rescheduled, renderNextFrame will also force
2670         a new layer flush, causing the repaint that will generate the display refreh event.
2671
2672         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2673         (WebKit::ThreadedCompositor::create):
2674         (WebKit::ThreadedCompositor::ThreadedCompositor):
2675         (WebKit::m_displayRefreshMonitor):
2676         (WebKit::ThreadedCompositor::handleDisplayRefreshMonitorUpdate):
2677         (WebKit::ThreadedCompositor::requestDisplayRefreshMonitorUpdate): Deleted.
2678         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
2679         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
2680         (WebKit::ThreadedDisplayRefreshMonitor::ThreadedDisplayRefreshMonitor):
2681         (WebKit::ThreadedDisplayRefreshMonitor::requestRefreshCallback):
2682         (WebKit::ThreadedDisplayRefreshMonitor::dispatchDisplayRefreshCallback):
2683         (WebKit::ThreadedDisplayRefreshMonitor::invalidate):
2684         (WebKit::ThreadedDisplayRefreshMonitor::displayRefreshCallback):
2685         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h:
2686         (WebKit::ThreadedDisplayRefreshMonitor::create):
2687         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
2688         (WebKit::CoordinatedLayerTreeHost::renderNextFrame):
2689         (WebKit::CoordinatedLayerTreeHost::flushLayersAndForceRepaint):
2690         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
2691         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
2692         (WebKit::ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost):
2693         (WebKit::ThreadedCoordinatedLayerTreeHost::requestDisplayRefreshMonitorUpdate):
2694         (WebKit::ThreadedCoordinatedLayerTreeHost::handleDisplayRefreshMonitorUpdate):
2695         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
2696
2697 2018-07-25  Brent Fulgham  <bfulgham@apple.com>
2698
2699         [macOS] Update sandboxes for revised OpenCL calls and streaming media
2700         https://bugs.webkit.org/show_bug.cgi?id=188013
2701         <rdar://problem/42594262>
2702
2703         Reviewed by Eric Carlson.
2704
2705         Testing logs from recent Mojave builds shows that OpenCL is checking more CPU-specific values as part of WebKit
2706         painting operations. We need to allow these checks in the sandbox to support these more optimized drawing operations.
2707
2708         I also corrected some sandbox violations I found while investigating streaming media issues.
2709
2710         * WebProcess/com.apple.WebProcess.sb.in:
2711
2712 2018-07-25  Jeremy Jones  <jeremyj@apple.com>
2713
2714         Mask AVBackgroundView to the corner radius.
2715         https://bugs.webkit.org/show_bug.cgi?id=187976
2716         rdar://problem/41810866
2717
2718         Reviewed by Jon Lee.
2719
2720         This changes sets the appropriate mask to the layer so the corners look correct.
2721
2722         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm:
2723         (-[WKFullscreenStackView init]):
2724
2725 2018-07-25  Zalan Bujtas  <zalan@apple.com>
2726
2727         REGRESSION(r227577) Text on TV & Movies page doesn't wrap properly in iTunes
2728         https://bugs.webkit.org/show_bug.cgi?id=188018
2729         <rdar://problem/42517520>
2730
2731         Reviewed by Dean Jackson.
2732
2733         * WebProcess/WebPage/WebPage.cpp:
2734         (WebKit::m_credentialsMessenger):
2735
2736 2018-07-25  Tim Horton  <timothy_horton@apple.com>
2737
2738         Fix the build.
2739
2740         * UIProcess/mac/ServicesController.mm:
2741         (WebKit::hasCompatibleServicesForItems):
2742         I can't even.
2743
2744 2018-07-25  Tim Horton  <timothy_horton@apple.com>
2745
2746         Crashing on some builds that don't have async NSSharingService API
2747         https://bugs.webkit.org/show_bug.cgi?id=188015
2748         <rdar://problem/42593935>
2749
2750         Reviewed by Eric Carlson.
2751
2752         * UIProcess/mac/ServicesController.mm:
2753         (WebKit::hasCompatibleServicesForItems):
2754
2755 2018-07-25  Chris Dumez  <cdumez@apple.com>
2756
2757         navigator.userAgent may return outdated value after webView.customUserAgent is set
2758         https://bugs.webkit.org/show_bug.cgi?id=188009
2759         <rdar://problem/42566456>
2760
2761         Reviewed by Alex Christensen.
2762
2763         Let the page know when the user agent changes.
2764
2765         * WebProcess/WebPage/WebPage.cpp:
2766         (WebKit::WebPage::setUserAgent):
2767
2768 2018-07-25  Alex Christensen  <achristensen@webkit.org>
2769
2770         Use CompletionHandler for policy decisions
2771         https://bugs.webkit.org/show_bug.cgi?id=187975
2772
2773         Reviewed by Chris Dumez.
2774
2775         * UIProcess/WebFramePolicyListenerProxy.cpp:
2776         (WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy):
2777         (WebKit::WebFramePolicyListenerProxy::use):
2778         (WebKit::WebFramePolicyListenerProxy::download):
2779         (WebKit::WebFramePolicyListenerProxy::ignore):
2780         (WebKit::WebFramePolicyListenerProxy::receivedPolicyDecision): Deleted.
2781         (WebKit::WebFramePolicyListenerProxy::setNavigation): Deleted.
2782         * UIProcess/WebFramePolicyListenerProxy.h:
2783         (WebKit::WebFramePolicyListenerProxy::create):
2784         (WebKit::WebFramePolicyListenerProxy::policyListenerType const): Deleted.
2785         (WebKit::WebFramePolicyListenerProxy::listenerID const): Deleted.
2786         (): Deleted.
2787         * UIProcess/WebFrameProxy.cpp:
2788         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
2789         (WebKit::WebFrameProxy::receivedPolicyDecision): Deleted.
2790         (WebKit::WebFrameProxy::activePolicyListenerProxy): Deleted.
2791         (WebKit::WebFrameProxy::changeWebsiteDataStore): Deleted.
2792         * UIProcess/WebFrameProxy.h:
2793         * UIProcess/WebPageProxy.cpp:
2794         (WebKit::WebPageProxy::receivedPolicyDecision):
2795         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2796         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
2797         (WebKit::WebPageProxy::decidePolicyForResponse):
2798         * UIProcess/WebPageProxy.h:
2799
2800 2018-07-25  Commit Queue  <commit-queue@webkit.org>
2801
2802         Unreviewed, rolling out r234196.
2803         https://bugs.webkit.org/show_bug.cgi?id=188011
2804
2805         broke API tests (Requested by alexchristensen on #webkit).
2806
2807         Reverted changeset:
2808
2809         "Use CompletionHandler for policy decisions"
2810         https://bugs.webkit.org/show_bug.cgi?id=187975
2811         https://trac.webkit.org/changeset/234196
2812
2813 2018-07-25  Alex Christensen  <achristensen@webkit.org>
2814
2815         Use CompletionHandler for policy decisions
2816         https://bugs.webkit.org/show_bug.cgi?id=187975
2817
2818         Reviewed by Chris Dumez.
2819
2820         * UIProcess/WebFramePolicyListenerProxy.cpp:
2821         (WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy):
2822         (WebKit::WebFramePolicyListenerProxy::use):
2823         (WebKit::WebFramePolicyListenerProxy::download):
2824         (WebKit::WebFramePolicyListenerProxy::ignore):
2825         (WebKit::WebFramePolicyListenerProxy::receivedPolicyDecision): Deleted.
2826         (WebKit::WebFramePolicyListenerProxy::setNavigation): Deleted.
2827         * UIProcess/WebFramePolicyListenerProxy.h:
2828         (WebKit::WebFramePolicyListenerProxy::create):
2829         (WebKit::WebFramePolicyListenerProxy::policyListenerType const): Deleted.
2830         (WebKit::WebFramePolicyListenerProxy::listenerID const): Deleted.
2831         (): Deleted.
2832         * UIProcess/WebFrameProxy.cpp:
2833         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
2834         (WebKit::WebFrameProxy::receivedPolicyDecision): Deleted.
2835         (WebKit::WebFrameProxy::activePolicyListenerProxy): Deleted.
2836         (WebKit::WebFrameProxy::changeWebsiteDataStore): Deleted.
2837         * UIProcess/WebFrameProxy.h:
2838         * UIProcess/WebPageProxy.cpp:
2839         (WebKit::WebPageProxy::receivedPolicyDecision):
2840         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2841         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
2842         (WebKit::WebPageProxy::decidePolicyForResponse):
2843         * UIProcess/WebPageProxy.h:
2844
2845 2018-07-25  Brent Fulgham  <bfulgham@apple.com>
2846
2847         [macOS] PluginProcess needs TCC entitlements for media capture
2848         https://bugs.webkit.org/show_bug.cgi?id=187981
2849         <rdar://problem/42433634>
2850
2851         Reviewed by Chris Dumez.
2852
2853         The changes needed in Bug 185526 are also needed for the plugin process, or else the UIProcess
2854         (e.g., Safari) is not able to pass the user's camera/microphone access permission to the plugin process.
2855
2856         This patch has the following changes:
2857
2858         1. Rename "WebContent-OSX-restricted.entitlements" to "WebContent-or-Plugin-OSX-restricted.entitlements"
2859         2. Rename "process-webcontent-entitlements.sh" to "process-webcontent-or-plugin-entitlements.sh"
2860         3. Add a run-script step to the Plugin.64 and Plugin.32 builds to add the relevant entitlements.
2861         4. Silence some Flash plugin sandbox exceptions triggered after activating the camera.
2862
2863         * Configurations/WebContent-or-Plugin-OSX-restricted.entitlements: Renamed from Source/WebKit/Configurations/WebContent-OSX-restricted.entitlements.
2864         * Resources/PlugInSandboxProfiles/com.macromedia.Flash Player ESR.plugin.sb: Address sandbox violations needed by camera use.
2865         * Resources/PlugInSandboxProfiles/com.macromedia.Flash Player.plugin.sb: Ditto.
2866         * Scripts/process-webcontent-or-plugin-entitlements.sh: Renamed from Source/WebKit/Scripts/process-webcontent-entitlements.sh.
2867         * WebKit.xcodeproj/project.pbxproj: Update for renaming, and perform entitlement steps on Plugin process.
2868
2869 2018-07-24  Tim Horton  <timothy_horton@apple.com>
2870
2871         Enable Web Content Filtering on watchOS
2872         https://bugs.webkit.org/show_bug.cgi?id=187979
2873         <rdar://problem/42559346>
2874
2875         Reviewed by Wenson Hsieh.
2876
2877         * Configurations/FeatureDefines.xcconfig:
2878
2879 2018-07-24  Aditya Keerthi  <akeerthi@apple.com>
2880
2881         [Datalist][macOS] Display suggestions for input[type=color]
2882         https://bugs.webkit.org/show_bug.cgi?id=187794
2883
2884         Reviewed by Tim Horton.
2885
2886         An input[type=color] element that has an associated datalist element should
2887         display the color values provided. We now support 1-12 suggested colors, that
2888         will be displayed at the top of the color selection popover. If no suggestions
2889         are specified we keep the existing default colors.
2890
2891         Created an NSPopoverColorWell subclass that allows custom colors to be specified
2892         in the form of an NSColorList.
2893
2894         Also fixed a bug where an additional color well was displayed when clicking on
2895         the input element.
2896
2897         * Shared/WebCoreArgumentCoders.cpp:
2898         (IPC::ArgumentCoder<Color>::decode):
2899         * Shared/WebCoreArgumentCoders.h:
2900         * UIProcess/API/gtk/PageClientImpl.cpp:
2901         (WebKit::PageClientImpl::createColorPicker):
2902         * UIProcess/API/gtk/PageClientImpl.h:
2903         * UIProcess/PageClient.h:
2904         * UIProcess/WebPageProxy.cpp:
2905         (WebKit::WebPageProxy::showColorPicker):
2906         * UIProcess/WebPageProxy.h:
2907         * UIProcess/WebPageProxy.messages.in:
2908         * UIProcess/ios/PageClientImplIOS.h:
2909         * UIProcess/ios/PageClientImplIOS.mm:
2910         (WebKit::PageClientImpl::createColorPicker):
2911         * UIProcess/mac/PageClientImplMac.h:
2912         * UIProcess/mac/PageClientImplMac.mm:
2913         (WebKit::PageClientImpl::createColorPicker):
2914         * UIProcess/mac/WebColorPickerMac.h:
2915         * UIProcess/mac/WebColorPickerMac.mm:
2916         (WebKit::WebColorPickerMac::create):
2917         (WebKit::WebColorPickerMac::WebColorPickerMac):
2918         (WebKit::WebColorPickerMac::showColorPicker):
2919         (+[WKPopoverColorWell _colorPopoverCreateIfNecessary:]):
2920         (-[WKPopoverColorWell _showPopover]):
2921         (-[WKPopoverColorWell setSuggestedColors:]):
2922         (-[WKColorPopoverMac initWithFrame:inView:]):
2923         (-[WKColorPopoverMac setAndShowPicker:withColor:suggestions:]):
2924         (-[WKColorPanelMac setAndShowPicker:withColor:suggestions:]):
2925         * WebProcess/WebCoreSupport/WebColorChooser.cpp:
2926         (WebKit::WebColorChooser::WebColorChooser):
2927         (WebKit::WebColorChooser::reattachColorChooser):
2928
2929 2018-07-24  Alex Christensen  <achristensen@webkit.org>
2930
2931         Modernize NavigationState
2932         https://bugs.webkit.org/show_bug.cgi?id=187966
2933
2934         Reviewed by Andy Estes.
2935
2936         Don't ignore switch warnings any more.
2937         Use BlockPtr.
2938
2939         * UIProcess/Cocoa/NavigationState.mm:
2940         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2941         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
2942
2943 2018-07-24  Alex Christensen  <achristensen@webkit.org>
2944
2945         Remove WebFramePolicyListenerProxy::changeWebsiteDataStore
2946         https://bugs.webkit.org/show_bug.cgi?id=187967
2947
2948         Reviewed by Andy Estes.
2949
2950         We need to call WebFrameProxy::changeWebsiteDataStore if the _WKWebsitePolicies has a WKWebsiteDataStore.
2951         We're doing that in a weird way that is not in the right layer.  Inside the call to WebFramePolicyListenerProxy::use
2952         we can inform the frame if there's a new WebsiteDataStore.
2953         
2954         No change in behavior, as verified by the WebKit.WebsitePoliciesDataStore API test.
2955         This is a step towards using lambdas in WebFramePolicyListenerProxy.
2956
2957         * UIProcess/API/APINavigationClient.h:
2958         (API::NavigationClient::decidePolicyForNavigationAction):
2959         (API::NavigationClient::decidePolicyForNavigationResponse):
2960         * UIProcess/API/APIPolicyClient.h:
2961         (API::PolicyClient::decidePolicyForNavigationAction):
2962         (API::PolicyClient::decidePolicyForNewWindowAction):
2963         (API::PolicyClient::decidePolicyForResponse):
2964         * UIProcess/API/C/WKFramePolicyListener.cpp:
2965         (WKFramePolicyListenerUse):
2966         (WKFramePolicyListenerUseInNewProcess):
2967         (useWithPolicies):
2968         * UIProcess/API/C/WKPage.cpp:
2969         (WKPageSetPagePolicyClient):
2970         (WKPageSetPageNavigationClient):
2971         * UIProcess/Cocoa/NavigationState.mm:
2972         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2973         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
2974         * UIProcess/WebFramePolicyListenerProxy.cpp:
2975         (WebKit::WebFramePolicyListenerProxy::use):
2976         (WebKit::WebFramePolicyListenerProxy::changeWebsiteDataStore): Deleted.
2977         * UIProcess/WebFramePolicyListenerProxy.h:
2978         * UIProcess/WebPageProxy.cpp:
2979         * UIProcess/mac/PageClientImplMac.mm:
2980
2981 2018-07-24  Ryan Haddad  <ryanhaddad@apple.com>
2982
2983         Unreviewed, rolling out r234121.
2984
2985         Caused perf test failures.
2986
2987         Reverted changeset:
2988
2989         "We should cache the compiled sandbox profile in a data vault"
2990         https://bugs.webkit.org/show_bug.cgi?id=184991
2991         https://trac.webkit.org/changeset/234121
2992
2993 2018-07-24  Jeff Miller  <jeffm@apple.com>
2994
2995         WKUIDelegate needs an alternate decideDatabaseQuotaForSecurityOrigin method that provides the database name and display name
2996         https://bugs.webkit.org/show_bug.cgi?id=187567
2997
2998         Reviewed by Alex Christensen.
2999
3000         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3001         Declare alternate decideDatabaseQuotaForSecurityOrigin method, copying the existing FIXME comment
3002         from the old method.
3003         
3004         * UIProcess/Cocoa/UIDelegate.h:
3005         Add flag for new delegate method.
3006         
3007         * UIProcess/Cocoa/UIDelegate.mm:
3008         (WebKit::UIDelegate::setDelegate):
3009         Initialize new flag.
3010         
3011         (WebKit::UIDelegate::UIClient::exceededDatabaseQuota):
3012         Prefer the new UIDelegate method that takes the database name and display name, falling back to the
3013         existing method if the client doesn't implement it.
3014
3015 2018-07-24  Stephan Szabo  <stephan.szabo@sony.com>
3016
3017         [WinCairo] Add support to WebView for setting tooltips
3018         https://bugs.webkit.org/show_bug.cgi?id=187930
3019
3020         Reviewed by Fujii Hironori.
3021
3022         * UIProcess/win/PageClientImpl.cpp:
3023         (WebKit::PageClientImpl::toolTipChanged): Set tooltip on WebView
3024         * UIProcess/win/WebView.cpp:
3025         (WebKit::WebView::setToolTip): Add support for updating the
3026         tooltip text in Windows.
3027         * UIProcess/win/WebView.h:
3028
3029 2018-07-24  Alex Christensen  <achristensen@webkit.org>
3030
3031         Reduce getters/setters in WebFramePolicyListenerProxy
3032         https://bugs.webkit.org/show_bug.cgi?id=187830
3033
3034         Reviewed by Dean Jackson.
3035
3036         This is a step towards making it a lambda, which has no getters or setters.
3037         No change in behavior.
3038
3039         setApplyPolicyInNewProcessIfPossible can be replaced by passing another parameter.
3040         This bit was just piggy-backing on the WebFramePolicyListenerProxy.
3041
3042         isMainFrame was only used in an assert, which has a corresponding ObjC exception in
3043         NavigationState::NavigationClient::decidePolicyForNavigationAction for the one relevant client.
3044
3045         * UIProcess/API/C/WKFramePolicyListener.cpp:
3046         (WKFramePolicyListenerUseInNewProcess):
3047         (useWithPolicies):
3048         (WKFramePolicyListenerUseWithPolicies):
3049         (WKFramePolicyListenerUseInNewProcessWithPolicies):
3050         * UIProcess/Cocoa/NavigationState.mm:
3051         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
3052         * UIProcess/WebFramePolicyListenerProxy.cpp:
3053         (WebKit::WebFramePolicyListenerProxy::receivedPolicyDecision):
3054         (WebKit::WebFramePolicyListenerProxy::use):
3055         (WebKit::WebFramePolicyListenerProxy::download):
3056         (WebKit::WebFramePolicyListenerProxy::ignore):
3057         (WebKit::WebFramePolicyListenerProxy::isMainFrame const): Deleted.
3058         * UIProcess/WebFramePolicyListenerProxy.h:
3059         (WebKit::WebFramePolicyListenerProxy::setApplyPolicyInNewProcessIfPossible): Deleted.
3060         (WebKit::WebFramePolicyListenerProxy::applyPolicyInNewProcessIfPossible const): Deleted.
3061         * UIProcess/WebFrameProxy.cpp:
3062         (WebKit::WebFrameProxy::receivedPolicyDecision):
3063         * UIProcess/WebFrameProxy.h:
3064         * UIProcess/WebPageProxy.cpp:
3065         (WebKit::WebPageProxy::receivedPolicyDecision):
3066         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3067         * UIProcess/WebPageProxy.h:
3068         * UIProcess/WebProcessPool.cpp:
3069         (WebKit::WebProcessPool::processForNavigation):
3070         (WebKit::WebProcessPool::processForNavigationInternal):
3071         * UIProcess/WebProcessPool.h:
3072
3073 2018-07-24  Alex Christensen  <achristensen@webkit.org>
3074
3075         Remove WebFramePolicyListenerProxy::invalidate
3076         https://bugs.webkit.org/show_bug.cgi?id=187833
3077
3078         Reviewed by Dean Jackson.
3079
3080         When we're invalidating the listener, calling ignore instead will at worst cause
3081         an ignored message to be sent.  The load will be cancelled either way.
3082         Removing the invalidate method gets it closer to being a lambda.
3083
3084         * UIProcess/WebFramePolicyListenerProxy.cpp:
3085         (WebKit::WebFramePolicyListenerProxy::invalidate): Deleted.
3086         * UIProcess/WebFramePolicyListenerProxy.h:
3087         * UIProcess/WebFrameProxy.cpp:
3088         (WebKit::WebFrameProxy::webProcessWillShutDown):
3089         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
3090
3091 2018-07-24  Chris Dumez  <cdumez@apple.com>
3092
3093         WebFullScreenManagerProxy does not need to be ref counted
3094         https://bugs.webkit.org/show_bug.cgi?id=187928
3095
3096         Reviewed by Eric Carlson.
3097
3098         WebFullScreenManagerProxy does not need to be ref counted, it is owned by WebPageProxy.
3099         It is also error-prone because WebFullScreenManagerProxy has a raw pointer to its WebPageProxy
3100         and anybody could extend the lifetime of the WebFullScreenManagerProxy by refing it, which
3101         would make the WebPageProxy pointer stale.
3102
3103         * UIProcess/WebFullScreenManagerProxy.cpp:
3104         (WebKit::WebFullScreenManagerProxy::WebFullScreenManagerProxy):
3105         (WebKit::WebFullScreenManagerProxy::willEnterFullScreen):
3106         (WebKit::WebFullScreenManagerProxy::didEnterFullScreen):
3107         (WebKit::WebFullScreenManagerProxy::willExitFullScreen):
3108         (WebKit::WebFullScreenManagerProxy::didExitFullScreen):
3109         (WebKit::WebFullScreenManagerProxy::setAnimatingFullScreen):
3110         (WebKit::WebFullScreenManagerProxy::requestExitFullScreen):
3111         (WebKit::WebFullScreenManagerProxy::saveScrollPosition):
3112         (WebKit::WebFullScreenManagerProxy::restoreScrollPosition):
3113         (WebKit::WebFullScreenManagerProxy::setFullscreenInsets):
3114         (WebKit::WebFullScreenManagerProxy::setFullscreenAutoHideDuration):
3115         (WebKit::WebFullScreenManagerProxy::setFullscreenControlsHidden):
3116         (WebKit::WebFullScreenManagerProxy::invalidate):
3117         * UIProcess/WebFullScreenManagerProxy.h:
3118         * UIProcess/WebPageProxy.cpp:
3119         (WebKit::m_resetRecentCrashCountTimer):
3120         (WebKit::WebPageProxy::reattachToWebProcess):
3121         * UIProcess/WebPageProxy.h:
3122
3123 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
3124
3125         [TextureMapper] Separate repaint counter state from debug visuals
3126         https://bugs.webkit.org/show_bug.cgi?id=187946
3127
3128         Reviewed by Carlos Garcia Campos.
3129
3130         Instead of managing the repaint counter visibility along with the
3131         debug border visuals, do that together with the repaint count value.
3132
3133         In the CoordinatedGraphicsScene class, remove the helper
3134         setLayerRepaintCountIfNeeded() method that's only been called in one
3135         place, and instead set the repaint count information on the
3136         TextureMapperLayer object directly from setLayerState(). The repaint
3137         counter visiblity and count value are gathered from the new struct
3138         that's kept on the CoordinatedGraphicsLayerState object.
3139
3140         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3141         (WebKit::CoordinatedGraphicsScene::setLayerState):
3142         (WebKit::CoordinatedGraphicsScene::setLayerRepaintCountIfNeeded): Deleted.
3143         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
3144
3145 2018-07-24  Thibault Saunier  <tsaunier@igalia.com>
3146
3147         [WPE][GTK] Implement WebRTC based on libwebrtc
3148         https://bugs.webkit.org/show_bug.cgi?id=186932
3149
3150         Reviewed by Philippe Normand.
3151
3152         * WebProcess/Network/webrtc/LibWebRTCProvider.h: Use LibWebRTCProviderGlib when building WPE or GTK ports.
3153
3154 2018-07-23  Stephan Szabo  <stephan.szabo@sony.com>
3155
3156         [WinCairo] Add implementation for setting cursors
3157         https://bugs.webkit.org/show_bug.cgi?id=187868
3158
3159         Reviewed by Fujii Hironori.
3160
3161         * UIProcess/win/PageClientImpl.cpp:
3162         (WebKit::PageClientImpl::setCursor): Set cursor on the webview
3163         * UIProcess/win/WebView.cpp:
3164         (WebKit::WebView::setCursor): Add implementation to set the
3165         web cursor to update the Windows cursor
3166         * UIProcess/win/WebView.h:
3167
3168 2018-07-23  Jeremy Jones  <jeremyj@apple.com>
3169
3170         Crash when loadViewIfRequired called while WKFullScreenViewController is being deallocated.
3171         https://bugs.webkit.org/show_bug.cgi?id=187920
3172         rdar://problem/41324023
3173
3174         Reviewed by Eric Carlson.
3175
3176         Clear dangling weak-ref.
3177         Prevent async playback state calls from instantiating the interface.
3178         Release WKFullScreenViewController when it is no longer needed.
3179
3180         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
3181         (-[WKFullScreenViewController dealloc]):
3182         (-[WKFullScreenViewController setPlaying:]):
3183         (-[WKFullScreenViewController setAnimating:]):
3184         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
3185         (-[WKFullScreenWindowController _completedExitFullScreen]):
3186
3187 2018-07-23  Timothy Horton  <timothy_horton@apple.com>
3188
3189         Try to fix the build.
3190
3191         * UIProcess/mac/ServicesController.mm:
3192         (WebKit::hasCompatibleServicesForItems):
3193
3194 2018-07-23  Ben Richards  <benton_richards@apple.com>
3195
3196         We should cache the compiled sandbox profile in a data vault
3197         https://bugs.webkit.org/show_bug.cgi?id=184991
3198
3199         Reviewed by Ryosuke Niwa.
3200
3201         This patch changes a few things (note: data vaults and sandbox entitlements are only used in internal builds):
3202         (1) Instead of compiling a sandbox every time a process is launched, processes now look for a cached sandbox
3203             in a process specific data vault on macOS platforms. (ChildProcessMac.mm)
3204         (2) If a valid cached sandbox is not found, a process will create the data vault (or ensure that it exists),
3205             compile a sandbox, and cache it.
3206         (3) In order to create process specific data vaults, each process now has their own <process name>-OSX-sandbox.entitlements
3207             file which contains an entitlement with a process specific "storage class" which ensures that each process
3208             can only ever access its own data vault. (See the article on confluence "Data Vaults and Restricted Files" for more info)
3209         (4) The sandbox entitlements file for the Network, WebContent and Plugin services are loaded dynamically
3210             through Scripts/<process name>-process-entitlements.sh which is triggered in a new build phase for each service.
3211             The Storage process sandbox entitlements are loaded directly in Configurations/StorageService.xcconfig.
3212             The reason that the sandbox entitlements are applied dynamically is so that these sandbox entitlements
3213             are only applied when WK_USE_RESTRICTED_ENTITLEMENTS is YES. This means that open source builds will still work.
3214
3215         * Configurations/Network-OSX-sandbox.entitlements: Added.
3216         * Configurations/Plugin-OSX-sandbox.entitlements: Added.
3217         * Configurations/Storage-OSX-sandbox.entitlements: Added.
3218         * Configurations/StorageService.xcconfig:
3219         * Configurations/WebContent-OSX-sandbox.entitlements: Added.
3220         * Configurations/WebKit.xcconfig:
3221         * NetworkProcess/NetworkProcess.h:
3222         * PluginProcess/PluginProcess.h:
3223         * Scripts/process-network-entitlements.sh: Added.
3224         * Scripts/process-plugin-entitlements.sh: Added.
3225         * Scripts/process-webcontent-entitlements.sh:
3226         * Shared/ChildProcess.h:
3227         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
3228         (WebKit::XPCServiceInitializer):
3229         * Shared/SandboxInitializationParameters.h:
3230         (WebKit::SandboxInitializationParameters::setOverrideSandboxProfilePath):
3231         (WebKit::SandboxInitializationParameters::overrideSandboxProfilePath const):
3232         (WebKit::SandboxInitializationParameters::setSandboxProfile):
3233         (WebKit::SandboxInitializationParameters::sandboxProfile const):
3234         (): Deleted.
3235         * Shared/mac/ChildProcessMac.mm:
3236         (WebKit::SandboxProfileDeleter::operator()):
3237         (WebKit::SandboxParametersDeleter::operator()):
3238         (WebKit::SandboxInfo::SandboxInfo):
3239         (WebKit::fileContents):
3240         (WebKit::processStorageClass):
3241         (WebKit::setAndSerializeSandboxParameters):
3242         (WebKit::getUserCacheDirectory):
3243         (WebKit::sandboxDataVaultParentDirectory):
3244         (WebKit::sandboxDirectory):
3245         (WebKit::sandboxFilePath):
3246         (WebKit::ensureSandboxCacheDirectory):
3247         (WebKit::writeSandboxDataToCacheFile):
3248         (WebKit::compileAndCacheSandboxProfile):
3249         (WebKit::tryApplyCachedSandbox):
3250         (WebKit::webKit2Bundle):
3251         (WebKit::sandboxProfilePath):
3252         (WebKit::compileAndApplySandboxSlowCase):
3253         (WebKit::applySandbox):
3254         (WebKit::initializeSandboxParameters):
3255         (WebKit::ChildProcess::initializeSandbox):
3256         * Shared/mac/SandboxInitialiationParametersMac.mm:
3257         (WebKit::SandboxInitializationParameters::SandboxInitializationParameters):
3258         * StorageProcess/StorageProcess.h:
3259         * WebKit.xcodeproj/project.pbxproj:
3260         * WebProcess/WebProcess.h:
3261
3262 2018-07-23  Tim Horton  <timothy_horton@apple.com>
3263
3264         Creating and loading content in a WKWebView triggers Main Thread Checker warnings under ServicesController
3265         https://bugs.webkit.org/show_bug.cgi?id=186963
3266         <rdar://problem/41393682>
3267
3268         Reviewed by Timothy Hatcher.
3269
3270         * UIProcess/mac/ServicesController.h:
3271         * UIProcess/mac/ServicesController.mm:
3272         (WebKit::hasCompatibleServicesForItems):
3273         (WebKit::ServicesController::refreshExistingServices):
3274         Adopt async ShareKit SPI that is actually thread-safe instead of the not-quite-safe
3275         synchronous API. Request all three sets of services immediately, and dispatch
3276         to the Web Content processes when all three have returned.
3277
3278 2018-07-23  Chris Dumez  <cdumez@apple.com>
3279
3280         WebResourceLoadStatisticsStore fails to unregister itself as a MessageReceiver in its destructor
3281         https://bugs.webkit.org/show_bug.cgi?id=187910
3282         <rdar://problem/42356526>
3283
3284         Reviewed by Brent Fulgham.
3285
3286         The WebResourceLoadStatisticsStore was only removing itself as a MessageReceiver from the WebProcessProxy
3287         and that WebProcessProxy's connection was getting closed. However, it is possible for the
3288         WebResourceLoadStatisticsStore to get destroyed before this happens. This would lead to crashes such as
3289         the one in <rdar://problem/42356526>.
3290
3291         To address the issue, we let the WebsiteDataStore take care of registering / unregistering the
3292         WebResourceLoadStatisticsStore as a MessageReceiver with the WebProcessProxy. This is more reliable since
3293         the WebsiteDataStore is the one that subclasses WebProcessLifetimeObserver. Make sure the
3294         WebResourceLoadStatisticsStore is removed as a MessageReceiver whenever the WebsiteDataStore is destroyed
3295         or WebsiteDataStore::m_resourceLoadStatistics gets cleared.
3296
3297         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3298         * UIProcess/WebResourceLoadStatisticsStore.h:
3299         Drop logic to add / remove the WebResourceLoadStatisticsStore as a receiver now that the
3300         WebsiteDataStore takes care of it.
3301
3302         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3303         (WebKit::WebsiteDataStore::~WebsiteDataStore):
3304         Make sure the WebResourceLoadStatisticsStore gets unregistered as a MessageReceiver from all associated
3305         WebProcessProxy objects when the WebsiteDataStore gets destroyed.
3306
3307         (WebKit::WebsiteDataStore::webProcessWillOpenConnection):
3308         (WebKit::WebsiteDataStore::webProcessDidCloseConnection):
3309         Register / Unregister the WebResourceLoadStatisticsStore as a MessageReceiver with the WebProcessProxy.
3310
3311         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
3312         Make sure we unregister the WebResourceLoadStatisticsStore as a MessageReceiver with all associated
3313         WebProcessProxy objects before we clear m_resourceLoadStatistics as this will causes the
3314         WebResourceLoadStatisticsStore to get destroyed.
3315
3316         (WebKit::WebsiteDataStore::unregisterWebResourceLoadStatisticsStoreAsMessageReceiver):
3317         (WebKit::WebsiteDataStore::registerWebResourceLoadStatisticsStoreAsMessageReceiver):
3318         Add utility functions to register / unregister WebResourceLoadStatisticsStore as a MessageReceiver with
3319         all associated WebProcessProxy objects.
3320
3321         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
3322         Register the new WebResourceLoadStatisticsStore as a MessageReceiver with all associated WebProcessProxy
3323         objects in case setResourceLoadStatisticsEnabled(true) gets called *after* we've already started
3324         WebProcesses.
3325
3326         * UIProcess/WebsiteData/WebsiteDataStore.h:
3327
3328 2018-07-23  John Wilander  <wilander@apple.com>
3329
3330         Resource Load Statistics: Add logging of Storage Access API use in experimental debug mode
3331         https://bugs.webkit.org/show_bug.cgi?id=187918
3332         <rdar://problem/42509062>
3333
3334         Reviewed by Jiewen Tan.
3335
3336         Tested manually by looking at log output.
3337
3338         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
3339         (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords):
3340             This is just a clean-up change.
3341         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
3342         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener):
3343             Both these now log proper info in debug mode.
3344
3345 2018-07-23  Aditya Keerthi  <akeerthi@apple.com>
3346
3347         [iOS] Add support for input[type=color]
3348         https://bugs.webkit.org/show_bug.cgi?id=187871
3349
3350         Reviewed by Tim Horton.
3351
3352         Created WKFormColorControl to display a color picker once a color input gains
3353         focus. The control is presented as an inputView on iPhone and as a popover on
3354         iPad. The picker itself consists of two color matrices. The first is a set of 12
3355         default colors, displayed on the top row of the picker. In a subsequent patch,
3356         this top row will be made customizable through the use of the datalist element.
3357         The second matrix is a grid of 120 colors, provided by the system. Colors can be
3358         selected from either matrix by tapping or with a pan gesture.
3359
3360         WKColorMatrixView represents a single color matrix and is comprised of
3361         WKColorButtons that represent each color in the matrix.
3362
3363         * Shared/AssistedNodeInformation.h:
3364         * UIProcess/API/Cocoa/_WKFocusedElementInfo.h:
3365         * UIProcess/ios/PageClientImplIOS.h:
3366         * UIProcess/ios/PageClientImplIOS.mm:
3367         (WebKit::PageClientImpl::createColorPicker):
3368         * UIProcess/ios/WKContentViewInteraction.mm:
3369         (-[WKFocusedElementInfo initWithAssistedNodeInformation:isUserInitiated:userObject:]):
3370         (-[WKContentView _requiresKeyboardWhenFirstResponder]):
3371         (-[WKContentView inputView]):
3372         (-[WKContentView requiresAccessoryView]):
3373         (isAssistableInputType):
3374         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3375         (-[WKContentView actionNameForFocusedFormControlView:]):