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