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