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