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