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