Black flash in content area when returning to Mail
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-07-16  Tim Horton  <timothy_horton@apple.com>
2
3         Black flash in content area when returning to Mail
4         https://bugs.webkit.org/show_bug.cgi?id=187719
5         <rdar://problem/42165340>
6
7         Reviewed by Wenson Hsieh.
8
9         * UIProcess/ios/WebPageProxyIOS.mm:
10         (WebKit::WebPageProxy::applicationDidFinishSnapshottingAfterEnteringBackground):
11         This still reproduces sometimes even after r233723, because:
12
13         If a pending commit arrives after ApplicationDidEnterBackground (when we
14         ask the web content process to freeze the layer tree), and after
15         ApplicationDidFinishSnapshottingAfterEnteringBackground (when we hide
16         WKContentView), but before the process sleeps, it will cause WKContentView
17         to be unhidden (potentially including layers with empty surfaces as contents).
18         Nothing will re-hide WKContentView. Instead, we should wait for the next
19         *pending* commit, which will necessarily not come until after the application
20         returns to the foreground because of the strict IPC ordering between
21         the message that freezes the layer tree and the "next commit" mechanism.
22
23 2018-07-16  Said Abou-Hallawa  <sabouhallawa@apple.com>
24
25         [iOS] When bringing MobileSafari to the foreground, images, which are pending decoding, won't be drawn into the immediate-paint transaction
26         https://bugs.webkit.org/show_bug.cgi?id=187375
27
28         Reviewed by Simon Fraser.
29
30         For immediate-paint transaction, we should force all the images which are 
31         pending decoding to be repainted before building this transaction.
32
33         * WebProcess/Plugins/PDF/PDFPlugin.mm:
34         (WebKit::PDFPlugin::updateControlTints):
35         * WebProcess/Plugins/PluginView.cpp:
36         (WebKit::PluginView::paint):
37         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
38         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
39
40 2018-07-11  Dean Jackson  <dino@apple.com>
41
42         Allow removal of white backgrounds
43         https://bugs.webkit.org/show_bug.cgi?id=187574
44         <rdar://problem/41146792>
45
46         Reviewed by Simon Fraser.
47
48         Add a new WebPreference for punching out white backgrounds.
49
50         * Shared/WebPreferences.yaml:
51         * UIProcess/API/C/WKPreferences.cpp:
52         (WKPreferencesSetPunchOutWhiteBackgroundsInDarkMode):
53         (WKPreferencesGetPunchOutWhiteBackgroundsInDarkMode):
54         * UIProcess/API/C/WKPreferencesRefPrivate.h:
55         * UIProcess/API/Cocoa/WKWebView.mm:
56         (-[WKWebView _initializeWithConfiguration:]):
57         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
58         (-[WKWebViewConfiguration init]):
59         (-[WKWebViewConfiguration copyWithZone:]):
60         (-[WKWebViewConfiguration _punchOutWhiteBackgroundsInDarkMode]):
61         (-[WKWebViewConfiguration _setPunchOutWhiteBackgroundsInDarkMode:]):
62         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
63
64 2018-07-16  Aditya Keerthi  <akeerthi@apple.com>
65
66         [Datalist][macOS] Add suggestions UI for TextFieldInputTypes
67         https://bugs.webkit.org/show_bug.cgi?id=186531
68
69         Reviewed by Tim Horton.
70
71         Created WebDataListSuggestionsDropdownMac as a wrapper around the suggestions
72         view. The suggestions for TextFieldInputTypes are displayed using an NSTableView
73         in it's own child window. This is done so that suggestions can be presented
74         outside of the page if the parent window's size is too small. The maximum number
75         of suggestions that are visible at one time is 6, with additional suggestions made
76         available by scrolling.
77
78         Suggestions in the view can be selected via click or by using arrow keys. If the
79         input element associated with the suggestions is blurred, or the page is moved in
80         any way, the suggestions view is hidden.
81
82         Added IPC messages to the UIProcess to enable the display of the suggestions view.
83         This required a new ArgumentCoder for DataListSuggestionInformation.
84
85         * Shared/WebCoreArgumentCoders.cpp:
86         (IPC::ArgumentCoder<DataListSuggestionInformation>::encode):
87         (IPC::ArgumentCoder<DataListSuggestionInformation>::decode):
88         * Shared/WebCoreArgumentCoders.h:
89         * UIProcess/PageClient.h:
90         * UIProcess/WebDataListSuggestionsDropdown.cpp: Copied from Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h.
91         (WebKit::WebDataListSuggestionsDropdown::WebDataListSuggestionsDropdown):
92         (WebKit::WebDataListSuggestionsDropdown::~WebDataListSuggestionsDropdown):
93         (WebKit::WebDataListSuggestionsDropdown::close):
94         * UIProcess/WebDataListSuggestionsDropdown.h: Copied from Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h.
95         (WebKit::WebDataListSuggestionsDropdown::Client::~Client):
96         * UIProcess/WebPageProxy.cpp:
97         (WebKit::WebPageProxy::viewWillStartLiveResize):
98         (WebKit::WebPageProxy::viewDidLeaveWindow):
99         (WebKit::WebPageProxy::handleWheelEvent):
100         (WebKit::WebPageProxy::setPageZoomFactor):
101         (WebKit::WebPageProxy::setPageAndTextZoomFactors):
102         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
103         (WebKit::WebPageProxy::pageDidScroll):
104         (WebKit::WebPageProxy::showDataListSuggestions):
105         (WebKit::WebPageProxy::handleKeydownInDataList):
106         (WebKit::WebPageProxy::endDataListSuggestions):
107         (WebKit::WebPageProxy::didCloseSuggestions):
108         (WebKit::WebPageProxy::didSelectOption):
109         (WebKit::WebPageProxy::resetState):
110         (WebKit::WebPageProxy::closeOverlayedViews):
111         * UIProcess/WebPageProxy.h:
112         * UIProcess/WebPageProxy.messages.in:
113         * UIProcess/ios/PageClientImplIOS.h:
114         * UIProcess/ios/PageClientImplIOS.mm:
115         (WebKit::PageClientImpl::createDataListSuggestionsDropdown):
116         * UIProcess/mac/PageClientImplMac.h:
117         * UIProcess/mac/PageClientImplMac.mm:
118         (WebKit::PageClientImpl::createDataListSuggestionsDropdown):
119         * UIProcess/mac/WebDataListSuggestionsDropdownMac.h: Copied from Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h.
120         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm: Added.
121         (WebKit::WebDataListSuggestionsDropdownMac::create):
122         (WebKit::WebDataListSuggestionsDropdownMac::~WebDataListSuggestionsDropdownMac):
123         (WebKit::WebDataListSuggestionsDropdownMac::WebDataListSuggestionsDropdownMac):
124         (WebKit::WebDataListSuggestionsDropdownMac::show):
125         (WebKit::WebDataListSuggestionsDropdownMac::didSelectOption):
126         (WebKit::WebDataListSuggestionsDropdownMac::selectOption):
127         (WebKit::WebDataListSuggestionsDropdownMac::handleKeydownWithIdentifier):
128         (WebKit::WebDataListSuggestionsDropdownMac::close):
129         (-[WKDataListSuggestionCell initWithFrame:]):
130         (-[WKDataListSuggestionCell setText:]):
131         (-[WKDataListSuggestionCell setActive:]):
132         (-[WKDataListSuggestionCell drawRect:]):
133         (-[WKDataListSuggestionCell mouseEntered:]):
134         (-[WKDataListSuggestionCell mouseExited:]):
135         (-[WKDataListSuggestionCell acceptsFirstResponder]):
136         (-[WKDataListSuggestionTable initWithElementRect:]):
137         (-[WKDataListSuggestionTable setVisibleRect:]):
138         (-[WKDataListSuggestionTable currentActiveRow]):
139         (-[WKDataListSuggestionTable setActiveRow:]):
140         (-[WKDataListSuggestionTable reload]):
141         (-[WKDataListSuggestionTable acceptsFirstResponder]):
142         (-[WKDataListSuggestionTable enclosingScrollView]):
143         (-[WKDataListSuggestionTable removeFromSuperviewWithoutNeedingDisplay]):
144         (-[WKDataListSuggestionsView initWithInformation:inView:]):
145         (-[WKDataListSuggestionsView currentSelectedString]):
146         (-[WKDataListSuggestionsView updateWithInformation:]):
147         (-[WKDataListSuggestionsView moveSelectionByDirection:]):
148         (-[WKDataListSuggestionsView invalidate]):
149         (-[WKDataListSuggestionsView dropdownRectForElementRect:]):
150         (-[WKDataListSuggestionsView showSuggestionsDropdown:]):
151         (-[WKDataListSuggestionsView selectedRow:]):
152         (-[WKDataListSuggestionsView numberOfRowsInTableView:]):
153         (-[WKDataListSuggestionsView tableView:heightOfRow:]):
154         (-[WKDataListSuggestionsView tableView:viewForTableColumn:row:]):
155         * WebKit.xcodeproj/project.pbxproj:
156         * WebProcess/WebCoreSupport/WebDataListSuggestionPicker.cpp:
157         (WebKit::WebDataListSuggestionPicker::handleKeydownWithIdentifier):
158         (WebKit::WebDataListSuggestionPicker::didSelectOption):
159         (WebKit::WebDataListSuggestionPicker::didCloseSuggestions):
160         (WebKit::WebDataListSuggestionPicker::close):
161         (WebKit::WebDataListSuggestionPicker::displayWithActivationType):
162         * WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h:
163
164 2018-07-16  Jeremy Jones  <jeremyj@apple.com>
165
166         Fullscreen requires active document.
167         https://bugs.webkit.org/show_bug.cgi?id=186226
168         rdar://problem/36187413
169
170         Reviewed by Jer Noble.
171
172         This change guarantees the document to be visible for both element fullscreen and video fullscreen.
173
174         User gesture is not enough to guarantee that the document is visible when fullscreen is initiated
175         because JavaScript can spin wait before initiating fullscreen. During that spin the page or window might
176         be hidden.
177
178         Document::hidden() can't be relied upon because it won't update while JavaScript spins.
179
180         This change adds a sync call to the UI process to get the current UI visibility state.
181
182         * UIProcess/WebPageProxy.cpp:
183         (WebKit::WebPageProxy::getIsViewVisible):
184         * UIProcess/WebPageProxy.h:
185         * UIProcess/WebPageProxy.messages.in:
186         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
187         (WebKit::WebChromeClient::isViewVisible):
188         * WebProcess/WebCoreSupport/WebChromeClient.h:
189
190 2018-07-16  Tim Horton  <timothy_horton@apple.com>
191
192         REGRESSION (r233502): Camera in <input type=file> becomes unresponsive after attempting to dismiss it
193         https://bugs.webkit.org/show_bug.cgi?id=187706
194         <rdar://problem/42137088>
195
196         Reviewed by Wenson Hsieh.
197
198         * UIProcess/ios/forms/WKFileUploadPanel.mm:
199         Remove an unused member.
200
201         (-[WKFileUploadPanel _dismissDisplayAnimated:]):
202         Allow us to dismiss the camera view controller in addition to the menu.
203
204 2018-07-16  Alex Christensen  <achristensen@webkit.org>
205
206         Reduce size of NetworkLoadMetrics and therefore ResourceResponse
207         https://bugs.webkit.org/show_bug.cgi?id=187671
208
209         Reviewed by Darin Adler.
210
211         * Shared/WebCoreArgumentCoders.h:
212
213 2018-07-16  Sihui Liu  <sihui_liu@apple.com>
214
215         IndexedDB: closeAndDeleteDatabasesForOrigins should remove all databases for those origins
216         https://bugs.webkit.org/show_bug.cgi?id=187631
217         <rdar://problem/42164227>
218
219         Reviewed by Brady Eidson.
220
221         We need to return all origins, both openingOrigin and mainFrameOrigin, of IndexedDB so users
222         could be better aware of which origins are using databases and decide what they want to 
223         remove.
224
225         * StorageProcess/StorageProcess.cpp:
226         (WebKit::StorageProcess::indexedDatabaseOrigins):
227         * StorageProcess/StorageProcess.h:
228
229 2018-07-15  Carlos Garcia Campos  <cgarcia@igalia.com>
230
231         [SOUP] http/tests/misc/bubble-drag-events.html crashes
232         https://bugs.webkit.org/show_bug.cgi?id=182352
233
234         Reviewed by Youenn Fablet.
235
236         PingLoad is not refcounted and deletes itself when the load finishes. The problem is that the network data
237         task can also finish the load, causing the PingLoad to be deleted early. We tried to fix it in r233032 in the
238         network data task soup implementation, but it caused regressions.
239
240         * NetworkProcess/PingLoad.cpp:
241         (WebKit::PingLoad::didReceiveChallenge): Create a weak ref for the ping load before calling the operation completion
242         handler and return early after the completion handler if it was deleted.
243         (WebKit::PingLoad::didReceiveResponseNetworkSession): Ditto.
244         * NetworkProcess/PingLoad.h:
245         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
246         (WebKit::NetworkDataTaskSoup::continueAuthenticate): Revert r233032.
247
248 2018-07-13  Timothy Hatcher  <timothy@apple.com>
249
250         Add _drawsBackground to WKWebViewConfiguration.
251         https://bugs.webkit.org/show_bug.cgi?id=187665
252         rdar://problem/42182268
253
254         Reviewed by Tim Horton.
255
256         * UIProcess/API/APIPageConfiguration.cpp:
257         (API::PageConfiguration::copy const): Copy m_drawsBackground, and some missing values.
258         * UIProcess/API/APIPageConfiguration.h:
259         (API::PageConfiguration::drawsBackground const): Added.
260         (API::PageConfiguration::setDrawsBackground): Added.
261         * UIProcess/API/Cocoa/WKWebView.mm:
262         (-[WKWebView _initializeWithConfiguration:]): Transfer _drawsBackground to page config.
263         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
264         (-[WKWebViewConfiguration init]): Set _drawsBackground to YES.
265         (-[WKWebViewConfiguration encodeWithCoder:]): Encode _drawsBackground.
266         (-[WKWebViewConfiguration initWithCoder:]): Decode _drawsBackground.
267         (-[WKWebViewConfiguration copyWithZone:]): Copy _drawsBackground.
268         (-[WKWebViewConfiguration _drawsBackground]): Added.
269         (-[WKWebViewConfiguration _setDrawsBackground:]): Added.
270         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
271         * UIProcess/WebPageProxy.cpp: Set m_drawsBackground based on configuration.
272
273 2018-07-13  Tim Horton  <timothy_horton@apple.com>
274
275         WebKit sometimes holds WiFi/BT assertions while the Networking process is suspended
276         https://bugs.webkit.org/show_bug.cgi?id=187662
277         <rdar://problem/41999448>
278
279         Reviewed by Chris Dumez.
280
281         Inform WiFiAssertions when the Networking process is first going into the background,
282         so it has a chance of dropping its assertions even in cases where the system
283         suspends the process before we receive prepareToSuspend.
284
285         * NetworkProcess/NetworkProcess.cpp:
286         (WebKit::NetworkProcess::processDidTransitionToForeground):
287         (WebKit::NetworkProcess::processDidTransitionToBackground):
288         * NetworkProcess/NetworkProcess.h:
289         * NetworkProcess/NetworkProcess.messages.in:
290         * NetworkProcess/curl/NetworkProcessCurl.cpp:
291         (WebKit::NetworkProcess::platformProcessDidTransitionToForeground):
292         (WebKit::NetworkProcess::platformProcessDidTransitionToBackground):
293         * NetworkProcess/soup/NetworkProcessSoup.cpp:
294         (WebKit::NetworkProcess::platformProcessDidTransitionToForeground):
295         (WebKit::NetworkProcess::platformProcessDidTransitionToBackground):
296         * UIProcess/Network/NetworkProcessProxy.cpp:
297         (WebKit::NetworkProcessProxy::sendProcessDidTransitionToForeground):
298         (WebKit::NetworkProcessProxy::sendProcessDidTransitionToBackground):
299         * UIProcess/Network/NetworkProcessProxy.h:
300         * UIProcess/WebProcessPool.cpp:
301         (WebKit::WebProcessPool::updateProcessAssertions):
302         Plumb the foreground/background transition to NetworkProcess.
303
304         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
305         (WebKit::NetworkProcess::platformPrepareToSuspend):
306         (WebKit::NetworkProcess::platformProcessDidTransitionToBackground):
307         (WebKit::NetworkProcess::platformProcessDidTransitionToForeground):
308         Make use of SuspensionReason to explain to WiFiAssertions the
309         difference between prepareToSuspend and didTransitionToBackground,
310         so that it can adjust the timing of dropping the assertion.
311
312 2018-07-13  Tim Horton  <timothy_horton@apple.com>
313
314         REGRESSION (r231676): watchOS WebKit usually doesn't load in the background
315         https://bugs.webkit.org/show_bug.cgi?id=187663
316         <rdar://problem/42181185>
317
318         Reviewed by Chris Dumez.
319
320         * UIProcess/ios/WebPageProxyIOS.mm:
321         (WebKit::WebPageProxy::applicationDidEnterBackground):
322         "Screen lock" is very aggressive on watchOS; we want to do our usual
323         30 seconds of loading in the background when you drop your wrist,
324         so disable this power optimization on that platform.
325
326 2018-07-13  Chris Dumez  <cdumez@apple.com>
327
328         WebResourceLoader may try to send a IPC with a destination ID that is 0
329         https://bugs.webkit.org/show_bug.cgi?id=187654
330         <rdar://problem/39265927>
331
332         Reviewed by Brady Eidson.
333
334         WebResourceLoader may try to send a IPC with a destination ID that is 0 according to release
335         assertion hits we see in the wild. This can lead to HashMap corruption on recipient side when
336         trying to lookup a key that is 0.
337
338         As per the crash traces, we see it starts from WebLoaderStrategy::internallyFailedLoadTimerFired()
339         which is likely due to the Network process crashing. WebLoaderStrategy::networkProcessCrashed()
340         calls scheduleInternallyFailedLoad() on each ResourceLoader and clears the WebResourceLoaders in
341         m_webResourceLoaders. When a ResourceLoader is cancelled (marked as failed), we clear its identifier
342         and we normally null out the WebLoaderStrategy's coreLoader. However, if we cannot find the
343         WebResourceLoader in m_webResourceLoaders (because that map was already cleared) then the
344         WebResourceLoader's coreLoader may not get nulled out, even if the coreLoader's identifier has
345         been reset. We have 2 lambdas in WebResourceLoader which keep the WebResourceLoader alive and
346         try to send IPC and are merely doing a null check on the coreLoader before trying to send the
347         IPC.
348
349         To address the issue, we now clear the WebResourceLoader's coreLoader in
350         WebLoaderStrategy::networkProcessCrashed(). For robustness, we also check that a coreLoader's
351         identifier is not 0 before trying to send IPC.
352
353         * WebProcess/Network/WebLoaderStrategy.cpp:
354         (WebKit::WebLoaderStrategy::networkProcessCrashed):
355         * WebProcess/Network/WebResourceLoader.cpp:
356         (WebKit::WebResourceLoader::willSendRequest):
357         (WebKit::WebResourceLoader::didReceiveResponse):
358
359 2018-07-13  Zach Li  <zachli@apple.com>
360
361         Allow BOCOM and ABC plug-ins to run unsandboxed
362         https://bugs.webkit.org/show_bug.cgi?id=187652
363         rdar://problem/42149182
364
365         Reviewed by Youenn Fablet.
366
367         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
368         (WebKit::PluginInfoStore::shouldAllowPluginToRunUnsandboxed):
369
370 2018-07-13  Chris Dumez  <cdumez@apple.com>
371
372         Add more threading release assertions
373         https://bugs.webkit.org/show_bug.cgi?id=187647
374
375         Reviewed by Alex Christensen.
376
377         Add more threading release assertions to help debug <rdar://problem/39265927>.
378
379         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
380         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
381         (WebKit::NetworkConnectionToWebProcess::~NetworkConnectionToWebProcess):
382         * UIProcess/WebProcessProxy.cpp:
383         (WebKit::m_isInPrewarmedPool):
384         (WebKit::WebProcessProxy::~WebProcessProxy):
385         (WebKit::WebProcessProxy::shutDown):
386         (WebKit::WebProcessProxy::didFinishLaunching):
387
388 2018-07-13  Christopher Reid  <chris.reid@sony.com>
389
390         [WinCairo] Add windows storage process connection implementation
391         https://bugs.webkit.org/show_bug.cgi?id=187531
392
393         Reviewed by Fujii Hironori.
394
395         * NetworkProcess/NetworkProcess.cpp:
396         * Platform/IPC/Attachment.h:
397         * StorageProcess/StorageProcess.cpp:
398         * UIProcess/Storage/StorageProcessProxy.cpp:
399
400 2018-07-13  Dan Bernstein  <mitz@apple.com>
401
402         [macOS] REGRESSION (r233536): Development WebContent service got opted back into Library Validation
403         https://bugs.webkit.org/show_bug.cgi?id=187640
404
405         Reviewed by Daniel Bates.
406
407         * Scripts/process-webcontent-entitlements.sh: Add the
408           com.apple.security.cs.disable-library-validation to the Development service regardless of
409           whether restricted entitlements are to be used, because that entitlement is not restricted.
410
411 2018-07-13  Chris Dumez  <cdumez@apple.com>
412
413         NetworkConnectionToWebProcess::m_networkResourceLoaders should use Ref<> for its values
414         https://bugs.webkit.org/show_bug.cgi?id=187629
415
416         Reviewed by Youenn Fablet.
417
418         NetworkConnectionToWebProcess::m_networkResourceLoaders should use Ref<> for its values
419         since they cannot be null.
420
421         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
422         (WebKit::NetworkConnectionToWebProcess::didClose):
423         (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
424         (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
425         * NetworkProcess/NetworkConnectionToWebProcess.h:
426
427 2018-07-12  Alex Christensen  <achristensen@webkit.org>
428
429         Reduce size of WebCore::URL
430         https://bugs.webkit.org/show_bug.cgi?id=186820
431
432         Reviewed by Yusuke Suzuki and Youenn Fablet.
433
434         * NetworkProcess/cache/NetworkCacheStorage.h:
435         Increment cache version because of URL encoding change.
436
437 2018-07-12  Chris Dumez  <cdumez@apple.com>
438
439         [Cocoa] Make sure NetworkProcess::createNetworkConnectionToWebProcess() returns a valid mach port
440         https://bugs.webkit.org/show_bug.cgi?id=187625
441
442         Reviewed by Youenn Fablet.
443
444         Make sure NetworkProcess::createNetworkConnectionToWebProcess() returns a valid mach port to help
445         debug <rdar://problem/41995022>.
446
447         * NetworkProcess/NetworkProcess.cpp:
448         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
449         * UIProcess/Network/NetworkProcessProxy.cpp:
450         (WebKit::NetworkProcessProxy::didCreateNetworkConnectionToWebProcess):
451
452 2018-07-12  Chris Dumez  <cdumez@apple.com>
453
454         PingLoad does not need to ref the NetworkConnectionToWebProcess
455         https://bugs.webkit.org/show_bug.cgi?id=187624
456
457         Reviewed by Youenn Fablet.
458
459         PingLoad does not need to ref the NetworkConnectionToWebProcess and keep it alive longer than it needs to be.
460         Instead, ref the IPC::Connection which is lighter weight and gets invalidated when the NetworkConnectionToWebProcess
461         is destroyed.
462
463         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
464         (WebKit::NetworkConnectionToWebProcess::loadPing):
465         (WebKit::NetworkConnectionToWebProcess::didFinishPingLoad): Deleted.
466         * NetworkProcess/NetworkConnectionToWebProcess.h:
467
468 2018-07-12  Brady Eidson  <beidson@apple.com>
469
470         Make process-swap-on-navigation an experimental feature.
471         <rdar://problem/41995053> and https://bugs.webkit.org/show_bug.cgi?id=187558
472
473         Reviewed by Chris Dumez.
474
475         * Shared/WebPreferences.yaml:
476         
477         * UIProcess/API/C/WKPreferences.cpp:
478         (WKPreferencesSetProcessSwapOnNavigationEnabled):
479         (WKPreferencesGetProcessSwapOnNavigationEnabled):
480         * UIProcess/API/C/WKPreferencesRef.h:
481         
482         * UIProcess/WebPreferences.cpp:
483         (WebKit::WebPreferences::updateBoolValueForExperimentalFeatureKey):
484         
485         * UIProcess/WebProcessPool.cpp:
486         (WebKit::WebProcessPool::createWebPage): If the new web page has PSON enabled via WebPreferences,
487           absorb that setting into this process pool's configuration.
488
489 2018-07-12  Chris Dumez  <cdumez@apple.com>
490
491         Simplify code in NetworkConnectionToWebProcess::didReceiveMessage()
492         https://bugs.webkit.org/show_bug.cgi?id=187621
493
494         Reviewed by Youenn Fablet.
495
496         Simplify code in NetworkConnectionToWebProcess::didReceiveMessage() by not using HashMap iterators and
497         calling get() directly.
498
499         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
500         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
501
502 2018-07-12  Chris Dumez  <cdumez@apple.com>
503
504         Make sure WebProcess::ensureNetworkProcessConnection() is always called on the main thread
505         https://bugs.webkit.org/show_bug.cgi?id=187607
506
507         Reviewed by Alex Christensen.
508
509         Add release assertion to make sure that ensureNetworkProcessConnection() is always called on the main
510         thread. Calling it on a background thread would not be safe. It would not be safe because:
511         1. We check if we have a network process connection and then create one if we don't without any locking.
512         2. It is not safe to construct or use a NetworkProcessConnection object from a non-main thread
513
514         * WebProcess/WebProcess.cpp:
515         (WebKit::WebProcess::ensureNetworkProcessConnection):
516
517 2018-07-12  Chris Dumez  <cdumez@apple.com>
518
519         Assert that the IPC::Connection is valid in Connection::dispatchMessage(Decoder&)
520         https://bugs.webkit.org/show_bug.cgi?id=187617
521
522         Reviewed by Youenn Fablet.
523
524         Assert that the IPC::Connection is valid in Connection::dispatchMessage(Decoder&) as
525         m_client would be stale otherwise.
526
527         * Platform/IPC/Connection.cpp:
528         (IPC::Connection::dispatchMessage):
529
530 2018-07-12  Youenn Fablet  <youenn@apple.com>
531
532         Add a FrameLoaderClient willInjectUserScriptForFrame callback
533         https://bugs.webkit.org/show_bug.cgi?id=187565
534
535         Reviewed by Alex Christensen.
536
537         Introduce a new WKBundlePageLoaderClient callback that is called everytime a user script is injected.
538         Implement WebFrameLoaderClient::willInjectUserScript by calling this new callback.
539
540         * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h:
541         (API::InjectedBundle::PageLoaderClient::willInjectUserScriptForFrame):
542         * WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h:
543         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
544         (setUpPageLoaderClient):
545         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
546         (WebKit::InjectedBundlePageLoaderClient::globalObjectIsAvailableForFrame):
547         (WebKit::InjectedBundlePageLoaderClient::willInjectUserScriptForFrame):
548         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
549         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
550         (WebKit::WebFrameLoaderClient::willInjectUserScript):
551         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
552
553 2018-07-12  Said Abou-Hallawa  <sabouhallawa@apple.com>
554
555         [iOS] When bringing MobileSafari to the foreground, images are drawn asynchronously after removing a snapshot that included them
556         https://bugs.webkit.org/show_bug.cgi?id=187374
557         <rdar://problem/41249545>
558
559         Reviewed by Tim Horton.
560
561         UIProcess should block committing all the layer tree transactions for 
562         immediate update until it receives a one whose activityStateChangeID is
563         greater than or equal to the one it sends with SetActivityState message.
564
565         * Scripts/webkit/messages.py:
566         Fix the messages code generator to include DrawingAreaInfo.h for the WebKit
567         typedef ActivityStateChangeID.
568
569         * Shared/DrawingAreaInfo.h:
570         Define ActivityStateChangeID to be uint64_t. Add a definition for the case
571         when the UIProcess won't be blocked for a reply back from the WebProcess.
572
573         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
574         (WebKit::RemoteLayerTreeTransaction::activityStateChangeID const):
575         (WebKit::RemoteLayerTreeTransaction::setActivityStateChangeID):
576         Add a member for activityStateChangeID in the LayerTreeTransaction.
577
578         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
579         (WebKit::RemoteLayerTreeTransaction::encode const):
580         (WebKit::RemoteLayerTreeTransaction::decode):
581         Make LayerTreeTransaction know how to encode and decode activityStateChangeID.
582
583         * UIProcess/DrawingAreaProxy.h:
584         (WebKit::DrawingAreaProxy::waitForDidUpdateActivityState):
585         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
586         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
587         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
588         (WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateActivityState):
589         Make the DrawingArea in the UIProcess wait the layer tree with a certain
590         activityStateChangeID.
591
592         * UIProcess/WebPageProxy.cpp:
593         (WebKit::WebPageProxy::dispatchActivityStateChange):
594         (WebKit::WebPageProxy::waitForDidUpdateActivityState):
595         If m_activityStateChangeWantsSynchronousReply is true, generate a new 
596         activityStateChangeID and send it in the SetActivityState message.
597
598         * UIProcess/WebPageProxy.h:
599         (WebKit::WebPageProxy::takeNextActivityStateChangeID):
600         A simple way to generate a new activityStateChangeID.
601
602         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
603         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
604         (WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState):
605         Fix the UIProcess functions' prototype for Mac.
606
607         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
608         (WebKit::AcceleratedDrawingArea::activityStateDidChange):
609         * WebProcess/WebPage/AcceleratedDrawingArea.h:
610         Fix the UIProcess functions' prototype for GTK.
611
612         * WebProcess/WebPage/DrawingArea.h:
613         (WebKit::DrawingArea::activityStateDidChange):
614         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
615         Replace wantsDidUpdateActivityState with activityStateChangeID. Treat
616         activityStateChangeID == ActivityStateChangeAsynchronous as if 
617         wantsDidUpdateActivityState == false.
618
619         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
620         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
621         Make the WebPrcess pass the activityStateChangeID which it receives from
622         the SetActivityState message to the LayerTreeTransaction.
623
624         (WebKit::RemoteLayerTreeDrawingArea::activityStateDidChange):
625         When receiving the SetActivityState, treat activityStateChangeID !=
626         ActivityStateChangeAsynchronous as if wantsDidUpdateActivityState == true.
627
628         * WebProcess/WebPage/WebPage.cpp:
629         (WebKit::WebPage::reinitializeWebPage):
630         (WebKit::WebPage::setActivityState):
631         * WebProcess/WebPage/WebPage.h:
632         * WebProcess/WebPage/WebPage.messages.in:
633         Replace the boolean wantsDidUpdateActivityState with activityStateChangeID
634         in the SetActivityState message.
635
636         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
637         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
638         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
639         (WebKit::TiledCoreAnimationDrawingArea::activityStateDidChange):
640         (WebKit::TiledCoreAnimationDrawingArea::didUpdateActivityStateTimerFired):
641         Fix the WebProcess functions' prototype for Mac.
642
643 2018-07-12  Antti Koivisto  <antti@apple.com>
644
645         REGRESSION (r232356): After zooming a page in and out, it's possible to temporarily have missing tiles (google.com, apple.com)
646         https://bugs.webkit.org/show_bug.cgi?id=187553
647         <rdar://problem/41863803>
648
649         Reviewed by Simon Fraser.
650
651         We ignore zoom scale from UI process if it doesn't match the last remote layer tree transaction. However nothing
652         guarantees that we receive the real scale again until user interacts with the page. This means the web process
653         scale and the UI process scale can be wildly out of sync.
654
655         This problem becomes more likely to be visible when
656         - we are under memory pressure so we don't update tiles during zooming and rely on the one final update afterwards
657         - the page generates lots of layer tree transactions
658
659         * WebProcess/WebPage/WebPage.cpp:
660         (WebKit::WebPage::willCommitLayerTree):
661
662         Remember the last transaction where we actually changed the page scale.
663
664         * WebProcess/WebPage/WebPage.h:
665         * WebProcess/WebPage/ios/WebPageIOS.mm:
666         (WebKit::WebPage::scaleFromUIProcess const):
667
668         Only reject the UI process scale if there has been a scale changing transaction meanwhile.
669         The transaction id test was added in r218149 and the problem it fixed remains fixed. This change also matches better
670         what it was purpoted to implement.
671
672 2018-07-12  Megan Gardner  <megan_gardner@apple.com>
673
674         Keep Selections within Shadow DOM boundaries
675         https://bugs.webkit.org/show_bug.cgi?id=187556
676         <rdar://problem/41664567>
677
678         Reviewed by Ryosuke Niwa.
679
680         Update rangeForPosition to take into account both editing and shadow DOM boundries.
681
682         * WebProcess/WebPage/ios/WebPageIOS.mm:
683         (WebKit::rangeForPoint):
684         (WebKit::WebPage::updateSelectionWithTouches):
685         (WebKit::rangeForPosition): Deleted.
686         
687 2018-07-12  Jer Noble  <jer.noble@apple.com>
688
689         REGRESSION (r230163): Videos cannot be seen full screen in Complete Anatomy app
690         https://bugs.webkit.org/show_bug.cgi?id=187527
691         <rdar://problem/40511527>
692
693         Reviewed by Ryosuke Niwa.
694
695         Do not enable element fullscreen mode unless apps specifically opt-in. The Fullscreen API is
696         an experimental feature on iOS, but not on Mac, but we can't simply not return the ExperimentalFeature
697         object from the list of experimental features, as this keeps Safari from being able to apply a
698         NSUserDefault value for that feature. Instead, add a property to API::ExperimentalFeature and
699         _WKExperimentalFeature called "hidden", which signals to clients whether to display the feature
700         in their UI.
701
702         * Scripts/GeneratePreferences.rb:
703         * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb:
704         * Shared/WebPreferences.yaml:
705         * Shared/WebPreferencesDefaultValues.h:
706         * UIProcess/API/APIExperimentalFeature.cpp:
707         (API::ExperimentalFeature::create):
708         (API::ExperimentalFeature::ExperimentalFeature):
709         * UIProcess/API/APIExperimentalFeature.h:
710         * UIProcess/API/Cocoa/_WKExperimentalFeature.h:
711         * UIProcess/API/Cocoa/_WKExperimentalFeature.mm:
712         (-[_WKExperimentalFeature isHidden]):
713
714 2018-07-12  Alexey Proskuryakov  <ap@apple.com>
715
716         [Mac] Run Unlock Keychain more reliably
717         https://bugs.webkit.org/show_bug.cgi?id=187604
718
719         Reviewed by Dan Bernstein.
720
721         Move unlocking to a separate target, and make it a dependency for all targets that
722         produce binaries.
723         
724         This is more than strictly required to fix the build, but this way, we won't need
725         to remember about keychain when project structure changes. Another consideration that
726         wasn't initially apparent to me is that is should be possible to build any target,
727         not just "All", so projects aren't necessarily built in the same order even now.
728
729         * WebKit.xcodeproj/project.pbxproj: 
730
731 2018-07-12  Per Arne Vollan  <pvollan@apple.com>
732
733         Add compile guard for enabling NSRunLoop in the WebContent process.
734         https://bugs.webkit.org/show_bug.cgi?id=187563
735
736         Reviewed by Chris Dumez.
737
738         Also, replace __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 with ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) where appropriate.
739
740         * Platform/mac/LayerHostingContext.mm:
741         (WebKit::LayerHostingContext::createForExternalHostingProcess):
742         * Shared/ChildProcess.h:
743         * Shared/mac/ChildProcessMac.mm:
744         * Shared/mac/HangDetectionDisablerMac.mm:
745         (WebKit::setClientsMayIgnoreEvents):
746         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
747         (WebKit::WebProcessPool::registerNotificationObservers):
748         (WebKit::WebProcessPool::unregisterNotificationObservers):
749         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
750         (WebKit::shouldLeakBoost):
751         * UIProcess/WebProcessPool.h:
752         * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h:
753         * WebProcess/Plugins/PDF/PDFPlugin.mm:
754         (WebKit::PDFPlugin::PDFPlugin):
755         * WebProcess/WebProcess.h:
756         * WebProcess/WebProcess.messages.in:
757         * WebProcess/cocoa/WebProcessCocoa.mm:
758         (WebKit::WebProcess::platformInitializeWebProcess):
759         (WebKit::WebProcess::stopRunLoop):
760
761 2018-07-11  Carlos Garcia Campos  <cgarcia@igalia.com>
762
763         [WPE] Pass the backend library name as command line parameter to the web process
764         https://bugs.webkit.org/show_bug.cgi?id=186841
765
766         Reviewed by Žan Doberšek.
767
768         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
769         (WebKit::ProcessLauncher::launchProcess): Add --backend-library parameter when launching the web process.
770         * WebProcess/wpe/WebProcessMainWPE.cpp: Call wpe_loader_init() with the library passed as --backend-library parameter.
771
772 2018-07-11  Jon Lee  <jonlee@apple.com>
773
774         Update iOS fullscreen alert text
775         https://bugs.webkit.org/show_bug.cgi?id=187576
776         rdar://problem/42052284
777
778         Reviewed by Ryosuke Niwa.
779
780         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
781         (-[WKFullScreenViewController _showPhishingAlert]): Update text and string keys.
782
783 2018-07-11  Aditya Keerthi  <akeerthi@apple.com>
784
785         REGRESSION (231276): Attempting to copy an image fails
786         https://bugs.webkit.org/show_bug.cgi?id=187212
787         <rdar://problem/41540074>
788
789         Reviewed by Ryosuke Niwa.
790
791         r210683 introduced logic to prevent file URLs from being copied to the clipboard
792         in unexpected cases. In order to achieve this functionality,
793         checkURLReceivedFromWebProcess was called on all items in the pathnames array
794         passed into WebPasteboardProxy::setPasteboardPathnamesForType. However, this
795         method is a misnomer, as the pathnames array always contains exactly one URL and
796         one title for the URL.
797
798         Renamed methods to make it clear that one URL and one title are being passed in
799         and updated logic to ensure that checkURLReceivedFromWebProcess is only called
800         on the URL and not the title.
801
802         * Shared/WebCoreArgumentCoders.cpp:
803         (IPC::ArgumentCoder<PasteboardURL>::encode):
804         (IPC::ArgumentCoder<PasteboardURL>::decode):
805         * Shared/WebCoreArgumentCoders.h:
806         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
807         (WebKit::WebPasteboardProxy::setPasteboardURL):
808         * UIProcess/WebPasteboardProxy.h:
809         * UIProcess/WebPasteboardProxy.messages.in:
810         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
811         (WebKit::WebPlatformStrategies::setURL):
812         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
813
814 2018-07-11  Alex Christensen  <achristensen@webkit.org>
815
816         Add SPI for immediate injection of user scripts
817         https://bugs.webkit.org/show_bug.cgi?id=173342
818         <rdar://problem/29202285>
819
820         Reviewed by Brady Eidson, Youenn Fablet, and Geoff Garen.
821
822         * UIProcess/API/C/WKPageGroup.cpp:
823         (WKPageGroupAddUserScript):
824         * UIProcess/API/C/WKUserContentControllerRef.cpp:
825         (WKUserContentControllerAddUserScript):
826         * UIProcess/API/Cocoa/WKUserContentController.mm:
827         (-[WKUserContentController addUserScript:]):
828         (-[WKUserContentController _addUserScriptImmediately:]):
829         * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h:
830         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
831         (WebKit::WebUserContentControllerProxy::addUserScript):
832         * UIProcess/UserContent/WebUserContentControllerProxy.h:
833         * WebProcess/UserContent/WebUserContentController.cpp:
834         (WebKit::WebUserContentController::addUserScripts):
835         (WebKit::WebUserContentController::addUserScriptInternal):
836         If we are to inject the script internally, inject it into the appropriate pages.
837         If we're injecting into the top frame only, there's no need to traverse the frame tree.
838         (WebKit::WebUserContentController::addUserScript):
839         * WebProcess/UserContent/WebUserContentController.h:
840         * WebProcess/UserContent/WebUserContentController.messages.in:
841         * WebProcess/WebPage/WebPage.cpp:
842         (WebKit::m_cpuLimit):
843
844 2018-07-11  Simon Fraser  <simon.fraser@apple.com>
845
846         [iOS WK2] Address a possible cause of missing tiles
847         https://bugs.webkit.org/show_bug.cgi?id=187570
848         rdar://problem/40941118
849
850         Reviewed by Tim Horton.
851         
852         If the web process crashes, it's possible for the user to trigger a scroll before
853         the process is re-launched. The pre-commit handler will bail early on the _isValid
854         check without clearing _hasScheduledVisibleRectUpdate, so that remains YES and we
855         get stuck doing no more visible content rect updates.
856         
857         Fix by adding -[WKWebView _didRelaunchProcess] (WKContentView got this already), and
858         in that clear state that could have been set in the UI process while the web process
859         connection was invalid.
860         
861         Also add more release logging around process termination, crash and relaunch.
862
863         * UIProcess/API/Cocoa/WKWebView.mm:
864         (-[WKWebView _processDidExit]):
865         (-[WKWebView _didRelaunchProcess]):
866         (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]):
867         (-[WKWebView _updateVisibleContentRects]):
868         * UIProcess/API/Cocoa/WKWebViewInternal.h:
869         * UIProcess/WebPageProxy.cpp:
870         (WebKit::WebPageProxy::reattachToWebProcess):
871         (WebKit::WebPageProxy::processDidTerminate):
872         * UIProcess/WebProcessProxy.cpp:
873         (WebKit::WebProcessProxy::didClose):
874         (WebKit::WebProcessProxy::didFinishLaunching):
875         * UIProcess/ios/PageClientImplIOS.mm:
876         (WebKit::PageClientImpl::didRelaunchProcess):
877
878 2018-07-11  Wenson Hsieh  <wenson_hsieh@apple.com>
879
880         Release logging dumps "Cleaning up dragging state…" every time gesture recognizers are reset in WKContentView
881         https://bugs.webkit.org/show_bug.cgi?id=187562
882
883         Reviewed by Tim Horton.
884
885         Tweaks up a release logging statement, such that it only logs when performing a drag or drop.
886
887         * UIProcess/ios/WKContentViewInteraction.mm:
888         (-[WKContentView cleanUpDragSourceSessionState]):
889
890 2018-07-11  Commit Queue  <commit-queue@webkit.org>
891
892         Unreviewed, rolling out r233741.
893         https://bugs.webkit.org/show_bug.cgi?id=187568
894
895         "WKTR vs exp features, booooooo" (Requested by bradee-oh on
896         #webkit).
897
898         Reverted changeset:
899
900         "Make process-swap-on-navigation an experimental feature."
901         https://bugs.webkit.org/show_bug.cgi?id=187558
902         https://trac.webkit.org/changeset/233741
903
904 2018-07-11  Brady Eidson  <beidson@apple.com>
905
906         Make process-swap-on-navigation an experimental feature.
907         <rdar://problem/41995053> and https://bugs.webkit.org/show_bug.cgi?id=187558
908
909         Reviewed by Geoff Garen.
910
911         * Shared/WebPreferences.yaml:
912
913         * UIProcess/WebPreferences.cpp:
914         (WebKit::WebPreferences::updateBoolValueForExperimentalFeatureKey):
915
916         * UIProcess/WebProcessPool.cpp:
917         (WebKit::WebProcessPool::createWebPage): If the new web page has PSON enabled via WebPreferences,
918           absorb that setting into this process pool's configuration.
919
920 2018-07-11  Jer Noble  <jer.noble@apple.com>
921
922         Disable all network caching for HLS streams.
923         https://bugs.webkit.org/show_bug.cgi?id=187544
924         <rdar://problem/41863600>
925
926         Reviewed by Chris Dumez.
927
928         Revert the behavior added in r215263 where Media responses are cached if they are from
929         a resource whose expected content length is <4MB.
930
931         * NetworkProcess/cache/NetworkCache.cpp:
932         (WebKit::NetworkCache::makeStoreDecision):
933         (WebKit::NetworkCache::expectedTotalResourceSizeFromContentRange): Deleted.
934
935 2018-07-11  Zan Dobersek  <zdobersek@igalia.com>
936
937         [WPE] AC for fixed-position elements is not enabled
938         https://bugs.webkit.org/show_bug.cgi?id=187514
939
940         Reviewed by Carlos Garcia Campos.
941
942         Enable accelerated compositing for fixed-position elements when using
943         AcceleratedDrawingArea and AC is force-enabled. This effectively enables
944         this option for the WPE port which is using the AcceleratedDrawingArea
945         implementation and not DrawingAreaImpl like the GTK+ port.
946
947         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
948         (WebKit::AcceleratedDrawingArea::updatePreferences):
949
950 2018-07-11  Christopher Reid  <chris.reid@sony.com>
951
952         [Win][WebKit] Disable accelerated compositing until it is supported
953         https://bugs.webkit.org/show_bug.cgi?id=187503
954
955         Reviewed by Žan Doberšek.
956
957         * UIProcess/win/WebView.cpp:
958
959 2018-07-10  Tim Horton  <timothy_horton@apple.com>
960
961         REGRESSION (r233480): Mail contents flash black when activating
962         https://bugs.webkit.org/show_bug.cgi?id=187504
963         <rdar://problem/41752351>
964
965         Reviewed by Simon Fraser.
966
967         The sequence of events to reproduce the bug originally fixed in r203371
968         is either:
969
970         A) the simple background/foreground case
971
972         1] app begins to suspend
973         2] app suspension snapshots are taken
974         3] WKWebView's surfaces are marked volatile
975         4] app completes suspension
976             ... time goes by ...
977         5] WKWebView's volatile surfaces are purged
978             ... time goes by ...
979         6] app begins to resume, shows (good) suspension snapshot
980         7] app removes suspension snapshot
981         8] WKWebView has sublayers with purged (black) surfaces
982         9] WKWebView sublayers are repaired by a new commit with nonvolatile surfaces
983
984         B) the re-snapshot while in the background case
985
986         1] app begins to suspend
987         2] app suspension snapshots are taken
988         3] WKWebView's surfaces are marked volatile
989         4] app completes suspension
990         ... time goes by ...
991         5] WKWebView's volatile surfaces are purged
992         ... time goes by ...
993         6] app wakes up in the background to update its snapshots
994         7] in the updated snapshots, WKWebView has sublayers with purged (black) surfaces
995         ... time goes by ...
996         8] app begins to resume, shows (bad) suspension snapshot
997         9] WKWebView presents layers with purged (black) surfaces until new commit fixes them
998         10] WKWebView sublayers are repaired by a new commit with nonvolatile surfaces
999
1000         WebKit's current approach to fix this problem is simply to hide the
1001         WKWebView's sublayers at some point after A2/B2 (suspension snapshots),
1002         but before A8/B7 (the first time the empty layers would be presented
1003         or snapshotted).
1004
1005         Previously, we did this by hiding the layers when the window's CAContext
1006         was created, which happened early enough in both cases (at A6/B6).
1007         However, that notification was removed underneath us at some point.
1008
1009         However, in looking at the timelines, there's a better place to do this:
1010         immediately after marking the surfaces volatile (A3/B3), which is always
1011         strictly after the app suspension snapshots are taken, and also always
1012         before the freshly-made-volatile layers could be presented or snapshotted.
1013
1014         * UIProcess/ApplicationStateTracker.h:
1015         * UIProcess/ApplicationStateTracker.mm:
1016         (WebKit::ApplicationStateTracker::ApplicationStateTracker):
1017         (WebKit::ApplicationStateTracker::~ApplicationStateTracker):
1018         (WebKit::ApplicationStateTracker::applicationDidCreateWindowContext): Deleted.
1019         * UIProcess/ios/WKApplicationStateTrackingView.h:
1020         * UIProcess/ios/WKApplicationStateTrackingView.mm:
1021         (-[WKApplicationStateTrackingView didMoveToWindow]):
1022         (-[WKApplicationStateTrackingView _applicationDidCreateWindowContext]): Deleted.
1023         * UIProcess/ios/WKContentView.mm:
1024         (-[WKContentView _applicationDidCreateWindowContext]): Deleted.
1025         * UIProcess/ios/WebPageProxyIOS.mm:
1026         (WebKit::WebPageProxy::applicationDidFinishSnapshottingAfterEnteringBackground):
1027         Remove the didCreateWindowContext notification, and hide content after
1028         snapshotting after entering the background.
1029
1030 2018-07-10  Youenn Fablet  <youenn@apple.com>
1031
1032         Make fetch() use "same-origin" credentials by default
1033         https://bugs.webkit.org/show_bug.cgi?id=176023
1034
1035         Reviewed by Chris Dumez.
1036
1037         Before the patch, when changing the credential mode in case of redirection,
1038         we were not waiting for WebProcess response to restart the load.
1039         This patch updates the implementation to ask the WebProcess whether to proceed as for other regular asynchronous loads.
1040         This requires some refactoring in particular we now pass request, redirectRequest and redirectResponse to NetworkLoadChecker
1041         that will send them back as part of the completion handler.
1042
1043         To do so, we change manual redirection handling and make it a successful case and not an error case as before.
1044
1045         * NetworkProcess/NetworkLoadChecker.cpp:
1046         (WebKit::redirectionError):
1047         (WebKit::NetworkLoadChecker::checkRedirection):
1048         * NetworkProcess/NetworkLoadChecker.h:
1049         * NetworkProcess/NetworkResourceLoader.cpp:
1050         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
1051         (WebKit::NetworkResourceLoader::restartNetworkLoad):
1052         (WebKit::NetworkResourceLoader::continueWillSendRequest):
1053         * NetworkProcess/NetworkResourceLoader.h:
1054         * NetworkProcess/PingLoad.cpp:
1055         (WebKit::PingLoad::willPerformHTTPRedirection):
1056
1057 2018-07-10  Chris Dumez  <cdumez@apple.com>
1058
1059         [IOS] We should prevent WebProcess suspension while the UIProcess is waiting for a reply from its injected bundle
1060         https://bugs.webkit.org/show_bug.cgi?id=187536
1061         <rdar://problem/41931912>
1062
1063         Reviewed by Brady Eidson.
1064
1065         Update RemoteObjectRegistry to take a background process assertion for each pending reply on the
1066         UIProcess side. Otherwise, the destination web process may get suspended and the reply block would
1067         not get called. We already do this in WebPageProxy for callbacks waiting for an IPC from the
1068         WebProcess.
1069
1070         * Shared/API/Cocoa/RemoteObjectRegistry.h:
1071         * Shared/API/Cocoa/RemoteObjectRegistry.mm:
1072         (WebKit::RemoteObjectRegistry::RemoteObjectRegistry):
1073         (WebKit::RemoteObjectRegistry::sendInvocation):
1074         (WebKit::RemoteObjectRegistry::callReplyBlock):
1075         (WebKit::RemoteObjectRegistry::releaseUnusedReplyBlock):
1076         * Shared/API/Cocoa/_WKRemoteObjectRegistry.mm:
1077         (-[_WKRemoteObjectRegistry _initWithWebPage:]):
1078         (-[_WKRemoteObjectRegistry _initWithWebPageProxy:]):
1079         (-[_WKRemoteObjectRegistry _initWithMessageSender:]): Deleted.
1080         * Shared/API/Cocoa/_WKRemoteObjectRegistryInternal.h:
1081         * UIProcess/API/Cocoa/WKWebView.mm:
1082         (-[WKWebView _remoteObjectRegistry]):
1083         * UIProcess/Cocoa/WebViewImpl.mm:
1084         (WebKit::WebViewImpl::remoteObjectRegistry):
1085         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1086         (-[WKWebProcessPlugInBrowserContextController _remoteObjectRegistry]):
1087
1088 2018-07-09  Brian Burg  <bburg@apple.com>
1089
1090         WebDriver: hang when running Selenium test correct_event_firing_tests.py::testShouldEmitOnChangeEventsWhenSelectingElements[Safari]
1091         https://bugs.webkit.org/show_bug.cgi?id=187486
1092         <rdar://problem/41987110>
1093
1094         Reviewed by Tim Horton.
1095
1096         This test takes the unusual step of doing Element Click directly on a <select> element,
1097         despite the specification supporting clicking on <option> elements directly. It hangs
1098         because we fire a nested run loop when the Carbon popup menu appears, and the nested runloop
1099         is not exited until the popup menu is clicked or dismissed.
1100
1101         If a click is being simulated on the <select> via WebDriver, we should just not show
1102         the popup menu but still deliver all of the events that are fired when clicking the element.
1103
1104         * UIProcess/WebPageProxy.cpp:
1105         (WebKit::WebPageProxy::showPopupMenu):
1106
1107 2018-07-10  Tim Horton  <timothy_horton@apple.com>
1108
1109         Try to fix the build
1110
1111         * UIProcess/API/Cocoa/WKWebView.mm:
1112         (-[WKWebView _internalDoAfterNextPresentationUpdate:withoutWaitingForPainting:withoutWaitingForAnimatedResize:]):
1113
1114 2018-07-10  Tim Horton  <timothy_horton@apple.com>
1115
1116         doAfterNextPresentationUpdate should not be called while content is hidden due to animated resize
1117         https://bugs.webkit.org/show_bug.cgi?id=187500
1118         <rdar://problem/41294139>
1119
1120         Reviewed by Simon Fraser.
1121
1122         Clients generally expect that after doAfterNextPresentationUpdate, there's
1123         something vaguely sensible on the screen. They use this to remove snapshots,
1124         unhide web views, etc.
1125
1126         During some kinds of resize/rotation, we will hide the WKContentView,
1127         and asynchronously hide it when the resize/rotation is complete. This
1128         can cause clients to prematurely expose a blank WKWebView.
1129
1130         To fix this, avoid calling doAfterNextPresentationUpdate until the
1131         animated resize completes. Add a variant that does not wait for this
1132         (to be used for testing purposes).
1133
1134         * UIProcess/API/Cocoa/WKWebView.mm:
1135         (-[WKWebView _didCompleteAnimatedResize]):
1136         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
1137         Rename the vector of blocks that we call after animated resize completes
1138         to be generic rather than just about snapshots.
1139
1140         (-[WKWebView _internalDoAfterNextPresentationUpdate:withoutWaitingForPainting:withoutWaitingForAnimatedResize:]):
1141         Add this _internal variant of _doAfterNextPresentationUpdate that takes bits determining
1142         which waits to perform or avoid, to reduce duplication.
1143
1144         (-[WKWebView _doAfterNextPresentationUpdate:]):
1145         (-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForAnimatedResizeForTesting:]):
1146         (-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForPainting:]):
1147         Call _internalDoAfterNextPresentationUpdate with the appropriate bits set for each situation.
1148
1149         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1150         Add _doAfterNextPresentationUpdateWithoutWaitingForAnimatedResizeForTesting to WKWebView(WKTesting).
1151
1152 2018-07-10  Tim Horton  <timothy_horton@apple.com>
1153
1154         REGRESSION (r231510): Dismissing PDFPlugin context menu automatically clicks the first item
1155         https://bugs.webkit.org/show_bug.cgi?id=187507
1156         <rdar://problem/42007155>
1157
1158         Reviewed by Per Arne Vollan.
1159
1160         WebPageProxy::showPDFContextMenu, introduced in r213510, assumes that
1161         the user always chooses some item from the menu; it does not handle
1162         the case where the context menu is dismissed without selecting anything.
1163
1164         * UIProcess/WebPageProxy.h:
1165         * UIProcess/WebPageProxy.messages.in:
1166         * UIProcess/mac/WebPageProxyMac.mm:
1167         (-[WKPDFMenuTarget selectedMenuItem]):
1168         (-[WKPDFMenuTarget contextMenuAction:]):
1169         (WebKit::WebPageProxy::showPDFContextMenu):
1170         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1171         (WebKit::PDFPlugin::handleContextMenuEvent):
1172         Make showPDFContextMenu return an optional index, instead of always
1173         returning an index. Don't perform any action if it is nullopt.
1174
1175 2018-07-10  Stephan Szabo  <stephan.szabo@sony.com>
1176
1177         [WinCairo] Support display of webinspector ui on non-legacy minibrowser
1178         https://bugs.webkit.org/show_bug.cgi?id=187415
1179
1180         Reviewed by Brian Burg.
1181
1182         * UIProcess/WebInspectorProxy.h:
1183         * UIProcess/win/WebInspectorProxyWin.cpp:
1184         (WebKit::getInspectedWindowInfo):
1185         (WebKit::WebInspectorProxy::windowReceivedMessage):
1186         (WebKit::WebInspectorProxy::wndProc):
1187         (WebKit::WebInspectorProxy::registerWindowClass):
1188         (WebKit::decidePolicyForNavigationAction):
1189         (WebKit::webProcessDidCrash):
1190         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
1191         (WebKit::WebInspectorProxy::platformCloseFrontendPageAndWindow):
1192         (WebKit::WebInspectorProxy::inspectorPageURL):
1193         (WebKit::WebInspectorProxy::inspectorTestPageURL):
1194         (WebKit::WebInspectorProxy::inspectorBaseURL):
1195         (WebKit::WebInspectorProxy::platformInspectedWindowHeight):
1196         (WebKit::WebInspectorProxy::platformInspectedWindowWidth):
1197         (WebKit::WebInspectorProxy::platformAttach):
1198         (WebKit::WebInspectorProxy::platformDetach):
1199         (WebKit::WebInspectorProxy::platformSetAttachedWindowHeight):
1200         (WebKit::WebInspectorProxy::platformSetAttachedWindowWidth):
1201         (WebKit::WebInspectorProxy::platformIsFront):
1202         (WebKit::WebInspectorProxy::platformHide):
1203         (WebKit::WebInspectorProxy::platformBringToFront):
1204         (WebKit::WebInspectorProxy::platformBringInspectedPageToFront):
1205         (WebKit::WebInspectorProxy::platformInspectedURLChanged):
1206         (WebKit::WebInspectorProxy::platformCreateFrontendWindow):
1207         (WebKit::WebInspectorProxy::platformDidCloseForCrash):
1208         (WebKit::WebInspectorProxy::platformInvalidate):
1209         (WebKit::WebInspectorProxy::platformStartWindowDrag):
1210         * WebProcess/WebPage/WebInspector.cpp:
1211         (WebKit::WebInspector::openFrontendConnection):
1212         * WebProcess/WebPage/win/WebInspectorUIWin.cpp:
1213         (WebKit::WebInspectorUI::localizedStringsURL):
1214         (WebKit::RemoteWebInspectorUI::localizedStringsURL):
1215
1216 2018-07-10  John Wilander  <wilander@apple.com>
1217
1218         Resource Load Statistics: Make testRunner.statisticsResetToConsistentState() take a completion handler
1219         https://bugs.webkit.org/show_bug.cgi?id=187499
1220         <rdar://problem/41999431>
1221
1222         Reviewed by Chris Dumez.
1223
1224         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1225         (WKWebsiteDataStoreStatisticsResetToConsistentState):
1226             Now uses a WTF::CallbackAggregator to call its
1227             completion handler when both the call to
1228             WebResourceLoadStatisticsStore::scheduleClearInMemory()
1229             and to
1230             WebResourceLoadStatisticsStore::resetParametersToDefaultValues()
1231             are complete.
1232         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1233         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1234         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemory):
1235             Now takes a WTF::CompletionHandler so that it can support the
1236             completion handler in
1237             WKWebsiteDataStoreStatisticsResetToConsistentState().
1238         (WebKit::WebResourceLoadStatisticsStore::resetParametersToDefaultValues):
1239             Now takes a WTF::CompletionHandler so that it can support the
1240             completion handler in
1241             WKWebsiteDataStoreStatisticsResetToConsistentState().
1242         * UIProcess/WebResourceLoadStatisticsStore.h:
1243
1244 2018-07-10  Ryosuke Niwa  <rniwa@webkit.org>
1245
1246         Disable cross-origin-window-policy by default
1247         https://bugs.webkit.org/show_bug.cgi?id=187509
1248
1249         Reviewed by Chris Dumez.
1250
1251         * Shared/WebPreferences.yaml:
1252         * UIProcess/API/C/WKPreferences.cpp:
1253         (WKPreferencesSetCrossOriginWindowPolicyEnabled):
1254         (WKPreferencesGetCrossOriginWindowPolicyEnabled):
1255         * UIProcess/API/C/WKPreferencesRef.h:
1256
1257 2018-07-09  Tim Horton  <timothy_horton@apple.com>
1258
1259         REGRESSION (r232416): Flickering when going back to Google search results on back swipe
1260         https://bugs.webkit.org/show_bug.cgi?id=187506
1261         <rdar://problem/41939594>
1262
1263         Reviewed by Chris Dumez.
1264
1265         Same document navigations won't have a preceding didStartProvisionalLoadForMainFrame,
1266         so the code introduced in r232416 would immediately remove the snapshot
1267         upon any same document navigation.
1268
1269         Instead, adjust r232416 slightly to start tracking snapshot removal events
1270         after didStartProvisionalLoad OR didSameDocumentNavigation. Call the block
1271         that starts tracking, then immediately fire the same-document navigation event.
1272
1273         * UIProcess/Cocoa/ViewGestureController.cpp:
1274         (WebKit::ViewGestureController::didStartProvisionalLoadForMainFrame):
1275         (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState):
1276         (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame):
1277         (WebKit::ViewGestureController::SnapshotRemovalTracker::stopWaitingForEvent):
1278         * UIProcess/Cocoa/ViewGestureController.h:
1279         * UIProcess/ios/ViewGestureControllerIOS.mm:
1280         (WebKit::ViewGestureController::endSwipeGesture):
1281         * UIProcess/mac/ViewGestureControllerMac.mm:
1282         (WebKit::ViewGestureController::endSwipeGesture):
1283
1284 2018-07-09  Youenn Fablet  <youenn@apple.com>
1285
1286         Remove cfca.com.npCryptoKit.CGB.MAC.sb and cfca.com.npP11CertEnroll.MAC.CGB.sb
1287         https://bugs.webkit.org/show_bug.cgi?id=187487
1288         <rdar://problem/41991584>
1289
1290         Reviewed by Alexey Proskuryakov.
1291
1292         * Resources/PlugInSandboxProfiles/cfca.com.npCryptoKit.CGB.MAC.sb: Removed.
1293         * Resources/PlugInSandboxProfiles/cfca.com.npP11CertEnroll.MAC.CGB.sb: Removed.
1294         * WebKit.xcodeproj/project.pbxproj:
1295
1296 2018-07-09  Youenn Fablet  <youenn@apple.com>
1297
1298         Add the possibility to run unsandboxed plug-ins
1299         https://bugs.webkit.org/show_bug.cgi?id=187310
1300         <rdar://problem/41798808>
1301
1302         Reviewed by Alexey Proskuryakov.
1303
1304         Add a utility method to know which plug-ins are allowed to run unsandboxed.
1305         For such plug-ins, we skip the sandboxing done when starting the plug-in process.
1306
1307         * PluginProcess/mac/PluginProcessMac.mm:
1308         (WebKit::PluginProcess::initializeSandbox):
1309         * Shared/WebPreferences.yaml:
1310         * UIProcess/Plugins/PluginInfoStore.cpp:
1311         (WebKit::PluginInfoStore::shouldRunPluginUnsandboxed):
1312         * UIProcess/Plugins/PluginInfoStore.h:
1313         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
1314         (WebKit::PluginInfoStore::shouldRunPluginUnsandboxed):
1315         (WebKit::PluginInfoStore::shouldUsePlugin):
1316
1317 2018-07-09  Dean Jackson  <dino@apple.com>
1318
1319         Remove fullscreen-auto-hide-delay
1320         https://bugs.webkit.org/show_bug.cgi?id=187493
1321         <rdar://problem/41830852>
1322
1323         Reviewed by Antoine Quint.
1324
1325         Now there is no delay, rename setFullscreenAutoHideTiming to setFullscreenAutoHideDuration,
1326         and only send that value over to the Web Process.
1327
1328         * UIProcess/WebFullScreenManagerProxy.cpp:
1329         (WebKit::WebFullScreenManagerProxy::setFullscreenAutoHideDuration):
1330         (WebKit::WebFullScreenManagerProxy::setFullscreenAutoHideTiming): Deleted.
1331         * UIProcess/WebFullScreenManagerProxy.h:
1332         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1333         (-[WKFullScreenViewController viewWillAppear:]):
1334         * WebProcess/FullScreen/WebFullScreenManager.cpp:
1335         (WebKit::WebFullScreenManager::didExitFullScreen):
1336         (WebKit::WebFullScreenManager::setFullscreenAutoHideDuration):
1337         (WebKit::WebFullScreenManager::setFullscreenAutoHideTiming): Deleted.
1338         * WebProcess/FullScreen/WebFullScreenManager.h:
1339         * WebProcess/FullScreen/WebFullScreenManager.messages.in:
1340
1341 2018-07-09  Timothy Hatcher  <timothy@apple.com>
1342
1343         Semantic colors don't update when accessibility Increase Contrast mode is enabled.
1344         https://bugs.webkit.org/show_bug.cgi?id=187425
1345         rdar://problem/39948240
1346
1347         Reviewed by Tim Horton.
1348
1349         * UIProcess/API/Cocoa/WKWebView.mm:
1350         (-[WKWebView _initializeWithConfiguration:]): Moved call to setUseDarkAppearance to WebViewImpl.
1351         (-[WKWebView _setUseSystemAppearance:]): No need to call setUseDarkAppearance here anymore.
1352         (-[WKWebView viewDidChangeEffectiveAppearance]): Added. This is the proper NSView method to use.
1353         (-[WKWebView _effectiveAppearanceIsDark]): Deleted.
1354         (-[WKWebView effectiveAppearanceDidChange]): Deleted. This method is a deprecated name.
1355         * UIProcess/API/mac/WKView.mm:
1356         (-[WKView viewDidChangeEffectiveAppearance]): Added. This is the proper NSView method to use.
1357         (-[WKView _setUseSystemAppearance:]): No need to call setUseDarkAppearance here anymore.
1358         (-[WKView _effectiveAppearanceIsDark]): Deleted.
1359         (-[WKView effectiveAppearanceDidChange]): Deleted. This method is a deprecated name.
1360         * UIProcess/Cocoa/WebViewImpl.h:
1361         * UIProcess/Cocoa/WebViewImpl.mm:
1362         (WebKit::WebViewImpl::WebViewImpl): Call setUseDarkAppearance before page config is sent in initializeWebPage.
1363         (WebKit::WebViewImpl::effectiveAppearanceDidChange): Added.
1364         * WebProcess/WebPage/WebPage.cpp:
1365         (WebKit::WebPage::setUseDarkAppearance): WebCore::Page::setUseDarkAppearance now handles the style changes.
1366         The RenderTheme color caches also don't need cleared with platformColorsDidChange(), since we cache light
1367         and dark colors seperatly in RenderThemeMac.
1368
1369 2018-07-09  Simon Fraser  <simon.fraser@apple.com>
1370
1371         Shrink various loading-related enums to shrink CachedResource
1372         https://bugs.webkit.org/show_bug.cgi?id=187443
1373
1374         Reviewed by Chris Dumez.
1375
1376         * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm:
1377         (WebKit::LegacyCustomProtocolManager::wasRedirectedToRequest):
1378         * NetworkProcess/NetworkLoad.cpp:
1379         (WebKit::NetworkLoad::continueWillSendRequest):
1380         * NetworkProcess/NetworkLoadParameters.h:
1381         * NetworkProcess/NetworkResourceLoader.cpp:
1382         (WebKit::NetworkResourceLoader::canUseCache const):
1383         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
1384         * NetworkProcess/cache/NetworkCache.cpp:
1385         (WebKit::NetworkCache::cachePolicyAllowsExpired):
1386         (WebKit::NetworkCache::makeRetrieveDecision):
1387         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
1388         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
1389         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1390         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
1391         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1392         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
1393         (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
1394         * Shared/API/c/mac/WKURLRequestNS.mm:
1395         (WKURLRequestCopyNSURLRequest):
1396         * Shared/Cocoa/WKNSURLRequest.mm:
1397         (-[WKNSURLRequest _web_createTarget]):
1398         * Shared/mac/WebCoreArgumentCodersMac.mm:
1399         (IPC::ArgumentCoder<ResourceRequest>::encodePlatformData):
1400         * UIProcess/API/Cocoa/WKFrameInfo.mm:
1401         (-[WKFrameInfo request]):
1402         * UIProcess/API/Cocoa/WKNavigation.mm:
1403         (-[WKNavigation _request]):
1404         * UIProcess/API/Cocoa/WKNavigationAction.mm:
1405         (-[WKNavigationAction request]):
1406         * UIProcess/API/Cocoa/WKNavigationData.mm:
1407         (-[WKNavigationData originalRequest]):
1408         * UIProcess/API/Cocoa/WKNavigationResponse.mm:
1409         (-[WKNavigationResponse _request]):
1410         * UIProcess/API/Cocoa/WKURLSchemeTask.mm:
1411         (-[WKURLSchemeTaskImpl request]):
1412         * UIProcess/API/Cocoa/_WKDownload.mm:
1413         (-[_WKDownload request]):
1414         * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:
1415         (WebKit::LegacyCustomProtocolManagerClient::startLoading):
1416         * WebProcess/Network/WebLoaderStrategy.cpp:
1417         (WebKit::maximumBufferingTime):
1418         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1419         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
1420         * WebProcess/WebPage/mac/WebPageMac.mm:
1421         (WebKit::WebPage::platformCanHandleRequest):
1422
1423 2018-07-09  Chris Dumez  <cdumez@apple.com>
1424
1425         WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData() fails to protect the page in its lambda
1426         https://bugs.webkit.org/show_bug.cgi?id=187478
1427         <rdar://problem/41975998>
1428
1429         Reviewed by Youenn Fablet.
1430
1431         Make sure we protect the WebPageProxy when we capture it in the lambda or it might go away by the
1432         time the lambda gets called.
1433
1434         * UIProcess/WebProcessProxy.cpp:
1435         (WebKit::WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData):
1436
1437 2018-07-09  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1438
1439         [Curl] Remove unused AuthenticationManager static methods.
1440         https://bugs.webkit.org/show_bug.cgi?id=187419
1441
1442         Reviewed by Yusuke Suzuki.
1443
1444         The file for curl port was added without implementation and never called from anyware.
1445         Also interfaces only used by the curl port were removed from the shared header file.
1446
1447         * PlatformWin.cmake:
1448         * Shared/Authentication/AuthenticationManager.h:
1449         * Shared/Authentication/curl/AuthenticationManagerCurl.cpp: Removed.
1450
1451 2018-07-09  Stephan Szabo  <stephan.szabo@sony.com>
1452
1453         Check that LayerTreeHost was created before use
1454         https://bugs.webkit.org/show_bug.cgi?id=187404
1455
1456         Reviewed by Žan Doberšek.
1457
1458         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
1459         (WebKit::AcceleratedDrawingArea::enterAcceleratedCompositingMode):
1460
1461 2018-07-09  Commit Queue  <commit-queue@webkit.org>
1462
1463         Unreviewed, rolling out r233612.
1464         https://bugs.webkit.org/show_bug.cgi?id=187475
1465
1466         Revision caused the api test LinkColorWithSystemAppearance to
1467         fail on all systems. (Requested by Truitt on #webkit).
1468
1469         Reverted changeset:
1470
1471         "Semantic colors don't update when accessibility Increase
1472         Contrast mode is enabled."
1473         https://bugs.webkit.org/show_bug.cgi?id=187425
1474         https://trac.webkit.org/changeset/233612
1475
1476 2018-07-09  Brian Burg  <bburg@apple.com>
1477
1478         WebDriver: hang in Selenium test alerts_tests.py::testShouldHandleAlertOnPageBeforeUnload
1479         https://bugs.webkit.org/show_bug.cgi?id=187418
1480         <rdar://problem/41909520>
1481
1482         Unreviewed build fix for Sierra.
1483
1484         * UIProcess/WebPageProxy.cpp:
1485         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
1486         According to some compilers, the local 'automationSession' is unused. Change this
1487         to just convert the return value to boolean rather than assign to an unused local.
1488
1489 2018-07-07  Wenson Hsieh  <wenson_hsieh@apple.com>
1490
1491         Introduce a layout milestone to track when the document contains a large number of rendered characters
1492         https://bugs.webkit.org/show_bug.cgi?id=187412
1493         <rdar://problem/41744338>
1494
1495         Reviewed by Ryosuke Niwa.
1496
1497         Add plumbing for the new significant rendered text layout milestone in the modern WebKit client layer. See
1498         WebCore/ChangeLog for more details.
1499
1500         * Shared/API/Cocoa/_WKRenderingProgressEvents.h:
1501         * Shared/API/Cocoa/_WKRenderingProgressEventsInternal.h:
1502         (renderingProgressEvents):
1503         * Shared/API/c/WKPageLoadTypes.h:
1504         * Shared/API/c/WKSharedAPICast.h:
1505         (WebKit::toWKLayoutMilestones):
1506         (WebKit::toLayoutMilestones):
1507         * UIProcess/API/Cocoa/WKWebView.mm:
1508         (layoutMilestones):
1509
1510 2018-07-07  Simon Fraser  <simon.fraser@apple.com>
1511
1512         REGRESSION (r233561): MobileMail crashes when replying to an email
1513         https://bugs.webkit.org/show_bug.cgi?id=187436
1514         rdar://problem/41931915
1515
1516         Reviewed by Alan Bujtas.
1517         
1518         r233561 added a RELEASE_ASSERT(isMainThread()) in this function. This is fine most of the time,
1519         until Mail spawns a WebThread for mail compose, at which point the meaning of isMainThread changes
1520         and the RELEASE_ASSERT fires.
1521         
1522         For now, just remove the RELEASE_ASSERT.
1523
1524         * UIProcess/API/Cocoa/WKWebView.mm:
1525         (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]):
1526
1527 2018-07-06  Timothy Hatcher  <timothy@apple.com>
1528
1529         Semantic colors don't update when accessibility Increase Contrast mode is enabled.
1530         https://bugs.webkit.org/show_bug.cgi?id=187425
1531         rdar://problem/39948240
1532
1533         Reviewed by Tim Horton.
1534
1535         * UIProcess/API/Cocoa/WKWebView.mm:
1536         (-[WKWebView _initializeWithConfiguration:]): Moved call to setUseDarkAppearance to WebViewImpl.
1537         (-[WKWebView _setUseSystemAppearance:]): No need to call setUseDarkAppearance here anymore.
1538         (-[WKWebView viewDidChangeEffectiveAppearance]): Added. This is the proper NSView method to use.
1539         (-[WKWebView _effectiveAppearanceIsDark]): Deleted.
1540         (-[WKWebView effectiveAppearanceDidChange]): Deleted. This method is a deprecated name.
1541         * UIProcess/API/mac/WKView.mm:
1542         (-[WKView viewDidChangeEffectiveAppearance]): Added. This is the proper NSView method to use.
1543         (-[WKView _setUseSystemAppearance:]): No need to call setUseDarkAppearance here anymore.
1544         (-[WKView _effectiveAppearanceIsDark]): Deleted.
1545         (-[WKView effectiveAppearanceDidChange]): Deleted. This method is a deprecated name.
1546         * UIProcess/Cocoa/WebViewImpl.h:
1547         * UIProcess/Cocoa/WebViewImpl.mm:
1548         (WebKit::WebViewImpl::WebViewImpl): Call setUseDarkAppearance before page config is sent in initializeWebPage.
1549         (WebKit::WebViewImpl::effectiveAppearanceDidChange): Added.
1550         * WebProcess/WebPage/WebPage.cpp:
1551         (WebKit::WebPage::setUseDarkAppearance): WebCore::Page::setUseDarkAppearance now handles the style changes.
1552         The RenderTheme color caches also don't need cleared with platformColorsDidChange(), since we cache light
1553         and dark colors seperatly in RenderThemeMac.
1554
1555 2018-07-06  Chris Dumez  <cdumez@apple.com>
1556
1557         Add release assertions to try and catch a possible HashMap corruption in NetworkConnectionToWebProcess
1558         https://bugs.webkit.org/show_bug.cgi?id=187417
1559
1560         Reviewed by Ryosuke Niwa.
1561
1562         Add assertions to make sure we:
1563         - Always use NetworkConnectionToWebProcess::m_networkResourceLoaders from the main thread
1564         - Never use a 0 identifier as key for NetworkConnectionToWebProcess::m_networkResourceLoaders
1565
1566         We see crashes (rdar://problem/39265927) that only seem to make sense if this HashMap was
1567         somehow getting corrupted. Let's try and catch the most common reasons for HashMap corruption.
1568
1569         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1570         (WebKit::NetworkConnectionToWebProcess::didCleanupResourceLoader):
1571         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
1572         (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
1573         (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
1574         (WebKit::NetworkConnectionToWebProcess::removeLoadIdentifier):
1575         (WebKit::NetworkConnectionToWebProcess::setDefersLoading):
1576         (WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload):
1577         * WebProcess/Network/WebResourceLoader.cpp:
1578         (WebKit::WebResourceLoader::messageSenderDestinationID):
1579
1580 2018-07-06  Brian Burg  <bburg@apple.com>
1581
1582         WebDriver: hang in Selenium test alerts_tests.py::testShouldHandleAlertOnPageBeforeUnload
1583         https://bugs.webkit.org/show_bug.cgi?id=187418
1584         <rdar://problem/41909520>
1585
1586         Reviewed by Timothy Hatcher.
1587
1588         Per the W3C specification, “User prompts that are spawned from beforeunload event handlers,
1589         are dismissed implicitly upon navigation or close window, regardless of the defined user prompt handler.”
1590
1591         This behavior differs from legacy Selenium behavior where (as in the test) it's expected that
1592         a test can accept or dismiss a beforeunload alert manually.
1593
1594         Prior to this patch, beforeunload alerts hang because Safari uses a nested modal run loop, which does
1595         not process incoming Automation messages, so there was no way for the test to manually dismiss
1596         the alert.
1597
1598         * UIProcess/WebPageProxy.cpp:
1599         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
1600         Don't show beforeunload alerts for pages being controlled by automation.
1601
1602
1603 2018-07-06  Chris Dumez  <cdumez@apple.com>
1604
1605         ASSERTION FAILED: contextConnection under WebCore::SWServer::terminateWorkerInternal
1606         https://bugs.webkit.org/show_bug.cgi?id=187348
1607         <rdar://problem/41853270>
1608
1609         Reviewed by Youenn Fablet.
1610
1611         Make sure we mark corresponding SWServerWorkers as terminated when we terminate a
1612         Service Worker context connection once it is no longer needed.
1613
1614         * StorageProcess/StorageProcess.cpp:
1615         (WebKit::StorageProcess::swContextConnectionMayNoLongerBeNeeded):
1616
1617 2018-07-06  Andy Estes  <aestes@apple.com>
1618
1619         [iOS] WKPDFView should show the Data Detectors sheet when long-pressing a URL that Data Detectors can handle
1620         https://bugs.webkit.org/show_bug.cgi?id=187396
1621         <rdar://problem/41786980>
1622
1623         Reviewed by Dan Bernstein.
1624
1625         If a URL can be presented by Data Detectors, show the Data Detectors sheet instead
1626         of the link sheet. Also implement the optional WKActionSheetAssistantDelegate
1627         method that asks the UI delegate for its data detection context.
1628
1629         * UIProcess/ios/WKPDFView.mm:
1630         (-[WKPDFView _showActionSheetForURL:atLocation:withAnnotationRect:]):
1631         (-[WKPDFView dataDetectionContextForActionSheetAssistant:]):
1632
1633 2018-07-06  Chris Dumez  <cdumez@apple.com>
1634
1635         WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler() should take in a CompletionHandler
1636         https://bugs.webkit.org/show_bug.cgi?id=187392
1637
1638         Reviewed by Youenn Fablet.
1639
1640         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1641         (WebKit::WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler):
1642         * UIProcess/WebResourceLoadStatisticsStore.h:
1643
1644 2018-07-06  Chris Dumez  <cdumez@apple.com>
1645
1646         [iOS] Assertion failure in WebProcessProxy::allProcesses() (isMainThread())
1647         https://bugs.webkit.org/show_bug.cgi?id=187394
1648
1649         Reviewed by Dan Bernstein.
1650
1651         Use RunLoop::isMain() instead of isMainThread() in the assertion to fix issues for
1652         applications using both WebKit and WebKitLegacy.
1653
1654         * UIProcess/WebProcessProxy.cpp:
1655
1656 2018-07-06  Daniel Bates  <dabates@apple.com>
1657
1658         Remove Strong Confirmation Password button
1659         https://bugs.webkit.org/show_bug.cgi?id=187306
1660         <rdar://problem/41795185>
1661
1662         Reviewed by Sam Weinig.
1663
1664         Remove support for the Strong Confirmation Password button because we never made use of it.
1665
1666         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
1667         (toAutoFillButtonType):
1668         (toWKAutoFillButtonType):
1669         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h:
1670         * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:
1671         (toAutoFillButtonType):
1672         (toWKAutoFillButtonType):
1673         * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h:
1674
1675 2018-07-05  Youenn Fablet  <youenn@apple.com>
1676
1677         REGRESSION (r230843): Flash doesn't work; Produces blue box on page
1678         https://bugs.webkit.org/show_bug.cgi?id=187346
1679         <rdar://problem/41773974>
1680
1681         Reviewed by Ryosuke Niwa.
1682
1683         Reset page plugins when the load client policies are updated.
1684         This will ensure that pages will rebuild their plugin lists based on the new policies.
1685
1686         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
1687         (WebKit::WebPluginInfoProvider::setPluginLoadClientPolicy):
1688         (WebKit::WebPluginInfoProvider::clearPluginClientPolicies):
1689
1690 2018-07-05  Brady Eidson  <beidson@apple.com>
1691
1692         IndexedDB operations in a Page fail after a StorageProcess crash.
1693         <rdar://problem/41626526> and https://bugs.webkit.org/show_bug.cgi?id=187123
1694
1695         Reviewed by Alex Christensen.
1696
1697         When the connection to a StorageProcess goes away, explicitly tell all of the WebPages
1698         in the WebProcess about it.
1699         
1700         This puts Documents/Workers in an error mode where requests fail instead of timeout.
1701         It also clears the Page's connection so *new* Documents and Workers will get a fresh 
1702         new connection that works.
1703         
1704         * UIProcess/API/C/WKContext.cpp:
1705         (WKContextTerminateStorageProcess):
1706         
1707         * UIProcess/API/Cocoa/WKProcessPool.mm:
1708         (-[WKProcessPool _terminateStorageProcess]):
1709         
1710         * UIProcess/Storage/StorageProcessProxy.cpp:
1711         (WebKit::StorageProcessProxy::terminateForTesting):
1712         * UIProcess/Storage/StorageProcessProxy.h:
1713         
1714         * UIProcess/WebProcessPool.cpp:
1715         (WebKit::WebProcessPool::terminateStorageProcessForTesting):
1716         (WebKit::WebProcessPool::terminateStorageProcess): Deleted.
1717         * UIProcess/WebProcessPool.h:
1718         
1719         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
1720         (WebKit::WebToStorageProcessConnection::didClose):
1721         * WebProcess/Storage/WebToStorageProcessConnection.h:
1722         (WebKit::WebToStorageProcessConnection::existingIDBConnectionToServerForIdentifier):
1723         
1724         * WebProcess/WebProcess.cpp:
1725         (WebKit::WebProcess::webToStorageProcessConnectionClosed):
1726
1727 2018-07-05  Simon Fraser  <simon.fraser@apple.com>
1728
1729         Address two possible causes of missing tiles in iOS Safari, and add logging to gather more data about other possible causes
1730         https://bugs.webkit.org/show_bug.cgi?id=187376
1731         rdar://problem/40941118
1732
1733         Reviewed by Tim Horton.
1734         
1735         We have continual reports of users experiencing missing tiles in MobileSafari, where loading a page
1736         shows the tiles at the top, but we don't render new tiles as the user scrolls down. This is consistent
1737         with failing to dispatch visible content rect updates via -[WKWebView _updateVisibleContentRects].
1738         
1739         This patch addresses two possible (but unlikely) causes. First, it resets _currentlyAdjustingScrollViewInsetsForKeyboard
1740         after a web process crash. Second, it catches exceptions thrown by [webView _updateVisibleContentRects]
1741         and resets _hasScheduledVisibleRectUpdate.
1742         
1743         This patch also adds release logging that fires if over 1s has elapsed between scheduling
1744         a visible content rect update and trying to re-schedule, and logging for all reasons that
1745         -_updateVisibleContentRects returns early.
1746
1747         * UIProcess/API/Cocoa/WKWebView.mm:
1748         (-[WKWebView _initializeWithConfiguration:]):
1749         (-[WKWebView _processDidExit]):
1750         (-[WKWebView _addUpdateVisibleContentRectPreCommitHandler]):
1751         (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]):
1752         (-[WKWebView _updateVisibleContentRects]):
1753
1754 2018-07-05  Olivia Barnett  <obarnett@apple.com>
1755
1756         iPad: Scrolling with hardware keyboard while SELECT popover is visible scrolls the page, detaches popover
1757         https://bugs.webkit.org/show_bug.cgi?id=187363
1758         <rdar://problem/41106306>
1759
1760         Reviewed by Tim Horton.
1761
1762         Added extra check to prevent keyboard scrolling when the select box is open.
1763
1764         * UIProcess/ios/WKContentViewInteraction.mm:
1765         (-[WKContentView _scrollOffsetForEvent:]):
1766
1767 2018-07-05  Timothy Hatcher  <timothy@apple.com>
1768
1769         Rename and flip the meaning of defaultAppearance to be useDarkAppearance.
1770         https://bugs.webkit.org/show_bug.cgi?id=187369
1771         rdar://problem/41870420
1772
1773         Reviewed by Tim Horton.
1774
1775         * Shared/WebPageCreationParameters.cpp:
1776         (WebKit::WebPageCreationParameters::encode const):
1777         (WebKit::WebPageCreationParameters::decode):
1778         * Shared/WebPageCreationParameters.h:
1779         * UIProcess/API/Cocoa/WKWebView.mm:
1780         (-[WKWebView _effectiveAppearanceIsDark]):
1781         (-[WKWebView _initializeWithConfiguration:]):
1782         (-[WKWebView _setUseSystemAppearance:]):
1783         (-[WKWebView effectiveAppearanceDidChange]):
1784         (-[WKWebView _defaultAppearance]): Deleted.
1785         * UIProcess/API/mac/WKView.mm:
1786         (-[WKView _effectiveAppearanceIsDark]):
1787         (-[WKView effectiveAppearanceDidChange]):
1788         (-[WKView _setUseSystemAppearance:]):
1789         (-[WKView _defaultAppearance]): Deleted.
1790         (-[WKView _setDefaultAppearance:]): Deleted.
1791         * UIProcess/Cocoa/WebViewImpl.h:
1792         * UIProcess/Cocoa/WebViewImpl.mm:
1793         (WebKit::WebViewImpl::effectiveAppearanceIsDark):
1794         (WebKit::WebViewImpl::setUseDarkAppearance):
1795         (WebKit::WebViewImpl::useDefaultAppearance): Deleted.
1796         (WebKit::WebViewImpl::setDefaultAppearance): Deleted.
1797         * UIProcess/WebPageProxy.cpp:
1798         (WebKit::WebPageProxy::creationParameters):
1799         (WebKit::WebPageProxy::setUseDarkAppearance):
1800         (WebKit::WebPageProxy::showPlaybackTargetPicker):
1801         (WebKit::WebPageProxy::setDefaultAppearance): Deleted.
1802         * UIProcess/WebPageProxy.h:
1803         (WebKit::WebPageProxy::useDarkAppearance const):
1804         (WebKit::WebPageProxy::defaultAppearance const): Deleted.
1805         * UIProcess/mac/WKPrintingView.mm:
1806         (-[WKPrintingView drawRect:]):
1807         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
1808         (WebKit::InjectedBundleRangeHandle::renderedImage):
1809         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1810         (WebKit::PDFPlugin::paintControlForLayerInContext):
1811         * WebProcess/WebPage/WebPage.cpp:
1812         (WebKit::m_credentialsMessenger):
1813         (WebKit::WebPage::drawRect):
1814         (WebKit::WebPage::setUseDarkAppearance):
1815         (WebKit::WebPage::setDefaultAppearance): Deleted.
1816         * WebProcess/WebPage/WebPage.h:
1817         * WebProcess/WebPage/WebPage.messages.in:
1818
1819 2018-07-05  Brian Burg  <bburg@apple.com>
1820
1821         REGRESSION: ASSERT under WebAutomationSessionProxy::computeElementLayout when elementInViewClientCenterPoint returns nullopt
1822         https://bugs.webkit.org/show_bug.cgi?id=187367
1823         <rdar://problem/41861346>
1824
1825         Reviewed by Timothy Hatcher.
1826
1827         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1828         (WebKit::WebAutomationSessionProxy::computeElementLayout):
1829         There's no reason to unwrap this optional, as the IPC argument type is std::optional<IntPoint>.
1830
1831 2018-07-05  Tim Horton  <timothy_horton@apple.com>
1832
1833         Upstream hover gesture implementation
1834         https://bugs.webkit.org/show_bug.cgi?id=187366
1835
1836         Reviewed by Wenson Hsieh.
1837
1838         * UIProcess/ios/WKContentViewInteraction.h:
1839         * UIProcess/ios/WKContentViewInteraction.mm:
1840         (-[WKContentView setupInteraction]):
1841         (-[WKContentView cleanupInteraction]):
1842         (-[WKContentView _removeDefaultGestureRecognizers]):
1843         (-[WKContentView _addDefaultGestureRecognizers]):
1844         (-[WKContentView _hoverGestureRecognizerChanged:]):
1845
1846 2018-07-05  Tim Horton  <timothy_horton@apple.com>
1847
1848         Fix some -Wdocumentation warnings in WebKit
1849         https://bugs.webkit.org/show_bug.cgi?id=187318
1850
1851         Reviewed by Dan Bernstein.
1852
1853         Fix most of the -Wdocumentation warnings in WebKit. The remaining
1854         ones are slightly mysterious, so we can't turn the warning on yet.
1855
1856         * Configurations/BaseTarget.xcconfig:
1857         Define U_HIDE_DEPRECATED_API. It's defined in all other WebKit projects,
1858         and the doc comments in the deprecated ICU API have some errors.
1859
1860         * UIProcess/API/Cocoa/WKUIDelegate.h:
1861         * UIProcess/API/Cocoa/WKWebView.h:
1862         * UIProcess/API/Cocoa/WKWebsiteDataStore.h:
1863         Adjust comments or parameter names to be consistent with each other.
1864
1865 2018-07-05  Chris Dumez  <cdumez@apple.com>
1866
1867         Regression(r232886): WebsiteDataStore objects may get destroyed on a background thread
1868         https://bugs.webkit.org/show_bug.cgi?id=187356
1869         <rdar://problem/41854555>
1870
1871         Reviewed by Geoffrey Garen.
1872
1873         As of r232886, CallbackAggregators in WebsiteDataStore hold a Ref<> to their WebsiteDataStore. This
1874         is an issue because CallbackAggregator objects can get destroyed on a background thread and may be
1875         the last ones holding a ref to the data store. When this happens, the WebsiteDataStore would get
1876         destroyed on a background store and potentially cause crashes. Note that even if the callback
1877         aggregator would not be the last one to hold a ref to the store, it still would not be safe to deref
1878         the store on the background thread since WebsiteDataStore is not ThreadSafeRefCounted.
1879
1880         To address the issue, this patch updates the CallbackAggregators' destructor to deref their data
1881         store member on the main thread. Note that we could also have WebsiteDataStore subclass
1882         ThreadSafeRefCounted<T, DestructionThread::Main> but the data store technically does not need to
1883         be ThreadSafeRefCounted at the moment.
1884
1885         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1886         (WebKit::WebsiteDataStore::WebsiteDataStore):
1887         (WebKit::WebsiteDataStore::~WebsiteDataStore):
1888         (WebKit::WebsiteDataStore::fetchDataAndApply):
1889         (WebKit::WebsiteDataStore::removeData):
1890
1891 2018-07-05  Dan Bernstein  <mitz@apple.com>
1892
1893         [macOS] REGRESSION: Development WebContent service has restricted entitlements, rendering it useless for development
1894         https://bugs.webkit.org/show_bug.cgi?id=187355
1895
1896         Reviewed by Anders Carlsson.
1897
1898         * Configurations/WebContentService.Development.xcconfig: Set WK_USE_RESTRICTED_ENTITLEMENTS
1899           to NO for the Development service.
1900
1901 2018-07-05  Rob Buis  <rbuis@igalia.com>
1902
1903         [GTK] Remove soup/DownloadSoupErrors.h
1904         https://bugs.webkit.org/show_bug.cgi?id=187339
1905
1906         This header is not used anymore.
1907
1908         Reviewed by Frédéric Wang.
1909
1910         * NetworkProcess/Downloads/soup/DownloadSoupErrors.h: Removed.
1911         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
1912         * PlatformGTK.cmake:
1913
1914 2018-07-04  Carlos Garcia Campos  <cgarcia@igalia.com>
1915
1916         REGRESSION(r233325): [GTK] Broke 40 animations tests
1917         https://bugs.webkit.org/show_bug.cgi?id=187264
1918
1919         Reviewed by Žan Doberšek.
1920
1921         Use a different PlatformDisplayID for compositing in the GTK port. This way, when entering AC a window screen
1922         changed is emitted and the GTK default display refresh monitor is destroyed, ensuring the one created by the
1923         threaded compositor is used.
1924
1925         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1926         (WebKit::ThreadedCompositor::create): Remove unused WebPage parameter and add PlatformDisplayID.
1927         (WebKit::ThreadedCompositor::ThreadedCompositor): Create the display refresh monitor with the given displayID.
1928         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
1929         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
1930         (WebKit::ThreadedDisplayRefreshMonitor::ThreadedDisplayRefreshMonitor): Pass the given displayID to the parent constructor.
1931         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h:
1932         (WebKit::ThreadedDisplayRefreshMonitor::create): Add PlatformDisplayID parameter.
1933         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
1934         (WebKit::ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost): Use compositingDisplayID when
1935         creating the threaded compositor and notify about the window screen change.
1936         (WebKit::ThreadedCoordinatedLayerTreeHost::setIsDiscardable): Use primaryDisplayID when leaving AC and
1937         compositingDisplayID when re-entering.
1938
1939 2018-07-04  Olivia Barnett  <obarnett@apple.com>
1940
1941         A WKWebView in a UIViewController that is presented modally and uses a file picker will be incorrectly dismissed by the system
1942         https://bugs.webkit.org/show_bug.cgi?id=185257
1943         <rdar://problem/40819252>
1944
1945         Reviewed by Tim Horton.
1946
1947         Call to dismiss the presented modal was being called on the parent and not the child, which caused the file picker to be incorrectly dismissed along with the modal. A test for this bug-fix could not be completed without additional tools as TestWebKitAPI is not a UI application.
1948
1949         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1950         (-[WKFileUploadPanel _dismissDisplayAnimated:]):
1951
1952 2018-07-04  Tim Horton  <timothy_horton@apple.com>
1953
1954         Introduce PLATFORM(IOSMAC)
1955         https://bugs.webkit.org/show_bug.cgi?id=187315
1956
1957         Reviewed by Dan Bernstein.
1958
1959         * Configurations/Base.xcconfig:
1960         * Configurations/FeatureDefines.xcconfig:
1961         * Configurations/NetworkService.xcconfig:
1962         * Configurations/WebContentService.xcconfig:
1963         * Configurations/WebKit.xcconfig:
1964         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1965         (WebKit::NetworkProcess::sourceApplicationAuditData const):
1966         * NetworkProcess/ios/NetworkProcessIOS.mm:
1967         * NetworkProcess/mac/NetworkProcessMac.mm:
1968         (WebKit::NetworkProcess::initializeProcessName):
1969         (WebKit::overrideSystemProxies):
1970         * Platform/mac/LayerHostingContext.mm:
1971         (WebKit::LayerHostingContext::createForExternalHostingProcess):
1972         * Platform/spi/ios/UIKitSPI.h:
1973         * Shared/ios/ChildProcessIOS.mm:
1974         (WebKit::ChildProcess::initializeSandbox):
1975         * Shared/ios/InteractionInformationAtPosition.h:
1976         * Shared/ios/InteractionInformationAtPosition.mm:
1977         (WebKit::InteractionInformationAtPosition::encode const):
1978         (WebKit::InteractionInformationAtPosition::decode):
1979         * Shared/mac/ChildProcessMac.mm:
1980         (WebKit::ChildProcess::setApplicationIsDaemon):
1981         (WebKit::enableSandboxStyleFileQuarantine):
1982         * Shared/mac/CodeSigning.mm:
1983         * UIProcess/API/Cocoa/WKWebView.mm:
1984         (-[WKWebView _webViewPrintFormatter]):
1985         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1986         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
1987         (WebKit::RemoteLayerTreeHost::updateLayerTree):
1988         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
1989         (-[WKRemoteView initWithFrame:contextID:]):
1990         * UIProcess/_WKWebViewPrintFormatter.mm:
1991         * UIProcess/_WKWebViewPrintFormatterInternal.h:
1992         * UIProcess/ios/WKContentView.mm:
1993         (-[WKContentView _didExitStableState]):
1994         * UIProcess/ios/WKContentViewInteraction.mm:
1995         (-[WKContentView gestureRecognizer:canBePreventedByGestureRecognizer:]):
1996         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
1997         (-[WKContentView canPerformActionForWebView:withSender:]):
1998         (-[WKContentView _defineForWebView:]):
1999         (-[WKContentView setSelectedTextRange:]):
2000         (-[WKContentView closestPositionToPoint:]):
2001         (-[WKContentView _updateChangedSelection:]):
2002         * UIProcess/ios/WKLegacyPDFView.mm:
2003         * UIProcess/ios/WKPDFView.mm:
2004         * WebKit.xcodeproj/project.pbxproj:
2005         * WebProcess/WebPage/ios/WebPageIOS.mm:
2006         (WebKit::WebPage::selectWithGesture):
2007         (WebKit::WebPage::getPositionInformation):
2008         * WebProcess/cocoa/WebProcessCocoa.mm:
2009         (WebKit::WebProcess::initializeSandbox):
2010         * config.h:
2011
2012 2018-07-04  Carlos Garcia Campos  <cgarcia@igalia.com>
2013
2014         50 failing WebDriver tests after r233417
2015         https://bugs.webkit.org/show_bug.cgi?id=187263
2016
2017         Reviewed by Frédéric Wang.
2018
2019         A std::optional value is used while being std::nullopt. This is because the wrong input source is used when
2020         transitioning keyboard input states.
2021
2022         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
2023         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
2024
2025 2018-07-03  Youenn Fablet  <youenn@apple.com>
2026
2027         Remove quarantine for Webex plugin
2028         https://bugs.webkit.org/show_bug.cgi?id=187050
2029         rdar://problem/41478189
2030
2031         Reviewed by Brent Fulgham.
2032
2033         Update the Plugin Info.plist to not do quarantine of downloaded files by default.
2034         Update PluginProcess implementation to reenable quarantine for all plug-ins except cisco webex plug-in.
2035
2036         * Platform/spi/mac/QuarantineSPI.h: Add qtn_proc_init.
2037         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist:
2038         * PluginProcess/PluginProcess.h:
2039         * PluginProcess/mac/PluginProcessMac.mm:
2040         (WebKit::PluginProcess::shouldOverrideQuarantine):
2041         * Shared/ChildProcess.h:
2042         (WebKit::ChildProcess::shouldOverrideQuarantine):
2043         * Shared/mac/ChildProcessMac.mm:
2044         (WebKit::ChildProcess::initializeSandbox):
2045
2046 2018-07-03  Youenn Fablet  <youenn@apple.com>
2047
2048         Crash in  WebKit::CacheStorage::Cache::toRecordInformation when running http/tests/cache-storage/cache-persistency.https.html
2049         https://bugs.webkit.org/show_bug.cgi?id=187243
2050
2051         Reviewed by Chris Dumez.
2052
2053         In case a caches object has an engine, it uses the engine to get the salt.
2054         In case engine/caches are non persistent, no salt was set for the engine, hence the crashes.
2055         Add an empty salt whenever initializing a non-persistent engine to remove the crash.
2056
2057         Covered by updated expectations for two tests.
2058
2059         * NetworkProcess/cache/CacheStorageEngine.cpp:
2060         (WebKit::CacheStorage::Engine::initialize):
2061
2062 2018-07-03  Youenn Fablet  <youenn@apple.com>
2063
2064         Fix regression introduced in r233335
2065         https://bugs.webkit.org/show_bug.cgi?id=187282
2066
2067         Reviewed by Chris Dumez.
2068
2069         When checking for navigation loads, we need to return whether the request URL matches the service worker URL.
2070         Before this patch, if the request URL was not matching the service worker URL, we were using the origin/referrer
2071         which should only be used for subresource loads.
2072
2073         Covered by imported/w3c/web-platform-tests/service-workers/service-worker/claim-with-redirect.https.html
2074         being no longer flaky.
2075
2076         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2077         (WebKit::isValidFetch):
2078
2079 2018-07-03  Chris Dumez  <cdumez@apple.com>
2080
2081         Make CallbackMap::invalidate() safe to re-enter
2082         https://bugs.webkit.org/show_bug.cgi?id=187298
2083         <rdar://problem/41057167>
2084
2085         Reviewed by Geoffrey Garen.
2086
2087         Made it safe to re-enter CallbackMap::invalidate(), GenericCallback::performCallbackWithReturnValue(),
2088         GenericCallback::invalidate() & invalidateCallbackMap() since those execute client blocks which may
2089         re-enter WebKit.
2090
2091         * UIProcess/GenericCallback.h:
2092         (WebKit::GenericCallback::performCallbackWithReturnValue):
2093         (WebKit::invalidateCallbackMap):
2094
2095 2018-07-03  Brent Fulgham  <bfulgham@apple.com>
2096
2097         [iOS] Clean up sandbox warnings found during Public Beta
2098         https://bugs.webkit.org/show_bug.cgi?id=187308
2099         <rdar://problem/41203914>
2100
2101         Reviewed by Eric Carlson.
2102
2103         I made our sandbox overly restrictive during our iOS 12.0 development cycle, and have found a number of missing items.
2104
2105         This patch adds the missing IOKit properties, and removes a duplicate call to (play-media).
2106
2107         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2108
2109 2018-07-03  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2110
2111         [Curl] Embed certificate information into ResourceResponse.
2112         https://bugs.webkit.org/show_bug.cgi?id=187102
2113
2114         Reviewed by Youenn Fablet.
2115
2116         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
2117         (WebKit::NetworkDataTaskCurl::curlDidComplete):.
2118
2119 2018-07-03  Simon Fraser  <simon.fraser@apple.com>
2120
2121         [iOS WK2] We fail to make surfaces volatile when suspending, increasing memory impact
2122         https://bugs.webkit.org/show_bug.cgi?id=187285
2123         rdar://problem/41732391
2124
2125         Reviewed by Tim Horton.
2126         
2127         The "Mach port as layer contents" code path used in iOS WK2 relies on replacing the 
2128         Mach port layer contents with the actual IOSurface on suspension (otherwise the
2129         live Mach port will keep the surface in use). However, we were never hitting this
2130         RemoteLayerTreeHost::mapAllIOSurfaceBackingStore() code path on iOS 11 and later
2131         because UIKit stopped firing the notification we relied on.
2132         
2133         To fix this, use the _UIApplicationDidFinishSuspensionSnapshotNotification notification
2134         which is fired on UIApp.
2135
2136         * Platform/spi/ios/UIKitSPI.h:
2137         * UIProcess/ApplicationStateTracker.mm:
2138         (WebKit::ApplicationStateTracker::ApplicationStateTracker):
2139
2140 2018-07-02  Simon Fraser  <simon.fraser@apple.com>
2141
2142         Clean up the layer volatility code and logging
2143         https://bugs.webkit.org/show_bug.cgi?id=187286
2144
2145         Reviewed by Tim Horton.
2146         
2147         Fix the layer volatility logging so it doesn't say "succeeded" when it actually failed
2148         and gave up.
2149         
2150         Use a couple of lambda functions in RemoteLayerBackingStore::setBufferVolatility() to
2151         make the code easier to read.
2152
2153         * Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
2154         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
2155         (WebKit::RemoteLayerBackingStore::setBufferVolatility):
2156         * WebProcess/WebPage/WebPage.cpp:
2157         (WebKit::WebPage::callVolatilityCompletionHandlers):
2158         (WebKit::WebPage::layerVolatilityTimerFired):
2159         (WebKit::WebPage::markLayersVolatile):
2160         * WebProcess/WebPage/WebPage.h:
2161         (WebKit::WebPage::markLayersVolatile):
2162         * WebProcess/WebProcess.cpp:
2163         (WebKit::WebProcess::actualPrepareToSuspend):
2164         (WebKit::WebProcess::markAllLayersVolatile):
2165         * WebProcess/WebProcess.h:
2166
2167 2018-07-03  John Wilander  <wilander@apple.com>
2168
2169         Resource Load Statistics: Make WebsiteDataStore::getAllStorageAccessEntries() call the right network process instead of iterating over the process pools
2170         https://bugs.webkit.org/show_bug.cgi?id=187277
2171         <rdar://problem/41745510>
2172
2173         Reviewed by Chris Dumez.
2174
2175         Existing tests use this code. The change is for correctness.
2176
2177         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2178         (-[WKWebsiteDataStore _getAllStorageAccessEntriesFor:completionHandler:]):
2179             Now receives a WKWebView from its caller and gets the page ID from it.
2180         (-[WKWebsiteDataStore _getAllStorageAccessEntries:]): Deleted.
2181         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2182         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2183         (WebKit::WebsiteDataStore::getAllStorageAccessEntries):
2184             Now gets a page ID from its caller and gets the right network process
2185             through it.
2186         * UIProcess/WebsiteData/WebsiteDataStore.h:
2187
2188 2018-07-03  Jonathan Bedard  <jbedard@apple.com>
2189
2190         Unreviewed, rolling out r233461.
2191
2192         Assertions triggered during iOS 11 debug layout and API tests
2193
2194         Reverted changeset:
2195
2196         "[iOS] Add assert to catch improper use of WebCore::Timer in
2197         UI Process"
2198         https://bugs.webkit.org/show_bug.cgi?id=185330
2199         https://trac.webkit.org/changeset/233461
2200
2201 2018-07-03  Youenn Fablet  <youenn@apple.com>
2202
2203         Update com.cmbchina.CMBSecurity.sb to make it functional
2204         https://bugs.webkit.org/show_bug.cgi?id=187278
2205
2206         Reviewed by Brent Fulgham.
2207
2208         * Resources/PlugInSandboxProfiles/com.cmbchina.CMBSecurity.sb:
2209
2210 2018-07-03  Jer Noble  <jer.noble@apple.com>
2211
2212         Update Fullscreen anti-phishing alert text
2213         https://bugs.webkit.org/show_bug.cgi?id=187199
2214         <rdar://problem/41162543>
2215
2216         Reviewed by Brent Fulgham.
2217
2218         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
2219         (-[WKFullScreenViewController _showPhishingAlert]):
2220
2221 2018-07-03  David Kilzer  <ddkilzer@apple.com>
2222
2223         [iOS] Add assert to catch improper use of WebCore::Timer in UI Process
2224         <https://webkit.org/b/185330>
2225         <rdar://problem/32816079>
2226
2227         Reviewed by Darin Adler.
2228
2229         * NetworkProcess/NetworkProcess.cpp:
2230         (WebKit::NetworkProcess::NetworkProcess):
2231         * StorageProcess/StorageProcess.cpp:
2232         (WebKit::StorageProcess::StorageProcess):
2233         * WebProcess/WebProcess.cpp:
2234         (WebKit::m_nonVisibleProcessCleanupTimer):
2235         - Call setWebKitProcessType() to se the global for the current
2236           process.
2237
2238 2018-07-03  Frederic Wang  <fred.wang@free.fr>
2239
2240         [iOS] Animations with Bézier timing function not suspended on UI process when animation-play-state is set to "paused"
2241         https://bugs.webkit.org/show_bug.cgi?id=170784
2242
2243         Reviewed by Antoine Quint.
2244
2245         In order to pause a running animation, GraphicsLayerCA::pauseCAAnimationOnLayer calls
2246         PlatformCALayer::addAnimationForKey, assuming it will replace the current animation.
2247         This patch fixes PlatformCALayerRemote::addAnimationForKey to ensure this assumption holds.
2248
2249         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
2250         (WebKit::PlatformCALayerRemote::addAnimationForKey): If the animation was already sent to
2251         the UI process, make sure it is properly updated.
2252
2253 2018-07-02  Youenn Fablet  <youenn@apple.com>
2254
2255         Add sandbox to microdone plugin
2256         https://bugs.webkit.org/show_bug.cgi?id=187149
2257         <rdar://problem/41538057>
2258
2259         Unreviewed.
2260
2261         * Resources/PlugInSandboxProfiles/cn.microdone.cmb.safari.sb: Renamed from Source/WebKit/Resources/PlugInSandboxProfiles/cn.microdone.cmb.safari.
2262         * WebKit.xcodeproj/project.pbxproj:
2263
2264 2018-07-02  Tim Horton  <timothy_horton@apple.com>
2265
2266         Adjust now-incorrect animated resize logging after r232544
2267         https://bugs.webkit.org/show_bug.cgi?id=187281
2268         <rdar://problem/41645347>
2269
2270         Reviewed by Simon Fraser.
2271
2272         * UIProcess/API/Cocoa/WKWebView.mm:
2273         (-[WKWebView _didCommitLayerTree:]):
2274         (-[WKWebView _didCompleteAnimatedResize]):
2275         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
2276         _beginAnimatedResizeWithUpdate: and _didCompleteAnimatedResize are
2277         not strictly paired; we could instead track the SPI, but it's a bit
2278         tricky since resizeWithContentHidden has an implicit endAnimatedResize.
2279         Instead, just log if we still have a resizeAnimationView when we're
2280         committing outside of an animated resize, which seems to be the original concern,
2281         and point toward the possibility of unpaired begin/end.
2282         Also fix logging that has the wrong method name.
2283
2284 2018-07-02  Youenn Fablet  <youenn@apple.com>
2285
2286         Update com.apple.NPSafeInput.sb to make it functional
2287         https://bugs.webkit.org/show_bug.cgi?id=187276
2288
2289         Reviewed by Brent Fulgham.
2290
2291         * Resources/PlugInSandboxProfiles/com.apple.NPSafeInput.sb:
2292
2293 2018-07-02  Youenn Fablet  <youenn@apple.com>
2294
2295         Update com.cfca.npSecEditCtl.MAC.BOC.plugin.sb to make it functional
2296         https://bugs.webkit.org/show_bug.cgi?id=187261
2297
2298         Reviewed by Brent Fulgham.
2299
2300         * Resources/PlugInSandboxProfiles/com.cfca.npSecEditCtl.MAC.BOC.plugin.sb:
2301
2302 2018-07-02  Brady Eidson  <beidson@apple.com>
2303
2304         Crash notifying observers of responsiveness state change
2305         <rdar://problem/41267796> and https://bugs.webkit.org/show_bug.cgi?id=187262
2306
2307         Reviewed by Tim Horton.
2308
2309         * UIProcess/PageLoadState.cpp:
2310         (WebKit::PageLoadState::callObserverCallback): Copy the container ahead of time.
2311
2312 2018-07-02  Sihui Liu  <sihui_liu@apple.com>
2313
2314         Remove InitWebCoreThreadSystemInterface() in WKProcessPool _initWithConfiguration
2315         https://bugs.webkit.org/show_bug.cgi?id=187252
2316
2317         Reviewed by Dan Bernstein.
2318
2319         Clean up after <rdar://problem/15256572>.
2320
2321         * UIProcess/API/Cocoa/WKProcessGroup.mm:
2322         (-[WKProcessGroup initWithInjectedBundleURL:]):
2323         * UIProcess/API/Cocoa/WKProcessPool.mm:
2324         (-[WKProcessPool _initWithConfiguration:]):
2325
2326 2018-07-02  Zan Dobersek  <zdobersek@igalia.com>
2327
2328         REGRESSION(r233381): Double WebResourceLoadStatisticsStore destructor invocation
2329         https://bugs.webkit.org/show_bug.cgi?id=187247
2330
2331         Reviewed by Chris Dumez.
2332
2333         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2334         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
2335         Don't call postTask() to dispatch this task, as that keeps a reference
2336         to this WebResourceLoadStatisticsStore object and thus causes problems
2337         when invoked from the destructor in the form of a second destructor
2338         invocation that ends up crashing the process. Blocking nature of this
2339         call should be enough to avoid WebResourceLoadStatisticsStore lifetime
2340         issues.
2341
2342 2018-07-02  Per Arne Vollan  <pvollan@apple.com>
2343
2344         Delete display link when closing page or the WebContent process has crashed.
2345         https://bugs.webkit.org/show_bug.cgi?id=186895
2346
2347         Reviewed by Brent Fulgham.
2348
2349         If there is a running display link in the UI process, there is no need to keep it around if the
2350         page is being closed or the WebContent process has crashed.
2351
2352         * UIProcess/WebPageProxy.cpp:
2353         (WebKit::WebPageProxy::close):
2354         (WebKit::WebPageProxy::resetStateAfterProcessExited):
2355
2356 2018-06-23  Darin Adler  <darin@apple.com>
2357
2358         [Cocoa] Improve ARC compatibility of more code in JavaScriptCore
2359         https://bugs.webkit.org/show_bug.cgi?id=186973
2360
2361         Reviewed by Dan Bernstein.
2362
2363         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
2364         (WebKit::XPCServiceInitializerDelegate::hasEntitlement): Use WTF::hasEntitlement.
2365
2366         * Shared/mac/SandboxUtilities.h: Removed connectedProcessHasEntitlement since
2367         we can now use WTF::hasEntitlement instead.
2368         * Shared/mac/SandboxUtilities.mm: Ditto.
2369
2370         * StorageProcess/ios/StorageProcessIOS.mm:
2371         (WebKit::StorageProcess::parentProcessHasServiceWorkerEntitlement): Use
2372         WTF::hasEntitlement.
2373         * WebProcess/WebPage/ios/WebPageIOS.mm:
2374         (WebKit::WebPage::parentProcessHasServiceWorkerEntitlement): Ditto.
2375
2376 2018-06-30  David Kilzer  <ddkilzer@apple.com>
2377
2378         Fix clang static analyzer warnings: Garbage return value
2379         <https://webkit.org/b/187224>
2380
2381         Reviewed by Eric Carlson.
2382
2383         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
2384         (WebKit::WebPlatformStrategies::changeCount):
2385         (WebKit::WebPlatformStrategies::addTypes):
2386         (WebKit::WebPlatformStrategies::setTypes):
2387         (WebKit::WebPlatformStrategies::setBufferForType):
2388         (WebKit::WebPlatformStrategies::setPathnamesForType):
2389         (WebKit::WebPlatformStrategies::setStringForType):
2390         (WebKit::WebPlatformStrategies::getNumberOfFiles):
2391         (WebKit::WebPlatformStrategies::getPasteboardItemsCount):
2392         (WebKit::WebPlatformStrategies::writeCustomData):
2393         * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:
2394         (WebKit::WebEditorClient::substitutionsPanelIsShowing):
2395         - Use brace initialization for local variables.
2396
2397 2018-06-30  Michael Catanzaro  <mcatanzaro@igalia.com>
2398
2399         Unreviewed, add missing PLATFORM(COCOA) guard after r233207
2400         https://bugs.webkit.org/show_bug.cgi?id=186788
2401         <rdar://problem/41094167>
2402
2403         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
2404         (WKBundleExtendClassesForParameterCoder):
2405
2406 2018-06-30  Dan Bernstein  <mitz@apple.com>
2407
2408         Added a missing availability attribute.
2409
2410         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
2411
2412 2018-06-29  John Wilander  <wilander@apple.com>
2413
2414         Resource Load Statistics: Make network process calls only for the process pool that the page belongs to
2415         https://bugs.webkit.org/show_bug.cgi?id=187206
2416         <rdar://problem/41659160>
2417
2418         Reviewed by Chris Dumez.
2419
2420         Instead of iterating over all process pools, we should resolve which
2421         process pool the page belongs to and call the network process only for
2422         that pool. This is especially important since we use WTFMove for the
2423         completion handlers.
2424
2425         This patch also renames "callback" to "completionHandler" for
2426         the functions touched.
2427
2428         A FIXME comment is added to WebsiteDataStore::getAllStorageAccessEntries()
2429         where we currently don't have a page ID to do the lookup with.
2430
2431         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2432         (WebKit::WebsiteDataStore::updatePrevalentDomainsToPartitionOrBlockCookies):
2433         (WebKit::WebsiteDataStore::hasStorageAccessForFrameHandler):
2434         (WebKit::WebsiteDataStore::getAllStorageAccessEntries):
2435         (WebKit::WebsiteDataStore::grantStorageAccessHandler):
2436         (WebKit::WebsiteDataStore::hasStorageAccess):
2437         (WebKit::WebsiteDataStore::requestStorageAccess):
2438         (WebKit::WebsiteDataStore::grantStorageAccess):
2439
2440 2018-06-29  Chris Dumez  <cdumez@apple.com>
2441
2442         Add utility methods to WebResourceLoadStatisticsStore to hop back and forth between threads
2443         https://bugs.webkit.org/show_bug.cgi?id=187200
2444
2445         Reviewed by Brent Fulgham.
2446
2447         Add utility methods to WebResourceLoadStatisticsStore to hop back and forth between threads,
2448         in order the simplify the code a little bit.
2449
2450         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
2451         (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
2452         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2453         (WebKit::WebResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned):
2454         (WebKit::WebResourceLoadStatisticsStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
2455         (WebKit::WebResourceLoadStatisticsStore::setShouldSubmitTelemetry):
2456         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
2457         (WebKit::WebResourceLoadStatisticsStore::postTask):
2458         (WebKit::WebResourceLoadStatisticsStore::postTaskReply):
2459         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
2460         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
2461         (WebKit::WebResourceLoadStatisticsStore::scheduleStatisticsAndDataRecordsProcessing):
2462         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
2463         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
2464         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
2465         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
2466         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
2467         (WebKit::WebResourceLoadStatisticsStore::performDailyTasks):
2468         (WebKit::WebResourceLoadStatisticsStore::submitTelemetry):
2469         (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation):
2470         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
2471         (WebKit::WebResourceLoadStatisticsStore::logNonRecentUserInteraction):
2472         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
2473         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
2474         (WebKit::WebResourceLoadStatisticsStore::setLastSeen):
2475         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
2476         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource):
2477         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
2478         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource):
2479         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder):
2480         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo):
2481         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
2482         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
2483         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
2484         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
2485         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
2486         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
2487         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom):
2488         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo):
2489         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom):
2490         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdate):
2491         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdateForDomains):
2492         (WebKit::WebResourceLoadStatisticsStore::scheduleClearPartitioningStateForDomains):
2493         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningStateReset):
2494         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemory):
2495         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
2496         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
2497         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree):
2498         (WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
2499         (WebKit::WebResourceLoadStatisticsStore::setGrandfatheringTime):
2500         (WebKit::WebResourceLoadStatisticsStore::setMaxStatisticsEntries):
2501         (WebKit::WebResourceLoadStatisticsStore::setPruneEntriesDownTo):
2502         (WebKit::WebResourceLoadStatisticsStore::resetParametersToDefaultValues):
2503         * UIProcess/WebResourceLoadStatisticsStore.h:
2504
2505 2018-06-29  Aditya Keerthi  <akeerthi@apple.com>
2506
2507         [macOS] Do not crash if there is an attempt to copy a file URL to the clipboard
2508         https://bugs.webkit.org/show_bug.cgi?id=187183
2509
2510         Reviewed by Wenson Hsieh.
2511
2512         r210683 introduced logic to prevent file URLs from being copied to the clipboard
2513         in unexpected cases. The current logic always crashes the WebProcess if
2514         webProcessProxy->checkURLReceivedFromWebProcess returns false. Instead of
2515         crashing, we can fail silently and not copy anything to the clipboard.
2516
2517         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
2518         (WebKit::WebPasteboardProxy::setPasteboardPathnamesForType): Removed call to markCurrentlyDispatchedMessageAsInvalid() which was causing the process to crash.
2519
2520 2018-06-29  Chris Dumez  <cdumez@apple.com>
2521
2522         Regression(r233359): Caused ITP tests to be flaky
2523         https://bugs.webkit.org/show_bug.cgi?id=187189
2524
2525         Reviewed by Youenn Fablet.
2526
2527         r233359 started using m_resolvedConfiguration.resourceLoadStatisticsDirectory instead of
2528         m_configuration.resourceLoadStatisticsDirectory for the ITP path. This is consistent
2529         with what we do for other database paths so that things like '~' in paths get resolved.
2530
2531         This introduced flakiness because the resourceLoadStatisticsDirectory was never getting
2532         resolved and m_resolvedConfiguration.resourceLoadStatisticsDirectory was not set.
2533         Update the WebsiteDataStore so that m_resolvedConfiguration.resourceLoadStatisticsDirectory
2534         properly gets set to the resolved version of m_configuration.resourceLoadStatisticsDirectory.
2535
2536         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2537         (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
2538         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
2539
2540 2018-06-29  John Wilander  <wilander@apple.com>
2541
2542         Resource Load Statistics: Don't create a WebResourceLoadStatisticsStore for ephemeral sessions
2543         https://bugs.webkit.org/show_bug.cgi?id=187154
2544         <rdar://problem/41487250>
2545
2546         Reviewed by Brent Fulgham and Chris Dumez.
2547
2548         Most of the changes in this patch remove the boolean parameter for tracking
2549         ephemeral sessions and the IsReadOnly enum.
2550
2551         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2552         (-[WKWebsiteDataStore _setResourceLoadStatisticsTestingCallback:]):
2553             Now returns early for ephemeral sessions.
2554         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
2555         (WebKit::ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage):
2556         (WebKit::ResourceLoadStatisticsPersistentStorage::writeMemoryStoreToDisk):
2557         (WebKit::ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore):
2558         * UIProcess/ResourceLoadStatisticsPersistentStorage.h:
2559         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2560         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
2561         * UIProcess/WebResourceLoadStatisticsStore.h:
2562         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2563         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
2564             Now returns early for ephemeral sessions.
2565         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
2566
2567 2018-06-29  Chris Dumez  <cdumez@apple.com>
2568
2569         Stop using lambdas for WebResourceLoadStatisticsStore to interact with its WebsiteDataStore
2570         https://bugs.webkit.org/show_bug.cgi?id=187165
2571
2572         Reviewed by Brent Fulgham.
2573
2574         Stop using lambdas for WebResourceLoadStatisticsStore to interact with its WebsiteDataStore. Instead,
2575         WebResourceLoadStatisticsStore now holds a weak pointer to its WebsiteDataStore and is able to call
2576         methods on it directly. Reducing the indirection makes the code less complex and more understandable.
2577
2578         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2579         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
2580         (WebKit::WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler):
2581         (WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler):
2582         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
2583         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToPartitionOrBlockCookiesHandler):
2584         (WebKit::WebResourceLoadStatisticsStore::callRemoveDomainsHandler):
2585         * UIProcess/WebResourceLoadStatisticsStore.h:
2586         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2587         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
2588
2589 2018-06-29  Miguel Gomez  <magomez@igalia.com>
2590
2591         [WPE] Some frames are dropped when using rAF to animate an element
2592         https://bugs.webkit.org/show_bug.cgi?id=187175
2593
2594         Always call renderNextFrame in ThreadedCompositor::requestDisplayRefreshMonitorUpdate()
2595         so we have to process any pending layer flush request.
2596
2597         Reviewed by Žan Doberšek.
2598
2599         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2600         (WebKit::ThreadedCompositor::handleDisplayRefreshMonitorUpdate):
2601
2602 2018-06-28  Chris Dumez  <cdumez@apple.com>
2603
2604         Make sure the WebResourceLoadStatisticsStore gets destroyed on the main thread
2605         https://bugs.webkit.org/show_bug.cgi?id=187143
2606
2607         Reviewed by Youenn Fablet.
2608
2609         Have WebResourceLoadStatisticsStore subclass ThreadSafeRefCounted<WebResourceLoadStatisticsStore, WTF::DestructionThread::Main>
2610         instead of IPC::Connection::WorkQueueMessageReceiver. This makes sure that the WebResourceLoadStatisticsStore
2611         objects get destroyed on the main thread, even if the last ref was held by a background thread.
2612
2613         Also, methods called by IPC are now called on the main thread instead of the background queue. I think it is clearer for all
2614         of WebResourceLoadStatisticsStore usage to be on the main thread. Expensive work is still done on the background queue, inside
2615         the persistent / memory store classes.
2616
2617         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2618         (WebKit::WebResourceLoadStatisticsStore::~WebResourceLoadStatisticsStore):
2619         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
2620         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
2621         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
2622         (WebKit::WebResourceLoadStatisticsStore::processWillOpenConnection):
2623         (WebKit::WebResourceLoadStatisticsStore::processDidCloseConnection):
2624         * UIProcess/WebResourceLoadStatisticsStore.h:
2625
2626 2018-06-28  Jiewen Tan  <jiewen_tan@apple.com>
2627
2628         Add nullptr check for xpc_connection_t in AuthenticationManager::initializeConnection
2629         https://bugs.webkit.org/show_bug.cgi?id=187110
2630         <rdar://problem/41536815>
2631
2632         Reviewed by Brent Fulgham.
2633
2634         In some rare cases as shown by crash tracers that the passed xpc_connection_t object could be nullptr,
2635         and xpc_connection_set_event_handler won't do the nullptr check on its parameters. Therefore, we should
2636         do it by ourselves.
2637
2638         * Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
2639         (WebKit::AuthenticationManager::initializeConnection):
2640         * UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm:
2641         (WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc const):
2642
2643 2018-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2644
2645         [iOS] DataTransfer.getData always returns the empty string when dropping text
2646         https://bugs.webkit.org/show_bug.cgi?id=187130
2647         <rdar://problem/41014117>
2648
2649         Reviewed by Ryosuke Niwa.
2650
2651         Add plumbing to grab information for each item in the pasteboard. See WebCore ChangeLog for more detail.
2652
2653         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
2654         (WebKit::WebPasteboardProxy::allPasteboardItemInfo):
2655         * UIProcess/WebPasteboardProxy.h:
2656         * UIProcess/WebPasteboardProxy.messages.in:
2657         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
2658         (WebKit::WebPlatformStrategies::allPasteboardItemInfo):
2659         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
2660
2661 2018-06-28  Youenn Fablet  <youenn@apple.com>
2662
2663         Early return when handling fetch event in case service worker origin does not match origin of a subresource load
2664         https://bugs.webkit.org/show_bug.cgi?id=187153
2665         <rdar://problem/41329832>
2666
2667         Reviewed by Chris Dumez.
2668
2669         Stop crashing the service worker process in case a subresource load origin is not matching a service worker origin.
2670         Instead, just return early so that the load will be handled by the network process.
2671
2672         Keep crashing in case a navigation load is not matching its service worker origin.
2673         Add more logging to help with the debugging.
2674
2675         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2676         (WebKit::logValidFetchError):
2677         (WebKit::isValidFetch):
2678         (WebKit::WebSWContextManagerConnection::startFetch):
2679
2680 2018-06-28  Jeremy Jones  <jeremyj@apple.com>
2681
2682         Fullscreen exits when placeholder is removed then added during a single runloop.
2683         https://bugs.webkit.org/show_bug.cgi?id=187079
2684
2685         Reviewed by Jer Noble.
2686
2687         Instead of closing fullscreen as soon as the placeholder is removed from the view hierarchy,
2688         give the placeholder until the next runloop to be re-added to the view hierarchy.
2689
2690         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
2691         (-[WKFullScreenWindowController placeholderWillMoveToSuperview:]):
2692
2693 2018-06-28  Youenn Fablet  <youenn@apple.com>
2694
2695         Handle the case of registerMDNSNameCallback called several times
2696         https://bugs.webkit.org/show_bug.cgi?id=187150
2697         <rdar://problem/41329832>
2698
2699         Reviewed by Eric Carlson.
2700
2701         This is a speculative fix on the basis that registerMDNSNameCallback may be called several times.
2702         In that case, we would have freed the context after the first call and would reuse it for the second call.
2703
2704         Instead, keep a map of pending requests and pass to registerMDNSNameCallback an identifier to that map.
2705         If the map has no value for that identifier, return early.
2706
2707         * NetworkProcess/webrtc/NetworkMDNSRegister.cpp:
2708         (WebKit::NetworkMDNSRegister::~NetworkMDNSRegister):
2709         (WebKit::pendingRegistrationRequests):
2710         (WebKit::registerMDNSNameCallback):
2711         (WebKit::NetworkMDNSRegister::clearPendingRequests):
2712         (WebKit::NetworkMDNSRegister::registerMDNSName):
2713         * NetworkProcess/webrtc/NetworkMDNSRegister.h:
2714         (): Deleted.
2715
2716 2018-06-28  Chris Dumez  <cdumez@apple.com>
2717
2718         Unreviewed attempt to fix Win Cairo build after r233310.
2719
2720         * UIProcess/WebResourceLoadStatisticsStore.h:
2721
2722 2018-06-28  Chris Dumez  <cdumez@apple.com>
2723
2724         Unreviewed attempt to fix Win Cairo build after r233310.
2725
2726         * UIProcess/WebResourceLoadStatisticsStore.h:
2727
2728 2018-06-28  Chris Dumez  <cdumez@apple.com>
2729
2730         Split memory store logic out of WebResourceLoadStatisticsStore to clarify threading model
2731         https://bugs.webkit.org/show_bug.cgi?id=187055
2732         <rdar://problem/41584026>
2733
2734         Unreviewed, temporarily disable main thread assertion added to flushAndDestroyPersistentStore()
2735         in r233310, until Bug 187143 is fixed.
2736
2737         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2738         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
2739
2740 2018-06-28  Youenn Fablet  <youenn@apple.com>
2741
2742         Add sandbox to microdone plugin
2743         https://bugs.webkit.org/show_bug.cgi?id=187149
2744         rdar://problem/41538057
2745
2746         Reviewed by Brent Fulgham.
2747
2748         * Resources/PlugInSandboxProfiles/cn.microdone.cmb.safari: Added.
2749         * WebKit.xcodeproj/project.pbxproj:
2750
2751 2018-06-28  Brian Burg  <bburg@apple.com>
2752
2753         Web Inspector: REGRESSION(r223770): "Open Link" context menu action on a linkified URL doesn't work
2754         https://bugs.webkit.org/show_bug.cgi?id=187146
2755         <rdar://problem/41369591>
2756
2757         Reviewed by Joseph Pecoraro.
2758
2759         When Web Inspector's page receives a navigation request, it's supposed to redirect any
2760         non-Inspector navigations to be loaded in the inspected page. When I refactored to use
2761         modern a policy delegate, the one line that redirects the loads was left out.
2762
2763         No new tests, because inspector tests can't navigate the inspector or inspected pages.
2764
2765         * UIProcess/mac/WKInspectorViewController.mm:
2766         (-[WKInspectorViewController webView:decidePolicyForNavigationAction:decisionHandler:]):
2767
2768 2018-06-28  Jeremy Jones  <jeremyj@apple.com>
2769
2770         Crash when _topConstraint is null in element fullscreen.
2771         https://bugs.webkit.org/show_bug.cgi?id=187075
2772
2773         Reviewed by Eric Carlson.
2774
2775         NSArray can't contain a null pointer, so check for null before creating an array from a pointer.
2776         Use the recommended +deactivateConstraints: instead of -removeConstraints:.
2777
2778         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
2779         (-[WKFullScreenViewController showUI]):
2780         (-[WKFullScreenViewController hideUI]):
2781
2782 2018-06-28  Chris Dumez  <cdumez@apple.com>
2783
2784         Split memory store logic out of WebResourceLoadStatisticsStore to clarify threading model
2785         https://bugs.webkit.org/show_bug.cgi?id=187055
2786         <rdar://problem/41584026>
2787
2788         Reviewed by Brent Fulgham.
2789
2790         Split memory store logic out of WebResourceLoadStatisticsStore and into a ResourceLoadStatisticsMemoryStore class
2791         to clarify the threading model. Previously, some of the methods of the WebResourceLoadStatisticsStore had to be
2792         called on the main thread and some of them on the background queue, which was confusing and error prone. Now,
2793         all WebResourceLoadStatisticsStore methods (except for IPC ones which will be addressed in a follow-up) are called
2794         on the main thread. The ResourceLoadStatisticsMemoryStore objects is constructed / used and destroyed on the
2795         background queue, similarly to the ResourceLoadStatisticsPersistentStore. The WebResourceLoadStatisticsStore
2796         objects merely proxies calls from WebKit to those persistent / memory stores and takes care of hopping back and
2797         forth between the background thread and the work queue.
2798
2799         While spliting code code, I found several instances where we were calling completion handlers on the wrong thread.
2800         I fixed those in this patch now that the model is clearer.
2801
2802         We can likely clean up (organize the code a bit better) in a follow-up). This patch takes care of splitting the
2803         code as it was. Code that was called on the background queue was moved to ResourceLoadStatisticsMemoryStore class
2804         and code that was called on the main thread stays in WebResourceLoadStatisticsStore.
2805
2806         * CMakeLists.txt:
2807         * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm: Renamed from Source/WebKit/UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm.
2808         (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):
2809         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp: Added.
2810         (WebKit::appendWithDelimiter):
2811         (WebKit::OperatingDate::fromWallTime):
2812         (WebKit::OperatingDate::today):
2813         (WebKit::OperatingDate::secondsSinceEpoch const):
2814         (WebKit::OperatingDate::operator== const):
2815         (WebKit::OperatingDate::operator< const):
2816         (WebKit::OperatingDate::operator<= const):
2817         (WebKit::OperatingDate::OperatingDate):
2818         (WebKit::mergeOperatingDates):
2819         (WebKit::pruneResources):
2820         (WebKit::computeImportance):
2821         (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
2822         (WebKit::ResourceLoadStatisticsMemoryStore::~ResourceLoadStatisticsMemoryStore):
2823         (WebKit::ResourceLoadStatisticsMemoryStore::setPersistentStorage):
2824         (WebKit::ResourceLoadStatisticsMemoryStore::calculateAndSubmitTelemetry):
2825         (WebKit::ResourceLoadStatisticsMemoryStore::setNotifyPagesWhenDataRecordsWereScanned):
2826         (WebKit::ResourceLoadStatisticsMemoryStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
2827         (WebKit::ResourceLoadStatisticsMemoryStore::setShouldSubmitTelemetry):
2828         (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords):
2829         (WebKit::ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain):
2830         (WebKit::ResourceLoadStatisticsMemoryStore::markAsPrevalentIfHasRedirectedToPrevalent):
2831         (WebKit::ResourceLoadStatisticsMemoryStore::processStatisticsAndDataRecords):
2832         (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess):
2833         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
2834         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener):
2835         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccess):
2836         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal):
2837         (WebKit::ResourceLoadStatisticsMemoryStore::grandfatherExistingWebsiteData):
2838         (WebKit::ResourceLoadStatisticsMemoryStore::setResourceLoadStatisticsDebugMode):
2839         (WebKit::ResourceLoadStatisticsMemoryStore::scheduleStatisticsProcessingRequestIfNecessary):
2840         (WebKit::ResourceLoadStatisticsMemoryStore::cancelPendingStatisticsProcessingRequest):
2841         (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
2842         (WebKit::ResourceLoadStatisticsMemoryStore::logUserInteraction):
2843         (WebKit::ResourceLoadStatisticsMemoryStore::logNonRecentUserInteraction):
2844         (WebKit::ResourceLoadStatisticsMemoryStore::clearUserInteraction):
2845         (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUserInteraction):
2846         (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResource):
2847         (WebKit::ResourceLoadStatisticsMemoryStore::isPrevalentResource const):
2848         (WebKit::ResourceLoadStatisticsMemoryStore::isVeryPrevalentResource const):
2849         (WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsSubFrameUnder):
2850         (WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsRedirectingTo):
2851         (WebKit::ResourceLoadStatisticsMemoryStore::clearPrevalentResource):
2852         (WebKit::ResourceLoadStatisticsMemoryStore::setGrandfathered):
2853         (WebKit::ResourceLoadStatisticsMemoryStore::isGrandfathered const):
2854         (WebKit::ResourceLoadStatisticsMemoryStore::setSubframeUnderTopFrameOrigin):
2855         (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUnderTopFrameOrigin):
2856         (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUniqueRedirectTo):
2857         (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUniqueRedirectFrom):
2858         (WebKit::ResourceLoadStatisticsMemoryStore::setTopFrameUniqueRedirectTo):
2859         (WebKit::ResourceLoadStatisticsMemoryStore::setTopFrameUniqueRedirectFrom):
2860         (WebKit::ResourceLoadStatisticsMemoryStore::setTimeToLiveUserInteraction):
2861         (WebKit::ResourceLoadStatisticsMemoryStore::setTimeToLiveCookiePartitionFree):
2862         (WebKit::ResourceLoadStatisticsMemoryStore::setMinimumTimeBetweenDataRecordsRemoval):
2863         (WebKit::ResourceLoadStatisticsMemoryStore::setGrandfatheringTime):
2864         (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveDataRecords const):
2865         (WebKit::ResourceLoadStatisticsMemoryStore::setDataRecordsBeingRemoved):
2866         (WebKit::ResourceLoadStatisticsMemoryStore::ensureResourceStatisticsForPrimaryDomain):
2867         (WebKit::ResourceLoadStatisticsMemoryStore::createEncoderFromData const):
2868         (WebKit::ResourceLoadStatisticsMemoryStore::mergeWithDataFromDecoder):
2869         (WebKit::ResourceLoadStatisticsMemoryStore::clear):
2870         (WebKit::ResourceLoadStatisticsMemoryStore::wasAccessedAsFirstPartyDueToUserInteraction):
2871         (WebKit::ResourceLoadStatisticsMemoryStore::mergeStatistics):
2872         (WebKit::ResourceLoadStatisticsMemoryStore::shouldPartitionCookies):
2873         (WebKit::ResourceLoadStatisticsMemoryStore::shouldBlockCookies):
2874         (WebKit::ResourceLoadStatisticsMemoryStore::hasUserGrantedStorageAccessThroughPrompt):
2875         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookiePartitioning):
2876         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookiePartitioningForDomains):
2877         (WebKit::ResourceLoadStatisticsMemoryStore::clearPartitioningStateForDomains):
2878         (WebKit::ResourceLoadStatisticsMemoryStore::resetCookiePartitioningState):
2879         (WebKit::ResourceLoadStatisticsMemoryStore::processStatistics const):
2880         (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUnexpiredRecentUserInteraction const):
2881         (WebKit::ResourceLoadStatisticsMemoryStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor):
2882         (WebKit::ResourceLoadStatisticsMemoryStore::includeTodayAsOperatingDateIfNecessary):
2883         (WebKit::ResourceLoadStatisticsMemoryStore::hasStatisticsExpired const):
2884         (WebKit::ResourceLoadStatisticsMemoryStore::setMaxStatisticsEntries):
2885         (WebKit::ResourceLoadStatisticsMemoryStore::setPruneEntriesDownTo):
2886         (WebKit::ResourceLoadStatisticsMemoryStore::pruneStatisticsIfNeeded):
2887         (WebKit::ResourceLoadStatisticsMemoryStore::resetParametersToDefaultValues):
2888         (WebKit::ResourceLoadStatisticsMemoryStore::logTestingEvent):
2889         (WebKit::ResourceLoadStatisticsMemoryStore::setLastSeen):
2890         (WebKit::ResourceLoadStatisticsMemoryStore::setVeryPrevalentResource):
2891         (WebKit::ResourceLoadStatisticsMemoryStore::removeAllStorageAccess):
2892         * UIProcess/ResourceLoadStatisticsMemoryStore.h: Added.
2893         (WebKit::ResourceLoadStatisticsMemoryStore::isEmpty const):
2894         (WebKit::ResourceLoadStatisticsMemoryStore::setStorageAccessPromptsEnabled):
2895         (WebKit::ResourceLoadStatisticsMemoryStore::setDebugLogggingEnabled):
2896         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
2897         (WebKit::ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage):
2898         (WebKit::ResourceLoadStatisticsPersistentStorage::startMonitoringDisk):
2899         (WebKit::ResourceLoadStatisticsPersistentStorage::monitorDirectoryForNewStatistics):
2900         (WebKit::ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore):
2901         * UIProcess/ResourceLoadStatisticsPersistentStorage.h:
2902         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2903         (WebKit::WebResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned):
2904         (WebKit::WebResourceLoadStatisticsStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
2905         (WebKit::WebResourceLoadStatisticsStore::setShouldSubmitTelemetry):
2906         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
2907         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
2908         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
2909         (WebKit::WebResourceLoadStatisticsStore::scheduleStatisticsAndDataRecordsProcessing):
2910         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
2911         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
2912         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
2913         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
2914         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
2915         (WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler):
2916         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
2917         (WebKit::WebResourceLoadStatisticsStore::performDailyTasks):
2918         (WebKit::WebResourceLoadStatisticsStore::submitTelemetry):
2919         (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation):
2920         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
2921         (WebKit::WebResourceLoadStatisticsStore::logNonRecentUserInteraction):
2922         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
2923         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
2924         (WebKit::WebResourceLoadStatisticsStore::setLastSeen):
2925         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
2926         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource):
2927         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
2928         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource):
2929         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder):
2930         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo):
2931         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
2932         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
2933         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
2934         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
2935         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
2936         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
2937         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom):
2938         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo):
2939         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom):
2940         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdate):
2941         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdateForDomains):
2942         (WebKit::WebResourceLoadStatisticsStore::scheduleClearPartitioningStateForDomains):
2943         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningStateReset):
2944         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemory):
2945         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
2946         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
2947         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree):
2948         (WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
2949         (WebKit::WebResourceLoadStatisticsStore::setGrandfatheringTime):
2950         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToPartitionOrBlockCookiesHandler):
2951         (WebKit::WebResourceLoadStatisticsStore::callRemoveDomainsHandler):
2952         (WebKit::WebResourceLoadStatisticsStore::setMaxStatisticsEntries):
2953         (WebKit::WebResourceLoadStatisticsStore::setPruneEntriesDownTo):
2954         (WebKit::WebResourceLoadStatisticsStore::resetParametersToDefaultValues):
2955         (WebKit::WebResourceLoadStatisticsStore::logTestingEvent):
2956         * UIProcess/WebResourceLoadStatisticsStore.h:
2957         * UIProcess/WebResourceLoadStatisticsTelemetry.cpp:
2958         (WebKit::sortedPrevalentResourceTelemetry):
2959         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
2960         * UIProcess/WebResourceLoadStatisticsTelemetry.h:
2961         * WebKit.xcodeproj/project.pbxproj:
2962
2963 2018-06-28  Michael Catanzaro  <mcatanzaro@igalia.com>
2964
2965         [GTK] ASSERTION FAILED: !HashTranslator::equal(KeyTraits::emptyValue(), key) when dragging file into webview
2966         https://bugs.webkit.org/show_bug.cgi?id=175602
2967
2968         Reviewed by Carlos Garcia Campos.
2969
2970         We check using the GdkDragContext to ensure the DroppingContext is still alive (present in
2971         m_droppingContexts), but access it via the pointer to the DroppingContext that could be
2972         dangling. This happens on every drag. I can't actually reproduce the original assertion
2973         since I'm currently working with an asan build, but I imagine it's probably the same issue
2974         that I'm fixing here.
2975
2976         * UIProcess/gtk/DragAndDropHandler.cpp:
2977         (WebKit::DragAndDropHandler::dragLeave):
2978
2979 2018-06-27  Timothy Hatcher  <timothy@apple.com>
2980
2981         Don't expose new semantic -apple-system color keywords on iOS.
2982         https://bugs.webkit.org/show_bug.cgi?id=187080
2983         rdar://problem/41505699
2984
2985         Reviewed by Tim Horton.
2986
2987         * DerivedSources.make: Use gnu++14, since gnu++17 is giving errors on macOS 10.12.
2988
2989 2018-06-27  Megan Gardner  <megan_gardner@apple.com>
2990
2991         Fix IBeam issues with iPad apps on Mac
2992         https://bugs.webkit.org/show_bug.cgi?id=186900
2993
2994         Reviewed by Wenson Hsieh.
2995
2996         * Shared/ios/InteractionInformationAtPosition.h:
2997         * Shared/ios/InteractionInformationAtPosition.mm:
2998         (WebKit::InteractionInformationAtPosition::encode const):
2999         (WebKit::InteractionInformationAtPosition::decode):
3000
3001         Add functionality to determine what a caret rect should be, but as it is
3002         expensive, it should only be done for this platform.
3003         
3004         * Shared/ios/InteractionInformationRequest.cpp:
3005         (WebKit::InteractionInformationRequest::isApproximateForRequest):
3006         * Shared/ios/InteractionInformationRequest.h:
3007
3008         As there is no way to premptively request information on hover, we need to use 
3009         the last cached information, but only if it is close to the point we are about
3010         to request information for. So having a way to determine if a point is very close
3011         to a previous point is a good idea.
3012
3013         * UIProcess/ios/WKContentViewInteraction.mm:
3014         (-[WKContentView _currentPositionInformationIsApproximateForRequest:]):
3015         (-[WKContentView closestPositionToPoint:]):
3016
3017         UIKit is using this function to determine if we should show an Ibeam or not.
3018         So we need to implement it, at least for this platform. 
3019
3020         * WebProcess/WebPage/ios/WebPageIOS.mm:
3021         (WebKit::WebPage::getPositionInformation):
3022
3023         Pass up the calculated caret rect, but only for iPad apps on Mac.
3024
3025 2018-06-27  Yusuke Suzuki  <utatane.tea@gmail.com>
3026
3027         [GTK][WPE] Use LazyNeverDestroyed<XErrorTrapper> to remove static initializers
3028         https://bugs.webkit.org/show_bug.cgi?id=187089
3029
3030         Reviewed by Michael Catanzaro.
3031
3032         Use LazyNeverDestroyed<XErrorTrapper> instead of global std::unique_ptr<XErrorTrapper>.
3033         Since this variable's exit time destructor is not important in this code, using
3034         LazyNeverDestroyed<XErrorTrapper> is fine. This removes the last static initializer
3035         of libwebkit2gtk.so.
3036
3037         * PluginProcess/unix/PluginProcessMainUnix.cpp:
3038
3039 2018-06-27  Youenn Fablet  <youenn@apple.com>
3040
3041         Add a sandbox profile for some additional bank plugins
3042         https://bugs.webkit.org/show_bug.cgi?id=187105
3043
3044         Reviewed by Brent Fulgham.
3045
3046         * Resources/PlugInSandboxProfiles/cfca.com.npCryptoKit.CGB.MAC.sb: Added.
3047         * Resources/PlugInSandboxProfiles/cfca.com.npP11CertEnroll.MAC.CGB.sb: Added.
3048         * Resources/PlugInSandboxProfiles/com.apple.BocomSubmitCtrl.sb: Added.
3049         * Resources/PlugInSandboxProfiles/com.apple.NPSafeInput.sb: Added.
3050         * Resources/PlugInSandboxProfiles/com.apple.NPSafeSubmit.sb: Added.
3051         * Resources/PlugInSandboxProfiles/com.cfca.npSecEditCtl.MAC.BOC.plugin.sb: Added.
3052         * Resources/PlugInSandboxProfiles/com.cmbchina.CMBSecurity.sb: Added.
3053         * Resources/PlugInSandboxProfiles/com.ftsafe.NPAPI-Core-Safe-SoftKeybaord.plugin.rfc1034identifier.sb: Added.
3054         * WebKit.xcodeproj/project.pbxproj:
3055
3056 2018-06-27  Youenn Fablet  <youenn@apple.com>
3057
3058         NetworkLoadChecker should not need to hard ref NetworkConnectionToWebProcess
3059         https://bugs.webkit.org/show_bug.cgi?id=186551
3060
3061         Reviewed by Daniel Bates.
3062
3063         Removed the need for NetworkLoadChecker to reference a NetworkConnectionToWebProcess.
3064         Instead a CSP client is given to NetworkLoadChecker when needed.
3065
3066         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3067         (WebKit::NetworkConnectionToWebProcess::loadPing):
3068         * NetworkProcess/NetworkLoadChecker.cpp:
3069         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
3070         (WebKit::NetworkLoadChecker::check):
3071         (WebKit::NetworkLoadChecker::checkRedirection):
3072         (WebKit::NetworkLoadChecker::checkRequest):
3073         (WebKit::NetworkLoadChecker::contentSecurityPolicy):
3074         (WebKit::NetworkLoadChecker::addConsoleMessage): Deleted.
3075         (WebKit::NetworkLoadChecker::sendCSPViolationReport): Deleted.
3076         (WebKit::NetworkLoadChecker::enqueueSecurityPolicyViolationEvent): Deleted.
3077         * NetworkProcess/NetworkLoadChecker.h:
3078         * NetworkProcess/NetworkResourceLoader.cpp:
3079         (WebKit::NetworkResourceLoader::start):
3080         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
3081         * NetworkProcess/PingLoad.cpp:
3082         (WebKit::PingLoad::PingLoad):
3083         (WebKit::PingLoad::willPerformHTTPRedirection):
3084         * NetworkProcess/PingLoad.h:
3085
3086 2018-06-27  Stephan Szabo  <stephan.szabo@sony.com>
3087
3088         [Wincairo] Add support for context menus to non-legacy minibrowser
3089         https://bugs.webkit.org/show_bug.cgi?id=186815.
3090
3091         Reviewed by Ryosuke Niwa.
3092
3093         * UIProcess/WebPageProxy.h:
3094         * UIProcess/win/PageClientImpl.cpp:
3095         (WebKit::PageClientImpl::viewWidget):
3096         * UIProcess/win/PageClientImpl.h:
3097         * UIProcess/win/WebContextMenuProxyWin.cpp:
3098         (WebKit::WebContextMenuProxyWin::show):
3099         (WebKit::createMenu):
3100         (WebKit::createMenuItem):
3101         (WebKit::populate):
3102         (WebKit::WebContextMenuProxyWin::showContextMenuWithItems):
3103         (WebKit::WebContextMenuProxyWin::WebContextMenuProxyWin):
3104         (WebKit::WebContextMenuProxyWin::~WebContextMenuProxyWin):
3105         * UIProcess/win/WebContextMenuProxyWin.h:
3106         * UIProcess/win/WebPageProxyWin.cpp:
3107         (WebKit::WebPageProxy::viewWidget):
3108         * UIProcess/win/WebView.cpp:
3109         (WebKit::WebView::wndProc):
3110         (WebKit::WebView::onMenuCommand):
3111         * UIProcess/win/WebView.h:
3112
3113 2018-06-27  Youenn Fablet  <youenn@apple.com>
3114
3115         Disable content blockers in NetworkLoadChecker except for ping loads
3116         https://bugs.webkit.org/show_bug.cgi?id=187083
3117         <rdar://problem/41440083>
3118
3119         Reviewed by Chris Dumez.
3120
3121         * NetworkProcess/NetworkLoadChecker.cpp:
3122         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
3123         * NetworkProcess/NetworkLoadChecker.h:
3124         (WebKit::NetworkLoadChecker::enableContentExtensionsCheck):
3125         * NetworkProcess/PingLoad.cpp:
3126
3127 2018-06-27  Simon Fraser  <simon.fraser@apple.com>
3128
3129         https://hackernoon.com/ uses lots of layer backing store
3130         https://bugs.webkit.org/show_bug.cgi?id=186909
3131         rdar://problem/40257540
3132
3133         Reviewed by Tim Horton.
3134         
3135         PlatformCALayerRemote was actually holding onto backing stores for layers with
3136         backing store detached, which could increase memory use. When told that backing stores
3137         are not attached, explicitly throw away the backing, and re-create it (via setNeedsDisplay)
3138         when attached. This is now similar to what PlatformLayerCACocoa does.
3139
3140         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
3141         (WebKit::PlatformCALayerRemote::setNeedsDisplayInRect):
3142         (WebKit::PlatformCALayerRemote::setNeedsDisplay):
3143         (WebKit::PlatformCALayerRemote::hasContents const):
3144         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
3145
3146 2018-06-27  Jonathan Bedard  <jbedard@apple.com>
3147
3148         Enable WebKit iOS 12 build
3149         https://bugs.webkit.org/show_bug.cgi?id=187024
3150         <rdar://problem/39759057>
3151
3152         Reviewed by David Kilzer.
3153
3154         * Platform/spi/ios/PDFKitSPI.h: Added PDFKit SPI.
3155         * Platform/spi/ios/UIKitSPI.h: Add new UIKit SPI and UICompositingMode enumeration.
3156         * UIProcess/ios/WKPDFView.mm: Use PDFKitSPI header.
3157         * UIProcess/ios/WKSystemPreviewView.mm: Use CoreGraphicsSPI.h.
3158         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm: Use QuartzCoreSPI.h.
3159
3160 2018-06-27  Timothy Horton  <timothy_horton@apple.com>
3161
3162         CSS Animation Triggers is not an experimental feature, should be globally off by default
3163
3164         Reviewed by Dean Jackson.
3165
3166         * Shared/WebPreferences.yaml:
3167
3168 2018-06-27  Timothy Horton  <timothy_horton@apple.com>
3169
3170         Promote the Secure Context API feature from experimental-yet-on-by-default to always-on
3171
3172         Reviewed by Dan Bates.
3173
3174         * Shared/WebPreferences.yaml:
3175         Secure Context API is on by default, it's not experimental anymore.
3176
3177 2018-06-27  Timothy Horton  <timothy_horton@apple.com>
3178
3179         Make Link Preload an on-by-default feature
3180         https://bugs.webkit.org/show_bug.cgi?id=187104
3181
3182         Reviewed by Ryosuke Niwa.
3183
3184         * Shared/WebPreferences.yaml:
3185         This should be on, not experimental. It already shipped on in the past.
3186
3187 2018-06-27  Chris Dumez  <cdumez@apple.com>
3188
3189         Regression(r233208): Completion handler does not get called on GTK port
3190         https://bugs.webkit.org/show_bug.cgi?id=187099
3191
3192         Reviewed by Antti Koivisto.
3193
3194         Make sure UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler's completion handler
3195         gets called on non-COCOA ports.
3196
3197         * UIProcess/WebResourceLoadStatisticsStore.h:
3198
3199 2018-06-27  Tim Horton  <timothy_horton@apple.com>
3200
3201         When trying to print a very long email on iOS, the print preview is blank
3202         https://bugs.webkit.org/show_bug.cgi?id=187077
3203         <rdar://problem/41107013>
3204
3205         Reviewed by Timothy Hatcher.
3206
3207         * UIProcess/ios/WebPageProxyIOS.mm:
3208         (WebKit::WebPageProxy::computePagesForPrintingAndDrawToPDF):
3209         ChildProcessProxy::sendSync has a (surprising) default timeout of 1 second,
3210         (as opposed to Connection::sendSync's default timeout of ∞ seconds).
3211         The printing path already waits ∞ seconds for the final PDF, but currently
3212         uses the default 1 second timeout for page count computation. If page
3213         count computation takes more than 1 second, the preview will be blank.
3214         Since the print preview is generated asynchronously, we really want
3215         to wait until it's done, and not give up after 1 second.
3216
3217 2018-06-26  Wenson Hsieh  <wenson_hsieh@apple.com>
3218
3219         [iPad apps on macOS] Unable to interact with video elements that have started playing
3220         https://bugs.webkit.org/show_bug.cgi?id=187073
3221         <rdar://problem/40591107>
3222
3223         Reviewed by Tim Horton.
3224
3225         On iOS, we currently force remote hosting contexts to be non-interactive by passing in `kCAContextIgnoresHitTest`
3226         when creating the CAContext. However, this flag is not respected by CoreAnimation when running iOS apps on macOS.
3227         This means all HID events dispatched over a video that has been played (which causes WebKit to insert a
3228         CALayerHost-backed WKRemoteView in the view hierarchy) will be routed to the context ID of the video's CAContext
3229         rather than the context ID of the key window containing the WKWebView.
3230
3231         This subsequently causes all gesture recognizers (hover, touch, tap, long press) to fail recognition when
3232         running iOS apps on macOS. To address this, we set a flag on WKRemoteView's CALayerHost to prevent hit-testing
3233         to the remote layer. This allows us to avoid routing HID events to the wrong context, and instead target the
3234         main UIWindow.
3235
3236         Manually verified that click, touch, and mouseenter/mouseleave events are dispatched when interacting over a
3237         video element.
3238
3239         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
3240         (-[WKRemoteView initWithFrame:contextID:]):
3241
3242 2018-06-26  Commit Queue  <commit-queue@webkit.org>
3243
3244         Unreviewed, rolling out r233232.
3245         https://bugs.webkit.org/show_bug.cgi?id=187081
3246
3247         "This is breaking launching some plugins" (Requested by youenn
3248         on #webkit).
3249
3250         Reverted changeset:
3251
3252         "Remove quarantine for Webex plugin"
3253         https://bugs.webkit.org/show_bug.cgi?id=187050
3254         https://trac.webkit.org/changeset/233232
3255
3256 2018-06-26  Timothy Horton  <timothy_horton@apple.com>
3257
3258         Rearrange some WebPreferences; move two experimental prefs into the experimental section
3259
3260         * Shared/WebPreferences.yaml:
3261
3262 2018-06-26  Chris Dumez  <cdumez@apple.com>
3263
3264         Deal better with the network process crashing on startup
3265         https://bugs.webkit.org/show_bug.cgi?id=187065
3266         <rdar://problem/41451622>
3267
3268         Reviewed by Geoffrey Garen.
3269
3270         When a network process crashes on startup, we would not attempt to relaunch it. If there were web
3271         processes waiting for a connection to this network process, we would send them an invalid connection
3272         identifier which would cause them to forcefully crash.
3273
3274         Instead, we now apply the same policy whether a network process crashes on startup or later:
3275         - We attempt to relaunch the network process
3276         - If there were pending connections from WebContent processes, we ask the new Network process instead.
3277
3278         As a result, WebContent processes no longer crash in this case. Instead, they wait for a valid
3279         connection to the network process.
3280
3281         * UIProcess/API/Cocoa/WKProcessPool.mm:
3282         (-[WKProcessPool _makeNextNetworkProcessLaunchFailForTesting]):
3283         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3284         * UIProcess/Network/NetworkProcessProxy.cpp:
3285         (WebKit::NetworkProcessProxy::getLaunchOptions):
3286         (WebKit::NetworkProcessProxy::didFinishLaunching):
3287         * UIProcess/Network/NetworkProcessProxy.h:
3288         * UIProcess/WebProcessPool.cpp:
3289         (WebKit::WebProcessPool::networkProcessCrashed):
3290         * UIProcess/WebProcessPool.h:
3291
3292 2018-06-26  Daniel Bates  <dabates@apple.com>
3293
3294         REGRESSION (r231479): Unable to buy Odeon cinema tickets in STP (bogus 'X-Frame-Options' to 'SAMEORIGIN')
3295         https://bugs.webkit.org/show_bug.cgi?id=186090
3296         <rdar://problem/40692595>
3297
3298         Reviewed by Andy Estes.
3299
3300         Fixes an issue where a page P delivered with "X-Frame-Options: SAMEORIGIN" loaded in a sub-
3301         frame would be blocked if we were redirected to it in response to the cross-origin POST
3302         request regardless of whether P is same-origin with its parent document.
3303
3304         * NetworkProcess/NetworkResourceLoader.cpp:
3305         (WebKit::NetworkResourceLoader::shouldInterruptLoadForXFrameOptions): Compare the origin
3306         of the top frame's document as opposed to the source origin. The latter represents the
3307         origin of the document that initiated the navigation, which can be cross-origin, and
3308         should not be considered when applying "X-Frame-Options: SAMEORIGIN". This check exists
3309         as a performance optimization to avoid traversing over all frame ancestors only to find
3310         out that the innermost frame (the one that made this request) is cross-origin with the
3311         top-most frame.
3312         * NetworkProcess/NetworkResourceLoader.h:
3313         * WebProcess/Network/WebLoaderStrategy.cpp:
3314         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): Exclude the origin of the
3315         frame that is making the load request from the list of ancestor origins. This makes the
3316         X-Frame-Options algorithm in WebKit2 match the logic we do in FrameLoader::shouldInterruptLoadForXFrameOptions().
3317
3318 2018-06-26  Youenn Fablet  <youenn@apple.com>
3319
3320         Remove quarantine for Webex plugin
3321         https://bugs.webkit.org/show_bug.cgi?id=187050
3322         rdar://problem/41478189
3323
3324         Reviewed by Brent Fulgham.
3325
3326         Update the Plugin Info.plist to not do quarantine of downloaded files by default.
3327         Update PluginProcess implementation to reenable quarantine for all plug-ins except cisco webex plug-in.
3328
3329         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist:
3330         * PluginProcess/PluginProcess.h:
3331         * PluginProcess/mac/PluginProcessMac.mm:
3332         (WebKit::PluginProcess::shouldOverrideQuarantine):
3333         * Shared/ChildProcess.h:
3334         (WebKit::ChildProcess::shouldOverrideQuarantine):
3335         * Shared/mac/ChildProcessMac.mm:
3336         (WebKit::ChildProcess::initializeSandbox):
3337
3338 2018-06-26  Jeremy Jones  <jeremyj@apple.com>
3339
3340         Ensure element fullscreen animation is always visible.
3341         https://bugs.webkit.org/show_bug.cgi?id=187068
3342         rdar://problem/36187369
3343
3344         Reviewed by Eric Carlson.
3345
3346         The fullscreen animation is important for communicating to users that they are no longer in inline mode.
3347         If fullscreen animation's inline rect is not visible, animate from a point in the middle of the screen.
3348
3349         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
3350         (WebKit::safeInlineRect):
3351         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
3352         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
3353
3354 2018-06-26  Youenn Fablet  <youenn@apple.com>
3355
3356         Add a sandbox profile for com.google.o1dbrowserplugin plugin
3357         https://bugs.webkit.org/show_bug.cgi?id=187067
3358
3359         Reviewed by Brent Fulgham.
3360
3361         * Resources/PlugInSandboxProfiles/com.google.o1dbrowserplugin.sb: Added.
3362         * WebKit.xcodeproj/project.pbxproj:
3363
3364 2018-06-26  Tim Horton  <timothy_horton@apple.com>
3365
3366         Promote two more experimental features to traditional features
3367         https://bugs.webkit.org/show_bug.cgi?id=187063
3368
3369         Reviewed by Dean Jackson.
3370
3371         * Shared/WebPreferences.yaml:
3372         Promote some shipped/default-on features to non-experimental.
3373
3374 2018-06-26  Jiewen Tan  <jiewen_tan@apple.com>
3375
3376         Rollout macOS sandbox change in r232276
3377         https://bugs.webkit.org/show_bug.cgi?id=186904
3378         <rdar://problem/41350969>
3379
3380         Reviewed by Brent Fulgham.
3381
3382         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
3383
3384 2018-06-26  Aditya Keerthi  <akeerthi@apple.com>
3385
3386         Tap highlight displayed when tapping a field that is already focussed
3387         https://bugs.webkit.org/show_bug.cgi?id=187004
3388         <rdar://problem/41428008>
3389         Reviewed by Tim Horton.
3390
3391         In the case where fast-clicking is enabled, _singleTapCommited: could be invoked
3392         before the tap highlight request, causing _potentialTapInProgress to be set to NO.
3393         This results in the early return for preventing multiple tap highlights on an
3394         assisted node to be skipped. Since a tap highlight should never be shown for an
3395         input field that is already focussed, _potentialTapInProgress can be removed from
3396         the early return condition.
3397
3398         * UIProcess/ios/WKContentViewInteraction.mm:
3399         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:]):
3400
3401 2018-06-26  Timothy Horton  <timothy_horton@apple.com>
3402
3403         Rearrange some WebPreferences; move two non-experimental prefs out of the experimental section
3404
3405         * Shared/WebPreferences.yaml:
3406
3407 2018-06-26  Tim Horton  <timothy_horton@apple.com>
3408
3409         Promote some experimental features to traditional features
3410         https://bugs.webkit.org/show_bug.cgi?id=187047
3411
3412         Reviewed by Simon Fraser.
3413
3414         * Shared/WebPreferences.yaml:
3415         Reindent.
3416         Promote some shipped/default-on features to non-experimental.
3417
3418 2018-06-26  Eric Carlson  <eric.carlson@apple.com>
3419
3420         [Mac] AirPlay picker uses incorrect theme in Dark mode
3421         https://bugs.webkit.org/show_bug.cgi?id=187054
3422         <rdar://problem/41291093>
3423
3424