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