b16e747d2393bd132ce92c69fec0ecf7c194e39a
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-06-15  Thibault Saunier  <tsaunier@igalia.com>
2
3         [GTK][WPE]: Avoid using uninitialized launchOptions in getLaunchOptions
4         https://bugs.webkit.org/show_bug.cgi?id=185611
5
6         Reviewed by Chris Dumez.
7
8         Otherwise we might segfault.
9
10         * UIProcess/Plugins/PluginProcessProxy.cpp:
11         (WebKit::PluginProcessProxy::getLaunchOptions):
12
13 2018-06-14  Youenn Fablet  <youenn@apple.com>
14
15         Make NetworkProcess get cache storage parameters at creation of the CacheStorage engine
16         https://bugs.webkit.org/show_bug.cgi?id=186166
17
18         Reviewed by Alex Christensen.
19
20         Make CacheStorage::Engine creation asynchronous.
21         Update Engine public methods be static methods taking a SessionID, which will be used to create the engine.
22
23         Add IPC methods to retrieve cache storage parameters from NetworkProcess to UIProcess.
24
25         Add NetworkProcessProxy ability to compute the cache storage parameters based on the SessionID.
26         For that purpose, make NetworkProcessProxy store a map of SessionID-to-WebsiteDataStore.
27
28         * NetworkProcess/NetworkProcess.cpp:
29         (WebKit::NetworkProcess::deleteWebsiteData):
30         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
31         (WebKit::NetworkProcess::cacheStorageParameters):
32         (WebKit::NetworkProcess::setCacheStorageParameters):
33         (WebKit::NetworkProcess::cacheStorageDirectory const): Deleted.
34         (WebKit::NetworkProcess::cacheStoragePerOriginQuota const): Deleted.
35         * NetworkProcess/NetworkProcess.h:
36         * NetworkProcess/NetworkProcess.messages.in:
37         * NetworkProcess/NetworkProcessCreationParameters.cpp:
38         (WebKit::NetworkProcessCreationParameters::encode const):
39         (WebKit::NetworkProcessCreationParameters::decode):
40         * NetworkProcess/NetworkProcessCreationParameters.h:
41         * NetworkProcess/cache/CacheStorageEngine.cpp:
42         (WebKit::CacheStorage::Engine::from):
43         (WebKit::CacheStorage::Engine::fetchEntries):
44         (WebKit::CacheStorage::Engine::open):
45         (WebKit::CacheStorage::Engine::remove):
46         (WebKit::CacheStorage::Engine::retrieveCaches):
47         (WebKit::CacheStorage::Engine::retrieveRecords):
48         (WebKit::CacheStorage::Engine::putRecords):
49         (WebKit::CacheStorage::Engine::deleteMatchingRecords):
50         (WebKit::CacheStorage::Engine::lock):
51         (WebKit::CacheStorage::Engine::unlock):
52         (WebKit::CacheStorage::Engine::clearMemoryRepresentation):
53         (WebKit::CacheStorage::Engine::representation):
54         (WebKit::CacheStorage::Engine::clearAllCaches):
55         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
56         (WebKit::CacheStorage::Engine::Engine):
57         (WebKit::CacheStorage::Engine::readCachesFromDisk):
58         (WebKit::CacheStorage::Engine::defaultEngine): Deleted.
59         * NetworkProcess/cache/CacheStorageEngine.h:
60         (WebKit::CacheStorage::Engine::shouldPersist const):
61         (WebKit::CacheStorage::Engine::weakPtrFactory):
62         (WebKit::CacheStorage::Engine::create): Deleted.
63         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
64         (WebKit::CacheStorageEngineConnection::~CacheStorageEngineConnection):
65         (WebKit::CacheStorageEngineConnection::open):
66         (WebKit::CacheStorageEngineConnection::remove):
67         (WebKit::CacheStorageEngineConnection::caches):
68         (WebKit::CacheStorageEngineConnection::retrieveRecords):
69         (WebKit::CacheStorageEngineConnection::deleteMatchingRecords):
70         (WebKit::CacheStorageEngineConnection::putRecords):
71         (WebKit::CacheStorageEngineConnection::reference):
72         (WebKit::CacheStorageEngineConnection::dereference):
73         (WebKit::CacheStorageEngineConnection::clearMemoryRepresentation):
74         (WebKit::CacheStorageEngineConnection::engineRepresentation):
75         * NetworkProcess/cache/CacheStorageEngineConnection.h:
76         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
77         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
78         * NetworkProcess/mac/RemoteNetworkingContext.mm:
79         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
80         * Shared/WebsiteDataStoreParameters.cpp:
81         (WebKit::WebsiteDataStoreParameters::encode const):
82         (WebKit::WebsiteDataStoreParameters::decode):
83         (WebKit::WebsiteDataStoreParameters::privateSessionParameters):
84         * Shared/WebsiteDataStoreParameters.h:
85         (): Deleted.
86         * UIProcess/Network/NetworkProcessProxy.cpp:
87         (WebKit::NetworkProcessProxy::addSession):
88         (WebKit::NetworkProcessProxy::removeSession):
89         (WebKit::NetworkProcessProxy::retrieveCacheStorageParameters):
90         * UIProcess/Network/NetworkProcessProxy.h:
91         * UIProcess/Network/NetworkProcessProxy.messages.in:
92         * UIProcess/WebProcessPool.cpp:
93         (WebKit::WebProcessPool::ensureNetworkProcess):
94         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
95         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
96         (WebKit::WebProcessPool::pageEndUsingWebsiteDataStore):
97         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
98         (WebKit::WebsiteDataStore::parameters):
99         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
100         (WebKit::WebsiteDataStore::~WebsiteDataStore):
101
102 2018-06-14  Basuke Suzuki  <Basuke.Suzuki@sony.com>
103
104         [Win] Add IPC error case for broken pipe
105         https://bugs.webkit.org/show_bug.cgi?id=186445
106
107         Add error handling for ERROR_BROKEN_PIPE on IPC::Connection::readEventHandler.
108
109         Reviewed by Ryosuke Niwa.
110
111         * Platform/IPC/win/ConnectionWin.cpp:
112         (IPC::Connection::readEventHandler):
113
114 2018-06-14  John Wilander  <wilander@apple.com>
115
116         Resource Load Statistics: Shortcut classification for redirect to prevalent resource
117         https://bugs.webkit.org/show_bug.cgi?id=186627
118         <rdar://problem/41132308>
119
120         Reviewed by Brent Fulgham.
121
122         This patch shortcuts classification of redirect collusion so that we more seldom
123         have to rely on the recursive backtrace of the redirect graph. The initial
124         implementation of Resource Load Statistics actually had this classification method.
125
126         * UIProcess/WebResourceLoadStatisticsStore.cpp:
127         (WebKit::WebResourceLoadStatisticsStore::markAsPrevalentIfHasRedirectedToPrevalent):
128             Iterates through a non-classified resource's data for where it has redirected
129             and classifies it as prevalent if has redirected to 
130         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
131             Now calls WebResourceLoadStatisticsStore::markAsPrevalentIfHasRedirectedToPrevalent()
132             before regular classification steps. 
133         * UIProcess/WebResourceLoadStatisticsStore.h:
134
135 2018-06-14  Youenn Fablet  <youenn@apple.com>
136
137         Apply CSP checks before Content blocker checks in NetworkLoadChecker as done by CachedResourceLoader
138         https://bugs.webkit.org/show_bug.cgi?id=186550
139
140         Reviewed by Alex Christensen.
141
142         Do CSP checks and URL upgrade before content blocker checks.
143
144         * NetworkProcess/NetworkLoadChecker.cpp:
145         (WebKit::NetworkLoadChecker::checkRequest):
146         (WebKit::NetworkLoadChecker::continueCheckingRequest):
147
148 2018-06-14  Brent Fulgham  <bfulgham@apple.com>
149
150         Plug-in Process crashing on Mojave (affects Flash, others)
151         https://bugs.webkit.org/show_bug.cgi?id=186628
152         <rdar://problem/41120462>
153
154         Reviewed by Eric Carlson.
155
156         Add the missing “com.apple.security.cs.allow-unsigned-executable-memory” entitlement. Also alphabetize
157         the entitlements file to make it easier to read.
158
159         * Configurations/PluginService.entitlements:
160
161 2018-06-14  Carlos Garcia Campos  <cgarcia@igalia.com>
162
163         [GTK][WPE] WebDriver: handle acceptInsecureCertificates capability
164         https://bugs.webkit.org/show_bug.cgi?id=186560
165
166         Reviewed by Brian Burg.
167
168         * UIProcess/API/glib/WebKitAutomationSession.cpp:
169         (webkitAutomationSessionCreate): Check the acceptInsecureCertificates capability and set the TLS error policy in
170         the WebContext accordingly if needed.
171         * UIProcess/API/glib/WebKitAutomationSessionPrivate.h:
172         * UIProcess/API/glib/WebKitWebContext.cpp:
173         * UIProcess/Cocoa/AutomationClient.h:
174         * UIProcess/Cocoa/AutomationClient.mm:
175         (WebKit::AutomationClient::requestAutomationSession): Use SessionCapabilities to fill the session configuration.
176         (WebKit::AutomationClient::requestAutomationSessionWithCapabilities): Deleted.
177
178 2018-06-13  Adrian Perez de Castro  <aperez@igalia.com>
179
180         [WPE] Trying to access the remote inspector hits an assertion in the UIProcess
181         https://bugs.webkit.org/show_bug.cgi?id=186588
182
183         Reviewed by Carlos Garcia Campos.
184
185         Make both the WPE and GTK+ ports use /org/webkit/inspector as base prefix
186         for resource paths, which avoids needing a switcheroo depending on the port.
187
188         * UIProcess/API/wpe/WebKit2InspectorGResourceBundle.xml:
189         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
190         (WebKit::WebInspectorProxy::inspectorPageURL):
191         (WebKit::WebInspectorProxy::inspectorTestPageURL):
192         (WebKit::WebInspectorProxy::inspectorBaseURL):
193         * UIProcess/wpe/WebInspectorProxyWPE.cpp:
194         (WebKit::WebInspectorProxy::inspectorPageURL):
195         (WebKit::WebInspectorProxy::inspectorTestPageURL):
196         (WebKit::WebInspectorProxy::inspectorBaseURL):
197         * WebProcess/WebPage/gtk/WebInspectorUIGtk.cpp:
198         (WebKit::WebInspectorUI::localizedStringsURL):
199         (WebKit::RemoteWebInspectorUI::localizedStringsURL):
200
201 2018-06-13  Chris Dumez  <cdumez@apple.com>
202
203         Crash under SWServer::unregisterConnection(Connection&)
204         https://bugs.webkit.org/show_bug.cgi?id=186584
205         <rdar://problem/40931680>
206
207         Reviewed by Youenn Fablet.
208
209         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
210         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
211         * StorageProcess/StorageToWebProcessConnection.cpp:
212         (WebKit::StorageToWebProcessConnection::~StorageToWebProcessConnection):
213         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
214         (WebKit::StorageToWebProcessConnection::didReceiveSyncMessage):
215         (WebKit::StorageToWebProcessConnection::didClose):
216         (WebKit::StorageToWebProcessConnection::unregisterSWConnections):
217         (WebKit::StorageToWebProcessConnection::establishSWServerConnection):
218         * StorageProcess/StorageToWebProcessConnection.h:
219
220 2018-06-13  Dean Jackson  <dino@apple.com>
221
222         Disable AR support in WKWebView clients
223         https://bugs.webkit.org/show_bug.cgi?id=186611
224         <rdar://problem/39544684>
225
226         Reviewed by Jon Lee.
227
228         Since it hasn't been adequately tested, System Preview (AR) should
229         be disabled by default for WKWebViews.
230
231         Add a new WebPreference, and SPI into WKWebViewConfiguration. Also
232         don't register the WebViewContentProvider if the feature is
233         disabled.
234
235         * Shared/WebPreferences.yaml:
236         * UIProcess/API/Cocoa/WKWebView.mm:
237         (-[WKWebView _initializeWithConfiguration:]):
238         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
239         (-[WKWebViewConfiguration init]):
240         (-[WKWebViewConfiguration encodeWithCoder:]):
241         (-[WKWebViewConfiguration initWithCoder:]):
242         (-[WKWebViewConfiguration copyWithZone:]):
243         (-[WKWebViewConfiguration _contentProviderRegistry]):
244         (-[WKWebViewConfiguration _systemPreviewEnabled]):
245         (-[WKWebViewConfiguration _setSystemPreviewEnabled:]):
246         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
247         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.h:
248         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
249         (-[WKWebViewContentProviderRegistry initWithConfiguration:]):
250         (-[WKWebViewContentProviderRegistry init]): Deleted.
251
252 2018-06-13  Youenn Fablet  <youenn@apple.com>
253
254         Supported plugin check should be based on plugin identifier
255         https://bugs.webkit.org/show_bug.cgi?id=186578
256         <rdar://problem/40523828>
257
258         Reviewed by Darin Adler.
259
260         Refactoring to move from Plugin name to Plugin identifier.
261         Set built-in pdf plugin identifier.
262         This allows making sure that the PDF plug-in check might not change according localization.
263
264         * Scripts/webkit/messages.py:
265         * Shared/WebCoreArgumentCoders.cpp:
266         (IPC::ArgumentCoder<PluginInfo>::encode):
267         (IPC::ArgumentCoder<PluginInfo>::decode):
268         * UIProcess/Plugins/PluginInfoStore.cpp:
269         (WebKit::PluginInfoStore::supportedPluginIdentifiers):
270         (WebKit::PluginInfoStore::addSupportedPlugin):
271         (WebKit::PluginInfoStore::supportedPluginNames): Deleted.
272         * UIProcess/Plugins/PluginInfoStore.h:
273         * UIProcess/WebProcessProxy.cpp:
274         (WebKit::WebProcessProxy::getPlugins):
275         * UIProcess/WebProcessProxy.h:
276         * UIProcess/WebProcessProxy.messages.in:
277         * WebProcess/Plugins/PDF/PDFPlugin.mm:
278         (WebKit::PDFPlugin::pluginInfo):
279         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
280         (WebKit::WebPluginInfoProvider::pluginInfo):
281         (WebKit::WebPluginInfoProvider::webVisiblePluginInfo):
282         (WebKit::WebPluginInfoProvider::populatePluginCache):
283         * WebProcess/Plugins/WebPluginInfoProvider.h:
284
285 2018-06-13  Chris Dumez  <cdumez@apple.com>
286
287         PSON: http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-collusion.html ASSERTS with process swap enabled
288         https://bugs.webkit.org/show_bug.cgi?id=186545
289
290         Reviewed by Brady Eidson.
291
292         Move frame navigation logging for ITP purposes from the WebProcess to the UIProcess.
293         This information was previously logged in DocumentLoader::willSendRequest() and was getting
294         sync'd to the UIProcess at regular intervals or when the layout tests call testRunner's
295         statisticsNotifyObserver(). We now do the logging directly in the UIProcess, in
296         WebPageProxy::decidePolicyForNavigationAction (which was getting called via IPC from
297         DocumentLoader::willSendRequest()).
298
299         This is more efficient and will also be needed soon due to the way process swap on navigation 
300         deals with cross-origin redirects. On cross-origin redirect of the main frame, PSON cancels
301         the load and started a new load to the redirected to URL in the new WebProcess. As a result,
302         the new WebProcess is not aware that the load is a redirect, which is information that ITP
303         requires. By moving the ITP logging to the UIProcess, we still have access to this
304         information.
305
306         * UIProcess/WebPageProxy.cpp:
307         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
308         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
309         * UIProcess/WebPageProxy.h:
310         * UIProcess/WebPageProxy.messages.in:
311         - We now pass the full redirect response the the delegate method instead of a simple
312         isRedirect boolean.
313         - Log the navigation in the WebResourceLoadStatisticsStore for ITP purposes.
314
315         * UIProcess/WebResourceLoadStatisticsStore.cpp:
316         (WebKit::areDomainsAssociated):
317         Equivalent of ResourceLoadObserver's areDomainsAssociated(). Most of the logic was moved
318         to ResourceLoadStatistics::areDomainsAssociated() to avoid code duplication.
319
320         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
321         This is called whenever a WebProcess sends new resource load statistics to the UIProcess.
322         Whenever this happens, we call processStatisticsAndDataRecords() right away, which is
323         sometimes the tests currently rely on. As a result, we can cancels any pending statistics
324         processing request that was scheduled by logFrameNavigation().
325
326         (WebKit::WebResourceLoadStatisticsStore::scheduleStatisticsProcessingRequestIfNecessary):
327         (WebKit::WebResourceLoadStatisticsStore::cancelPendingStatisticsProcessingRequest):
328         Whenever a navigation is logged and statistics have been updated, we need to make sure we
329         schedule a "timer" to process the new data. We do this at most every 5 seconds for performance
330         reasons. This 5 second interval matches what the ResourceLoadObserver is using in the WebProcess
331         to notify the UIProcess of new data.
332
333         (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation):
334         This code was moved from ResourceLoadObserver to WebResourceLoadStatisticsStore now that we
335         do this logging in the UIProcess instead of the WebProcess. One difference with WebCore is
336         that we use WebPageProxy::pageLoadState().url() as mainFrameURL instead of
337         WebPageProxy::mainFrame().url(). The reason for that is that WebPageProxy::mainFrame().url()
338         becomes empty in case of process swap but ITP still needs the actual main frame URL when the
339         navigation was triggered. WebPageProxy::pageLoadState().url() gives us this information.
340
341         * UIProcess/WebResourceLoadStatisticsStore.h:
342
343         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
344         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
345         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
346         We now pass the full redirect response the the delegate method instead of a simple
347         isRedirect boolean.
348
349 2018-06-13  Brent Fulgham  <bfulgham@apple.com>
350
351         Crash during interrupted process termination
352         https://bugs.webkit.org/show_bug.cgi?id=185373
353         <rdar://problem/40019480>
354
355         Reviewed by Alex Christensen.
356
357         It's possible to encounter a crash if a user agent feature (such as Safari's responsiveness timer) decides
358         to kill a Web Process around the same time that a user decides to trigger a new page load. One of the two
359         termination operations may attempt to call methods on a nulled process pointer.
360
361         We can avoid this by holding our own reference to the terminating process until the termination steps have
362         been completed.
363
364         * UIProcess/API/C/WKPage.cpp:
365         (WKPageTerminate): Ref<> the active process while the termination call is performed.
366         * UIProcess/API/Cocoa/WKWebView.mm:
367         ([WKWebView _killWebContentProcessAndResetState]): Ditto.
368
369 2018-06-13  Brian Burg  <bburg@apple.com>
370
371         [Cocoa] Web Automation: wrong modifiers sent for 'Help' virtual key
372         https://bugs.webkit.org/show_bug.cgi?id=186600
373         <rdar://problem/41088912>
374
375         Reviewed by Timothy Hatcher.
376
377         This fixes a hang when running W3C test:
378
379             special_keys.py::test_webdriver_special_key_sends_keydown[HELP-expected2]
380
381         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
382         (WebKit::eventModifierFlagsForVirtualKey):
383         The help modifier doesn't seem to be used when pressing the Help key.
384         I verified this using the Help key on the Keyboard Viewer, since no
385         keyboards from the past decade actually have this physical button.
386
387 2018-06-13  Thibault Saunier  <tsaunier@igalia.com>
388
389         [WPE] Build getUserMedia support
390         https://bugs.webkit.org/show_bug.cgi?id=186547
391
392         Reviewed by Alejandro G. Castro.
393
394         * SourcesWPE.txt: Compile files necessary for MediaStream/webrtc.
395
396 2018-06-13  Andy Estes  <aestes@apple.com>
397
398         [iOS] Synchronize PDF resizing with device rotation
399         https://bugs.webkit.org/show_bug.cgi?id=186587
400         <rdar://problem/40922462>
401
402         Reviewed by Darin Adler.
403
404         Both -beginPDFViewRotation and -endPDFViewRotation need to be called as part of
405         the transition coordinator's -animateAlongsideTransition: block to be synchronized
406         with rotation. Additionally, updateBlock needs to be invoked between the two calls
407         so that PDFKit can capture the frame geometry before and after the update.
408
409         * UIProcess/API/Cocoa/WKWebView.mm:
410         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
411         * UIProcess/Cocoa/WKWebViewContentProvider.h:
412         * UIProcess/ios/WKPDFView.mm:
413         (-[WKPDFView web_beginAnimatedResizeWithUpdates:]):
414         (-[WKPDFView web_beginAnimatedResize]): Renamed to web_beginAnimatedResizeWithUpdates:.
415         (-[WKPDFView web_endAnimatedResize]): Deleted.
416
417 2018-06-12  Brent Fulgham  <bfulgham@apple.com>
418
419         Turn CSS Spring Animations and Link Preload off by default for production builds.
420         https://bugs.webkit.org/show_bug.cgi?id=186548
421         <rdar://problem/41023774>
422
423         Reviewed by Eric Carlson.
424
425         * Shared/WebPreferences.yaml: Switch these features from 'on' to
426         DEFAULT_EXPERIMENTAL_FEATURES_ENABLED.
427
428 2018-06-12  Wenson Hsieh  <wenson_hsieh@apple.com>
429
430         [WebKit on watchOS] Upstream watchOS source additions to OpenSource (Part 2)
431         https://bugs.webkit.org/show_bug.cgi?id=186442
432         <rdar://problem/40879364>
433
434         Reviewed by Tim Horton.
435
436         Upstream most of the work around form controls on watchOS. Also, rename WKFormControlListViewController.* to
437         its intended name, WKQuickboardListViewController.*.
438
439         * UIProcess/ios/WKContentViewInteraction.mm:
440         * UIProcess/ios/forms/WKDatePickerViewController.h:
441         * UIProcess/ios/forms/WKDatePickerViewController.mm:
442         (datePickerSetButtonHeight):
443         (datePickerVerticalMargin):
444         (-[WKDatePickerWheelLabel initWithFrame:]):
445         (-[WKDatePickerWheelLabel lastSelectedDate]):
446         (-[WKDatePickerWheelLabel setLastSelectedDate:]):
447         (-[WKDatePickerWheelLabel needsUpdateForIndex:selectedDate:]):
448         (-[WKDatePickerWheel initWithStyle:]):
449         (-[WKDatePickerWheel initWithController:style:]):
450         (-[WKDatePickerWheel gestureRecognized:]):
451         (-[WKDatePickerWheel setDrawsFocusOutline:]):
452         (-[WKDatePickerWheel drawsFocusOutline]):
453         (-[WKDatePickerWheel gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
454         (-[WKDatePickerViewController initWithDelegate:]):
455         (-[WKDatePickerViewController viewDidLoad]):
456         (-[WKDatePickerViewController prefersStatusBarHidden]):
457         (-[WKDatePickerViewController viewWillAppear:]):
458         (-[WKDatePickerViewController viewDidAppear:]):
459         (-[WKDatePickerViewController viewDidDisappear:]):
460         (-[WKDatePickerViewController _handleStatusBarNavigation]):
461         (-[WKDatePickerViewController viewWillLayoutSubviews]):
462         (-[WKDatePickerViewController becomeFirstResponder]):
463         (-[WKDatePickerViewController defaultMinimumDate]):
464         (-[WKDatePickerViewController defaultMaximumDate]):
465         (-[WKDatePickerViewController _valueForInput]):
466         (-[WKDatePickerViewController _dateFromInitialText]):
467         (-[WKDatePickerViewController _setButtonPressed]):
468         (-[WKDatePickerViewController _updateSelectedPickerViewIndices]):
469         (-[WKDatePickerViewController _configurePickerView:]):
470         (-[WKDatePickerViewController setMinimumDate:]):
471         (-[WKDatePickerViewController minimumDate]):
472         (-[WKDatePickerViewController setMaximumDate:]):
473         (-[WKDatePickerViewController maximumDate]):
474         (-[WKDatePickerViewController setDate:]):
475         (-[WKDatePickerViewController setDateFromComponents:]):
476         (-[WKDatePickerViewController setDay:month:year:era:]):
477         (-[WKDatePickerViewController date]):
478         (-[WKDatePickerViewController _dateComponentForDay:month:year:era:]):
479         (-[WKDatePickerViewController _adjustDateToValidDateIfNecessary]):
480         (-[WKDatePickerViewController _createAndConfigureGranularityLabelWithText:]):
481         (-[WKDatePickerViewController _canonicalizeAndUpdateSelectedDate]):
482         (-[WKDatePickerViewController numberOfItemsInPickerView:]):
483         (-[WKDatePickerViewController pickerView:viewForItemAtIndex:]):
484         (-[WKDatePickerViewController didBeginInteractingWithDatePicker:]):
485         (-[WKDatePickerViewController pickerView:didSelectItemAtIndex:]):
486         (-[WKDatePickerViewController pickerViewWillBeginSelection:]):
487         (-[WKDatePickerViewController pickerViewDidEndSelection:]):
488         (-[WKDatePickerViewController _dayFromIndex:]):
489         (-[WKDatePickerViewController _eraAndYearFromIndex:]):
490         (-[WKDatePickerViewController _monthFromIndex:]):
491         (-[WKDatePickerViewController _indexFromDay:]):
492         (-[WKDatePickerViewController _indexFromYear:era:]):
493         (-[WKDatePickerViewController _indexFromMonth:]):
494         * UIProcess/ios/forms/WKFormControlListViewController.h: Removed.
495         * UIProcess/ios/forms/WKFormControlListViewController.mm: Removed.
496         * UIProcess/ios/forms/WKNumberPadViewController.h:
497         * UIProcess/ios/forms/WKNumberPadViewController.mm:
498         (inputLabelFontSize):
499         (-[WKNumberPadViewController initWithDelegate:initialText:inputMode:]):
500         (-[WKNumberPadViewController dealloc]):
501         (-[WKNumberPadViewController viewDidLoad]):
502         (-[WKNumberPadViewController viewWillDisappear:]):
503         (-[WKNumberPadViewController viewWillLayoutSubviews]):
504         (-[WKNumberPadViewController _reloadHeaderViewFromInputText]):
505         (-[WKNumberPadViewController didSelectKey:]):
506         (-[WKNumberPadViewController _handleKeyPress:]):
507         (-[WKNumberPadViewController _cancelInput]):
508         (-[WKNumberPadViewController _deleteLastInputCharacter]):
509         (-[WKNumberPadViewController _deleteButtonPressed]):
510         (-[WKNumberPadViewController _cancelDeletionTimers]):
511         (-[WKNumberPadViewController _startDeletionTimer]):
512         (-[WKNumberPadViewController _deletionTimerFired]):
513         (-[WKNumberPadViewController addContentViewAnimations:]):
514         * UIProcess/ios/forms/WKQuickboardListViewController.h: Added.
515         * UIProcess/ios/forms/WKQuickboardListViewController.mm: Added.
516         (-[WKQuickboardListItemCell topToLabelBaselineSpecValue]):
517         (-[WKQuickboardListItemCell baselineToBottomSpecValue]):
518         (-[WKQuickboardListViewController initWithDelegate:]):
519         (-[WKQuickboardListViewController updateContextViewIfNeeded]):
520         (-[WKQuickboardListViewController prefersStatusBarHidden]):
521         (-[WKQuickboardListViewController viewDidLoad]):
522         (-[WKQuickboardListViewController viewWillAppear:]):
523         (-[WKQuickboardListViewController viewDidDisappear:]):
524         (-[WKQuickboardListViewController _handleStatusBarNavigation]):
525         (-[WKQuickboardListViewController reloadContextView]):
526         (-[WKQuickboardListViewController actionController]):
527         (-[WKQuickboardListViewController languageControllerDidChangePrimaryLanguage:]):
528         (-[WKQuickboardListViewController headerContentViewHeight]):
529         (-[WKQuickboardListViewController headerContentView]):
530         (configureStatusBarForController):
531         * UIProcess/ios/forms/WKSelectMenuListViewController.h:
532         * UIProcess/ios/forms/WKSelectMenuListViewController.mm:
533         (-[WKSelectMenuItemCell initWithStyle:reuseIdentifier:]):
534         (-[WKSelectMenuItemCell imageView]):
535         (-[WKSelectMenuListViewController initWithDelegate:]):
536         (-[WKSelectMenuListViewController viewDidLoad]):
537         (-[WKSelectMenuListViewController acceptButtonTappedWithCompletion:]):
538         (-[WKSelectMenuListViewController shouldShowTrayView]):
539         (-[WKSelectMenuListViewController didSelectListItem:]):
540         (-[WKSelectMenuListViewController numberOfListItems]):
541         (-[WKSelectMenuListViewController heightForListItem:width:]):
542         (-[WKSelectMenuListViewController cellForListItem:]):
543         (-[WKSelectMenuListViewController selectItemAtIndex:]):
544         * UIProcess/ios/forms/WKTimePickerViewController.h:
545         * UIProcess/ios/forms/WKTimePickerViewController.mm:
546         (-[WKTimePickerViewController initWithDelegate:]):
547         (-[WKTimePickerViewController dateFormatter]):
548         (-[WKTimePickerViewController timeValueForFormControls]):
549         (-[WKTimePickerViewController dateComponentsFromInitialValue]):
550         (-[WKTimePickerViewController viewDidAppear:]):
551         (-[WKTimePickerViewController viewDidLoad]):
552         (-[WKTimePickerViewController becomeFirstResponder]):
553         (-[WKTimePickerViewController setHour:minute:]):
554         (-[WKTimePickerViewController leftButtonWOTAction]):
555         (-[WKTimePickerViewController rightButtonWOTAction]):
556         * WebKit.xcodeproj/project.pbxproj:
557
558 2018-06-12  Jer Noble  <jer.noble@apple.com>
559
560         Make Modern EME An Experimental Feature Again
561         https://bugs.webkit.org/show_bug.cgi?id=186569
562         <rdar://problem/41054402>
563
564         Reviewed by Eric Carlson.
565
566         * Shared/WebPreferences.yaml:
567
568 2018-06-12  Andy Estes  <aestes@apple.com>
569
570         [watchOS] Enable NetworkActivityTracker
571         https://bugs.webkit.org/show_bug.cgi?id=186568
572         <rdar://problem/41050624>
573
574         Reviewed by Tim Horton.
575
576         * NetworkProcess/NetworkActivityTracker.h:
577
578 2018-06-12  Antti Koivisto  <antti@apple.com>
579
580         Add performance logging for slow cache retrieves
581         https://bugs.webkit.org/show_bug.cgi?id=186520
582         <rdar://problem/41002070>
583
584         Reviewed by Chris Dumez.
585
586         We sometimes see slow cache retrieves in logs. Add some more logging to better analyze these cases.
587
588         This patch adds timings to all cache storage retrieve operations and passes them up to the client.
589         We then log the timings on NetworkResourceLoader levels if needed. Items logged include
590
591         - total retrieve time
592         - dispatch delay and number of resources dispatched before this one
593         - record I/O time
594         - blob I/O time
595         - whether cache shrink was in progress
596         - whether cache synchronization was in progress
597         - cancellation
598
599         * NetworkProcess/NetworkResourceLoader.cpp:
600         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
601         (WebKit::NetworkResourceLoader::logSlowCacheRetrieveIfNeeded):
602
603         Log if the retrieve took more than 1s.
604
605         * NetworkProcess/NetworkResourceLoader.h:
606         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
607         (WebKit::CacheStorage::Caches::readRecord):
608         * NetworkProcess/cache/NetworkCache.cpp:
609         (WebKit::NetworkCache::Cache::retrieve):
610         (WebKit::NetworkCache::Cache::completeRetrieve):
611         (WebKit::NetworkCache::Cache::retrieveData):
612         * NetworkProcess/cache/NetworkCache.h:
613         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
614         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveEntryFromStorage):
615         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveSubresourcesEntry):
616
617         SpeculativeLoadManager does not records specific timings yet but at least we do log when they occur.
618
619         * NetworkProcess/cache/NetworkCacheStorage.cpp:
620         (WebKit::NetworkCache::Storage::ReadOperation::cancel):
621         (WebKit::NetworkCache::Storage::ReadOperation::finish):
622
623         Record timing info in ReadOperations.
624
625         (WebKit::NetworkCache::Storage::dispatchReadOperation):
626         (WebKit::NetworkCache::retrieveFromMemory):
627         (WebKit::NetworkCache::Storage::retrieve):
628         * NetworkProcess/cache/NetworkCacheStorage.h:
629
630 2018-06-11  Carlos Garcia Campos  <cgarcia@igalia.com>
631
632         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.21.4 release.
633
634         * gtk/NEWS: Add release notes for 2.21.4.
635
636 2018-06-11  Youenn Fablet  <youenn@apple.com>
637
638         Improve error messages in case FetchEvent.respondWith has a rejected promise
639         https://bugs.webkit.org/show_bug.cgi?id=186368
640
641         Reviewed by Chris Dumez.
642
643         Log in JS console in case of failures.
644         Rely on ThreadableLoader to log which client actually failed.
645
646         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
647         (WebKit::ServiceWorkerClientFetch::didFail):
648
649 2018-06-11  Chris Dumez  <cdumez@apple.com>
650
651         http/tests/security/xss-DENIED-script-inject-into-inactive-window2.html times out with PSON enabled
652         https://bugs.webkit.org/show_bug.cgi?id=186546
653
654         Reviewed by Brady Eidson.
655
656         Disable process swap on navigation in frames that have opened other frames via
657         window.open(). These new windows may have a WindowProxy to their opener, and it
658         would therefore be unsafe to process swap at this point.
659
660         * Shared/NavigationActionData.cpp:
661         (WebKit::NavigationActionData::encode const):
662         (WebKit::NavigationActionData::decode):
663         * Shared/NavigationActionData.h:
664         * UIProcess/API/APINavigation.h:
665         (API::Navigation::setHasOpenedFrames):
666         (API::Navigation::hasOpenedFrames const):
667         * UIProcess/WebPageProxy.cpp:
668         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
669         * UIProcess/WebProcessPool.cpp:
670         (WebKit::WebProcessPool::processForNavigationInternal):
671         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
672         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
673
674 2018-06-11  Keith Rollin  <krollin@apple.com>
675
676         Add logging around internalError(const URL&)
677         https://bugs.webkit.org/show_bug.cgi?id=186369
678         <rdar://problem/40872046>
679
680         Reviewed by Brent Fulgham.
681
682         There are times when we receive bug reports where the user says that
683         they are simply shown a page saying an internal error occurred. To
684         help understand the circumstances of that error, add some logging to
685         internalError() in WebErrors.cpp. This logging logs at the Error level
686         that internalError() was called and then logs a backtrace.
687
688         * Shared/WebErrors.cpp:
689         (WebKit::internalError):
690
691 2018-06-11  Tim Horton  <timothy_horton@apple.com>
692
693         Link drag image is inconsistently unreadable in dark mode
694         https://bugs.webkit.org/show_bug.cgi?id=186472
695
696         Reviewed by Timothy Hatcher.
697
698         * UIProcess/Cocoa/WebViewImpl.mm:
699         (WebKit::WebViewImpl::useDefaultAppearance):
700         Make defaultAppearance accurate even if useSystemAppearance is false.
701         Some parts of WebKit (like the link drag image, but also context menus)
702         want to be able to follow the system appearance regardless of whether
703         the view or content has opted in.
704
705 2018-06-11  Chris Dumez  <cdumez@apple.com>
706
707         http/tests/security/cors-post-redirect-307.html fails with PSON enabled
708         https://bugs.webkit.org/show_bug.cgi?id=186441
709
710         Reviewed by Brady Eidson.
711
712         Rename existing flag to something a bit more generic, now that it is used for
713         more things than bypassing the navigation policy check.
714
715         * Shared/LoadParameters.cpp:
716         (WebKit::LoadParameters::encode const):
717         (WebKit::LoadParameters::decode):
718         * Shared/LoadParameters.h:
719         * UIProcess/WebPageProxy.cpp:
720         (WebKit::WebPageProxy::reattachToWebProcessForReload):
721         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
722         (WebKit::WebPageProxy::loadRequest):
723         (WebKit::WebPageProxy::loadRequestWithNavigation):
724         (WebKit::WebPageProxy::goToBackForwardItem):
725         (WebKit::WebPageProxy::continueNavigationInNewProcess):
726         * UIProcess/WebPageProxy.h:
727         * WebProcess/WebPage/WebPage.cpp:
728         (WebKit::WebPage::loadRequest):
729         (WebKit::WebPage::goToBackForwardItem):
730         * WebProcess/WebPage/WebPage.h:
731         * WebProcess/WebPage/WebPage.messages.in:
732
733 2018-06-11  Nan Wang  <n_wang@apple.com>
734
735         AX: [iOS] accessibility sometimes doesn't know process suspension is canceled
736         https://bugs.webkit.org/show_bug.cgi?id=186450
737
738         Reviewed by Chris Fleizach.
739
740         There's some early return condition in WebProcess::cancelPrepareToSuspend() which
741         could lead to accessibility failing to post process status notificaiton. Fixed it
742         by moving the accessibility notification before the early return condition.
743
744         * WebProcess/WebProcess.cpp:
745         (WebKit::WebProcess::cancelPrepareToSuspend):
746
747 2018-06-10  Carlos Garcia Campos  <cgarcia@igalia.com>
748
749         [GTK][WPE] Add API run run javascript from a WebKitWebView in an isolated world
750         https://bugs.webkit.org/show_bug.cgi?id=186192
751
752         Reviewed by Michael Catanzaro.
753
754         Add webkit_web_view_run_javascript_in_world() that receives a world name. Also add
755         webkit_script_world_new_with_name() to create an isolated world with a name and webkit_script_world_get_name()
756         to get the name of a WebKitScriptWorld.
757
758         * UIProcess/API/glib/WebKitWebView.cpp:
759         (webkit_web_view_run_javascript):
760         (webkit_web_view_run_javascript_finish):
761         (webkit_web_view_run_javascript_in_world):
762         (webkit_web_view_run_javascript_in_world_finish):
763         * UIProcess/API/gtk/WebKitWebView.h:
764         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: Add new symbols.
765         * UIProcess/API/wpe/WebKitWebView.h:
766         * UIProcess/WebPageProxy.cpp:
767         (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld): Send RunJavaScriptInMainFrameScriptWorld message to
768         the WebProcess.
769         * UIProcess/WebPageProxy.h:
770         * WebProcess/InjectedBundle/API/glib/WebKitScriptWorld.cpp:
771         (webkitScriptWorldCreate):
772         (webkit_script_world_new_with_name):
773         (webkit_script_world_get_name):
774         * WebProcess/InjectedBundle/API/gtk/WebKitScriptWorld.h:
775         * WebProcess/InjectedBundle/API/wpe/WebKitScriptWorld.h:
776         * WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp:
777         (WebKit::InjectedBundleScriptWorld::find): Find an InjectedBundleScriptWorld by its name.
778         * WebProcess/InjectedBundle/InjectedBundleScriptWorld.h:
779         * WebProcess/WebPage/WebPage.cpp:
780         (WebKit::WebPage::runJavaScriptInMainFrameScriptWorld): Find the InjectedBundleScriptWorld for the given name
781         and run the script in its js context.
782         * WebProcess/WebPage/WebPage.h:
783         * WebProcess/WebPage/WebPage.messages.in: Add RunJavaScriptInMainFrameScriptWorld message.
784
785 2018-06-10  Chris Dumez  <cdumez@apple.com>
786
787         Reload the Web view in case of crash if the client does not implement webViewWebContentProcessDidTerminate delegate
788         https://bugs.webkit.org/show_bug.cgi?id=186468
789
790         Reviewed by Geoffrey Garen.
791
792         We now attempt to reload the Web view if the web content process crashes and the client
793         does not implement the webViewWebContentProcessDidTerminate delegate (or any of the similar
794         delegates in our SPI).
795
796         * UIProcess/API/APILoaderClient.h:
797         (API::LoaderClient::processDidCrash):
798         * UIProcess/API/APINavigationClient.h:
799         (API::NavigationClient::processDidTerminate):
800         * UIProcess/API/C/WKPage.cpp:
801         (WKPageSetPageLoaderClient):
802         (WKPageSetPageNavigationClient):
803         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
804         * UIProcess/API/glib/WebKitNavigationClient.cpp:
805         * UIProcess/Cocoa/NavigationState.h:
806         * UIProcess/Cocoa/NavigationState.mm:
807         (WebKit::NavigationState::NavigationClient::processDidTerminate):
808         * UIProcess/WebPageProxy.cpp:
809         (WebKit::m_resetRecentCrashCountTimer):
810         (WebKit::WebPageProxy::didFinishLoadForFrame):
811         (WebKit::shouldReloadAfterProcessTermination):
812         (WebKit::WebPageProxy::dispatchProcessDidTerminate):
813         (WebKit::WebPageProxy::tryReloadAfterProcessTermination):
814         (WebKit::WebPageProxy::resetRecentCrashCountSoon):
815         (WebKit::WebPageProxy::resetRecentCrashCount):
816         (WebKit::m_configurationPreferenceValues): Deleted.
817         * UIProcess/WebPageProxy.h:
818
819 2018-06-09  Dan Bernstein  <mitz@apple.com>
820
821         [Xcode] Clean up and modernize some build setting definitions
822         https://bugs.webkit.org/show_bug.cgi?id=186463
823
824         Reviewed by Sam Weinig.
825
826         * Configurations/Base.xcconfig: Removed definition for macOS 10.11.
827         * Configurations/BaseTarget.xcconfig: Simplified the definition of WK_PRIVATE_FRAMEWORKS_DIR
828           now that WK_XCODE_SUPPORTS_TEXT_BASED_STUBS is true for all supported Xcode versions.
829         * Configurations/DebugRelease.xcconfig: Removed definition for macOS 10.11.
830         * Configurations/FeatureDefines.xcconfig: Simplified the definitions of ENABLE_APPLE_PAY and
831           ENABLE_VIDEO_PRESENTATION_MODE now macOS 10.12 is the earliest supported version.
832         * Configurations/Version.xcconfig: Removed definition for macOS 10.11.
833         * Configurations/WebKitTargetConditionals.xcconfig: Removed definitions for macOS 10.11.
834
835 2018-06-09  Dan Bernstein  <mitz@apple.com>
836
837         Added missing file references to the Configuration group.
838
839         * WebKit.xcodeproj/project.pbxproj:
840
841 2018-06-08  Wenson Hsieh  <wenson_hsieh@apple.com>
842
843         [WebKit on watchOS] Upstream watchOS source additions to OpenSource (Part 1)
844         https://bugs.webkit.org/show_bug.cgi?id=186442
845         <rdar://problem/40879364>
846
847         Reviewed by Tim Horton.
848
849         * Configurations/FeatureDefines.xcconfig:
850         * UIProcess/ios/WKContentViewInteraction.mm:
851         (-[WKContentView dismissQuickboardViewControllerAndRevealFocusedFormOverlayIfNecessary:]):
852         (-[WKContentView quickboard:textEntered:]):
853         (-[WKContentView quickboardInputCancelled:]):
854         (-[WKContentView viewController:inputContextViewHeightForSize:]):
855         (-[WKContentView allowsLanguageSelectionMenuForListViewController:]):
856         (-[WKContentView inputContextViewForViewController:]):
857         (-[WKContentView inputLabelTextForViewController:]):
858         (-[WKContentView initialValueForViewController:]):
859         (-[WKContentView shouldDisplayInputContextViewForListViewController:]):
860         (-[WKContentView numericInputModeForListViewController:]):
861         (-[WKContentView textContentTypeForListViewController:]):
862         (-[WKContentView textSuggestionsForListViewController:]):
863         (-[WKContentView listViewController:didSelectTextSuggestion:]):
864         (-[WKContentView allowsDictationInputForListViewController:]):
865         * UIProcess/ios/WKScrollView.mm:
866         (-[WKScrollView initWithFrame:]):
867         (-[WKScrollView addGestureRecognizer:]):
868         (-[WKScrollView _configureDigitalCrownScrolling]):
869         (-[WKScrollView _puic_contentOffsetForCrownInputSequencerOffset:]):
870         * UIProcess/ios/forms/WKFocusedFormControlView.h:
871         * UIProcess/ios/forms/WKFocusedFormControlView.mm:
872         (pathWithRoundedRectInFrame):
873         (-[WKFocusedFormControlView initWithFrame:delegate:]):
874         (-[WKFocusedFormControlView handleWheelEvent:]):
875         (-[WKFocusedFormControlView show:]):
876         (-[WKFocusedFormControlView hide:]):
877         (-[WKFocusedFormControlView delegate]):
878         (-[WKFocusedFormControlView setDelegate:]):
879         (-[WKFocusedFormControlView dimmingMaskLayer]):
880         (-[WKFocusedFormControlView handleTap]):
881         (-[WKFocusedFormControlView _wheelChangedWithEvent:]):
882         (-[WKFocusedFormControlView didDismiss]):
883         (-[WKFocusedFormControlView didSubmit]):
884         (-[WKFocusedFormControlView layoutSubviews]):
885         (-[WKFocusedFormControlView setHighlightedFrame:]):
886         (-[WKFocusedFormControlView computeDimmingViewCutoutPath]):
887         (-[WKFocusedFormControlView disengageFocusedFormControlNavigation]):
888         (-[WKFocusedFormControlView engageFocusedFormControlNavigation]):
889         (-[WKFocusedFormControlView reloadData:]):
890         (-[WKFocusedFormControlView setMaskLayerPosition:animated:]):
891         (-[WKFocusedFormControlView setHighlightedFrame:animated:]):
892         (-[WKFocusedFormControlView submitActionName]):
893         (submitActionNameFontAttributes):
894         (-[WKFocusedFormControlView setSubmitActionName:]):
895         (-[WKFocusedFormControlView scrollViewForCrownInputSequencer]):
896         (-[WKFocusedFormControlView updateViewForCurrentCrownInputSequencerState]):
897         (-[WKFocusedFormControlView scrollOffsetForCrownInputOffset:]):
898         (-[WKFocusedFormControlView _crownInputSequencerTimerFired]):
899         (-[WKFocusedFormControlView cancelPendingCrownInputSequencerUpdate]):
900         (-[WKFocusedFormControlView scheduleCrownInputSequencerUpdate]):
901         (-[WKFocusedFormControlView crownInputSequencerOffsetDidChange:]):
902         (-[WKFocusedFormControlView crownInputSequencerDidBecomeIdle:willDecelerate:]):
903         (-[WKFocusedFormControlView crownInputSequencerIdleDidChange:]):
904         (-[WKFocusedFormControlView suggestions]):
905         (-[WKFocusedFormControlView setSuggestions:]):
906         (-[WKFocusedFormControlView handleWebViewCredentialsSaveForWebsiteURL:user:password:passwordIsAutoGenerated:]):
907         (-[WKFocusedFormControlView selectionWillChange:]):
908         (-[WKFocusedFormControlView selectionDidChange:]):
909         (-[WKFocusedFormControlView textWillChange:]):
910         (-[WKFocusedFormControlView textDidChange:]):
911
912 2018-06-08  Per Arne Vollan  <pvollan@apple.com>
913
914         Only display refresh monitors having requested display refresh callback should get notified on screen updates.
915         https://bugs.webkit.org/show_bug.cgi?id=186397
916         <rdar://problem/40897835>
917
918         Reviewed by Brent Fulgham.
919
920         Since all display refresh monitors in the WebContent process share a single UI process display link,
921         we should make sure that only the monitors having requested callback are getting notified on screen
922         updates. I have not been able to reproduce a case where a monitor is being notified without having
923         requested updates, but we should safeguard the code for future code changes.
924
925         * WebProcess/WebPage/mac/DrawingAreaMac.cpp:
926
927 2018-06-08  Aditya Keerthi  <akeerthi@apple.com>
928
929         [Datalist] Allow TextFieldInputType to show and hide suggestions
930         https://bugs.webkit.org/show_bug.cgi?id=186151
931
932         Reviewed by Tim Horton.
933
934         Added WebDataListSuggestionPicker to send messages to the UIProcess in order to update the suggestions view.
935         This object is also responsible for forwarding messages from WebKit into the DataListSuggestionsClient, which
936         is the TextFieldInputType in this case. The client needs to know when the suggestions are hidden or if an
937         suggestion has been selected.
938
939         * WebKit.xcodeproj/project.pbxproj:
940         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
941         (WebKit::WebChromeClient::createDataListSuggestionPicker): Responsible for creating WebDataListSuggestionPicker to send/receive messages.
942         * WebProcess/WebCoreSupport/WebChromeClient.h:
943         * WebProcess/WebCoreSupport/WebDataListSuggestionPicker.cpp: Added. Responsible for sending messages to UIProcess and updating the DataListSuggestionsClient.
944         (WebKit::WebDataListSuggestionPicker::WebDataListSuggestionPicker):
945         (WebKit::WebDataListSuggestionPicker::~WebDataListSuggestionPicker):
946         (WebKit::WebDataListSuggestionPicker::handleKeydownWithIdentifier):
947         (WebKit::WebDataListSuggestionPicker::didSelectOption):
948         (WebKit::WebDataListSuggestionPicker::didCloseSuggestions):
949         (WebKit::WebDataListSuggestionPicker::close):
950         (WebKit::WebDataListSuggestionPicker::displayWithActivationType):
951         * WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h: Added.
952         * WebProcess/WebPage/WebPage.cpp:
953         (WebKit::WebPage::setActiveDataListSuggestionPicker):
954         (WebKit::WebPage::didSelectDataListOption): Called by UIProcess when option selected.
955         (WebKit::WebPage::didCloseSuggestions): Called by UIProcess if the suggestions view is closed.
956         * WebProcess/WebPage/WebPage.h:
957         * WebProcess/WebPage/WebPage.messages.in:
958
959 2018-06-08  Basuke Suzuki  <Basuke.Suzuki@sony.com>
960
961         [Win] Fix initial value of HANDLE to INVALID_HANDLE_VALUE
962         https://bugs.webkit.org/show_bug.cgi?id=186405
963
964         The handle was not initialized at all. Initialized with INVALID_HANDLE_VALUE.
965
966         Reviewed by Per Arne Vollan.
967
968         * Platform/IPC/Attachment.h:
969         * Platform/IPC/win/AttachmentWin.cpp:
970         (IPC::Attachment::decode):
971
972 2018-06-08  Brian Burg  <bburg@apple.com>
973
974         [Cocoa] Web Automation: include browser name and version in listing for automation targets
975         https://bugs.webkit.org/show_bug.cgi?id=186204
976         <rdar://problem/36950423>
977
978         Reviewed by Darin Adler.
979
980         Add a new delegate method that allows the client to set the name and version
981         of the browser as returned in the 'browserName' and 'browserVersion' capabilities.
982         If the delegate methods are not implemented, try to get this information from
983         the main bundle.
984
985         In the RWI protocol, these fields are added to automation target listings.
986
987         * UIProcess/API/Cocoa/_WKAutomationDelegate.h:
988         * UIProcess/Cocoa/AutomationClient.h:
989         * UIProcess/Cocoa/AutomationClient.mm:
990         (WebKit::AutomationClient::AutomationClient):
991         (WebKit::AutomationClient::browserName const):
992         (WebKit::AutomationClient::browserVersion const):
993
994 2018-06-08  Per Arne Vollan  <pvollan@apple.com>
995
996         Run display links in the UI process when ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) is true.
997         https://bugs.webkit.org/show_bug.cgi?id=186379
998
999         Reviewed by Brent Fulgham.
1000
1001         Replace __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 with ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING).
1002
1003         * UIProcess/WebPageProxy.cpp:
1004         (WebKit::WebPageProxy::dispatchActivityStateChange):
1005         * UIProcess/WebPageProxy.h:
1006         * UIProcess/WebPageProxy.messages.in:
1007         * UIProcess/mac/DisplayLink.cpp:
1008         * UIProcess/mac/DisplayLink.h:
1009         * UIProcess/mac/WebPageProxyMac.mm:
1010         * WebProcess/WebPage/DrawingArea.cpp:
1011         * WebProcess/WebPage/mac/DrawingAreaMac.cpp:
1012
1013 2018-06-08  Per Arne Vollan  <pvollan@apple.com>
1014
1015         Send display link IPC message from display link thread.
1016         https://bugs.webkit.org/show_bug.cgi?id=186429
1017
1018         Reviewed by Geoffrey Garen.
1019
1020         When the display link callback is firing on the display link thread in the UI process,
1021         we schedule a function to be called on the main thread to send the IPC message to the
1022         WebContent process. Since Connection::send is thread-safe, we can just send the message
1023         from the display link thread, instead. This should be a small performance improvement.
1024
1025         * UIProcess/mac/DisplayLink.cpp:
1026         (WebKit::DisplayLink::DisplayLink):
1027         (WebKit::DisplayLink::displayLinkCallback):
1028         * UIProcess/mac/DisplayLink.h:
1029
1030 2018-06-07  Chris Dumez  <cdumez@apple.com>
1031
1032         Add base class to get WeakPtrFactory member and avoid some boilerplate code
1033         https://bugs.webkit.org/show_bug.cgi?id=186407
1034
1035         Reviewed by Brent Fulgham.
1036
1037         Add CanMakeWeakPtr base class to get WeakPtrFactory member and its getter, in
1038         order to avoid some boilerplate code in every class needing a WeakPtrFactory.
1039         This also gets rid of old-style createWeakPtr() methods in favor of the newer
1040         makeWeakPtr().
1041
1042         * NetworkProcess/NetworkLoadChecker.h:
1043         * NetworkProcess/NetworkProcess.cpp:
1044         (WebKit::NetworkProcess::canAuthenticateAgainstProtectionSpace):
1045         * NetworkProcess/PreconnectTask.h:
1046         * NetworkProcess/cache/CacheStorageEngine.h:
1047         * Shared/Authentication/AuthenticationManager.h:
1048         * UIProcess/API/APIAttachment.cpp:
1049         (API::Attachment::Attachment):
1050         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
1051         (WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard):
1052         (WebKit::WebPaymentCoordinatorProxy::openPaymentSetup):
1053         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
1054         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
1055         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
1056         * UIProcess/ApplicationStateTracker.h:
1057         * UIProcess/ApplicationStateTracker.mm:
1058         (WebKit::ApplicationStateTracker::ApplicationStateTracker):
1059         * UIProcess/Cocoa/ViewGestureController.cpp:
1060         (WebKit::ViewGestureController::setAlternateBackForwardListSourcePage):
1061         * UIProcess/Cocoa/WebViewImpl.h:
1062         * UIProcess/Cocoa/WebViewImpl.mm:
1063         (WebKit::WebViewImpl::updateWindowAndViewFrames):
1064         (WebKit::WebViewImpl::setTopContentInset):
1065         (WebKit::WebViewImpl::viewDidMoveToWindow):
1066         (WebKit::WebViewImpl::prepareForMoveToWindow):
1067         (WebKit::WebViewImpl::validateUserInterfaceItem):
1068         (WebKit::WebViewImpl::requestCandidatesForSelectionIfNeeded):
1069         (WebKit::WebViewImpl::interpretKeyEvent):
1070         (WebKit::WebViewImpl::firstRectForCharacterRange):
1071         (WebKit::WebViewImpl::performKeyEquivalent):
1072         (WebKit::WebViewImpl::keyUp):
1073         (WebKit::WebViewImpl::keyDown):
1074         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.cpp:
1075         (WebKit::WebCredentialsMessengerProxy::makeCredential):
1076         (WebKit::WebCredentialsMessengerProxy::getAssertion):
1077         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.h:
1078         * UIProcess/Downloads/DownloadProxy.cpp:
1079         (WebKit::DownloadProxy::setOriginatingPage):
1080         * UIProcess/Launcher/ProcessLauncher.h:
1081         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1082         (WebKit::ProcessLauncher::launchProcess):
1083         * UIProcess/ProcessAssertion.h:
1084         * UIProcess/WebPageProxy.h:
1085         * UIProcess/WebsiteData/WebsiteDataStore.h:
1086         * UIProcess/gtk/WaylandCompositor.cpp:
1087         (WebKit::WaylandCompositor::Surface::attachBuffer):
1088         * UIProcess/gtk/WaylandCompositor.h:
1089         * UIProcess/ios/ProcessAssertionIOS.mm:
1090         (WebKit::ProcessAssertion::ProcessAssertion):
1091         * UIProcess/mac/DisplayLink.cpp:
1092         (WebKit::DisplayLink::displayLinkCallback):
1093         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm:
1094         (WebKit::RemoteLayerTreeDisplayRefreshMonitor::RemoteLayerTreeDisplayRefreshMonitor):
1095         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
1096
1097 2018-06-07  Dan Bernstein  <mitz@apple.com>
1098
1099         Don’t install process-webcontent-entitlements.sh into the built XPC services.
1100
1101         * WebKit.xcodeproj/project.pbxproj:
1102
1103 2018-06-07  Andy Estes  <aestes@apple.com>
1104
1105         [iOS] Inform the client when PDFKit's extension process crashes
1106         https://bugs.webkit.org/show_bug.cgi?id=186418
1107         <rdar://problem/40175864>
1108
1109         Reviewed by Tim Horton.
1110
1111         * UIProcess/WebPageProxy.cpp:
1112         (WebKit::WebPageProxy::processDidTerminate):
1113         (WebKit::WebPageProxy::dispatchProcessDidTerminate):
1114
1115         Separated the dispatching of delegate methods from the rest of the web
1116         process-specific processDidTerminate logic.
1117
1118         * UIProcess/WebPageProxy.h:
1119         * UIProcess/ios/WKPDFView.mm:
1120         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
1121
1122         Minor style fix.
1123
1124         (-[WKPDFView pdfHostViewControllerExtensionProcessDidCrash:]):
1125
1126         Called WebPageProxy::dispatchProcessDidTerminate on the main thread.
1127
1128 2018-06-07  Andy Estes  <aestes@apple.com>
1129
1130         [iOS] Unable to present the share sheet after saving a PDF to Files.app
1131         https://bugs.webkit.org/show_bug.cgi?id=186413
1132         <rdar://problem/39937488>
1133
1134         Reviewed by Tim Horton.
1135
1136         WKApplicationStateTrackingView (WKPDFView's superclass) keeps track of whether
1137         it's in a window so that it can suspend and resume the web process accordingly.
1138         However, in WKPDFView's case, PDFKit's host view is in the window instead of
1139         WKPDFView itself when a PDF is being displayed (WKPDFView is only in a window as a
1140         placeholder while the PDF loads). Since WKApplicationStateTrackingView doesn't
1141         think its in a window, it suspends the web process, preventing messages necessary
1142         to displaying the share sheet from being delivered.
1143
1144         Fix this by teaching WKApplicationStateTrackingView to consider the in-windowness
1145         of the proper content view. For all cases other than WKPDFView, this is |self|.
1146         For WKPDFView, it is the PDFHostViewController's root view if it exists, otherwise
1147         it's |self|.
1148
1149         * UIProcess/ios/WKApplicationStateTrackingView.h:
1150         * UIProcess/ios/WKApplicationStateTrackingView.mm:
1151         (-[WKApplicationStateTrackingView willMoveToWindow:]):
1152         (-[WKApplicationStateTrackingView didMoveToWindow]):
1153         (-[WKApplicationStateTrackingView _contentView]):
1154         * UIProcess/ios/WKPDFView.mm:
1155         (-[WKPDFView _contentView]):
1156         (-[WKPDFView web_contentView]):
1157
1158 2018-06-07  Dean Jackson  <dino@apple.com>
1159
1160         Match HI spec for thumbnail view sizing and location
1161         https://bugs.webkit.org/show_bug.cgi?id=186412
1162         <rdar://problem/40226192>
1163
1164         Reviewed by Tim Horton.
1165
1166         Use the computed obscured inset to position the QuickLook
1167         view inside the WKSystemPreviewView.
1168
1169         * UIProcess/ios/WKSystemPreviewView.mm:
1170         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]):
1171         (-[WKSystemPreviewView _layoutThumbnailView]):
1172
1173 2018-06-07  Tadeu Zagallo  <tzagallo@apple.com>
1174
1175         Don't try to allocate JIT memory if we don't have the JIT entitlement
1176         https://bugs.webkit.org/show_bug.cgi?id=182605
1177         <rdar://problem/38271229>
1178
1179         Reviewed by Mark Lam.
1180
1181         Remove processHasEntitlement, which was moved into WTF and update all call sites.
1182
1183         * Shared/mac/SandboxUtilities.h:
1184         * Shared/mac/SandboxUtilities.mm:
1185         (WebKit::processHasEntitlement): Deleted.
1186         * UIProcess/API/Cocoa/WKWebView.mm:
1187         (-[WKWebView _initializeWithConfiguration:]):
1188         * UIProcess/ApplicationStateTracker.mm:
1189         (WebKit::applicationType):
1190         * UIProcess/ios/WKActionSheetAssistant.mm:
1191         (applicationHasAppLinkEntitlements):
1192
1193 2018-06-07  Tim Horton  <timothy_horton@apple.com>
1194
1195         REGRESSION (r232544): Pages are blank after homing out and then resuming on iPad
1196         https://bugs.webkit.org/show_bug.cgi?id=186408
1197         <rdar://problem/40907111>
1198
1199         Reviewed by Wenson Hsieh.
1200
1201         * UIProcess/API/Cocoa/WKWebView.mm:
1202         (-[WKWebView _resizeWhileHidingContentWithUpdates:]):
1203         Clients who use _resizeWhileHidingContentWithUpdates don't call
1204         _endAnimatedResize; the former API is a one-shot. We can't wait for
1205         _endAnimatedResize to complete the animation (and don't need to, since
1206         the content is hidden), but instead should just finish it when the
1207         commit with the resized tiles arrives.
1208
1209 2018-06-07  Jiewen Tan  <jiewen_tan@apple.com>
1210
1211         Use the same overloaded addInputString in WKContentViewInteraction
1212         https://bugs.webkit.org/show_bug.cgi?id=186376
1213         <rdar://problem/18498360>
1214
1215         Reviewed by Brent Fulgham.
1216
1217         Different overloaded variants of [UIKeyboardImpl -addInputString] behaves differently. We should use the same
1218         overloaded variant consistently: [UIKeyboardImpl -addInputString:withFlags:withInputManagerHint:].
1219
1220         Sadly, there is no test case for this change as:
1221         1) UIScriptController has troubles simulating '\r' keyboard event, and
1222         2) API test couldn't simulate proper UI keyboard events.
1223
1224         * UIProcess/ios/WKContentViewInteraction.mm:
1225         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
1226
1227 2018-06-07  Alex Christensen  <achristensen@webkit.org>
1228
1229         REGRESSION(r224134) Client certificate challenges don't always appear
1230         https://bugs.webkit.org/show_bug.cgi?id=186402
1231         <rdar://problem/35967150>
1232
1233         Reviewed by Brian Weinstein.
1234
1235         * NetworkProcess/NetworkLoad.cpp:
1236         (WebKit::NetworkLoad::completeAuthenticationChallenge):
1237         Add an exception for all TLS-handshake-related challenges, not just server trust.
1238
1239 2018-06-07  Ryosuke Niwa  <rniwa@webkit.org>
1240
1241         Release assert in Document::updateLayout() in WebPage::determinePrimarySnapshottedPlugIn()
1242         https://bugs.webkit.org/show_bug.cgi?id=186383
1243         <rdar://problem/40849498>
1244
1245         Reviewed by Jon Lee.
1246
1247         The release assert was hit because the descendent elemenet iterator, which instantiates ScriptDisallowedScope,
1248         was alive as determinePrimarySnapshottedPlugIn invoked Document::updateLayout. Avoid this by copying
1249         the list of plugin image elements into a vector first.
1250
1251         * WebProcess/WebPage/WebPage.cpp:
1252         (WebKit::WebPage::determinePrimarySnapshottedPlugIn): Fixed the release assert, and deployed Ref and RefPtr
1253         to make this code safe.
1254
1255 2018-06-07  Don Olmstead  <don.olmstead@sony.com>
1256
1257         [CoordGraphics] Fix compilation errors around USE(COORDINATED_GRAPHICS)
1258         https://bugs.webkit.org/show_bug.cgi?id=186374
1259
1260         Reviewed by Žan Doberšek.
1261
1262         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1263         (WebKit::ThreadedCompositor::sceneUpdateFinished):
1264
1265 2018-06-07  Brent Fulgham  <bfulgham@apple.com>
1266
1267         Remove unused debug mode conditions
1268         https://bugs.webkit.org/show_bug.cgi?id=186358
1269         <rdar://problem/39117121>
1270
1271         Reviewed by Zalan Bujtas.
1272
1273         Remove some unused code paths related to ResourceLoadStatistics debug mode.
1274
1275         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1276         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
1277         (WebKit::WebResourceLoadStatisticsStore::shouldPartitionCookies const):
1278
1279 2018-06-07  Dan Bernstein  <mitz@apple.com>
1280
1281         REGRESSION (r232520): Crash under IPC::ArgumentCoder<WebCore::Credential>::encodePlatformData
1282         https://bugs.webkit.org/show_bug.cgi?id=186385
1283         <rdar://problem/40853796>
1284
1285         Reviewed by Daniel Bates.
1286
1287         * Shared/mac/WebCoreArgumentCodersMac.mm:
1288         (IPC::ArgumentCoder<Credential>::encodePlatformData): Fixed an incorrect cast.
1289
1290 2018-06-06  Per Arne Vollan  <pvollan@apple.com>
1291
1292         Crash in lambda function WTF::Function<void ()>::CallableWrapper<WebKit::DisplayLink::displayLinkCallback
1293         https://bugs.webkit.org/show_bug.cgi?id=186370
1294         <rdar://problem/39791647>
1295
1296         Reviewed by Brent Fulgham.
1297
1298         When the display link is firing, the callback function is called on the display link thread, where a lambda function
1299         is created to be executed on the main thread. The WebPageProxy object is captured as a RefPtr in the lambda. This
1300         might crash when executing on the main thread, since the WebPageProxy object is possibly deleted then. Capturing
1301         the WebPageProxy will not prevent the object from being deleted if the destruction of the WebPageProxy object already
1302         has started on the main thread when the object is captured, which sometimes is the case. Instead, we can create a
1303         weak pointer to the object, which will work as intended, even if the WebPageProxy object is in the process of being
1304         deleted. This also matches the display link implementation used when the WebContent process has access to the
1305         WindowServer. This is not a frequent crash. I have not been able to reproduce it.
1306  
1307         * UIProcess/mac/DisplayLink.cpp:
1308         (WebKit::DisplayLink::displayLinkCallback):
1309
1310 2018-06-06  Antoine Quint  <graouts@apple.com>
1311
1312         Rename color-filter to -apple-color-filter and do not expose it to Web content
1313         https://bugs.webkit.org/show_bug.cgi?id=186306
1314         <rdar://problem/39874167>
1315
1316         Reviewed by Simon Fraser.
1317
1318         Change the ColorFilter setting to no longer be exposed as an experimental feature and ensure it's turned off by default.
1319         To allow internal clients to use the -apple-color-filter property, we expose a new _colorFilterEnabled property as SPI
1320         to WKWebViewConfigurationPrivate.
1321
1322         * Shared/WebPreferences.yaml:
1323         * UIProcess/API/C/WKPreferences.cpp:
1324         (WKPreferencesSetColorFilterEnabled):
1325         (WKPreferencesGetColorFilterEnabled):
1326         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1327         * UIProcess/API/Cocoa/WKWebView.mm:
1328         (-[WKWebView _initializeWithConfiguration:]):
1329         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1330         (-[WKWebViewConfiguration init]):
1331         (-[WKWebViewConfiguration copyWithZone:]):
1332         (-[WKWebViewConfiguration _setAttachmentElementEnabled:]):
1333         (-[WKWebViewConfiguration _colorFilterEnabled]):
1334         (-[WKWebViewConfiguration _setColorFilterEnabled:]):
1335         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1336
1337 2018-06-06  Jer Noble  <jer.noble@apple.com>
1338
1339         REGRESSION (r232301) - Unable to enter video fullscreen
1340         https://bugs.webkit.org/show_bug.cgi?id=186357
1341         <rdar://problem/40838449>
1342
1343         Reviewed by Jon Lee.
1344
1345         Only set up the standby fullscreen element if we are in element fullscreen.
1346
1347         * WebProcess/FullScreen/WebFullScreenManager.cpp:
1348         (WebKit::WebFullScreenManager::videoControlsManagerDidChange):
1349
1350 2018-06-06  Jeremy Jones  <jeremyj@apple.com>
1351
1352         attenuationFactor should be in range [0,1]
1353         https://bugs.webkit.org/show_bug.cgi?id=186320
1354         rdar://problem/40821456
1355
1356         Reviewed by Jer Noble.
1357
1358         If attenuationFactor is outside of this range it can cause false positives.
1359
1360         * UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.cpp:
1361         (WebKit::FullscreenTouchSecheuristic::attenuationFactor):
1362
1363 2018-06-06  Tim Horton  <timothy_horton@apple.com>
1364
1365         Move animated resize into the layer tree transaction, and make it asynchronous
1366         https://bugs.webkit.org/show_bug.cgi?id=186130
1367         <rdar://problem/38477288>
1368
1369         Reviewed by Simon Fraser.
1370
1371         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
1372         (WebKit::RemoteLayerTreeTransaction::setScrollPosition):
1373         (WebKit::RemoteLayerTreeTransaction::dynamicViewportSizeUpdateID const):
1374         (WebKit::RemoteLayerTreeTransaction::setDynamicViewportSizeUpdateID):
1375         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
1376         (WebKit::RemoteLayerTreeTransaction::encode const):
1377         (WebKit::RemoteLayerTreeTransaction::decode):
1378         * WebProcess/WebPage/WebPage.cpp:
1379         (WebKit::WebPage::willCommitLayerTree):
1380         Add scrollPosition to the transaction on all platforms, not just Mac.
1381         Add the optional dynamicViewportSizeUpdateID to the transaction, representing
1382         the most recent dynamicViewportSizeUpdate that commit contains, if any.
1383
1384         * Shared/ios/DynamicViewportSizeUpdate.h:
1385         Added a typedef for DynamicViewportSizeUpdateID, and move the mode enum here.
1386
1387         * UIProcess/ios/PageClientImplIOS.h:
1388         * UIProcess/ios/PageClientImplIOS.mm:
1389         (WebKit::PageClientImpl::dynamicViewportUpdateChangedTarget): Deleted.
1390         * UIProcess/PageClient.h:
1391         * UIProcess/WebPageProxy.cpp:
1392         (WebKit::WebPageProxy::resetState):
1393         * UIProcess/WebPageProxy.h:
1394         * UIProcess/WebPageProxy.messages.in:
1395         * UIProcess/ios/WebPageProxyIOS.mm:
1396         (WebKit::WebPageProxy::dynamicViewportSizeUpdate):
1397         (WebKit::WebPageProxy::didCommitLayerTree):
1398         (WebKit::WebPageProxy::synchronizeDynamicViewportUpdate): Deleted.
1399         (WebKit::WebPageProxy::dynamicViewportUpdateChangedTarget): Deleted.
1400         * WebProcess/WebPage/WebPage.h:
1401         * WebProcess/WebPage/WebPage.messages.in:
1402         * WebProcess/WebPage/ios/WebPageIOS.mm:
1403         (WebKit::WebPage::dynamicViewportSizeUpdate):
1404         (WebKit::WebPage::synchronizeDynamicViewportUpdate): Deleted.
1405         Remove dynamicViewportUpdateChangedTarget and synchronizeDynamicViewportUpdate.
1406         Move dynamicViewportSizeUpdateID maintenance into WKWebView.
1407
1408         * UIProcess/API/Cocoa/WKWebView.mm:
1409         (-[WKWebView _processDidExit]):
1410         Remove _resizeAnimationTransformTransactionID. We now instead pack
1411         the resize ID inside the transaction, instead of separately sending
1412         back a transaction ID to wait for.
1413
1414         (-[WKWebView _didCommitLayerTreeDuringAnimatedResize:]):
1415         (-[WKWebView _didCommitLayerTree:]):
1416         Added, factored out of _didCommitLayerTree:.
1417         If the transaction includes the result of the most recently-sent resize,
1418         store the requisite adjustments required to counter the new scale and
1419         scroll offset, update the resizeAnimationView, and, if endAnimatedResize
1420         has already been called, call _didCompleteAnimatedResize to tear down
1421         the animation view and put things back together.
1422
1423         Add some code so that if a commit arrives before the resize, we update
1424         the scale of the resize animation view to keep the width fitting.
1425
1426         (activeMaximumUnobscuredSize):
1427         (activeOrientation):
1428         Move these because the code that depends on them moved.
1429
1430         (-[WKWebView _didCompleteAnimatedResize]):
1431         Broken out of _endAnimatedResize. This can now be called from
1432         either endAnimatedResize or _didCommitLayerTreeDuringAnimatedResize,
1433         depending on which is called first.
1434
1435         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
1436         Don't create a new resize view if we still have one. Otherwise, we'll
1437         get the view ordering all wrong when making the second one. This
1438         didn't previously cause trouble, because we don't have a lot of
1439         WKScrollView subviews, but it totally could.
1440
1441         Adopt _initialContentOffsetForScrollView just to make this code more clear.
1442
1443         (-[WKWebView _endAnimatedResize]):
1444         (-[WKWebView _dynamicViewportUpdateChangedTargetToScale:position:nextValidLayerTreeTransactionID:]): Deleted.
1445         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1446
1447
1448 2018-06-05  Per Arne Vollan  <pvollan@apple.com>
1449
1450         Move OpenGL display mask to screen data struct.
1451         https://bugs.webkit.org/show_bug.cgi?id=186198
1452         <rdar://problem/40724854>
1453
1454         Reviewed by Brent Fulgham.
1455
1456         Currently, the OpenGL display mask is a global in the WebContent process. This is not correct in all cases, since
1457         it is possible to have two Web views in the same WebContent process, displayed on different displays. This can be
1458         resolved by moving the OpenGL display mask to a new ScreenData struct, containing information specific to each
1459         display. The display ID of the host window is used to find the OpenGL display mask when needed. This patch makes
1460         the host window available when creating an IOSurface, in order to find the right OpenGL display mask. If no host
1461         window is available, the OpenGL display mask of the main display is used.
1462
1463         * Shared/WebPageCreationParameters.cpp:
1464         (WebKit::WebPageCreationParameters::encode const):
1465         (WebKit::WebPageCreationParameters::decode):
1466         * Shared/WebPageCreationParameters.h:
1467         * Shared/WebProcessCreationParameters.cpp:
1468         (WebKit::WebProcessCreationParameters::encode const):
1469         (WebKit::WebProcessCreationParameters::decode):
1470         * Shared/WebProcessCreationParameters.h:
1471         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1472         (WebKit::WebProcessPool::platformInitializeWebProcess):
1473         * UIProcess/WebPageProxy.cpp:
1474         (WebKit::WebPageProxy::windowScreenDidChange):
1475         (WebKit::WebPageProxy::creationParameters):
1476         * UIProcess/WebProcessPool.cpp:
1477         (WebKit::WebProcessPool::screenPropertiesStateChanged):
1478         (WebKit::displayReconfigurationCallBack):
1479         * WebProcess/WebPage/WebPage.cpp:
1480         (WebKit::m_credentialsMessenger):
1481         * WebProcess/WebPage/WebPage.h:
1482         * WebProcess/WebPage/WebPage.messages.in:
1483         * WebProcess/WebPage/mac/WebPageMac.mm:
1484         (WebKit::WebPage::openGLDisplayMaskChanged): Deleted.
1485         * WebProcess/WebProcess.cpp:
1486         (WebKit::WebProcess::setScreenProperties):
1487         * WebProcess/WebProcess.h:
1488         * WebProcess/WebProcess.messages.in:
1489         * WebProcess/cocoa/WebProcessCocoa.mm:
1490         (WebKit::WebProcess::platformInitializeWebProcess):
1491
1492 2018-06-05  Keith Rollin  <krollin@apple.com>
1493
1494         Remove tracksResourceLoadMilestones support
1495         https://bugs.webkit.org/show_bug.cgi?id=186329
1496         <rdar://problem/40829898>
1497
1498         Reviewed by Darin Adler.
1499
1500         Remove the mechanism for enabling/disabling the tracking of
1501         resource-load milestones. This was initially added in order to enable
1502         the tracking only for Safari. However, the decision has been made to
1503         enable the tracking for all WebKit clients, so it's now enabled
1504         unconditionally.
1505
1506         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1507         (WebKit::NetworkConnectionToWebProcess::startTrackingResourceLoad):
1508         (WebKit::NetworkConnectionToWebProcess::stopTrackingResourceLoad):
1509         (WebKit::NetworkConnectionToWebProcess::stopAllNetworkActivityTracking):
1510         (WebKit::NetworkConnectionToWebProcess::stopAllNetworkActivityTrackingForPage):
1511         (WebKit::networkActivityTrackingEnabled): Deleted.
1512         * NetworkProcess/NetworkProcess.cpp:
1513         (WebKit::NetworkProcess::initializeNetworkProcess):
1514         * NetworkProcess/NetworkProcess.h:
1515         (WebKit::NetworkProcess::tracksResourceLoadMilestones const): Deleted.
1516         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1517         (WebKit::NetworkProcessCreationParameters::encode const):
1518         (WebKit::NetworkProcessCreationParameters::decode):
1519         * NetworkProcess/NetworkProcessCreationParameters.h:
1520         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1521         (API::ProcessPoolConfiguration::copy):
1522         * UIProcess/API/APIProcessPoolConfiguration.h:
1523         * UIProcess/API/C/WKContextConfigurationRef.cpp:
1524         (WKContextConfigurationTracksResourceLoadMilestones): Deleted.
1525         (WKContextConfigurationSetTracksResourceLoadMilestones): Deleted.
1526         * UIProcess/API/C/WKContextConfigurationRef.h:
1527         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1528         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1529         (-[_WKProcessPoolConfiguration tracksResourceLoadMilestones]): Deleted.
1530         (-[_WKProcessPoolConfiguration setTracksResourceLoadMilestones:]): Deleted.
1531         * UIProcess/WebProcessPool.cpp:
1532         (WebKit::WebProcessPool::ensureNetworkProcess):
1533
1534 2018-06-05  Darin Adler  <darin@apple.com>
1535
1536         [Cocoa] Retire DispatchPtr, and add more move semantics and simpler #ifs to other smart pointers
1537         https://bugs.webkit.org/show_bug.cgi?id=186324
1538
1539         Reviewed by Anders Carlsson.
1540
1541         * NetworkProcess/cache/NetworkCacheData.h: Use OSObjectPtr instead of
1542         DispatchPtr and also use an rvalue reference in the constructor.
1543         * NetworkProcess/cache/NetworkCacheDataCocoa.mm:
1544         (WebKit::NetworkCache::Data::Data): Use adoptOSObject, rvalue reference
1545         and WTFMove.
1546         (WebKit::NetworkCache::Data::empty): Use OSObjectPtr.
1547         (WebKit::NetworkCache::Data::data const): Use adoptOSObject.
1548         (WebKit::NetworkCache::Data::subrange const): Ditto.
1549         (WebKit::NetworkCache::concatenate): Ditto.
1550         (WebKit::NetworkCache::Data::adoptMap): Ditto. Also use WTFMove.
1551
1552         * NetworkProcess/cache/NetworkCacheIOChannel.h: Use OSObjectPtr.
1553         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
1554         (WebKit::NetworkCache::IOChannel::IOChannel): Use adoptOSObject.
1555         (WebKit::NetworkCache::IOChannel::read): Use OSObjectPtr.
1556
1557 2018-06-05  Brent Fulgham  <bfulgham@apple.com>
1558
1559         Adjust compile and runtime flags to match shippable state of features
1560         https://bugs.webkit.org/show_bug.cgi?id=186319
1561         <rdar://problem/40352045>
1562
1563         Reviewed by Maciej Stachowiak, Jon Lee, and others.
1564
1565         Change the default state of various experimental features so that they are off by default in production
1566         builds, since they are still under development.
1567
1568         Turn 'CacheAPIEnabled' and 'SubresourceIntegrityEnabled' on by default, since both features have been
1569         shipping for a full cycle and have proven to be stable in production.
1570
1571         * Configurations/FeatureDefines.xcconfig: Don't build ENABLE_INPUT_TYPE_COLOR
1572         or ENABLE_INPUT_TYPE_COLOR_POPOVER.
1573         * Shared/WebPreferences.yaml: 
1574 2018-06-05  Timothy Hatcher  <timothy@apple.com>
1575
1576         Clean up LocalDefaultSystemAppearance and prefers-dark-interface media query
1577
1578         https://bugs.webkit.org/show_bug.cgi?id=186323
1579         rdar://problem/38382252
1580
1581         Reviewed by Tim Horton.
1582
1583         * UIProcess/API/Cocoa/WKWebView.mm:
1584         (-[WKWebView _defaultAppearance]):
1585         * UIProcess/API/mac/WKView.mm:
1586         (-[WKView _defaultAppearance]):
1587         * UIProcess/Cocoa/WebViewImpl.h:
1588         * UIProcess/Cocoa/WebViewImpl.mm:
1589         (WebKit::WebViewImpl::useDefaultAppearance):
1590
1591 2018-06-05  Sihui Liu  <sihui_liu@apple.com>
1592
1593         [iOS] TestWebKitAPI.WebKit.WKHTTPCookieStoreWithoutProcessPool fails because cookies aren't flushed to file
1594         https://bugs.webkit.org/show_bug.cgi?id=186303
1595         <rdar://problem/40468716>
1596
1597         Reviewed by Geoffrey Garen.
1598
1599         No matter there is an observer or not, cookies in UI process should always be flushed to 
1600         file when new process pool is created, such that cookies created via API can be synced to
1601         network process.
1602
1603         * UIProcess/API/APIHTTPCookieStore.cpp:
1604         (API::HTTPCookieStore::HTTPCookieStore):
1605         (API::HTTPCookieStore::registerObserver):
1606         (API::HTTPCookieStore::cookieManagerDestroyed):
1607         (API::HTTPCookieStore::registerForNewProcessPoolNotifications):
1608
1609 2018-06-05  Jeremy Jones  <jeremyj@apple.com>
1610
1611         secheuristic should only use touch began and ended, not changed.
1612         https://bugs.webkit.org/show_bug.cgi?id=186318
1613         rdar://problem/39781486
1614
1615         Reviewed by Jer Noble.
1616
1617         Filter out change events so swiping gestures don't trigger the heuristic.
1618
1619         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1620         (-[WKFullScreenViewController _touchDetected:]):
1621
1622 2018-06-05  Darin Adler  <darin@apple.com>
1623
1624         [Cocoa] More preparation for ARC, focusing on WebKit and smart pointers
1625         https://bugs.webkit.org/show_bug.cgi?id=186314
1626
1627         Reviewed by Anders Carlsson.
1628
1629         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1630         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Use __bridge for cast.
1631         * NetworkProcess/mac/NetworkProcessMac.mm:
1632         (WebKit::overrideSystemProxies): Ditto.
1633         (WebKit::NetworkProcess::allowSpecificHTTPSCertificateForHost): Ditto.
1634         * Platform/IPC/mac/ConnectionMac.mm:
1635         (IPC::Connection::sendMessage): Ditto.
1636         (IPC::readFromMachPort): Ditto.
1637
1638         * Platform/mac/StringUtilities.mm:
1639         (WebKit::formattedPhoneNumberString): Use __bridge for cast and
1640         CFBridgingRelease instead of an explicit autorelease.
1641
1642         * Shared/API/Cocoa/_WKRemoteObjectInterface.mm:
1643         (initializeMethods): Use auto instead of an explicit type so that we get
1644         the correct type for the result of protocol_copyProtocolList.
1645
1646         * Shared/API/Cocoa/_WKRemoteObjectRegistry.mm:
1647         (-[_WKRemoteObjectRegistry _sendInvocation:interface:]): Added a
1648         bridging cast to void* because that's needed to call _Block_signature
1649         under ARC and harmless outside ARC.
1650
1651         * Shared/API/c/cf/WKStringCF.mm:
1652         (WKStringCreateWithCFString): Use __bridge for cast.
1653         * Shared/API/c/cf/WKURLCF.mm:
1654         (WKURLCreateWithCFURL): Ditto.
1655         * Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
1656         (WebKit::AuthenticationManager::initializeConnection): Ditto.
1657         * Shared/Cocoa/DataDetectionResult.mm:
1658         (WebKit::DataDetectionResult::encode const): Ditto.
1659         (WebKit::DataDetectionResult::decode): Ditto.
1660         * Shared/Cocoa/WKNSError.mm:
1661         (-[WKNSError _web_createTarget]): Ditto.
1662         * Shared/Cocoa/WKNSURLExtras.mm:
1663         (-[NSURL _web_originalDataAsWTFString]): Ditto.
1664
1665         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
1666         (WebKit::XPCServiceInitializer): Removed balanced calls to both
1667         adoptOSObject and xpc_retain and instead rely on the assignment
1668         operator just added to OSObjectPtr.
1669
1670         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
1671         (WebKit::XPCServiceEventHandler): Use __bridge for cast.
1672         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
1673         (WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer): Ditto.
1674         * Shared/cf/ArgumentCodersCF.cpp:
1675         (IPC::decode): Ditto.
1676         * Shared/mac/ArgumentCodersMac.mm:
1677         (IPC::isSerializableValue): Ditto.
1678         (IPC::encode): Ditto.
1679         * Shared/mac/WebCoreArgumentCodersMac.mm:
1680         (IPC::encodeNSError): Ditto. Also use CFSTR("")" instead of @""
1681         when we need a CFString.
1682         (IPC::decodeNSError): Ditto.
1683         (IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData): Ditto.
1684         (IPC::ArgumentCoder<ProtectionSpace>::decodePlatformData): Ditto.
1685         (IPC::ArgumentCoder<Credential>::encodePlatformData): Ditto.
1686         (IPC::ArgumentCoder<Credential>::decodePlatformData): Ditto.
1687         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::encode): Ditto.
1688         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::decode): Ditto.
1689         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData): Ditto.
1690         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::decodePlatformData): Ditto.
1691         * Shared/mac/WebHitTestResultData.mm:
1692         (WebKit::WebHitTestResultData::platformEncode const): Ditto.
1693         (WebKit::WebHitTestResultData::platformDecode): Ditto.
1694         * UIProcess/API/C/mac/WKContextPrivateMac.mm:
1695         (WKContextIsPlugInUpdateAvailable): Ditto.
1696         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
1697         (-[WKBrowsingContextController certificateChain]): Ditto.
1698         (didStartProvisionalLoadForFrame): Ditto.
1699         (didReceiveServerRedirectForProvisionalLoadForFrame): Ditto.
1700         (didFailProvisionalLoadWithErrorForFrame): Ditto.
1701         (didCommitLoadForFrame): Ditto.
1702         (didFinishLoadForFrame): Ditto.
1703         (didFailLoadWithErrorForFrame): Ditto.
1704         (canAuthenticateAgainstProtectionSpaceInFrame): Ditto.
1705         (didReceiveAuthenticationChallengeInFrame): Ditto.
1706         (didStartProgress): Ditto.
1707         (didChangeProgress): Ditto.
1708         (didFinishProgress): Ditto.
1709         (didChangeBackForwardList): Ditto.
1710         (processDidCrash): Ditto.
1711         (setUpPageLoaderClient): Ditto.
1712         (setUpPagePolicyClient): Ditto.
1713         * UIProcess/API/Cocoa/WKBrowsingContextGroup.mm:
1714         (createWKArray): Ditto.
1715         (-[WKBrowsingContextGroup addUserStyleSheet:baseURL:whitelistedURLPatterns:blacklistedURLPatterns:mainFrameOnly:]): Ditto.
1716         (-[WKBrowsingContextGroup addUserScript:baseURL:whitelistedURLPatterns:blacklistedURLPatterns:injectionTime:mainFrameOnly:]): Ditto.
1717         * UIProcess/API/Cocoa/WKConnection.mm:
1718         (didReceiveMessage): Ditto.
1719         (didClose): Ditto.
1720         (setUpClient): Ditto.
1721         * UIProcess/API/Cocoa/WKProcessGroup.mm:
1722         (didCreateConnection): Ditto.
1723         (getInjectedBundleInitializationUserData): Ditto.
1724         (setUpInjectedBundleClient): Ditto.
1725         (-[WKProcessGroup _setAllowsSpecificHTTPSCertificate:forHost:]): Ditto.
1726         * UIProcess/API/Cocoa/WKProcessPool.mm:
1727         (-[WKProcessPool _setAllowsSpecificHTTPSCertificate:forHost:]): Ditto.
1728         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1729         (-[WKWebsiteDataStore _setProxyConfiguration:]): Ditto.
1730         (-[WKWebsiteDataStore _proxyConfiguration]): Ditto.
1731         * UIProcess/API/Cocoa/_WKThumbnailView.mm:
1732         (-[_WKThumbnailView _didTakeSnapshot:]): Ditto.
1733
1734         * UIProcess/API/Cocoa/_WKUserContentFilter.mm: Added a missing include.
1735
1736         * UIProcess/Authentication/mac/WebCredentialMac.mm:
1737         (WebKit::chain): Use __bridge for cast.
1738
1739         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1740         (WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory):
1741         Use CFBridgingRelease instead of adoptNS.
1742         (WebKit::privateBrowsingSession): Use __bridge for cast.
1743
1744         * UIProcess/Cocoa/WebViewImpl.mm:
1745         (WebKit::WebViewImpl::provideDataForPasteboard): Use __bridge for cast.
1746         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
1747         (WebKit::PluginInfoStore::pluginPathsInDirectory): Ditto.
1748         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
1749         (WebKit::recursivelyMapIOSurfaceBackingStore): Ditto.
1750         * UIProcess/mac/ViewGestureControllerMac.mm:
1751         (WebKit::ViewGestureController::beginSwipeGesture): Ditto.
1752         * UIProcess/mac/WKFullScreenWindowController.mm:
1753         (-[WKFullScreenWindowController enterFullScreen:]): Ditto.
1754         * UIProcess/mac/WebPopupMenuProxyMac.mm:
1755         (WebKit::WebPopupMenuProxyMac::showPopupMenu): Ditto.
1756         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm:
1757         (didCreatePage): Ditto.
1758         (willDestroyPage): Ditto.
1759         (setUpBundleClient): Ditto.
1760         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1761         (didStartProvisionalLoadForFrame): Ditto.
1762         (didReceiveServerRedirectForProvisionalLoadForFrame): Ditto.
1763         (didFinishLoadForFrame): Ditto.
1764         (globalObjectIsAvailableForFrame): Ditto.
1765         (didRemoveFrameFromHierarchy): Ditto.
1766         (didCommitLoadForFrame): Ditto.
1767         (didFinishDocumentLoadForFrame): Ditto.
1768         (didFailProvisionalLoadWithErrorForFrame): Ditto.
1769         (didFailLoadWithErrorForFrame): Ditto.
1770         (didSameDocumentNavigationForFrame): Ditto.
1771         (didLayoutForFrame): Ditto.
1772         (didReachLayoutMilestone): Ditto.
1773         (didFirstVisuallyNonEmptyLayoutForFrame): Ditto.
1774         (didHandleOnloadEventsForFrame): Ditto.
1775         (userAgentForURL): Ditto.
1776         (setUpPageLoaderClient): Ditto.
1777         (willSendRequestForFrame): Ditto.
1778         (didInitiateLoadForResource): Ditto.
1779         (didFinishLoadForResource): Ditto.
1780         (didFailLoadForResource): Ditto.
1781         (setUpResourceLoadClient): Ditto.
1782         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
1783         (WebKit::InjectedBundle::initialize): Ditto.
1784         * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
1785         (WebKit::NetscapePlugin::popUpContextMenu): Ditto.
1786
1787         * WebProcess/Plugins/PDF/PDFPlugin.h: Put functions that return NSData inside
1788         an #ifdef __OBJC__ and use __bridge for cast.
1789
1790         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
1791         (WebKit::WebDragClient::declareAndWriteDragImage): Use __bridge for cast.
1792
1793         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
1794         (WebKit::PlatformCALayerRemoteCustom::contents const): Added a bridging cast.
1795         (WebKit::PlatformCALayerRemoteCustom::setContents): Use __bridge for cast.
1796         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1797         (WebKit::TiledCoreAnimationDrawingArea::commitTransientZoom): Ditto.
1798         * WebProcess/WebPage/mac/WebPageMac.mm:
1799         (WebKit::WebPage::setTopOverhangImage): Ditto.
1800         (WebKit::WebPage::setBottomOverhangImage): Ditto.
1801
1802 2018-06-05  Youenn Fablet  <youenn@apple.com>
1803
1804         ServiceWorker registration should store any script fetched through importScripts
1805         https://bugs.webkit.org/show_bug.cgi?id=182444
1806         <rdar://problem/37164835>
1807
1808         Reviewed by Chris Dumez.
1809
1810         Add C API to kill storage process.
1811         In case a Storage Process is closed or crashed, ensure that all its related service worker processes also exit.
1812
1813         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
1814         * UIProcess/API/C/WKContext.cpp:
1815         (WKContextTerminateStorageProcess):
1816         * UIProcess/API/C/WKContextPrivate.h:
1817         * WebProcess/WebProcess.cpp:
1818         (WebKit::WebProcess::webToStorageProcessConnectionClosed):
1819         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1820         (WebKit::WebSWContextManagerConnection::setScriptResource):
1821         * WebProcess/Storage/WebSWContextManagerConnection.h:
1822
1823 2018-06-05  Brent Fulgham  <bfulgham@apple.com>
1824
1825         Revise DEFAULT_EXPERIMENTAL_FEATURES_ENABLED to work properly on Apple builds
1826         https://bugs.webkit.org/show_bug.cgi?id=186286
1827         <rdar://problem/40782992>
1828
1829         Reviewed by Dan Bernstein.
1830
1831         Use the WK_RELOCATABLE_FRAMEWORKS flag (which is always defined for non-production builds)
1832         to define ENABLE(EXPERIMENTAL_FEATURES) so that we do not need to manually
1833         change this flag when preparing for a production release.
1834
1835         * Configurations/FeatureDefines.xcconfig: Use WK_RELOCATABLE_FRAMEWORKS to determine whether
1836         experimental features should be enabled, and use it to properly define the feature flag.
1837         * Shared/WebPreferencesDefaultValues.h:
1838
1839 2018-06-04  Chris Dumez  <cdumez@apple.com>
1840
1841         Rename "Cross-Origin-Options" HTTP header to "Cross-Origin-Window-Policy"
1842         https://bugs.webkit.org/show_bug.cgi?id=186287
1843         <rdar://problem/40783352>
1844
1845         Reviewed by Youenn Fablet.
1846
1847         * Shared/WebPreferences.yaml:
1848         * WebProcess/WebPage/WebPage.cpp:
1849         (WebKit::WebPage::frameBecameRemote):
1850
1851 2018-06-04  Dan Bernstein  <mitz@apple.com>
1852
1853         Restored code signing behavior when WK_USE_RESTRICTED_ENTITLEMENTS isn’t set.
1854
1855         * Configurations/DebugRelease.xcconfig: Use ad-hoc code signing when
1856           WK_USE_RESTRICTED_ENTITLEMENTS isn’t set.
1857
1858 2018-06-04  Dan Bernstein  <mitz@apple.com>
1859
1860         Removed a reference to a file that was deleted in r231190.
1861
1862         * WebKit.xcodeproj/project.pbxproj: Removed the reference to WebProcessShim.xcconfig.
1863
1864 2018-06-04  Chris Dumez  <cdumez@apple.com>
1865
1866         Update Fetch code to provide more useful exception messages
1867         https://bugs.webkit.org/show_bug.cgi?id=186156
1868
1869         Reviewed by Youenn Fablet.
1870
1871         Provide more useful error messages in our Loading / Fetch code.
1872
1873         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1874         (WebKit::WebSWServerConnection::didFailFetch):
1875         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1876         * StorageProcess/StorageProcess.cpp:
1877         (WebKit::StorageProcess::didFailFetch):
1878         * StorageProcess/StorageProcess.h:
1879         * StorageProcess/StorageProcess.messages.in:
1880         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
1881         (WebKit::ServiceWorkerClientFetch::didFail):
1882         (WebKit::ServiceWorkerClientFetch::continueLoadingAfterCheckingResponse):
1883         * WebProcess/Storage/ServiceWorkerClientFetch.h:
1884         * WebProcess/Storage/ServiceWorkerClientFetch.messages.in:
1885         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
1886         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveFormDataAndFinish):
1887         (WebKit::WebServiceWorkerFetchTaskClient::didFail):
1888         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
1889
1890 2018-06-04  Wenson Hsieh  <wenson_hsieh@apple.com>
1891
1892         [WebKit on watchOS] Remove all uses of the EXTRA_ZOOM_MODE compiler flag
1893         https://bugs.webkit.org/show_bug.cgi?id=186279
1894
1895         Reviewed by Tim Horton.
1896
1897         Replaces uses of ENABLE(EXTRA_ZOOM_MODE) with PLATFORM(WATCHOS).
1898
1899         * Shared/WebPreferencesDefaultValues.h:
1900         * UIProcess/API/Cocoa/WKWebView.mm:
1901         (-[WKWebView _initializeWithConfiguration:]):
1902         (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
1903         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1904         (-[WKWebViewConfiguration init]):
1905         * UIProcess/WebProcessProxy.cpp:
1906         * UIProcess/WebProcessProxy.h:
1907         * UIProcess/ios/WKContentViewInteraction.h:
1908         * UIProcess/ios/WKContentViewInteraction.mm:
1909         (-[WKContentView _willStartScrollingOrZooming]):
1910         (-[WKContentView _didEndScrollingOrZooming]):
1911         (-[WKContentView _startAssistingKeyboard]):
1912         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1913         (-[WKContentView _stopAssistingNode]):
1914         (-[WKContentView reloadContextViewForPresentedListViewController]):
1915         (-[WKContentView _wheelChangedWithEvent:]):
1916         (-[WKContentView _simulateTextEntered:]):
1917         (-[WKContentView selectFormAccessoryPickerRow:]):
1918         (-[WKContentView formInputLabel]):
1919         (-[WKContentView setTimePickerValueToHour:minute:]):
1920         * UIProcess/ios/WKScrollView.mm:
1921         (-[WKScrollView initWithFrame:]):
1922         (-[WKScrollView addGestureRecognizer:]):
1923         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1924         (-[WKFileUploadPanel platformSupportsPickerViewController]):
1925         * WebProcess/WebPage/ios/WebPageIOS.mm:
1926         (WebKit::WebPage::platformPrefersTextLegibilityBasedZoomScaling const):
1927
1928 2018-06-04  Jeremy Jones  <jeremyj@apple.com>
1929
1930         Disable keyboard in fullscreen ios.
1931         https://bugs.webkit.org/show_bug.cgi?id=186058
1932
1933         Reviewed by Jer Noble.
1934
1935         Disallow keyboard in ios fullscreen. This will still allow select keys useful for playback.
1936
1937         * UIProcess/WebFullScreenManagerProxy.cpp:
1938         (WebKit::WebFullScreenManagerProxy::supportsFullScreen):
1939
1940 2018-06-04  Youenn Fablet  <youenn@apple.com>
1941
1942         NetworkCORSPreflightChecker should set the preflight request User-Agent header
1943         https://bugs.webkit.org/show_bug.cgi?id=186254
1944         <rdar://problem/40293504>
1945
1946         Reviewed by Chris Dumez.
1947
1948         Some servers misbehave if the User-Agent header is not set properly on preflight requests.
1949         Set it to the same value as the request triggering the preflight.
1950
1951         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
1952         (WebKit::NetworkCORSPreflightChecker::startPreflight):
1953         * NetworkProcess/NetworkCORSPreflightChecker.h:
1954         * NetworkProcess/NetworkLoadChecker.cpp:
1955         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
1956
1957 2018-06-03  Andy Estes  <aestes@apple.com>
1958
1959         [Wi-Fi Assertions] Resume assertions when NetworkProcess::cancelPrepareToSuspend is called
1960         https://bugs.webkit.org/show_bug.cgi?id=186247
1961
1962         Reviewed by Tim Horton.
1963
1964         Since we suspended assertions in prepareToSuspend, we need to resume them if
1965         cancelPrepareToSuspend is called.
1966
1967         * NetworkProcess/NetworkProcess.cpp:
1968         (WebKit::NetworkProcess::cancelPrepareToSuspend):
1969
1970 2018-06-03  Andy Estes  <aestes@apple.com>
1971
1972         [iOS] Add a needed networking process entitlement
1973         https://bugs.webkit.org/show_bug.cgi?id=186246
1974         <rdar://problem/39578861>
1975
1976         Reviewed by Brent Fulgham.
1977
1978         Also sorted the existing entitlements.
1979
1980         * Configurations/Network-iOS.entitlements:
1981
1982 2018-06-03  Brent Fulgham  <bfulgham@apple.com>
1983
1984         Make sure that the fencePort received over IPC has the expected disposition (SEND)
1985         https://bugs.webkit.org/show_bug.cgi?id=186211
1986         <rdar://problem/37814171>
1987
1988         Reviewed by Geoffrey Garen.
1989
1990         It is possible (though very unlikely) for a message to be recevied that has the wrong mach port disposition.
1991         If this happens, we shouldn't manipulate the passed mach_port_t or pass it on to other API. We already
1992         drop messages that violate this expectation in the IPC layer, but code handling IPC::Attachment data types
1993         are not checking this value.
1994
1995         * WebProcess/WebPage/WebPage.cpp:
1996         (WebKit::WebPage::setTopContentInsetFenced):
1997         * WebProcess/cocoa/VideoFullscreenManager.mm:
1998         (WebKit::VideoFullscreenManager::setVideoLayerFrameFenced):
1999
2000 2018-06-02  Chris Dumez  <cdumez@apple.com>
2001
2002         Unreviewed, rolling out r232275.
2003
2004         May have caused a ~1% PLT regression on iOS
2005
2006         Reverted changeset:
2007
2008         "Store 0-lifetime stylesheets / scripts into the disk cache
2009         for faster history navigations"
2010         https://bugs.webkit.org/show_bug.cgi?id=186060
2011         https://trac.webkit.org/changeset/232275
2012
2013 2018-06-02  Jeremy Jones  <jeremyj@apple.com>
2014
2015         Make WKWebView firstResponder after entering or exiting fullscreen.
2016         https://bugs.webkit.org/show_bug.cgi?id=186088
2017         rdar://problem/40387859
2018
2019         Reviewed by Jer Noble.
2020
2021         Update first responder when WKWebView moves to a new window, otherwise there won't be a first responder.
2022
2023         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
2024         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
2025         (-[WKFullScreenWindowController _completedExitFullScreen]):
2026
2027 2018-06-02  Jeremy Jones  <jeremyj@apple.com>
2028
2029         Exit fullscreen when javascript alerts are presented.
2030         https://bugs.webkit.org/show_bug.cgi?id=185619
2031         rdar://problem/35724264
2032
2033         Reviewed by Jer Noble.
2034
2035         Prevent users from being trapped in fullscreen by alert cycles.
2036         Prevent fullscreen from becoming unresponsive due to alerts hidden behind fullscreen.
2037
2038         Fullscreen exit is initiated here in the UI process so that fullscreen UI is torn down immediately,
2039         before the alert is shown.
2040
2041         * UIProcess/WebPageProxy.cpp:
2042         (WebKit::WebPageProxy::exitFullscreenImmediately):
2043         (WebKit::WebPageProxy::runJavaScriptAlert):
2044         (WebKit::WebPageProxy::runJavaScriptConfirm):
2045         (WebKit::WebPageProxy::runJavaScriptPrompt):
2046         * UIProcess/WebPageProxy.h:
2047
2048 2018-06-02  Youenn Fablet  <youenn@apple.com>
2049
2050         Add a sandbox profile for com.cisco.webex.plugin.gpc64 plugin
2051         https://bugs.webkit.org/show_bug.cgi?id=186110
2052
2053         Reviewed by Brent Fulgham.
2054
2055         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in: Webex needs to create some symlinks.
2056         * Resources/PlugInSandboxProfiles/com.cisco.webex.plugin.gpc64.sb: Added.
2057         * WebKit.xcodeproj/project.pbxproj:
2058
2059 2018-06-01  Wenson Hsieh  <wenson_hsieh@apple.com>
2060
2061         [Extra zoom mode] The user should always be able to double tap to zoom to a scale of at least 1
2062         https://bugs.webkit.org/show_bug.cgi?id=186209
2063         <rdar://problem/40529255>
2064
2065         Reviewed by Tim Horton.
2066
2067         Tweaks the way double-tap-to-zoom scales are determined in extra zoom mode. Rather than zooming to make the 50th
2068         and 90th percentiles of text in the document legible, only consider the 90th percentile of text size when
2069         determining zoom scale, and fix the other potential zoom scale at 1; additionally, if the zoom scales are close
2070         (within 0.3 of each other), snap the lower zoom scale to the higher value.
2071
2072         This results in the following changes in behavior:
2073         -   Enables double tap to zoom in cases where all the text in the page is already legible.
2074         -   On pages with mobile viewports, usually allows the user to toggle between initial scale and a scale of 1.
2075         -   If a significant portion of text is unusually small, the zoomed-in scale may exceed 1.
2076
2077         Test: fast/events/extrazoom/double-tap-to-zoom-with-large-text.html
2078
2079         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
2080         (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
2081         (WebKit::ViewGestureGeometryCollector::computeTextLegibilityScales):
2082
2083 2018-06-01  Jeremy Jones  <jeremyj@apple.com>
2084
2085         Keyboard focus should exit fullscreen.
2086         https://bugs.webkit.org/show_bug.cgi?id=185617
2087         rdar://problem/34697938
2088
2089         Reviewed by Ryosuke Niwa.
2090
2091         While in element fullscreen, initiating keyboard focus should exit fullscreen in iOS.
2092
2093         * WebProcess/WebPage/WebPage.cpp:
2094         (WebKit::WebPage::elementDidFocus):
2095
2096 2018-06-01  Chris Dumez  <cdumez@apple.com>
2097
2098         Regression(r230567): Unable to log into twitter.com in private sessions
2099         https://bugs.webkit.org/show_bug.cgi?id=186205
2100         <rdar://problem/40670799>
2101
2102         Reviewed by Youenn Fablet.
2103
2104         We were using the same SWServer for all private sessions and the SWServer's sessionID would
2105         be legacyPrivateSessionID(). As a result, the service worker's sessionID would be legacyPrivateSessionID()
2106         as well and would not match the sessionID of its client pages. This sessionID mismatch was 
2107         causing the breakage.
2108
2109         Instead of using the same SWServer of all private sessions, we now go back to using a SWServer
2110         per private session. However, we now make sure that the SWServer gets destroyed whenever its
2111         corresponding session gets destroyed.
2112
2113         * NetworkProcess/NetworkProcess.cpp:
2114         (WebKit::NetworkProcess::destroySession):
2115         * NetworkProcess/cache/CacheStorageEngine.cpp:
2116         (WebKit::CacheStorage::Engine::from):
2117         * StorageProcess/StorageProcess.cpp:
2118         (WebKit::StorageProcess::destroySession):
2119         (WebKit::StorageProcess::swServerForSession):
2120         * StorageProcess/StorageProcess.h:
2121         * StorageProcess/StorageProcess.messages.in:
2122         * UIProcess/WebProcessPool.cpp:
2123         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
2124         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2125         (WebKit::WebsiteDataStore::~WebsiteDataStore):
2126
2127         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
2128         * UIProcess/WebsiteData/WebsiteDataStore.h:
2129         (WebKit::WebsiteDataStore::weakPtrFactory const):
2130         Fix memory leak caused by a reference cycle between the WebsiteDataStore and its
2131         WebResourceLoadStatisticsStore, by using WeakPtr to break the cycle. This was causing
2132         us to leak WebsiteDataStore objects, which would prevent the destruction of sessions.
2133
2134
2135 2018-06-01  Youenn Fablet  <youenn@apple.com>
2136
2137         Add an option to restrict communication to localhost sockets
2138         https://bugs.webkit.org/show_bug.cgi?id=186208
2139
2140         Reviewed by Eric Carlson.
2141
2142         Implement restriction to localhost sockets by setting any IP address to 127.0.0.1.
2143         This is done on WebProcess side just before requesting to open the socket by NetworkProcess.
2144
2145         * WebProcess/Network/webrtc/LibWebRTCNetwork.h:
2146         (WebKit::LibWebRTCNetwork::disableNonLocalhostConnections):
2147         * WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
2148         (WebKit::LibWebRTCProvider::disableNonLocalhostConnections):
2149         (WebKit::LibWebRTCProvider::registerMDNSName):
2150         * WebProcess/Network/webrtc/LibWebRTCProvider.h:
2151         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp:
2152         (WebKit::prepareSocketAddress):
2153         (WebKit::LibWebRTCSocketFactory::CreateServerTcpSocket):
2154         (WebKit::LibWebRTCSocketFactory::CreateUdpSocket):
2155         (WebKit::LibWebRTCSocketFactory::CreateClientTcpSocket):
2156         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.h:
2157
2158 2018-06-01  Chris Dumez  <cdumez@apple.com>
2159
2160         Regression(r230876): Swipe navigation snapshot may get removed too early
2161         https://bugs.webkit.org/show_bug.cgi?id=186168
2162         <rdar://problem/39743617>
2163
2164         Reviewed by Tim Horton.
2165
2166         The swipe navigation snapshot would get removed too early when receiving a paint
2167         event after requesting a history navigation but before the provisional load has
2168         actually started. This is because of the asynchronous navigation policy decision
2169         which occurs after requesting to navigate. To address the issue, we now start
2170         listening for events only after the provisional load has started.
2171
2172         * UIProcess/API/Cocoa/WKWebView.mm:
2173         (-[WKWebView _didStartProvisionalLoadForMainFrame]):
2174         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2175         * UIProcess/Cocoa/ViewGestureController.cpp:
2176         (WebKit::ViewGestureController::didStartProvisionalLoadForMainFrame):
2177         (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState):
2178         (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame):
2179         * UIProcess/Cocoa/ViewGestureController.h:
2180         * UIProcess/ios/PageClientImplIOS.mm:
2181         (WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame):
2182         * UIProcess/ios/ViewGestureControllerIOS.mm:
2183         (WebKit::ViewGestureController::endSwipeGesture):
2184         * UIProcess/mac/PageClientImplMac.h:
2185         * UIProcess/mac/PageClientImplMac.mm:
2186         (WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame):
2187         * UIProcess/mac/ViewGestureControllerMac.mm:
2188         (WebKit::ViewGestureController::endSwipeGesture):
2189
2190 2018-06-01  Jiewen Tan  <jiewen_tan@apple.com>
2191
2192         Unreviewed, build fix for r232276.
2193
2194         iOS sandbox profiles don't preprocess macros. Therefore, remove the whole
2195         macro condition block.
2196
2197         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2198
2199 2018-06-01  Sihui Liu  <sihui_liu@apple.com>
2200
2201         Stop using StorageTracker.db in LocalStorageDatabaseTracker
2202         https://bugs.webkit.org/show_bug.cgi?id=186104
2203
2204         Reviewed by Geoffrey Garen.
2205
2206         Stop using StorageTracker.db and stop caching origins in LocalStorageDatabaseTracker for efficiency 
2207         and simplicity. Since functions in LocalStorageDatabaseTracker are not frequently called, we get 
2208         little benefits from caching origins.
2209
2210         * Platform/Logging.h:
2211         * UIProcess/API/C/WKKeyValueStorageManager.cpp:
2212         (WKKeyValueStorageManagerGetStorageDetailsByOrigin):
2213         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
2214         (WebKit::LocalStorageDatabaseTracker::LocalStorageDatabaseTracker):
2215         (WebKit::LocalStorageDatabaseTracker::didOpenDatabaseWithOrigin):
2216         (WebKit::LocalStorageDatabaseTracker::deleteDatabaseWithOrigin):
2217         (WebKit::LocalStorageDatabaseTracker::deleteAllDatabases):
2218         (WebKit::LocalStorageDatabaseTracker::databasesModifiedSince):
2219         (WebKit::LocalStorageDatabaseTracker::origins const):
2220         (WebKit::LocalStorageDatabaseTracker::originDetails):
2221         (WebKit::LocalStorageDatabaseTracker::databasePath const):
2222         (WebKit::fileCreationTime): Deleted.
2223         (WebKit::fileModificationTime): Deleted.
2224         (WebKit::LocalStorageDatabaseTracker::trackerDatabasePath const): Deleted.
2225         (WebKit::LocalStorageDatabaseTracker::openTrackerDatabase): Deleted.
2226         (WebKit::LocalStorageDatabaseTracker::importOriginIdentifiers): Deleted.
2227         (WebKit::LocalStorageDatabaseTracker::updateTrackerDatabaseFromLocalStorageDatabaseFiles): Deleted.
2228         (WebKit::LocalStorageDatabaseTracker::addDatabaseWithOriginIdentifier): Deleted.
2229         (WebKit::LocalStorageDatabaseTracker::removeDatabaseWithOriginIdentifier): Deleted.
2230         (WebKit::LocalStorageDatabaseTracker::pathForDatabaseWithOriginIdentifier): Deleted.
2231         * UIProcess/WebStorage/LocalStorageDatabaseTracker.h:
2232         * UIProcess/WebStorage/StorageManager.h:
2233
2234 2018-06-01  Michael Catanzaro  <mcatanzaro@igalia.com>
2235
2236         [GTK] Crash in WebKitFaviconDatabase when pageURL is unset
2237         https://bugs.webkit.org/show_bug.cgi?id=186164
2238
2239         Reviewed by Carlos Garcia Campos.
2240
2241         PageURL can legitimately be null here if JavaScript does something silly with window.open.
2242
2243         * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
2244         (webkitFaviconDatabaseSetIconURLForPageURL):
2245         (webkitFaviconDatabaseSetIconForPageURL):
2246
2247 2018-05-31  Brian Burg  <bburg@apple.com>
2248
2249         [Cocoa] Web Automation: use the session delegate to perform window maximize
2250         https://bugs.webkit.org/show_bug.cgi?id=186167
2251         <rdar://problem/40544391>
2252
2253         Reviewed by Timothy Hatcher.
2254
2255         Add plumbing to hand off window maximizing to the session delegate.
2256
2257         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
2258         * UIProcess/Cocoa/AutomationSessionClient.h:
2259         * UIProcess/Cocoa/AutomationSessionClient.mm:
2260         (WebKit::AutomationSessionClient::AutomationSessionClient):
2261         (WebKit::AutomationSessionClient::requestMaximizeWindowOfPage):
2262
2263 2018-06-01  Carlos Garcia Campos  <cgarcia@igalia.com>
2264
2265         Unreviewed. Try to fix GTK+ build with old versions of GTK+ after r232390.
2266
2267         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
2268         (WebKit::WebPopupMenuProxyGtk::showPopupMenu):
2269
2270 2018-06-01  Carlos Garcia Campos  <cgarcia@igalia.com>
2271
2272         [GTK] Switch to use a popup window with a tree view instead of a menu for option menu default implementation
2273         https://bugs.webkit.org/show_bug.cgi?id=186146
2274
2275         Reviewed by Michael Catanzaro.
2276
2277         It's more convenient to use than the menu.
2278
2279         * UIProcess/API/gtk/WebKitPopupMenu.cpp:
2280         (WebKit::menuCloseCallback):
2281         (WebKit::WebKitPopupMenu::activateItem):
2282         * UIProcess/API/gtk/WebKitPopupMenu.h:
2283         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
2284         (WebKit::WebPopupMenuProxyGtk::WebPopupMenuProxyGtk):
2285         (WebKit::WebPopupMenuProxyGtk::selectItem):
2286         (WebKit::WebPopupMenuProxyGtk::activateItem):
2287         (WebKit::WebPopupMenuProxyGtk::activateItemAtPath):
2288         (WebKit::WebPopupMenuProxyGtk::treeViewRowActivatedCallback):
2289         (WebKit::WebPopupMenuProxyGtk::treeViewButtonReleaseEventCallback):
2290         (WebKit::WebPopupMenuProxyGtk::buttonPressEventCallback):
2291         (WebKit::WebPopupMenuProxyGtk::keyPressEventCallback):
2292         (WebKit::WebPopupMenuProxyGtk::createPopupMenu):
2293         (WebKit::WebPopupMenuProxyGtk::show):
2294         (WebKit::WebPopupMenuProxyGtk::showPopupMenu):
2295         (WebKit::WebPopupMenuProxyGtk::hidePopupMenu):
2296         (WebKit::WebPopupMenuProxyGtk::cancelTracking):
2297         (WebKit::WebPopupMenuProxyGtk::typeAheadFindIndex):
2298         (WebKit::WebPopupMenuProxyGtk::typeAheadFind):
2299         * UIProcess/gtk/WebPopupMenuProxyGtk.h:
2300
2301 2018-05-31  Per Arne Vollan  <pvollan@apple.com>
2302
2303         Add OpenGL display mask to WebPage creation parameters.
2304         https://bugs.webkit.org/show_bug.cgi?id=186163
2305         <rdar://problem/40634504>
2306
2307         Reviewed by Brent Fulgham.
2308
2309         To make sure the OpenGL display mask is always available, include it in the WebPage creation parameters.
2310         The OpenGL display mask is sent to the WebProcess when the platform display ID changes, but that is not
2311         early enough in all cases. If the OpenGL display mask is not set, only OpenGL software rendering is offered
2312         on some hardware configurations.
2313
2314         * Shared/WebPageCreationParameters.cpp:
2315         (WebKit::WebPageCreationParameters::encode const):
2316         (WebKit::WebPageCreationParameters::decode):
2317         * Shared/WebPageCreationParameters.h:
2318         * UIProcess/WebPageProxy.cpp:
2319         (WebKit::WebPageProxy::creationParameters):
2320         * WebProcess/WebPage/WebPage.cpp:
2321         (WebKit::m_credentialsMessenger):
2322
2323 2018-05-31  Brent Fulgham  <bfulgham@apple.com>
2324
2325         Add a rule to allow reading files with prefix /private/var/db/CVMS/cvmsCodeSignObj
2326         https://bugs.webkit.org/show_bug.cgi?id=186157
2327         <rdar://problem/40666437>
2328
2329         Reviewed by Eric Carlson.
2330
2331         * WebProcess/com.apple.WebProcess.sb.in:
2332
2333 2018-05-31  Megan Gardner  <megan_gardner@apple.com>
2334
2335         Add setting to allow override screen size to be disabled.
2336         https://bugs.webkit.org/show_bug.cgi?id=186109
2337
2338         Reviewed by Andy Estes.
2339
2340         Pipe the needed settings through to WebCore.
2341
2342         * Shared/WebPreferences.yaml:
2343         * UIProcess/WebPageProxy.cpp:
2344         (WebKit::m_configurationPreferenceValues):
2345
2346 2018-05-31  Brent Fulgham  <bfulgham@apple.com>
2347
2348         [macOS] Add JIT entitlements to WebContent process and plugin process on macOS
2349         https://bugs.webkit.org/show_bug.cgi?id=184485
2350         <rdar://problem/37556535>
2351
2352         Reviewed by Dan Bernstein.
2353
2354         This patch builds on the changes from Bug 185526 to add support for a JIT entitlement. It makes the
2355         following changes:
2356
2357         1. Adds a new 'WebContent-OSX.entitlements file that unconditionally adds the JIT entitlement for all builds.
2358         2. Modifies the PluginService.entitlements to unconditionally add the JIT entitlement.
2359
2360         * Configurations/PluginService.entitlements: Updated to add the JIT entitlement.
2361         * Configurations/WebContent-OSX.entitlements: Updated to add the JIT entitlement.
2362         * Configurations/WebContentService.xcconfig: Updated to use the new 'WebContent-OSX.entitlements' file.
2363         * WebKit.xcodeproj/project.pbxproj:
2364
2365 2018-05-31  Brent Fulgham  <bfulgham@apple.com>
2366
2367         Don't attempt to extend sandbox when running tests with mock media devices
2368         https://bugs.webkit.org/show_bug.cgi?id=186150
2369         <rdar://problem/40690875>
2370
2371         Reviewed by Alexey Proskuryakov.
2372
2373         Avoid attempting to issue a sandbox extension to actual media devices when
2374         running with Mock capture devices.
2375
2376         Also handle the 'denyNextRequest' test state outside of the USE(APPLE_INTERNAL_SDK)
2377         guards, since it is needed for Open Source builds as well.
2378
2379         * UIProcess/UserMediaProcessManager.cpp:
2380         (WebKit::UserMediaProcessManager::willCreateMediaStream):
2381
2382 2018-05-31  Antti Koivisto  <antti@apple.com>
2383
2384         WebKit memory management: Safari jetsams on some websites when zooming and scrolling
2385         https://bugs.webkit.org/show_bug.cgi?id=186091
2386         <rdar://problem/36315010>
2387
2388         Reviewed by Geoff Garen.
2389
2390         When zooming a page rapidly the visible rect and the page zoom level may get momentarily out of sync.
2391         When this happens we may generate tiles for a much larger area than needed and run out of memory
2392         building the next layer tree transaction. Running out of memory is more likely if the page has lots of
2393         tiled layers in addition to the main content layer.
2394
2395         We already have code for dealing with the scale mismatch for zoom-out case (where this would cause
2396         visibly missing tiles). This patch enables the same exact adjustment for zoom-in case (where the
2397         symptom is creating too many tiles).
2398
2399         * WebProcess/WebPage/ios/WebPageIOS.mm:
2400         (WebKit::adjustExposedRectForNewScale):
2401
2402         Do some renames to make it clear that this can both expand and contract the visible rect.
2403         Bail out if there is nothing to do.
2404
2405         (WebKit::WebPage::updateVisibleContentRects):
2406
2407         Call adjustExposedRectForNewScale directly and unconditionally.
2408
2409         (WebKit::adjustExposedRectForBoundedScale): Deleted.
2410
2411 2018-05-30  Yusuke Suzuki  <utatane.tea@gmail.com>
2412
2413         [JSC] Pass VM& parameter as much as possible
2414         https://bugs.webkit.org/show_bug.cgi?id=186085
2415
2416         Reviewed by Saam Barati.
2417
2418         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
2419         (WebKit::NPJSObject::hasMethod):
2420         (WebKit::NPJSObject::construct):
2421         (WebKit::NPJSObject::invoke):
2422
2423 2018-05-30  Brent Fulgham  <bfulgham@apple.com>
2424
2425         [macOS] WebProcess needs TCC entitlements for media capture (Take 2)
2426         https://bugs.webkit.org/show_bug.cgi?id=185526
2427         <rdar://problem/36674649>
2428
2429         Reviewed by Alexey Proskuryakov.
2430
2431         In Bug 181995 I added TCC entitlements for media capture to the macOS entitlements used for
2432         relocatable builds. These changes also need to apply to system builds of WebKit.
2433
2434         Previously we had not needed an entitlements file for system builds of WebKit, so only provided
2435         an entitlements file for our relocatable build targets. Now we need entitlements when building
2436         on recent macOS targets using internal SDKs.
2437
2438         Since these various scenarios are beginning to multiple, this patch dynamically generates the
2439         entitlements file.
2440
2441         This patch does the following:
2442
2443         1. Changes the "WebContent-OSX.entitlements" to hold the TCC entitlements needed for media capture, and rename
2444            to "WebContent-OSX-restricted.entitlements".
2445         2. Removes the unneeded "com.apple.private.xpc.domain-extension" from WebContent-OSX.entitlement, and dynamically
2446            adds it using a new build step using the script 'process-webcontent-entitlements.sh'
2447         3. Updates DebugRelease.xcconfig to use the 'Safari Engineering' signing key for internal builds.
2448         4. Updates WebContentService.xcconfig to remove the CODE_SIGN_ENTITLEMENTS_OSX_WITH_XPC_DOMAIN_EXTENSION_YES target
2449            since we no longer need a custom entitlement file for this case.
2450         5. Updates WebContentService.Development.xcconfig to remove CODE_SIGN_ENTITLEMENTS_COCOA_TOUCH_NO since it is no
2451            longer needed.
2452         6. Deletes the file Configurations/WebContent.Development.entitlements since it is no longer needed.
2453         7. Revises the WebContent process sandbox to allow camera and microphone access without needing TCC
2454            entitlements, since those cannot be applied without an internal SDK.
2455         8. Revises the UserMediaProcessManager to not pass dynamic sandbox extensions to the WebContent process
2456            when building with the public SDK since those entitlements cannot be added or consumed in Open
2457            Source builds.
2458
2459         We want to use the TCC entitlements when building with the internal SDK on recent macOS builds.
2460
2461         * Configurations/Base.xcconfig:
2462         * Configurations/DebugRelease.xcconfig:
2463         * Configurations/WebContent-OSX-restricted.entitlements: Renamed from Source/WebKit/Configurations/WebContent-OSX.entitlements.
2464         * Configurations/WebContent.Development.entitlements: Removed.
2465         * Configurations/WebContentService.Development.xcconfig:
2466         * Configurations/WebContentService.xcconfig:
2467         * Scripts/process-webcontent-entitlements.sh: Added.
2468         * UIProcess/UserMediaProcessManager.cpp:
2469         (WebKit::UserMediaProcessManager::willCreateMediaStream): Don't bother creating and sending sandbox extensions for
2470         camera and microphone control for builds that cannot support them.
2471         * WebKit.xcodeproj/project.pbxproj:
2472
2473 2018-05-30  Daniel Bates  <dabates@apple.com>
2474
2475         NavigationAction does not need to hold initiating DOM Event
2476         https://bugs.webkit.org/show_bug.cgi?id=185958
2477         <rdar://problem/40531539>
2478
2479         Reviewed by Simon Fraser.
2480
2481         Write in terms of NavigationAction::{keyStateEventData, mouseEventDataForFirstMouseEvent}().
2482
2483         * WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
2484         (WebKit::mouseButtonForMouseEventData):
2485         (WebKit::syntheticClickTypeForMouseEventData):
2486         (WebKit::clickLocationInRootViewCoordinatesForMouseEventData):
2487         (WebKit::InjectedBundleNavigationAction::modifiersForNavigationAction):
2488         (WebKit::InjectedBundleNavigationAction::mouseButtonForNavigationAction):
2489         (WebKit::InjectedBundleNavigationAction::syntheticClickTypeForNavigationAction):
2490         (WebKit::InjectedBundleNavigationAction::clickLocationInRootViewCoordinatesForNavigationAction):
2491         (WebKit::InjectedBundleNavigationAction::InjectedBundleNavigationAction):
2492         (WebKit::mouseEventForNavigationAction): Deleted.
2493         (WebKit::mouseButtonForMouseEvent): Deleted.
2494         (WebKit::syntheticClickTypeForMouseEvent): Deleted.
2495         (WebKit::clickLocationInRootViewCoordinatesForMouseEvent): Deleted.
2496
2497 2018-05-30  Andy Estes  <aestes@apple.com>
2498
2499         [Cocoa] Add an SPI to suppress connection termination errors from CFNetwork when network interfaces change
2500         https://bugs.webkit.org/show_bug.cgi?id=186107
2501         <rdar://problem/39338957>
2502
2503         Reviewed by Brady Eidson.
2504
2505         Added an SPI which configures a process pool's networking process to set the
2506         kCFStreamPropertyAutoErrorOnSystemChange to NO on its NSURLSessionConfigurations.
2507         This instructs CFNetwork to not terminate active connections when the system's
2508         network interfaces change.
2509
2510         * NetworkProcess/NetworkProcess.h:
2511         (WebKit::NetworkProcess::suppressesConnectionTerminationOnSystemChange const):
2512         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2513         (WebKit::NetworkProcessCreationParameters::encode const):
2514         (WebKit::NetworkProcessCreationParameters::decode):
2515         * NetworkProcess/NetworkProcessCreationParameters.h:
2516         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2517         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2518         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2519         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2520         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2521         (API::ProcessPoolConfiguration::copy):
2522         * UIProcess/API/APIProcessPoolConfiguration.h:
2523         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2524         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2525         (-[_WKProcessPoolConfiguration suppressesConnectionTerminationOnSystemChange]):
2526         (-[_WKProcessPoolConfiguration setSuppressesConnectionTerminationOnSystemChange:]):
2527         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2528         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2529
2530 2018-05-30  Youenn Fablet  <youenn@apple.com>
2531
2532         Rename FromOrigin runtime flag to CrossOriginResourcePolicy and enable it by default
2533         https://bugs.webkit.org/show_bug.cgi?id=186082
2534
2535         Reviewed by Chris Dumez.
2536
2537         * NetworkProcess/NetworkResourceLoadParameters.cpp:
2538         (WebKit::NetworkResourceLoadParameters::encode const):
2539         (WebKit::NetworkResourceLoadParameters::decode):
2540         * NetworkProcess/NetworkResourceLoadParameters.h:
2541         * Shared/WebPreferences.yaml:
2542         * UIProcess/API/C/WKPreferences.cpp:
2543         (WKPreferencesSetCrossOriginResourcePolicyEnabled):
2544         (WKPreferencesGetCrossOriginResourcePolicyEnabled):
2545         (WKPreferencesSetFromOriginResponseHeaderEnabled): Deleted.
2546         (WKPreferencesGetFromOriginResponseHeaderEnabled): Deleted.
2547         * UIProcess/API/C/WKPreferencesRef.h:
2548         * WebProcess/Network/WebLoaderStrategy.cpp:
2549         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2550
2551 2018-05-30  Youenn Fablet  <youenn@apple.com>
2552
2553         Rename CrossOriginResourcePolicy same to same-origin
2554         https://bugs.webkit.org/show_bug.cgi?id=186080
2555
2556         Reviewed by Chris Dumez.
2557
2558         * NetworkProcess/NetworkLoadChecker.cpp:
2559         (WebKit::NetworkLoadChecker::shouldCrossOriginResourcePolicyPolicyCancelLoad):
2560
2561 2018-05-30  David Kilzer  <ddkilzer@apple.com>
2562
2563         [iOS] -[WKFullScreenViewController viewWillAppear:] should call [super viewWillAppeear:]
2564         <https://webkit.org/b/186103>
2565         <rdar://problem/40655695>
2566
2567         Reviewed by Eric Carlson.
2568
2569         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
2570         (WKFullScreenViewControllerPlaybackSessionModelClient::setInterface):
2571         Drive-by clean up.  For consistency, we always use the same
2572         variable in the body of the `if` statement that was used in the
2573         condition.
2574         (-[WKFullScreenViewController viewWillAppear:]): Call
2575         [super viewWillAppeear:] to fulfill API contract.
2576
2577 2018-05-30  Chris Dumez  <cdumez@apple.com>
2578
2579         Take a background process assertion in WebPageProxy::callAfterNextPresentationUpdate()
2580         https://bugs.webkit.org/show_bug.cgi?id=186097
2581         <rdar://problem/40651225>
2582
2583         Reviewed by Dan Bernstein.
2584
2585         Refactor fix landed in r232298 so that we rely on the existing Callback infrastructure
2586         to take a background process assertion.
2587
2588         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
2589         (WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing):
2590         * UIProcess/WebPageProxy.cpp:
2591         (WebKit::WebPageProxy::callAfterNextPresentationUpdate):
2592
2593 2018-05-30  Aditya Keerthi  <akeerthi@apple.com>
2594
2595         Fix the ENABLE(DATALIST_ELEMENT) build
2596         https://bugs.webkit.org/show_bug.cgi?id=186105
2597
2598         Reviewed by Wenson Hsieh.
2599
2600         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2601
2602 2018-05-30  Jiewen Tan  <jiewen_tan@apple.com>
2603
2604         Unreviewed, a quick build fix for r232276.
2605
2606         Enabled SecItemShim again as it turns out to be useful for CFNetwork APIs that
2607         query Keychains underneath us.
2608
2609         * NetworkProcess/ios/NetworkProcessIOS.mm:
2610         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
2611         * NetworkProcess/mac/NetworkProcessMac.mm:
2612         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
2613
2614 2018-05-30  Jer Noble  <jer.noble@apple.com>
2615
2616         Auto-pip should use main content heuristic.
2617         https://bugs.webkit.org/show_bug.cgi?id=186065
2618         <rdar://problem/35862502>
2619
2620         Reviewed by Eric Carlson.
2621
2622         Make the m_pipStandbyElement clearable, which will allow the auto-pip mechanism to be torn down. Add
2623         a WebProcess-side notification when the main content changes, to facilitate this.
2624
2625         * WebProcess/FullScreen/WebFullScreenManager.cpp:
2626         (WebKit::WebFullScreenManager::videoControlsManagerDidChange):
2627         (WebKit::WebFullScreenManager::setPIPStandbyElement):
2628         (WebKit::WebFullScreenManager::didEnterFullScreen):
2629         (WebKit::WebFullScreenManager::willExitFullScreen):
2630         * WebProcess/FullScreen/WebFullScreenManager.h:
2631         * WebProcess/WebPage/WebPage.cpp:
2632         (WebKit::WebPage::videoControlsManagerDidChange):
2633         * WebProcess/WebPage/WebPage.h:
2634         * WebProcess/cocoa/PlaybackSessionManager.h:
2635         * WebProcess/cocoa/PlaybackSessionManager.mm:
2636         (WebKit::PlaybackSessionManager::setUpPlaybackControlsManager):
2637         (WebKit::PlaybackSessionManager::clearPlaybackControlsManager):
2638         (WebKit::PlaybackSessionManager::currentPlaybackControlsElement const):
2639
2640 2018-05-30  Jer Noble  <jer.noble@apple.com>
2641
2642         Fix a few issues in WKFullScreenViewController
2643         https://bugs.webkit.org/show_bug.cgi?id=186067
2644         <rdar://problem/40630944>
2645
2646         Reviewed by Darin Adler.
2647
2648         The check in setInterface() is checking the wrong pointer:
2649         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
2650         (WKFullScreenViewControllerPlaybackSessionModelClient::setInterface):
2651
2652         The check in -_effectiveFullscreenInsetTop is backwards:
2653         (-[WKFullScreenViewController _effectiveFullscreenInsetTop]):
2654
2655 2018-05-30  Chris Dumez  <cdumez@apple.com>
2656
2657         Take a background process assertion in WebPageProxy::callAfterNextPresentationUpdate()
2658         https://bugs.webkit.org/show_bug.cgi?id=186097
2659         <rdar://problem/40651225>
2660
2661         Reviewed by Tim Horton.
2662
2663         Take a background process assertion in WebPageProxy::callAfterNextPresentationUpdate(). Otherwise,
2664         apps may get stuck on _doAfterNextPresentationUpdate because the WebProcess got suspended.
2665
2666         * UIProcess/WebPageProxy.cpp:
2667         (WebKit::WebPageProxy::callAfterNextPresentationUpdate):
2668
2669 2018-05-29  Tim Horton  <timothy_horton@apple.com>
2670
2671         Fix the build
2672         https://bugs.webkit.org/show_bug.cgi?id=186078
2673
2674         Unreviewed build fix.
2675
2676         * UIProcess/API/Cocoa/WKWebView.mm:
2677         (-[WKWebView _denyNextUserMediaRequest]):
2678
2679 2018-05-29  Andy Estes  <aestes@apple.com>
2680
2681         [Wi-Fi Assertions] Track whether WiFiAssertionHolder should actually hold a Wi-Fi assertion
2682         https://bugs.webkit.org/show_bug.cgi?id=185983
2683         <rdar://problem/40205486>
2684
2685         Reviewed by Tim Horton.
2686
2687         * Configurations/Network-iOS.entitlements:
2688
2689         Added a needed entitlement.
2690
2691         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
2692         * NetworkProcess/cocoa/WiFiAssertionHolder.h:
2693         (WebKit::WiFiAssertionHolder::shouldHoldWiFiAssertion const):
2694
2695         Track whether WiFiAssertionHolder should actually hold a Wi-Fi assertion.
2696
2697         * NetworkProcess/cocoa/WiFiAssertionHolder.mm: Renamed from Source/WebKit/NetworkProcess/cocoa/WiFiAssertionHolder.cpp.
2698         (holdWiFiAssertion):
2699         (releaseWiFiAssertion):
2700         (WebKit::WiFiAssertionHolder::WiFiAssertionHolder):
2701         (WebKit::WiFiAssertionHolder::~WiFiAssertionHolder):
2702
2703         Changed holdWiFiAssertion() and releaseWiFiAssertion() to take the
2704         WiFiAssertionHolder as an argument.
2705
2706         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2707
2708         Added a needed sandbox extension.
2709
2710         * WebKit.xcodeproj/project.pbxproj:
2711
2712 2018-05-29  Youenn Fablet  <youenn@apple.com>
2713
2714         Add a consistency check between URL and CFURL
2715         https://bugs.webkit.org/show_bug.cgi?id=186057
2716         <rdar://problem/40258457>
2717
2718         Reviewed by Geoff Garen.
2719
2720         * Shared/Cocoa/WKNSURLExtras.mm:
2721         (+[NSURL _web_URLWithWTFString:relativeToURL:]):
2722         (urlWithWTFString): Deleted.
2723         (+[NSURL _web_URLWithWTFString:]): Deleted.
2724
2725 2018-05-29  Alex Christensen  <achristensen@webkit.org>
2726
2727         Remove unused WebPage::dummy
2728         https://bugs.webkit.org/show_bug.cgi?id=186068
2729
2730         Reviewed by Sam Weinig.
2731
2732         * WebProcess/WebPage/WebPage.cpp:
2733         (WebKit::WebPage::dummy): Deleted.
2734         * WebProcess/WebPage/WebPage.h:
2735         * WebProcess/WebPage/WebPage.messages.in:
2736
2737 2018-05-29  Per Arne Vollan  <pvollan@apple.com>
2738
2739         Create typedef for HashMap<PlatformDisplayID, ScreenProperties>
2740         https://bugs.webkit.org/show_bug.cgi?id=186056
2741
2742         Reviewed by Brent Fulgham.
2743
2744         * Shared/WebProcessCreationParameters.cpp:
2745         (WebKit::WebProcessCreationParameters::decode):
2746         * Shared/WebProcessCreationParameters.h:
2747
2748 2018-05-25  Jiewen Tan  <jiewen_tan@apple.com>
2749
2750         Tighten sandbox profiles for Networking Processes to restrict accesses to macOS/iOS Keychains
2751         https://bugs.webkit.org/show_bug.cgi?id=162948
2752         <rdar://problem/40558894>
2753
2754         Reviewed by Brent Fulgham.
2755
2756         The patch conditionally tighten sandbox profiles for Networking Processes to remove Keychain related
2757         permissions and some security permisssions that are not needed. Also it conditionally remove the
2758         Process Privilege for Networking Processes to access Credentials.
2759
2760         In addition, it remove process privilege assertions for SecItemShim as it is supposed to work in processes
2761         that don't have privileges to access Keychains and delegate all operations to UI Process via IPC. Also,
2762         the patch disables SecItemShim for Networking Process conditionally.
2763
2764         * Configurations/Network-iOS.entitlements:
2765         * NetworkProcess/NetworkProcess.cpp:
2766         (WebKit::NetworkProcess::initializeNetworkProcess):
2767         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2768         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2769         * Shared/mac/SecItemShim.cpp:
2770         (WebKit::sendSecItemRequest):
2771         (WebKit::webSecItemCopyMatching):
2772         (WebKit::webSecItemAdd):
2773         (WebKit::webSecItemUpdate):
2774         (WebKit::webSecItemDelete):
2775         (WebKit::initializeSecItemShim):
2776
2777 2018-05-29  Chris Dumez  <cdumez@apple.com>
2778
2779         Store 0-lifetime stylesheets / scripts into the disk cache for faster history navigations
2780         https://bugs.webkit.org/show_bug.cgi?id=186060
2781         <rdar://problem/40627270>
2782
2783         Reviewed by Geoffrey Garen.
2784
2785         Tweak our storeUnconditionallyForHistoryNavigation logic to match resources whose priority
2786         is High, not just VeryHigh. Per logic in CachedResource::defaultPriorityForResourceType(Type),
2787         This now matches stylesheets and scripts in addition to main resources.
2788
2789         I found that in case of a history navigation to apple.com, a significant number of scripts
2790         and stylesheets had to be loaded from the network because our previous heuristic decided
2791         not to store them (because their priority was not VeryHigh and because their max-age was
2792         0).
2793
2794         * NetworkProcess/cache/NetworkCache.cpp:
2795         (WebKit::NetworkCache::makeStoreDecision):
2796
2797 2018-05-28  Jeff Miller  <jeffm@apple.com>
2798
2799         Expose additional WKMenuItemIdentifier strings
2800         https://bugs.webkit.org/show_bug.cgi?id=186041
2801
2802         Reviewed by Dan Bernstein.
2803
2804         Expose identifiers for media-related menu items.
2805
2806         * UIProcess/API/Cocoa/WKMenuItemIdentifiers.mm:
2807         Define new identifiers.
2808
2809         * UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h:
2810         Declare new identifiers.
2811
2812         * UIProcess/mac/WebContextMenuProxyMac.mm:
2813         (WebKit::menuItemIdentifier):
2814         Map to new identifiers.
2815
2816 2018-05-29  Geoffrey Garen  <ggaren@apple.com>
2817
2818         Removed some unused WebSQL trackers
2819         https://bugs.webkit.org/show_bug.cgi?id=186026
2820
2821         Reviewed by Dan Bernstein.
2822
2823         * NetworkProcess/NetworkProcess.cpp:
2824         (WebKit::NetworkProcess::NetworkProcess):
2825         * NetworkProcess/NetworkProcess.h:
2826         * WebProcess/WebProcess.cpp:
2827         (WebKit::m_nonVisibleProcessCleanupTimer):
2828         (WebKit::m_webSQLiteDatabaseTracker): Deleted.
2829         * WebProcess/WebProcess.h:
2830
2831 2018-05-29  Per Arne Vollan  <pvollan@apple.com>
2832
2833         Follow-up fixes after r228907.
2834         https://bugs.webkit.org/show_bug.cgi?id=183338
2835
2836         Reviewed by Brent Fulgham.
2837
2838         Add screen properties to the WebProcess creation parameters, instead of sending
2839         them in a message to the WebProcess just after starting it up.
2840
2841         * Shared/WebProcessCreationParameters.cpp:
2842         (WebKit::WebProcessCreationParameters::encode const):
2843         (WebKit::WebProcessCreationParameters::decode):
2844         * Shared/WebProcessCreationParameters.h:
2845         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2846         (WebKit::WebProcessPool::platformInitializeWebProcess):
2847         * UIProcess/WebProcessPool.cpp:
2848         (WebKit::WebProcessPool::initializeNewWebProcess):
2849         * WebProcess/cocoa/WebProcessCocoa.mm:
2850         (WebKit::WebProcess::platformInitializeWebProcess):
2851
2852 2018-05-29  Sihui Liu  <sihui_liu@apple.com>
2853
2854         Unable to remove IndexedDB Databases with Cocoa API removeDataOfTypes
2855         https://bugs.webkit.org/show_bug.cgi?id=185835
2856         <rdar://problem/39142257>
2857
2858         Reviewed by Chris Dumez.
2859
2860         Fix a wrong if condition: databases should be closed and deleted if websiteDataTypes contains 
2861         WebsiteDataType::IndexedDBDatabases.
2862
2863         * StorageProcess/StorageProcess.cpp:
2864         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
2865
2866 2018-05-28  Sam Weinig  <sam@webkit.org>
2867
2868         Modernize SVGRenderStyleDefs.h
2869         https://bugs.webkit.org/show_bug.cgi?id=186024
2870
2871         Reviewed by Daniel Bates.
2872
2873         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
2874         (WebKit::applyPropertiesToLayer):
2875         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
2876         (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
2877         Update for new enum names.
2878
2879 2018-05-28  Carlos Garcia Campos  <cgarcia@igalia.com>
2880
2881         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.21.3 release.
2882
2883         * gtk/NEWS: Add release notes for 2.21.3.
2884
2885 2018-05-27  Dan Bernstein  <mitz@apple.com>
2886
2887         Reverted the changes made for https://webkit.org/b/186016
2888
2889         They broke the USE(APPLE_INTERNAL_SDK) Sierra build.
2890
2891 2018-05-27  David Kilzer  <ddkilzer@apple.com>
2892
2893         [iOS] Fix warnings about leaks found by clang static analyzer
2894         <https://webkit.org/b/186009>
2895         <rdar://problem/40574267>
2896
2897         Reviewed by Daniel Bates.
2898
2899         * UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
2900         (WebKit::WebAutomationSession::platformSimulateKeySequence): Fix
2901         leak of two WebEvent objects that happened in a loop.
2902         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
2903         (-[_WKPreviewControllerDelegate previewController:transitionImageForPreviewItem:contentRect:]):
2904         Fix leak of a UIImage.
2905
2906 2018-05-27  Dan Bernstein  <mitz@apple.com>
2907
2908         [Cocoa] Avoid importing directly from subumbrella frameworks
2909         https://bugs.webkit.org/show_bug.cgi?id=186016
2910
2911         Reviewed by Sam Weinig.
2912
2913         * Configurations/BaseTarget.xcconfig: Removed -iframework options from OTHER_CFLAGS and
2914           OTHER_CPLUSPLUSFLAGS.
2915         * UIProcess/Automation/mac/WebAutomationSessionMac.mm: Import Carbon.h instead of an
2916           HIToolbox header.
2917         * UIProcess/Cocoa/WebViewImpl.mm: Ditto.
2918         * UIProcess/mac/WKPrintingView.mm: Import Quartz.h instead of a PDFKit header.
2919         * UIProcess/mac/WKTextInputWindowController.mm: Import Carbon.h instead of an HIToolbox
2920           header.
2921         * WebProcess/Plugins/PDF/PDFAnnotationTextWidgetDetails.h: Import Quartz.h instead of a
2922           PDFKit header.
2923         * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h: Ditto.
2924         * WebProcess/Plugins/PDF/PDFPlugin.mm: Ditto.
2925         * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm: Ditto.
2926         * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm: Ditto.
2927         * WebProcess/Plugins/PDF/PDFPluginPasswordField.mm: Ditto.
2928         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm: Ditto.
2929         * WebProcess/WebPage/mac/WebPageMac.mm: Ditto.
2930
2931 2018-05-25  Timothy Hatcher  <timothy@apple.com>
2932
2933         Setting drawsBackground to YES on a WKView doesn't take effect immediately
2934         https://bugs.webkit.org/show_bug.cgi?id=185885
2935         rdar://problem/39706506
2936
2937         Reviewed by Simon Fraser.
2938
2939         * UIProcess/API/Cocoa/WKWebView.mm:
2940         (-[WKWebView _initializeWithConfiguration:]): Removed setBackgroundExtendsBeyondPage(true)
2941         since it is now the default.
2942         * UIProcess/Cocoa/WebViewImpl.mm:
2943         (WebKit::WebViewImpl::setDrawsBackground): Make sure updateLayer gets called on the web view
2944         by calling setNeedsDisplay:YES.
2945         (WebKit::WebViewImpl::setBackgroundColor): Ditto.
2946         (WebKit::WebViewImpl::updateLayer): Removed dead code.
2947         * UIProcess/WebPageProxy.h: Make m_backgroundExtendsBeyondPage default to true. WebKit was
2948         always turning this on during WKWebView initializtion, which would cause the scroll
2949         shadow layer to be created, flash black because of no background, then destroyed soon
2950         after once WebKit's message to turn it on got delivered.
2951         * WebProcess/WebPage/WebPage.cpp:
2952         (WebPage::WebPage): Call setBackgroundExtendsBeyondPage earlier to avoid creating the scroll
2953         shadow layer, since backgroundShouldExtendBeyondPage defautls to false in WebCore for WK1.
2954         (WebKit::WebPage::setDrawsBackground): Use updateBackgroundRecursively to propagate the
2955         correct base background color.
2956
2957 2018-05-25  Youenn Fablet  <youenn@apple.com>
2958
2959         Migrate From-Origin to Cross-Origin-Resource-Policy
2960         https://bugs.webkit.org/show_bug.cgi?id=185840
2961
2962         Reviewed by Chris Dumez.
2963
2964         Do Cross-Origin-Resource-Policy (CORP) checks in NetworkLoadChecker instead of NetworkResourceLoader directly.
2965         Make sure CORP only applies to no-cors loads.
2966         Remove ancestor checks and only consider the document origin making the load.
2967         This means that in case of cross-origin redirection to same-origin, the redirection will be CORP-checked,
2968         the final response will not be CORP-checked but will be opaque.
2969
2970         * NetworkProcess/NetworkLoadChecker.cpp:
2971         (WebKit::NetworkLoadChecker::validateCrossOriginResourcePolicyPolicy):
2972         (WebKit::NetworkLoadChecker::validateResponse):
2973         * NetworkProcess/NetworkLoadChecker.h:
2974         * NetworkProcess/NetworkResourceLoader.cpp:
2975         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
2976         (WebKit::NetworkResourceLoader::didReceiveResponse):
2977         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
2978         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
2979         (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
2980         * NetworkProcess/NetworkResourceLoader.h:
2981         * WebProcess/Network/WebLoaderStrategy.cpp:
2982         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2983         Send ancestor information for navigation loads only.
2984
2985 2018-05-25  Daniel Bates  <dabates@apple.com>
2986
2987         NavigationAction should not hold a strong reference to a Document
2988         https://bugs.webkit.org/show_bug.cgi?id=185712
2989         <rdar://problem/40320916>
2990
2991         Reviewed by Brent Fulgham.
2992
2993         Update code to make use of NavigationAction::requester().
2994
2995         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2996         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2997
2998 2018-05-25  Tim Horton  <timothy_horton@apple.com>
2999
3000         Ensure that the Web Content process doesn't sleep during initialization
3001         https://bugs.webkit.org/show_bug.cgi?id=185975
3002         <rdar://problem/40548159>
3003
3004         Reviewed by Geoffrey Garen.
3005
3006         WebProcessPool::warmInitialProcess isn't worth much (or at least, as much
3007         as it could be) if the Web Content process goes to sleep in the middle
3008         of initializeWebProcess.
3009
3010         Keep the Web Content process alive until it has handled all messages
3011         sent from WebProcessPool::initializeNewWebProcess.
3012
3013         This is a significant speedup on some benchmarks I've been running
3014         that involve prewarming a process long before any content is loaded.
3015
3016         * UIProcess/WebProcessPool.cpp:
3017         (WebKit::WebProcessPool::initializeNewWebProcess):
3018
3019 2018-05-25  Chris Dumez  <cdumez@apple.com>
3020
3021         WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback() unexpectedly constructs a process pool
3022         https://bugs.webkit.org/show_bug.cgi?id=185992
3023
3024         Reviewed by Geoffrey Garen.
3025
3026         Update enableResourceLoadStatisticsAndSetTestingCallback() to pass the right parameter to processPools()
3027         to avoid constructing a process pool when none exist. Also drop the 'resourceLoadStatisticsEnabled'
3028         flag on the WebProcessPool and have it query its data store instead to know if the feature is enabled.
3029
3030         * UIProcess/WebProcessPool.cpp:
3031         (WebKit::WebProcessPool::initializeNewWebProcess):
3032         (WebKit::WebProcessPool::setResourceLoadStatisticsEnabled):
3033         * UIProcess/WebProcessPool.h:
3034         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3035         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
3036
3037 2018-05-25  Chris Dumez  <cdumez@apple.com>
3038
3039         Drop support for NSURLCache in WebKit2
3040         https://bugs.webkit.org/show_bug.cgi?id=185990
3041
3042         Reviewed by Geoffrey Garen.
3043
3044         Drop support for NSURLCache in WebKit2 now that the WebKit network cache is stable.
3045
3046         * NetworkProcess/NetworkProcess.cpp:
3047         (WebKit::NetworkProcess::setCacheModel):
3048         * NetworkProcess/NetworkProcess.h:
3049         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3050         (WebKit::NetworkProcessCreationParameters::encode const):
3051         (WebKit::NetworkProcessCreationParameters::decode):
3052         * NetworkProcess/NetworkProcessCreationParameters.h:
3053         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3054         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
3055         (WebKit::NetworkProcess::clearDiskCache):
3056         (WebKit::NetworkProcess::platformSetURLCacheSize): Deleted.
3057         (WebKit::clearNSURLCache): Deleted.
3058         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
3059         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3060         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3061         (): Deleted.
3062         (WebKit::NetworkSessionCocoa::setUsesNetworkCache): Deleted.
3063         * NetworkProcess/curl/NetworkProcessCurl.cpp:
3064         (WebKit::NetworkProcess::platformSetURLCacheSize): Deleted.
3065         * NetworkProcess/soup/NetworkProcessSoup.cpp:
3066         (WebKit::NetworkProcess::platformSetURLCacheSize): Deleted.
3067         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3068         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
3069         (WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory):
3070         (WebKit::WebProcessPool::isNetworkCacheEnabled): Deleted.
3071         * UIProcess/WebProcessPool.h:
3072         * WebProcess/WebPage/WebFrame.cpp:
3073         (WebKit::WebFrame::suggestedFilenameForResourceWithURL const):
3074         (WebKit::WebFrame::mimeTypeForResourceWithURL const):
3075         * WebProcess/WebPage/WebPage.cpp:
3076         (WebKit::WebPage::getResourceDataFromFrame):
3077         (WebKit::WebPage::hasLocalDataForURL):
3078         * WebProcess/WebPage/WebPage.h:
3079         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
3080         (WebKit::WebPage::platformHasLocalDataForURL): Deleted.
3081         (WebKit::WebPage::cachedResponseMIMETypeForURL): Deleted.
3082         (WebKit::WebPage::cachedSuggestedFilenameForURL): Deleted.
3083         (WebKit::WebPage::cachedResponseDataForURL): Deleted.
3084         * WebProcess/WebPage/ios/WebPageIOS.mm:
3085         (WebKit::WebPage::platformHasLocalDataForURL): Deleted.
3086         (WebKit::WebPage::cachedSuggestedFilenameForURL): Deleted.
3087         (WebKit::WebPage::cachedResponseMIMETypeForURL): Deleted.
3088         (WebKit::WebPage::cachedResponseDataForURL): Deleted.
3089         * WebProcess/WebPage/mac/WebPageMac.mm:
3090         (WebKit::WebPage::accessibilityRemoteObject):
3091         (WebKit::WebPage::platformHasLocalDataForURL): Deleted.
3092         (WebKit::cachedResponseForURL): Deleted.
3093         (WebKit::WebPage::cachedSuggestedFilenameForURL): Deleted.
3094         (WebKit::WebPage::cachedResponseMIMETypeForURL): Deleted.
3095         (WebKit::WebPage::cachedResponseDataForURL): Deleted.
3096         * WebProcess/WebPage/win/WebPageWin.cpp:
3097         (WebKit::WebPage::platformHasLocalDataForURL): Deleted.
3098         (WebKit::WebPage::cachedResponseMIMETypeForURL): Deleted.
3099         (WebKit::WebPage::cachedSuggestedFilenameForURL): Deleted.
3100         (WebKit::WebPage::cachedResponseDataForURL): Deleted.
3101         * WebProcess/WebPage/wpe/WebPageWPE.cpp:
3102         (WebKit::WebPage::platformHasLocalDataForURL): Deleted.
3103         (WebKit::WebPage::cachedResponseMIMETypeForURL): Deleted.
3104         (WebKit::WebPage::cachedSuggestedFilenameForURL): Deleted.
3105         (WebKit::WebPage::cachedResponseDataForURL): Deleted.
3106         * WebProcess/cocoa/WebProcessCocoa.mm:
3107         (WebKit::WebProcess::platformInitializeWebProcess):
3108
3109 2018-05-25  Alex Christensen  <achristensen@webkit.org>
3110
3111         Fix internal iOS builds after r232198
3112         https://bugs.webkit.org/show_bug.cgi?id=185986
3113
3114         * WebProcess/WebPage/ios/WebPageIOS.mm:
3115         (WebKit::WebPage::sendTapHighlightForNodeIfNecessary):
3116
3117 2018-05-25  Alex Christensen  <achristensen@webkit.org>
3118
3119         URL::host should return a StringView to reduce allocations
3120         https://bugs.webkit.org/show_bug.cgi?id=185986
3121
3122         Reviewed by Geoff Garen.
3123
3124         * NetworkProcess/NetworkProcess.cpp:
3125         (WebKit::fetchDiskCacheEntries):
3126         * NetworkProcess/NetworkResourceLoader.cpp:
3127         (WebKit::areFrameAncestorsSameSite):
3128         * NetworkProcess/mac/NetworkProcessMac.mm:
3129         (WebKit::overrideSystemProxies):
3130         * Shared/API/APIURL.h:
3131         (API::URL::host const):
3132         * UIProcess/Automation/WebAutomationSession.cpp:
3133         (WebKit::WebAutomationSession::addSingleCookie):
3134         (WebKit::WebAutomationSession::deleteAllCookies):
3135         * UIProcess/WebProcessProxy.cpp:
3136         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
3137         * WebProcess/Plugins/PluginView.cpp:
3138         (WebKit::PluginView::pluginDidReceiveUserInteraction):
3139         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
3140         (WebKit::WebPluginInfoProvider::populatePluginCache):
3141         * WebProcess/WebPage/WebPage.cpp:
3142         (WebKit::needsHiddenContentEditableQuirk):
3143         (WebKit::needsPlainTextQuirk):
3144         (WebKit::WebPage::determinePrimarySnapshottedPlugIn):
3145
3146 2018-05-25  Adrian Perez de Castro  <aperez@igalia.com>
3147
3148         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.21.2 release.
3149
3150         * wpe/NEWS: Add release notes for the 2.21.2 release.
3151
3152 2018-05-25  Chris Dumez  <cdumez@apple.com>
3153
3154         Minor ApplicationCacheStorage clean up
3155         https://bugs.webkit.org/show_bug.cgi?id=185984
3156
3157         Reviewed by Youenn Fablet.
3158
3159         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3160         (WebKit::WebsiteDataStore::fetchDataAndApply):
3161         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
3162         (WKBundlePageCopyOriginsWithApplicationCache):
3163
3164 2018-05-25  Chris Dumez  <cdumez@apple.com>
3165
3166         Avoid triggering network cache speculative revalidation for loads allowing expired content
3167         https://bugs.webkit.org/show_bug.cgi?id=185985
3168
3169         Reviewed by Antti Koivisto.
3170
3171         Avoid triggering network cache speculative revalidation for loads allowing expired content
3172         (e.g. history loads, restoring pages after crash or safari relaunch). This causes us to do
3173         unnecessary revalidations, it is both wasteful and bad for performance.
3174
3175         * NetworkProcess/cache/NetworkCache.cpp:
3176         (WebKit::NetworkCache::Cache::retrieve):
3177
3178 2018-05-25  David Kilzer  <ddkilzer@apple.com>
3179
3180         Fix issues with -dealloc methods found by clang static analyzer
3181         <https://webkit.org/b/185887>
3182
3183         Reviewed by Joseph Pecoraro.
3184
3185         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Drive-by fix
3186         to use `copy` for `mimeType` property.
3187         (-[_WKPreviewControllerDataSource initWithMIMEType:]): Drive-by
3188         fix to use `instancetype` instead of `id`.  Use -copy for
3189         `mimeType` argument to match property definition.
3190         (-[_WKPreviewControllerDataSource dealloc]): Add.  Release
3191         `_completionHandler` and `_mimeType` to fix leaks.
3192         * UIProcess/ios/WKPasswordView.mm:
3193         (-[WKPasswordView dealloc]): Add.  Release
3194         `_userDidEnterPassword` to fix leak.
3195         * UIProcess/ios/fullscreen/WKFullScreenViewController.h:
3196         Drive-by clean-up to make `location` property `copy` instead of
3197         `retain`.
3198         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
3199         (-[WKFullScreenViewController dealloc]): Release `_target` and
3200         `_location` to fix leaks.
3201         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
3202         (-[WKFullscreenAnimationController dealloc]): Add.  Release
3203         `_viewController` to fix leak.
3204         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm:
3205         (@property secondaryMaterialOverlayView): Mark explicitly as
3206         `assign` since this isn't a retained variable.
3207         (@property secondaryMaterialOverlayViewConstraints): Mark
3208         explicitly as `retain` since there is nothing to keep this
3209         object alive.
3210         (+[WKFullscreenStackView secondaryMaterialOverlayView]): Fix
3211         leak by autoreleasing the return value.
3212         (-[WKFullscreenStackView dealloc]): Release retained instance
3213         variables to fix leaks.  Note that `_stackView` and
3214         `_visualEffectView` are internally retained despite their
3215         @property declarations.
3216         (-[WKFullscreenStackView setTargetViewForSecondaryMaterialOverlay:]):
3217         Retain @property targetViewForSecondaryMaterialOverlay to match
3218         its declaration.
3219
3220 2018-05-23  Antoine Quint  <graouts@apple.com>
3221
3222         [Web Animations] Use DEFAULT_EXPERIMENTAL_FEATURES_ENABLED for Web Animations experimental features
3223         https://bugs.webkit.org/show_bug.cgi?id=185919
3224
3225         Reviewed by Dean Jackson.
3226
3227         * Shared/WebPreferences.yaml:
3228
3229 2018-05-24  Dan Bernstein  <mitz@apple.com>
3230
3231         ProcessLauncherMac.mm contains a couple of meaningless #ifndef directives
3232         https://bugs.webkit.org/show_bug.cgi?id=185973
3233
3234         Reviewed by Tim Horton.
3235
3236         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
3237         (WebKit::ProcessLauncher::launchProcess): Use #if !ASSERT_DISABLED to guard statements that
3238           are only needed for an assertion, instead of #ifndef _NDEBUG, which is always true.
3239
3240 2018-05-24  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3241
3242         [GTK][WPE] Memory pressure monitor doesn't reliable notify all the subprocesses
3243         https://bugs.webkit.org/show_bug.cgi?id=184261
3244
3245         Reviewed by Carlos Garcia Campos.
3246
3247         On Linux we had two implementations for getting notifications about memory pressure events:
3248         - The memory cgroup (called systemd here).
3249         - The UIProcess memory monitor (which delivered events via a shared eventfd)
3250
3251         The problem with the first is that it was usually not working on a standard machine due to
3252         the special permissions or configurations required for memory cgroups, so the second one
3253         (eventfd) was used as a fall-back in that case.
3254         But this eventfd method is racy with more than one WebKit child process and it wasn't
3255         reliably delivering the notifications.
3256
3257         This patch removes the memory cgroup implementation and modifies the UIProcess memory monitor
3258         to deliver the events via WebKit IPC. This simplifies the code a lot and allows us to have
3259         only one implementation that should work in any Linux machine.
3260
3261         The implementation now also triggers the event with information about the criticalness of it.
3262
3263         Previously a critical event was triggered always at a 95% of pressure.
3264         Now a non-critical one is triggered at 90% and critical remains at a 95%.
3265
3266         Start triggering events early should compensate the fact than triggering the event via WebKit IPC is
3267         a bit slower than doing that via an eventfd (or than listening on the memory cgroup event controller).
3268
3269         The events are delivered to all WebKit childs: WebProcess, NetworkProcess, StorageProcess, PluginProcess.
3270
3271         In the case of the StorageProcess a dummy controller is installed, which currently does nothing,
3272         but leaves a note for a future implementation and at least allows to trigger platformReleaseMemory()
3273         that on Linux/glibc should end calling malloc_trim()
3274
3275         * NetworkProcess/NetworkProcess.cpp:
3276         (WebKit::NetworkProcess::initializeNetworkProcess):
3277         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3278         (WebKit::NetworkProcessCreationParameters::encode const):
3279         (WebKit::NetworkProcessCreationParameters::decode):
3280         * NetworkProcess/NetworkProcessCreationParameters.h:
3281         * PluginProcess/PluginProcess.cpp:
3282         (WebKit::PluginProcess::didReceiveMessage):
3283         (WebKit::PluginProcess::initializePluginProcess):
3284         * Shared/ChildProcess.cpp:
3285         (WebKit::ChildProcess::didReceiveMemoryPressureEvent):
3286         * Shared/ChildProcess.h:
3287         * Shared/ChildProcess.messages.in:
3288         * Shared/Plugins/PluginProcessCreationParameters.cpp:
3289         (WebKit::PluginProcessCreationParameters::encode const):
3290         (WebKit::PluginProcessCreationParameters::decode):
3291         * Shared/Plugins/PluginProcessCreationParameters.h:
3292         * Shared/WebProcessCreationParameters.cpp:
3293         (WebKit::WebProcessCreationParameters::encode const):
3294         (WebKit::WebProcessCreationParameters::decode):
3295         * Shared/WebProcessCreationParameters.h:
3296         * StorageProcess/StorageProcess.cpp:
3297         (WebKit::StorageProcess::initializeProcess):
3298         * UIProcess/Plugins/PluginProcessManager.cpp:
3299         (WebKit::PluginProcessManager::sendMemoryPressureEvent):
3300         * UIProcess/Plugins/PluginProcessManager.h:
3301         * UIProcess/Plugins/PluginProcessProxy.cpp:
3302         (WebKit::PluginProcessProxy::sendMemoryPressureEvent):
3303         (WebKit::PluginProcessProxy::didFinishLaunching):
3304         * UIProcess/Plugins/PluginProcessProxy.h:
3305         * UIProcess/WebProcessPool.cpp:
3306         (WebKit::WebProcessPool::sendMemoryPressureEvent):
3307         (WebKit::WebProcessPool::ensureNetworkProcess):
3308         (WebKit::WebProcessPool::initializeNewWebProcess):
3309         * UIProcess/WebProcessPool.h:
3310         (WebKit::WebProcessPool::sendToStorageProcess):
3311         * UIProcess/linux/MemoryPressureMonitor.cpp:
3312         (WebKit::pollIntervalForUsedMemoryPercentage): Fix equation for calculating the interval percentage.
3313         (WebKit::MemoryPressureMonitor::singleton):
3314         (WebKit::MemoryPressureMonitor::start):
3315         * UIProcess/linux/MemoryPressureMonitor.h:
3316         * WebProcess/WebProcess.cpp:
3317         (WebKit::WebProcess::initializeWebProcess):
3318
3319 2018-05-24  Youenn Fablet  <youenn@apple.com>
3320
3321         Update plugin search path to look for user installed plugins
3322         https://bugs.webkit.org/show_bug.cgi?id=185960
3323
3324         Reviewed by Brent Fulgham.
3325
3326         Now that UIProcess may be sandboxed, the home directory is no longer the user home directory.
3327         Update the path to still look for plugins in the user home directory.
3328
3329         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
3330         (WebKit::PluginInfoStore::pluginsDirectories):
3331
3332 2018-05-24  Jiewen Tan  <jiewen_tan@apple.com>
3333
3334         Adopt SecKeyProxy SPI in certificate based challenge response code
3335         https://bugs.webkit.org/show_bug.cgi?id=185848
3336         <rdar://problem/34586181>
3337
3338         Reviewed by Alex Christensen.
3339
3340         This patch adopts SecKeyProxy SPI in HTTPS client certificate authentication code.
3341         1) SecKeyProxy is a new SPI to relay crypto operations from one process to another. The owner process of the proxy
3342         will behave like a server, and other owners of the SecKeys created from the proxy's endpoints will then behave
3343         like clients. This client-server model allows more restricted sandbox for client processes, and meanwhile permits
3344         them to relay crypto operations to the server process while maintaining the same SecKey interfaces as used for local operations.
3345         2) Because of the client-server model, the server process, i.e. the UI Process in our case, needs to keep the proxy
3346         object alive long enough for the client process, i.e. Network Processes in our case, to finish all operations, and then destroy
3347         the proxy object afterward. The ideal place to hold such a proxy is WebsiteDataStore such that proxies could live with the
3348         corresponding network session.
3349         3) A new class called SecKeyProxyStore is then created to bind the lifetime of SecKeyProxy to the WebsiteDataStore while initializing
3350         it correctly. At the time the authentication process reaches WebPageProxy::didReceiveAuthenticationChallengeProxy where we have
3351         accesses to the WebsiteDataStore, we haven't yet been able to determine the Credential to authenticate the challenge. Therefore, we
3352         have to reserve a place in the WebsiteDataStore ahead and then fill it with the right Credential. That's why SecKeyProxyStore exists.
3353         In WebPageProxy::didReceiveAuthenticationChallengeProxy, we create a strong reference of SecKeyProxyStore which will eventually hold
3354         a strong reference of the SecKeyProxy, and move it to the WebsiteDataStore. We also create a weak reference to SecKeyProxyStore
3355         and move it to the AuthenticationChallenge. In this way, we indirectly bind the lifetime of SecKeyProxy to the WebsiteDataStore through
3356         the strong reference and also we can initialize the proxy through the weak reference while a credential is finally determined.
3357         4) Endpoints of the SecKeyProxy will be passed to the Network Process for creating the 'remote' SecKey. However, those endpoints are
3358         of NSXPCListenerEndpoint type, which can only be passed with xpc connections and are not compatible with our IPC mechanism. In order
3359         to pass endpoints around, this patch reuses the xpc connection that is used to bootstrap Network Processes from the UI Process. To do
3360         so, it sends xpc messages at the place where original IPC messages are sent and overwrites the boostrap listener of the xpc connection
3361         when Network Process is initialized. From the listener, it continues the original authentication code path.
3362         5) Tests, again, are manually covered by tlstestwebkit.org. Noted, the prompting Keychain dialog in macOS should say Safari instead of
3363         "com.apple.WebKit.Networking*" now.
3364
3365         * Shared/AuthenticationManagerCocoa.mm: Added.
3366         (WebKit::AuthenticationManager::initializeConnection):
3367         * Shared/Authentication/cocoa/AuthenticationManager.h:
3368         * Shared/Authentication/cocoa/ClientCertificateAuthenticationXPCConstants.h:
3369         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
3370         (WebKit::AuthenticationChallengeProxy::useCredential):
3371         (WebKit::AuthenticationChallengeProxy::setSecKeyProxyStore):
3372         * UIProcess/Authentication/AuthenticationChallengeProxy.h:
3373         * UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm: Added.
3374         (WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc const):
3375         * UIProcess/Authentication/cocoa/SecKeyProxyStore.h: Added.
3376         (WebKit::SecKeyProxyStore::create):
3377         (WebKit::SecKeyProxyStore::isInitialized const):
3378         (WebKit::SecKeyProxyStore::get const):
3379         (WebKit::SecKeyProxyStore::weakPtrFactory const):
3380         * UIProcess/Authentication/cocoa/SecKeyProxyStore.mm: Added.
3381         (WebKit::SecKeyProxyStore::initialize):
3382         * UIProcess/WebPageProxy.cpp:
3383         (WebKit::WebPageProxy::didReceiveAuthenticationChallengeProxy):
3384         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3385         (WebKit::WebsiteDataStore::addSecKeyProxyStore):
3386         * UIProcess/WebsiteData/WebsiteDataStore.h:
3387         * WebKit.xcodeproj/project.pbxproj:
3388
3389 2018-05-24  Megan Gardner  <megan_gardner@apple.com>
3390
3391         Fix Issues with Loupe Gesture
3392         https://bugs.webkit.org/show_bug.cgi?id=185926
3393
3394         Reviewed by Tim Horton.
3395
3396         The loupe gesture was not giving us the correct selection in some situations.
3397
3398         * UIProcess/ios/WKContentViewInteraction.mm:
3399         (-[WKContentView gestureRecognizer:canBePreventedByGestureRecognizer:]):
3400         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
3401         (-[WKContentView setSelectedTextRange:]):
3402         * WebProcess/WebPage/WebPage.h:
3403         * WebProcess/WebPage/ios/WebPageIOS.mm:
3404         (WebKit::WebPage::selectWithGesture):
3405         (WebKit::WebPage::clearSelection):
3406
3407 2018-05-24  Keith Rollin  <krollin@apple.com>
3408
3409         Don't track resource load milestones in private sessions
3410         https://bugs.webkit.org/show_bug.cgi?id=185828
3411         <rdar://problem/40424197>
3412
3413         Reviewed by Brent Fulgham.
3414
3415         Bug 184838 adds the facility for tracing the beginning and ending of
3416         resources loads and reporting so that historical information can be
3417         gathered to assess the health of the networking stack. Disable this
3418         facility for private browsing sessions.
3419
3420         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3421         (WebKit::NetworkConnectionToWebProcess::startTrackingResourceLoad):
3422         (WebKit::NetworkConnectionToWebProcess::stopTrackingResourceLoad):
3423         * NetworkProcess/NetworkConnectionToWebProcess.h:
3424         * NetworkProcess/NetworkResourceLoader.cpp:
3425         (WebKit::NetworkResourceLoader::start):
3426
3427 2018-05-24  Brent Fulgham  <bfulgham@apple.com>
3428
3429         REGRESSION(r224908): [macOS] Media playback not honoring custom caption styles
3430         https://bugs.webkit.org/show_bug.cgi?id=185955
3431         <rdar://problem/40339278>
3432
3433         Reviewed by Eric Carlson.
3434
3435         In r224908 I removed access to the MediaAccessibility mach port, as well as
3436         read/write access to various preferences associated with that process, as it
3437         was no longer needed by modern WebKit media routines.
3438
3439         Detailed testing reveals that read access is still needed to these preferences
3440         to properly handle custom caption styles.
3441
3442         This patch re-enables access to the media accessibility preferences.
3443
3444         * WebProcess/com.apple.WebProcess.sb.in:
3445
3446 2018-05-24  Brent Fulgham  <bfulgham@apple.com>
3447
3448         REGRESSION(r230269): ASSERTION FAILED: sendRightCount == 1 at ProcessLauncherMac.mm(218)
3449         https://bugs.webkit.org/show_bug.cgi?id=185687
3450         <rdar://problem/39386361>
3451
3452         Reviewed by Brady Eidson.
3453
3454         In r230269 I added an assertion to help identify cases where we were doing bad
3455         bookkeeping in our port send rights. I assumed that because we were adding
3456         one send right, that when we went to close down the connection that we should
3457         have only one send right.
3458         
3459         I have since discovered that this assumption is invalid, and that I should
3460         only be checking that we have AT LEAST ONE send right at the time we attempt
3461         to remove it.
3462
3463         This patch changes the assertion to confirm that we have at least one send
3464         right before we remove the send right.
3465
3466         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
3467         (WebKit::ProcessLauncher::launchProcess):
3468
3469 2018-05-24  Chris Dumez  <cdumez@apple.com>
3470
3471         Some of the work in initializeLogChannelsIfNecessary() is unnecessary for release builds
3472         https://bugs.webkit.org/show_bug.cgi?id=185951
3473
3474         Reviewed by Geoffrey Garen.
3475
3476         Some of the work in initializeLogChannelsIfNecessary() is unnecessary for release builds and slows down
3477         launch time. In particular, it is unnecessary to read NSDefaults to figure out which logging channels
3478         should be enabled.
3479
3480         * Platform/foundation/LoggingFoundation.mm:
3481         (WebKit::logLevelString):
3482         * Platform/unix/LoggingUnix.cpp:
3483         (WebKit::logLevelString):
3484         * Platform/win/LoggingWin.cpp:
3485         (WebKit::logLevelString):
3486
3487 2018-05-24  Per Arne Vollan  <pvollan@apple.com>
3488
3489         Crash under WebKit::PluginProxy::destroy()
3490         https://bugs.webkit.org/show_bug.cgi?id=185841
3491         <rdar://problem/39936896>
3492
3493         Reviewed by Brent Fulgham.
3494
3495         A release assert in Connection::sencSync is failing since scripts are not allowed in this context,
3496         and the WebKit process is allowed to process incoming messages while waiting for the sync reply.
3497         In this context, scripts are disallowed in the method Element::addShadowRoot. To make sure the
3498         WebContent process will not wait indefinitely for a reply from the Plugin process, use a timeout
3499         of 1 second when sending the message.
3500
3501         * WebProcess/Plugins/PluginProxy.cpp:
3502         (WebKit::PluginProxy::destroy):
3503
3504 2018-05-24  Carlos Garcia Campos  <cgarcia@igalia.com>
3505
3506         Unreviewed. Fix GTK+ input method unit tests after r232049.
3507
3508         Unit tests don't use a WebPageProxy.
3509
3510         * UIProcess/gtk/InputMethodFilter.cpp:
3511         (WebKit::InputMethodFilter::isViewFocused const):
3512         (WebKit::InputMethodFilter::setEnabled):
3513         * UIProcess/gtk/InputMethodFilter.h:
3514
3515 2018-05-24  Carlos Garcia Campos  <cgarcia@igalia.com>
3516
3517         WebDriver: implement maximize, minimize and fullscreen window commands
3518         https://bugs.webkit.org/show_bug.cgi?id=180398
3519
3520         Reviewed by Brian Burg.
3521
3522         * UIProcess/API/APIAutomationSessionClient.h:
3523         (API::AutomationSessionClient::requestMaximizeWindowOfPage): Added to allow clients maximize the window.
3524         * UIProcess/API/glib/WebKitAutomationSession.cpp:
3525         * UIProcess/API/glib/WebKitWebViewPrivate.h:
3526         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
3527         (WindowStateEvent::WindowStateEvent): Struct to handle window state events.
3528         (WindowStateEvent::~WindowStateEvent): Complete the event.
3529         (WindowStateEvent::complete): Call the completion handler is not called already.
3530         (windowStateEventCallback): Handle window state event changes.
3531         (webkitWebViewMaximizeWindow): Try to maximize the window and wait for the event.
3532         (webkitWebViewMinimizeWindow): Try to minimize the window and wait for the event.
3533         (webkitWebViewRestoreWindow): Try to unmaximize or unminimize the window and wait for the event.
3534         * UIProcess/API/wpe/WebKitWebViewWPE.cpp:
3535         (webkitWebViewMaximizeWindow):
3536         (webkitWebViewMinimizeWindow):
3537         (webkitWebViewRestoreWindow):
3538         * UIProcess/Automation/Automation.json:
3539         * UIProcess/Automation/WebAutomationSession.cpp:
3540         (WebKit::WebAutomationSession::maximizeWindowOfBrowsingContext): Exit fullscreen, restore the window and then
3541         maximize it.
3542         (WebKit::WebAutomationSession::maximizeWindowForPage): Ask the client to maximize the window of page.
3543         * UIProcess/Automation/WebAutomationSession.h:
3544         * UIProcess/Automation/atoms/EnterFullscreen.js:
3545         (enterFullscreen): Return early if fullscreen is disabled or if window is already in fullscreen.
3546
3547 2018-05-23  Eric Carlson  <eric.carlson@apple.com>
3548
3549         Avoid loading AVFoundation to check supported MIME types if possible
3550         https://bugs.webkit.org/show_bug.cgi?id=185839
3551         <rdar://problem/40182010>
3552
3553         Reviewed by Jer Noble.
3554         
3555         * Shared/WebProcessCreationParameters.cpp:
3556         (WebKit::WebProcessCreationParameters::encode const): Encode mediaMIMETypes.
3557         (WebKit::WebProcessCreationParameters::decode): Decode mediaMIMETypes.
3558         * Shared/WebProcessCreationParameters.h:
3559
3560         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
3561         (WebKit::mediaTypeCache): Static Vector of media MIME types.
3562         (WebKit::WebProcessProxy::cacheMediaMIMETypes): Cache the type list and pass it to every other
3563         process proxy.
3564         (WebKit::WebProcessProxy::cacheMediaMIMETypesInternal): Cache the type list and pass it to the
3565         web process.
3566         (WebKit::WebProcessProxy::mediaMIMETypes): Return the cached type list.
3567
3568         * UIProcess/WebProcessPool.cpp:
3569         (WebKit::WebProcessPool::initializeNewWebProcess): Set parameters.mediaMIMETypes.
3570
3571         * UIProcess/WebProcessProxy.h:
3572         * UIProcess/WebProcessProxy.messages.in: Add CacheMediaMIMETypes.
3573
3574         * WebProcess/WebProcess.h:
3575         * WebProcess/WebProcess.messages.in: Add SetMediaMIMETypes.
3576
3577         * WebProcess/cocoa/WebProcessCocoa.mm:
3578         (WebKit::WebProcess::platformInitializeWebProcess): Cache the MIME types if the list isn't
3579         empty, else register with AVFoundationMIMETypeCache to be notified when it loads types.
3580         AVFoundationMIMETypeCache to 
3581         (WebKit::WebProcess::platformTerminate): Unregister with AVFoundationMIMETypeCache.
3582         (WebKit::WebProcess::setMediaMIMETypes): Pass list of types to AVFoundationMIMETypeCache.
3583
3584 2018-05-23  Brian Burg  <bburg@apple.com>
3585
3586         Web Automation: disable process swap on navigation when an automation session is active
3587         https://bugs.webkit.org/show_bug.cgi?id=185552
3588
3589         Reviewed by Tim Horton.
3590
3591         * UIProcess/WebProcessPool.cpp:
3592         (WebKit::WebProcessPool::processForNavigationInternal):
3593         This is not intended to work right now. Opt out to avoid crashing
3594         later when a process is deallocated unexpectedly.
3595
3596 2018-05-23  Youenn Fablet  <youenn@apple.com>
3597
3598         NetworkLoadChecker should check cached redirections
3599         https://bugs.webkit.org/show_bug.cgi?id=185849
3600
3601         Reviewed by Chris Dumez.
3602
3603         * NetworkProcess/NetworkLoadChecker.cpp:
3604         (WebKit::NetworkLoadChecker::checkRedirection):
3605         Set the resource error url as done by WebCore SubresourceLoader.
3606         * NetworkProcess/NetworkResourceLoader.cpp:
3607         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
3608         Pass the resource request to dispatchWillSendRedirectedRequest now needs it.
3609         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
3610         Make sure that m_networkLoad is not null before cancelling it since we might be checking a cached redirection.
3611         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
3612         Ensure the redirect response is coming from the Network before adding it to the cache.
3613         (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
3614         Call willSendRedirectedRequest to make sure the cached redirect is validated.
3615         * NetworkProcess/NetworkResourceLoader.h:
3616
3617 2018-05-23  Carlos Garcia Campos  <cgarcia@igalia.com>
3618
3619         [GTK] WebDriver: implement AutomationSessionClient::didDisconnectFromRemote
3620         https://bugs.webkit.org/show_bug.cgi?id=185866
3621
3622         Reviewed by Brian Burg.
3623
3624         To handle the case of the session being closed by the browser, for example in case of a network process
3625         crash. This is currently causing WebDriver tests to timeout in the bot.
3626
3627         * UIProcess/API/glib/WebKitAutomationSession.cpp: Add an implementation of didDisconnectFromRemote() to notify
3628         the WebContext that the session will be closed.
3629         * UIProcess/API/glib/WebKitWebContext.cpp: Remove the automation session when closed.
3630         * UIProcess/API/glib/WebKitWebContextPrivate.h:
3631
3632 2018-05-22  Brent Fulgham  <bfulgham@apple.com>
3633
3634         Close access to "lsopen" for non-UI process
3635         https://bugs.webkit.org/show_bug.cgi?id=185890
3636         <rdar://problem/39686511>
3637
3638         Reviewed by Alexey Proskuryakov.
3639
3640         Close down access to 'lsopen' in the iOS sandboxes. These operations are
3641         performed by the UIProcess on behalf of these helper processes.
3642
3643         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
3644         * Resources/SandboxProfiles/ios/com.apple.WebKit.Storage.sb:
3645         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3646
3647 2018-05-22  Dean Jackson  <dino@apple.com>
3648
3649         Optimized path zoom animation needs a valid UIImage and CGRect
3650         https://bugs.webkit.org/show_bug.cgi?id=185883
3651         <rdar://problem/40306056>
3652
3653         Reviewed by Jon Lee.
3654
3655         Take the rectangle that was passed into the ResourceRequest and
3656         use it for the origin of an animation into QuickLook.
3657
3658         * Shared/WebCoreArgumentCoders.cpp:
3659         (IPC::ArgumentCoder<ResourceRequest>::encode):
3660         (IPC::ArgumentCoder<ResourceRequest>::decode):
3661         * UIProcess/Cocoa/DownloadClient.mm:
3662         (WebKit::DownloadClient::didStart):
3663         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
3664         (-[_WKPreviewControllerDelegate initWithSystemPreviewController:fromRect:]):
3665         (-[_WKPreviewControllerDelegate presentingViewController]):
3666         (-[_WKPreviewControllerDelegate previewController:frameForPreviewItem:inSourceView:]):
3667         (-[_WKPreviewControllerDelegate previewController:transitionImageForPreviewItem:contentRect:]):
3668         (WebKit::SystemPreviewController::start):
3669         (-[_WKPreviewControllerDelegate initWithSystemPreviewController:]): Deleted.
3670         * UIProcess/Downloads/DownloadProxy.h:
3671         (WebKit::DownloadProxy::systemPreviewDownloadRect const):
3672         * UIProcess/SystemPreviewController.h:
3673         * UIProcess/WebPageProxy.cpp:
3674         (WebKit::WebPageProxy::syncRootViewToScreen):
3675         * UIProcess/WebPageProxy.h:
3676
3677 2018-05-22  Sihui Liu  <sihui_liu@apple.com>
3678
3679         [iOS] TestWebKitAPI.WebKit.WKHTTPCookieStoreWithoutProcessPool fails because cookies use different files with/without processpool
3680         https://bugs.webkit.org/show_bug.cgi?id=185831
3681
3682         Reviewed by Chris Dumez.
3683
3684         Started to use uiProcessCookieStorageIdentifier for iOS: make sure cookies handled without 
3685         processpool would use the same storage file as when processpool exists.
3686
3687         * NetworkProcess/NetworkProcess.h:
3688         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3689         (WebKit::NetworkProcessCreationParameters::encode const):
3690         (WebKit::NetworkProcessCreationParameters::decode):
3691         * NetworkProcess/NetworkProcessCreationParameters.h:
3692         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3693         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
3694         * Shared/WebProcessCreationParameters.cpp:
3695         (WebKit::WebProcessCreationParameters::encode const):
3696         (WebKit::WebProcessCreationParameters::decode):
3697         * Shared/WebProcessCreationParameters.h:
3698         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3699         (WebKit::WebProcessPool::platformInitializeWebProcess):
3700         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
3701
3702 2018-05-22  Chris Dumez  <cdumez@apple.com>
3703
3704         Regression(AsyncPolicyDelegates): Box.app login Window is blank
3705         https://bugs.webkit.org/show_bug.cgi?id=185832
3706         <rdar://problem/40307871>
3707
3708         Reviewed by Geoffrey Garen.
3709
3710         Moved WeakObjCPtr.h header from WebKit/ to wtf/ so that it can be used in
3711         WebKitLegacy code.
3712
3713         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
3714         * UIProcess/API/Cocoa/WKBrowsingContextControllerInternal.h:
3715         * UIProcess/API/Cocoa/WKConnection.mm:
3716         * UIProcess/API/Cocoa/WKHTTPCookieStore.mm:
3717         * UIProcess/API/Cocoa/WKProcessGroup.mm:
3718         * UIProcess/API/Cocoa/WKProcessPool.mm:
3719         * UIProcess/API/Cocoa/WKScriptMessage.mm:
3720         * UIProcess/API/Cocoa/WKWebView.mm:
3721         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3722         * UIProcess/API/Cocoa/_WKAutomationSession.mm:
3723         * UIProcess/API/Cocoa/_WKDownload.mm:
3724         * UIProcess/API/Cocoa/_WKElementAction.mm:
3725         * UIProcess/ApplicationStateTracker.h:
3726         * UIProcess/Cocoa/AutomationClient.h:
3727         * UIProcess/Cocoa/AutomationSessionClient.h:
3728         * UIProcess/Cocoa/DiagnosticLoggingClient.h:
3729         * UIProcess/Cocoa/DownloadClient.h:
3730         * UIProcess/Cocoa/FindClient.h:
3731         * UIProcess/Cocoa/FullscreenClient.h:
3732         * UIProcess/Cocoa/IconLoadingDelegate.h:
3733         * UIProcess/Cocoa/NavigationState.h:
3734         * UIProcess/Cocoa/UIDelegate.h:
3735         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
3736         * UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm:
3737         * UIProcess/Cocoa/WebViewImpl.h:
3738         * UIProcess/ios/ViewGestureControllerIOS.mm:
3739         * UIProcess/ios/WKActionSheetAssistant.mm:
3740         * UIProcess/ios/WKContentViewInteraction.mm:
3741         * UIProcess/ios/WKPDFView.mm:
3742         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
3743         * UIProcess/ios/WKScrollView.mm:
3744         * UIProcess/mac/WKInspectorViewController.mm:
3745         * UIProcess/mac/WKInspectorWKWebView.mm:
3746         * WebKit.xcodeproj/project.pbxproj:
3747         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
3748
3749 2018-05-22  Sihui Liu  <sihui_liu@apple.com>
3750
3751         Conversion between SecurityOriginData and DatabaseIdentifier is asymmetric when port is null
3752         https://bugs.webkit.org/show_bug.cgi?id=185715
3753
3754         Reviewed by Geoffrey Garen.
3755
3756         Add getter for origins in WKWebsiteDataRecord for testing.
3757
3758         * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm:
3759         (-[WKWebsiteDataRecord _originsString]):
3760         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
3761
3762
3763 2018-05-22  Brady Eidson  <beidson@apple.com>
3764
3765         Rename the "Web content is visible" process assertion.
3766         https://bugs.webkit.org/show_bug.cgi?id=185878
3767
3768         Reviewed by Chris Dumez.
3769
3770         * UIProcess/ios/ProcessAssertionIOS.mm:
3771         (WebKit::ProcessAssertion::ProcessAssertion):
3772
3773 2018-05-22  Andy Estes  <aestes@apple.com>
3774
3775         [Wi-Fi Assertions] Drop assertions on process suspension
3776         https://bugs.webkit.org/show_bug.cgi?id=185844
3777         <rdar://problem/40352319>
3778
3779         Reviewed by Daniel Bates.
3780
3781         * NetworkProcess/NetworkProcess.cpp:
3782         (WebKit::NetworkProcess::actualPrepareToSuspend):
3783         (WebKit::NetworkProcess::processDidResume):
3784         * NetworkProcess/NetworkProcess.h:
3785         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3786         (WebKit::NetworkProcess::platformPrepareToSuspend):
3787         (WebKit::NetworkProcess::platformProcessDidResume):
3788
3789 2018-05-22  Brent Fulgham  <bfulgham@apple.com>
3790
3791         REGRESSION(r229093): Re-enable Network Extension support in the WebContent process (Take 2)
3792         https://bugs.webkit.org/show_bug.cgi?id=185874
3793         <rdar://problem/40454404>
3794
3795         Reviewed by Eric Carlson.
3796
3797         Add back a necessary XPC connection after locking down the network features in r229093.
3798
3799         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3800         * WebProcess/com.apple.WebProcess.sb.in:
3801
3802 2018-05-22  Ryan Haddad  <ryanhaddad@apple.com>
3803
3804         Unreviewed, rolling out r232052.
3805
3806         Breaks internal builds.
3807
3808         Reverted changeset:
3809
3810         "Use more C++17"
3811         https://bugs.webkit.org/show_bug.cgi?id=185176
3812         https://trac.webkit.org/changeset/232052
3813
3814 2018-05-22  Alberto Garcia  <berto@igalia.com>
3815
3816         [CMake] Properly detect compiler flags, needed libs, and fallbacks for usage of 64-bit atomic operations
3817         https://bugs.webkit.org/show_bug.cgi?id=182622
3818         <rdar://problem/40292317>
3819
3820         Reviewed by Michael Catanzaro.
3821
3822         Move the test to determine whether we need to link against
3823         libatomic to the common file WebKitCompilerFlags.cmake so it can
3824         also be used for JavaScriptCore.
3825
3826         * CMakeLists.txt:
3827
3828 2018-05-22  Michael Catanzaro  <mcatanzaro@igalia.com>
3829
3830         Unreviewed, rolling out r231843.
3831
3832         Broke cross build
3833
3834         Reverted changeset:
3835
3836         "[CMake] Properly detect compiler flags, needed libs, and
3837         fallbacks for usage of 64-bit atomic operations"
3838         https://bugs.webkit.org/show_bug.cgi?id=182622
3839         https://trac.webkit.org/changeset/231843
3840
3841 2018-05-22  Carlos Garcia Campos  <cgarcia@igalia.com>
3842
3843         Crash when loading a SVG image
3844         https://bugs.webkit.org/show_bug.cgi?id=185819
3845
3846         Reviewed by Brent Fulgham.
3847
3848         This is happening in WebLoaderStrategy::scheduleLoad() when getting the value of
3849         FrameLoaderClient::pageID(). SVGImage uses the empty clients for the loader, and
3850         EmptyFrameLoaderClient::pageID() returns std::nullopt. The same happens with the frameID. This changed in
3851         r225934, when pageID() and frameID() were changed to return std::optional, EmptyFrameLoaderClient was updated to
3852         return std::nullopt instead of 0.
3853
3854         * WebProcess/Network/WebLoaderStrategy.cpp:
3855         (WebKit::WebLoaderStrategy::scheduleLoad): Use value_or(0) instead of value() to get pageID and frameID from
3856         FrameLoaderClient.
3857
3858 2018-05-21  Yusuke Suzuki  <utatane.tea@gmail.com>
3859
3860         Use more C++17
3861         https://bugs.webkit.org/show_bug.cgi?id=185176
3862
3863         Reviewed by JF Bastien.
3864
3865         * Configurations/Base.xcconfig:
3866         * DerivedSources.make:
3867
3868 2018-05-21  Carlos Garcia Campos  <cgarcia@igalia.com>
3869
3870         [GTK][Wayland] UI process crash when closing the window
3871         https://bugs.webkit.org/show_bug.cgi?id=185818
3872
3873         Reviewed by Michael Catanzaro.
3874
3875         This happens when a page containing a text field is loaded but the focus remains in the url bar when the window
3876         is closed. This is because we are sending a notify-in to the IM context, but the focus is still in the URL
3877         bar. That confuses the wayland input method manager that tries to free the text of the web view IM context that has
3878         already been deleted.
3879
3880         * UIProcess/gtk/InputMethodFilter.cpp:
3881         (WebKit::InputMethodFilter::setEnabled): Only send notify-in if the view is actually focused.
3882
3883 2018-05-21  Ryosuke Niwa  <rniwa@webkit.org>
3884
3885         Remove unused and no-op WKContextSetCookieStorageDirectory
3886         https://bugs.webkit.org/show_bug.cgi?id=185857
3887
3888         Reviewed by Youenn Fablet.
3889
3890         Deleted C API which didn't do anything useful, and consequently not used by anyone.
3891
3892         * UIProcess/API/C/WKContext.cpp:
3893         (WKContextSetCookieStorageDirectory): Deleted.
3894         * UIProcess/API/C/WKContextPrivate.h:
3895         * UIProcess/WebProcessPool.h:
3896
3897 2018-05-21  Chris Nardi  <cnardi@chromium.org>
3898
3899         Remove dead exception in MediaList.appendMedium
3900         https://bugs.webkit.org/show_bug.cgi?id=185278
3901
3902         Reviewed by Chris Dumez.
3903
3904         Remove code pertaining to an exception being thrown by appendMedium().
3905
3906         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMediaList.cpp:
3907         (webkit_dom_media_list_append_medium):
3908
3909 2018-05-21  Aditya Keerthi  <akeerthi@apple.com>
3910
3911         [iOS] Click events only fire once when editing
3912         https://bugs.webkit.org/show_bug.cgi?id=185777
3913
3914         Reviewed by Tim Horton.
3915
3916         gestureRecognizerShouldBegin: was returning false for the single tap gesture when a node was being
3917         edited. This is an artifact of how the gesture was previously handled with the text selection assistant.
3918         This condition is now removed, allowing the single tap gesture to go through and correctly propagate the
3919         click event.
3920
3921         Also added an early return to _didGetTapHighlightForRequest: in order to prevent the tap highlight from
3922         being shown when the node is already being assisted.
3923
3924         * UIProcess/ios/WKContentViewInteraction.mm:
3925         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:]):
3926         (-[WKContentView gestureRecognizerShouldBegin:]):
3927
3928 2018-05-21  Daniel Bates  <dabates@apple.com>
3929
3930         REGRESSION (r231107): CSP report-only policies are ignored for beacon, importScripts, fetch(), EventSource, and XHR
3931         https://bugs.webkit.org/show_bug.cgi?id=185789
3932         <rdar://problem/40380175>
3933
3934         Reviewed by Andy Estes.
3935
3936         Have NetworkLoadChecker implement the ContentSecurityPolicyClient interface and support logging
3937         console messages, sending CSP reports, and dispatching SecurityPolicyViolation events.
3938
3939         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3940         (WebKit::NetworkConnectionToWebProcess::loadPing):
3941         * NetworkProcess/NetworkLoadChecker.cpp:
3942         (WebKit::NetworkLoadChecker::NetworkLoadChecker): Modified to take a reference to the NetworkConnectionToWebProcess,
3943         the web page ID, the web frame ID, and the resource load identifier. These details are necessary
3944         in order to implement the ContentSecurityPolicyClient interface.
3945         (WebKit::NetworkLoadChecker::isAllowedByContentSecurityPolicy): Added.
3946         (WebKit::NetworkLoadChecker::continueCheckingRequest): Write in terms of isAllowedByContentSecurityPolicy().
3947         (WebKit::NetworkLoadChecker::contentSecurityPolicy): Pass ourself as the client so that we receive
3948         delegate callbacks.
3949         (WebKit::NetworkLoadChecker::addConsoleMessage): Added.
3950         (WebKit::NetworkLoadChecker::sendCSPViolationReport): Added.
3951         (WebKit::NetworkLoadChecker::enqueueSecurityPolicyViolationEvent): Added.
3952         * NetworkProcess/NetworkLoadChecker.h:
3953         * NetworkProcess/NetworkResourceLoader.cpp:
3954         (NetworkResourceLoader::enqueueSecurityPolicyViolationEvent): Added.
3955         * NetworkProcess/NetworkResourceLoader.h:
3956         * NetworkProcess/PingLoad.cpp:
3957         (WebKit::PingLoad::PingLoad): Modified to take a reference to the NetworkConnectionToWebProcess and pass
3958         this through to the NetworkLoadChecker along with the web page ID, web frame ID and resource load identifier.
3959         * NetworkProcess/PingLoad.h:
3960         * WebProcess/WebPage/WebPage.cpp:
3961         (WebKit::WebPage::enqueueSecurityPolicyViolationEvent): Added.
3962         * WebProcess/WebPage/WebPage.h:
3963         * WebProcess/WebPage/WebPage.messages.in: Add message EnqueueSecurityPolicyViolationEvent.
3964
3965 2018-05-21  Brian Burg  <bburg@apple.com>
3966
3967         Web Automation: always return an empty cookie list if document.cookieURL() is empty
3968         https://bugs.webkit.org/show_bug.cgi?id=185838
3969         <rdar://problem/37737526>
3970
3971         Reviewed by Tim Horton.
3972
3973         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
3974         (WebKit::WebAutomationSessionProxy::getCookiesForFrame):
3975         This crashes in CFNetwork code because an empty cookie URL is not a valid input.
3976         Just return an empty list since there couldn't be any cookies returned.
3977
3978 2018-05-21  Brian Burg  <bburg@apple.com>
3979
3980         Web Automation: terminate the automation session if the network or storage process crashes
3981         https://bugs.webkit.org/show_bug.cgi?id=185827
3982         <rdar://problem/40424020>
3983
3984         Reviewed by Tim Horton.
3985
3986         If one of the processes crashes, the page may be in an undefined state and
3987         automation will fail in unpredictable ways. It's better to just give up immediately.
3988
3989         * UIProcess/WebProcessPool.cpp:
3990         (WebKit::WebProcessPool::networkProcessFailedToLaunch):
3991         (WebKit::WebProcessPool::storageProcessCrashed):
3992
3993 2018-05-21  Sihui Liu  <sihui_liu@apple.com>
3994
3995         Add a diskCacheSizeOverride accessor function on WKContextConfigurationRef
3996         https://bugs.webkit.org/show_bug.cgi?id=185826
3997         <rdar://problem/39732113>
3998
3999         Reviewed by Alex Christensen.
4000
4001         * UIProcess/API/C/WKContextConfigurationRef.cpp:
4002         (WKContextConfigurationDiskCacheSizeOverride):
4003         (WKContextConfigurationSetDiskCacheSizeOverride):
4004         * UIProcess/API/C/WKContextConfigurationRef.h:
4005
4006 2018-05-21  Jer Noble  <jer.noble@apple.com>
4007
4008         Complete fix for enabling modern EME by default
4009         https://bugs.webkit.org/show_bug.cgi?id=185770
4010         <rdar://problem/40368220>
4011
4012         Reviewed by Eric Carlson.
4013
4014         * Configurations/FeatureDefines.xcconfig:
4015
4016 2018-05-21  Sam Weinig  <sam@webkit.org>
4017
4018         Modernize RenderStyleConstants.h - Part 1
4019         https://bugs.webkit.org/show_bug.cgi?id=185809
4020
4021  &nb