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