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