Unreviewed, fix the internal iOS 11 build
[WebKit.git] / Source / WebKit2 / ChangeLog
1 2017-07-06  Wenson Hsieh  <wenson_hsieh@apple.com>
2
3         Unreviewed, fix the internal iOS 11 build
4
5         It turns out, our internal bots are still on an older version of the iOS 11 SDK that's missing _UIDataOwner in
6         <UIKit/NSItemProvider+UIKitAdditions_Private.h>. To ensure that we can build on both current and slightly older
7         versions of the iOS 11 SDK, fall back to using NSInteger instead of _UIDataOwner.
8
9         * Platform/spi/ios/UIKitSPI.h:
10         * UIProcess/ios/WKContentViewInteraction.mm:
11         (-[WKContentView _dragInteraction:dataOwnerForSession:]):
12         (-[WKContentView _dropInteraction:dataOwnerForSession:]):
13
14 2017-07-06  Wenson Hsieh  <wenson_hsieh@apple.com>
15
16         [iOS DnD] [WK2] Add delegate hooks for specifying the data owner for a drag or drop session
17         https://bugs.webkit.org/show_bug.cgi?id=174139
18         <rdar://problem/33126212>
19
20         Reviewed by Beth Dakin.
21
22         Add hooks to query the UI delegate for a _UIDataOwner on both drag and drop sides.
23
24         * Platform/spi/ios/UIKitSPI.h:
25         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
26         * UIProcess/ios/WKContentViewInteraction.mm:
27         (-[WKContentView _dragInteraction:dataOwnerForSession:]):
28         (-[WKContentView _dropInteraction:dataOwnerForSession:]):
29
30 2017-07-06  Brent Fulgham  <bfulgham@apple.com>
31
32         [WK2] ResourceLoadStatistics should batch its writes
33         https://bugs.webkit.org/show_bug.cgi?id=174111
34         <rdar://problem/33115894>
35
36         Reviewed by Chris Dumez.
37
38         Revise the data writing operation to only write on a specific interval (currently
39         set to 5 minutes).
40
41         Also make 'writeStoreToDisk' simpler to use by moving the deleting (before write) and
42         creating (after write) of the FileMonitor into the method, rather than requiring this
43         knowledge in multiple places.
44
45         Make sure that we write our statistics file out before exiting so that we do not
46         lose any data if we exit before the five-minute window has elapsed.
47
48         * UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
49         (WebKit::ResourceLoadStatisticsStore::setWritePersistentStoreCallback): Deleted.
50         * UIProcess/WebResourceLoadStatisticsStore.cpp:
51         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords): Remove the stop
52         and start monitoring into 'writeStoreToDisk'. Also check if enough time has elapsed since
53         the last write to commit to disk.
54         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver): Remove the
55         stop and start monitoring into 'writeStoreToDisk'.
56         (WebKit::WebResourceLoadStatisticsStore::writeStoreToDisk): Add the stop and start monitoring
57         commands here, so callers don't have to know to do so.
58
59 2017-07-06  Chris Dumez  <cdumez@apple.com>
60
61         FileMonitor should not be ref counted
62         https://bugs.webkit.org/show_bug.cgi?id=174166
63
64         Reviewed by Brent Fulgham.
65
66         Update code using FileMonitor to reflect API change.
67
68         * UIProcess/WebResourceLoadStatisticsStore.cpp:
69         (WebKit::WebResourceLoadStatisticsStore::startMonitoringStatisticsStorage):
70         (WebKit::WebResourceLoadStatisticsStore::stopMonitoringStatisticsStorage):
71         * UIProcess/WebResourceLoadStatisticsStore.h:
72
73 2017-07-06  Matt Rajca  <mrajca@apple.com>
74
75         Fix build with VIDEO support disabled.
76         https://bugs.webkit.org/show_bug.cgi?id=174217
77
78         Unreviewed build fix.
79
80         * WebProcess/WebPage/WebPage.cpp:
81         (WebKit::WebPage::updateWebsitePolicies):
82
83 2017-07-06  Chris Dumez  <cdumez@apple.com>
84
85         Crash under WebResourceLoadStatisticsStore::persistentStoragePath(WTF::String const&)
86         https://bugs.webkit.org/show_bug.cgi?id=174205
87         <rdar://problem/33093552>
88
89         Reviewed by Brent Fulgham.
90
91         Make sure we isolateCopy() m_statisticsStoragePath before using it from the background
92         thread.
93
94         * UIProcess/WebResourceLoadStatisticsStore.cpp:
95         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded):
96         (WebKit::WebResourceLoadStatisticsStore::refreshFromDisk):
97         (WebKit::WebResourceLoadStatisticsStore::resourceLogFilePath):
98         (WebKit::WebResourceLoadStatisticsStore::statisticsFilePath):
99         (WebKit::WebResourceLoadStatisticsStore::writeStoreToDisk):
100         (WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk):
101         (WebKit::WebResourceLoadStatisticsStore::deleteStoreFromDisk):
102         (WebKit::WebResourceLoadStatisticsStore::startMonitoringStatisticsStorage):
103         (WebKit::WebResourceLoadStatisticsStore::syncWithExistingStatisticsStorageIfNeeded):
104         (WebKit::WebResourceLoadStatisticsStore::persistentStoragePath): Deleted.
105         * UIProcess/WebResourceLoadStatisticsStore.h:
106
107 2017-07-06  Alex Christensen  <achristensen@webkit.org>
108
109         Fix CFURLRequestRef serialization after r207330
110         https://bugs.webkit.org/show_bug.cgi?id=163332
111
112         * Shared/mac/WebCoreArgumentCodersMac.mm:
113         (IPC::ArgumentCoder<ResourceRequest>::encodePlatformData):
114         The CFURLConnection code was not updated.
115         We did not catch this because nobody uses the WebKit2 CFURLConnection code, but I need to use it to debug something.
116
117 2017-07-06  Chris Dumez  <cdumez@apple.com>
118
119         Move ResourceLoadObserver notification throttling logic from WebProcess class to ResourceLoadObserver
120         https://bugs.webkit.org/show_bug.cgi?id=174194
121
122         Reviewed by Brent Fulgham.
123
124         Move ResourceLoadObserver notification throttling logic from WebProcess class to
125         ResourceLoadObserver. This makes more sense and decreases the complexity of the
126         WebProcess class.
127
128         * WebProcess/WebProcess.cpp:
129         (WebKit::m_webSQLiteDatabaseTracker):
130         (WebKit::WebProcess::statisticsChangedTimerFired): Deleted.
131         * WebProcess/WebProcess.h:
132
133 2017-07-06  Chris Dumez  <cdumez@apple.com>
134
135         WebResourceLoadStatisticsStore should only be constructed when the feature is enabled
136         https://bugs.webkit.org/show_bug.cgi?id=174189
137
138         Reviewed by Brent Fulgham.
139
140         Delay the construction of the WebResourceLoadStatisticsStore until the feature gets
141         enabled via WebsiteDataStore::setResourceLoadStatisticsEnabled(). Previously, we would
142         always construct a store and then have a boolean on the store to indicate if it is
143         enabled or not.
144
145         Also simplify the initialization process of the WebResourceLoadStatisticsStore, we
146         used to have:
147         1. WebResourceLoadStatisticsStore constructor
148         2. WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver()
149         3. WebResourceLoadStatisticsStore::setResourceLoadStatisticsEnabled(true)
150
151         All 3 steps are now taken care of by the WebResourceLoadStatisticsStore constructor.
152
153         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
154         (WebKit::WebProcessPool::platformInitialize):
155         * UIProcess/WebResourceLoadStatisticsStore.cpp:
156         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
157         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded):
158         * UIProcess/WebResourceLoadStatisticsStore.h:
159         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
160         (WebKit::WebsiteDataStore::platformInitialize):
161         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
162         (WebKit::WebsiteDataStore::WebsiteDataStore):
163         (WebKit::WebsiteDataStore::resourceLoadStatisticsEnabled):
164         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
165         * UIProcess/WebsiteData/WebsiteDataStore.h:
166         (WebKit::WebsiteDataStore::resourceLoadStatistics):
167         * UIProcess/wpe/WebProcessPoolWPE.cpp:
168         (WebKit::WebProcessPool::platformInitialize):
169
170 2017-07-06  Claudio Saavedra  <csaavedra@igalia.com>
171
172         [GTK] It should process MouseMoved events when the parent window is not active
173         https://bugs.webkit.org/show_bug.cgi?id=116691
174
175         Reviewed by Michael Catanzaro.
176
177         From reading the comments in the related code, only in Safari it
178         is desired that MouseMoved events are not processed when the
179         parent window is not active. In other ports, in particular those
180         targeting Linux, these events should be processed for consistency
181         with other browsers.
182
183         * UIProcess/WebPageProxy.cpp:
184         (WebKit::WebPageProxy::setCursor):
185         * UIProcess/mac/PageClientImpl.mm:
186         (WebKit::PageClientImpl::setCursor):
187         * WebProcess/WebPage/WebPage.cpp:
188         (WebKit::handleMouseEvent):
189         (WebKit::WebPage::mouseEvent):  No need to always pass a boolean
190         parameter that is only checked for one type of event. Do the check
191         internally in handleMouseEvent() only when needed and only in Cocoa.
192
193 2017-07-05  Don Olmstead  <don.olmstead@sony.com>
194
195         [WTF] Move SoftLinking.h into WTF
196         https://bugs.webkit.org/show_bug.cgi?id=174000
197
198         Reviewed by Alex Christensen.
199
200         * Platform/mac/StringUtilities.mm:
201         * Platform/spi/ios/ManagedConfigurationSPI.h:
202         * Shared/Cocoa/DataDetectionResult.mm:
203         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
204         * Shared/ios/InteractionInformationAtPosition.mm:
205         * Shared/ios/WebIconUtilities.mm:
206         * Shared/mac/CookieStorageShim.mm:
207         * Shared/mac/WebCoreArgumentCodersMac.mm:
208         * UIProcess/API/Cocoa/_WKElementAction.mm:
209         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
210         * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
211         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
212         * UIProcess/Cocoa/UIDelegate.mm:
213         * UIProcess/Cocoa/WebViewImpl.mm:
214         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
215         * UIProcess/ios/WKActionSheetAssistant.mm:
216         * UIProcess/ios/WKContentViewInteraction.mm:
217         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
218         * UIProcess/ios/forms/WKFileUploadPanel.mm:
219         * UIProcess/mac/WKImmediateActionController.mm:
220         * UIProcess/mac/WebInspectorProxyMac.mm:
221         * WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm:
222         * WebProcess/WebPage/mac/WebInspectorUIMac.mm:
223         * WebProcess/cocoa/WebProcessCocoa.mm:
224
225 2017-07-05  Brady Eidson  <beidson@apple.com>
226
227         Allow navigations in subframes to get a ShouldOpenExternalURLsPolicy of "ShouldAllow".
228         <rdar://problem/22485589> and https://bugs.webkit.org/show_bug.cgi?id=174178
229
230         Reviewed by Alex Christensen.
231
232         Adopt to the new constructor for FrameLoadRequest.
233
234         * WebProcess/Plugins/PluginView.cpp:
235         (WebKit::PluginView::loadURL):
236         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
237         (WebKit::WebFrameLoaderClient::dispatchCreatePage):
238         * WebProcess/WebPage/WebInspector.cpp:
239         (WebKit::WebInspector::openInNewTab):
240
241 2017-07-05  Ryosuke Niwa  <rniwa@webkit.org>
242
243         Remove unnecessary forward declartions now that we include Foundation.h
244
245         * UIProcess/API/Cocoa/WKContentRuleListStore.h:
246
247 2017-07-05  Ryosuke Niwa  <rniwa@webkit.org>
248
249         Make WebKit's public headers on Mac and iOS C++ module safe
250         https://bugs.webkit.org/show_bug.cgi?id=174175
251
252         Reviewed by Alex Christensen.
253
254         Fixed the header files.
255
256         * UIProcess/API/Cocoa/WKContentRuleList.h:
257         * UIProcess/API/Cocoa/WKContentRuleListStore.h:
258         * UIProcess/API/Cocoa/WKUIDelegate.h:
259
260 2017-07-05  Chris Dumez  <cdumez@apple.com>
261
262         [WK2] WebsiteDataStore::setResourceLoadStatisticsEnabled() updates processPools the store is not associated with
263         https://bugs.webkit.org/show_bug.cgi?id=174174
264
265         Reviewed by Brent Fulgham.
266
267         WebsiteDataStore::setResourceLoadStatisticsEnabled() updates processPools the store is not associated with.
268         Fix this by iterating over WebsiteDataStore::processPools() instead of WebProcessPool::allProcessPools().
269
270         Also rename shouldPartitionCookiesForTopPrivatelyOwnedDomains methods / IPC messages to
271         updateCookiePartitioningForTopPrivatelyOwnedDomains since this is a setter, not a getter.
272
273         Finally, drop ShouldPartitionCookiesForTopPrivatelyOwnedDomains IPC message to the NetworkProcessProxy
274         as well as corresponding methods as those appear to be unused.
275
276         * NetworkProcess/NetworkProcess.cpp:
277         (WebKit::NetworkProcess::updateCookiePartitioningForTopPrivatelyOwnedDomains):
278         (WebKit::NetworkProcess::shouldPartitionCookiesForTopPrivatelyOwnedDomains): Deleted.
279         * NetworkProcess/NetworkProcess.h:
280         * NetworkProcess/NetworkProcess.messages.in:
281         * UIProcess/Network/NetworkProcessProxy.cpp:
282         (WebKit::NetworkProcessProxy::shouldPartitionCookiesForTopPrivatelyOwnedDomains): Deleted.
283         * UIProcess/Network/NetworkProcessProxy.h:
284         * UIProcess/Network/NetworkProcessProxy.messages.in:
285         * UIProcess/WebProcessPool.cpp:
286         (WebKit::WebProcessPool::setResourceLoadStatisticsEnabled):
287         * UIProcess/WebProcessPool.h:
288         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
289         (WebKit::WebsiteDataStore::updateCookiePartitioningForTopPrivatelyOwnedDomains):
290         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
291         (WebKit::WebsiteDataStore::registerSharedResourceLoadObserver):
292         (WebKit::WebsiteDataStore::shouldPartitionCookiesForTopPrivatelyOwnedDomains): Deleted.
293         * UIProcess/WebsiteData/WebsiteDataStore.h:
294
295 2017-07-05  Tim Horton  <timothy_horton@apple.com>
296
297         Async Image Decoding: Image flashes away briefly when tapping on tab in iPad tab picker
298         https://bugs.webkit.org/show_bug.cgi?id=174173
299         <rdar://problem/32431952>
300
301         Reviewed by Geoffrey Garen.
302
303         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
304         (WebKit::RemoteLayerTreeDrawingArea::addTransactionCallbackID):
305         When a client uses e.g. doAfterNextPresentationUpdate (or internally,
306         dispatchAfterEnsuringDrawing), they're doing so in the hopes that the
307         callback is called after the page is well-painted -- for example, to
308         remove a snapshot (in the tab picker case, as well as for navigation
309         gestures), or to *take* a snapshot. In all of these cases, it is
310         preferable to do a synchronous decode, to ensure that the image does
311         not flash away temporarily.
312
313         Use the existing mechanism that was implemented for the synchronous
314         activity state change flush to also force synchronous image decoding
315         any time there is a post-commit transaction callback.
316
317 2017-07-05  Wenson Hsieh  <wenson_hsieh@apple.com>
318
319         [iOS DnD] [WK2] 3D touch fails to recognize when UIDragInteraction is enabled on phone
320         https://bugs.webkit.org/show_bug.cgi?id=174171
321         <rdar://problem/32956929>
322
323         Reviewed by Tim Horton.
324
325         By default, UIKit defers all competing long press gesture recognizers if dragging is enabled. However, this
326         would cause 3D touch to be prevented, due to UIKit asking us whether or not we can proceed with the 3D touch
327         gesture in -_interactionShouldBeginFromPreviewItemController:forPosition:, while the highlight long press
328         gesture recognizer is being deferred. To address this, we use SPI on UIDragInteraction to allow the highlight
329         long press gesture recognizer to recognize alongside the drag lift gesture. We then (already) manually cancel
330         the highlight long press gesture in _dragInteraction:prepareForSession:completion:.
331
332         * UIProcess/ios/WKContentViewInteraction.mm:
333         (-[WKContentView _dragInteraction:shouldDelayCompetingGestureRecognizer:]):
334
335 2017-07-03  Myles C. Maxfield  <mmaxfield@apple.com>
336
337         Remove copy of ICU headers from WebKit
338         https://bugs.webkit.org/show_bug.cgi?id=116407
339
340         Reviewed by Alex Christensen.
341
342         * Configurations/BaseTarget.xcconfig:
343
344 2017-07-05  Chris Dumez  <cdumez@apple.com>
345
346         Regression(r218821): Bad cast to WebKit::DiagnosticLoggingClient in WKWebView's _setDiagnosticLoggingDelegate
347         https://bugs.webkit.org/show_bug.cgi?id=174163
348         <rdar://problem/33067518>
349
350         Reviewed by Alex Christensen.
351
352         After r218821, WebPageProxy::setDiagnosticLoggingClient() would no longer set the client in
353         private session. This is an issue because there is code in WKWebView which expects the
354         DiagnosticLoggingClient to be set and of a specific type. This would lead to bad casts in
355         WKWebView's _diagnosticLoggingDelegate / _setDiagnosticLoggingDelegate.
356
357         To avoid the issue, we now unconditionally update the client in
358         WebPageProxy::setDiagnosticLoggingClient(). Instead, we implement the logic for disabling
359         logging in private session in the logging methods themselves, via the
360         WebPageProxy::effectiveDiagnosticLoggingClient() helper instead.
361
362         I also added null checks in WKWebView's _diagnosticLoggingDelegate /
363         _setDiagnosticLoggingDelegate. Even though the WKWebView sets itself as the diagnostic
364         logging client, WebPageProxy::diagnosticLoggingClient() can still return null after
365         calling WebPageProxy::close(). Previously, we would have done a bad cast if the WKWebView's
366         client would have used this API after calling 'close' as well.
367
368         * UIProcess/API/APIDiagnosticLoggingClient.h:
369         * UIProcess/API/Cocoa/WKWebView.mm:
370         (-[WKWebView _diagnosticLoggingDelegate]):
371         (-[WKWebView _setDiagnosticLoggingDelegate:]):
372         * UIProcess/WebPageProxy.cpp:
373         (WebKit::WebPageProxy::WebPageProxy):
374         (WebKit::WebPageProxy::setDiagnosticLoggingClient):
375         (WebKit::WebPageProxy::close):
376         (WebKit::WebPageProxy::effectiveDiagnosticLoggingClient):
377         (WebKit::WebPageProxy::logDiagnosticMessage):
378         (WebKit::WebPageProxy::logDiagnosticMessageWithResult):
379         (WebKit::WebPageProxy::logDiagnosticMessageWithValue):
380         (WebKit::WebPageProxy::logDiagnosticMessageWithEnhancedPrivacy):
381         * UIProcess/WebPageProxy.h:
382         (WebKit::WebPageProxy::diagnosticLoggingClient):
383
384 2017-07-05  Daniel Bates  <dabates@apple.com>
385
386         Do not pass API::FrameInfo for source frame or clear out page of target frame on
387         API navigation
388         https://bugs.webkit.org/show_bug.cgi?id=174170
389         <rdar://problem/33140328>
390
391         Reviewed by Brady Eidson.
392
393         As a step towards making it straightforward for an embedding client to determine whether
394         a WebPageProxy::decidePolicyForNavigationAction() callback was initiated from API we
395         should not pass frame info for the source frame and should not nullify the page pointer
396         in the target frame info.
397
398         Currently we always pass frame info for the source frame and nullify the page pointer
399         in both the source frame info and target frame info if the navigation was initiated from
400         API. This seems subtle and error prone. Instead we should not pass frame info for
401         the source frame and not nullify the page pointer in the target frame info as a step
402         towards making using this API less error-prone.
403
404         * UIProcess/WebPageProxy.cpp:
405         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
406
407 2017-07-05  Chris Dumez  <cdumez@apple.com>
408
409         Add a few more WebKit2 owners
410         https://bugs.webkit.org/show_bug.cgi?id=174169
411
412         Reviewed by Brady Eidson.
413
414         * Owners:
415
416 2017-07-05  Brent Fulgham  <bfulgham@apple.com>
417
418         [WK2] Prevent ResourceLoadStatistics from triggering a cascade of read/write events
419         https://bugs.webkit.org/show_bug.cgi?id=174062\
420         <rdar://problem/33086744>
421
422         Reviewed by Chris Dumez.
423
424         ResourceLoadStatistics was triggering periods of high CPU use due to a cascade of read/write
425         operations:
426         (1) The 'makeRefPtr' call in FileMonitor::startMonitoring was capturing a reference to itself, preventing
427             the FileMonitor from being destroyed. This caused the file modification handler to fire in response
428             to our own write events, creating a ridiculous read/write cycle. This problem was addressed in
429             the short term by stopping the file monitor in WebResourceLoadStatisticsStore::stopMonitoringStatisticsStorage,
430             rather than relying on the destructor to shut things down. This will be improved in a
431             subsequent patch.
432         (2) 'syncWithExistingStatisticsStorageIfNeeded' was creating a FileMonitor during the write operation,
433             which exacerbated the chain of read/writes already present due to the self-reference described above.
434         (3) Because VNODE dispatch sources are low level, they do not offer a means of filtering out operations
435             triggered by the current process. To avoid this, I added code to track the file modification time, so
436             that we don't bother reading a file that holds data that is older than the in-memory data, even though
437             we receive a file modification dispatch. Writes seem to trigger a chain of notification events in rapid
438             succession. Once we've responded to the first of these events, we don't need to to further reads until
439             the data on disk changes again.    
440
441         We also shouldn't allow the ResourceLoadStatistics worker thread to consume high CPU resources. Run it
442         as utility QoS, avoiding using the CPU when other work is going on.
443
444         Drive-by fix: The closure in setWritePersistentStoreCallback() should stop monitoring before writing
445         data, and should start monitoring after the write completes.
446
447         * UIProcess/WebResourceLoadStatisticsStore.cpp:
448         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore): Run our worker queue
449         as a utility-level process.
450         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver): Stop checking for
451         updates before writing, and begin checking again once the write is complete.
452         (WebKit::WebResourceLoadStatisticsStore::statisticsFileModificationTime): Added.
453         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded): Avoid reading the file if it
454         was last modified on (or before) the time we last read the file.
455         (WebKit::WebResourceLoadStatisticsStore::refreshFromDisk): Ditto.
456         (WebKit::WebResourceLoadStatisticsStore::stopMonitoringStatisticsStorage): Explicitly stop file
457         monitoring so that the active file modification handler will terminate.
458         (WebKit::WebResourceLoadStatisticsStore::syncWithExistingStatisticsStorageIfNeeded): Do not begin
459         monitoring the file after syncing, since this is only used as part of an ongoing write operation.
460
461 2017-07-05  Jonathan Bedard  <jbedard@apple.com>
462
463         Add WebKitPrivateFrameworkStubs for iOS 11
464         https://bugs.webkit.org/show_bug.cgi?id=173988
465
466         Reviewed by David Kilzer.
467
468         * Configurations/BaseTarget.xcconfig: iphoneos and iphonesimulator should use the
469         same directory for private framework stubs.
470
471 2017-07-05  Andy Estes  <aestes@apple.com>
472
473         [iOS] WKActionSheetAssistants can outlive their host views
474         https://bugs.webkit.org/show_bug.cgi?id=174160
475         <rdar://problem/20638607>
476
477         Reviewed by Tim Horton.
478
479         WKActionSheetAssistant keeps a raw pointer to its host UIView, and nothing clears it when
480         the host view is deallocated. If the assistant outlives the view, we can end up accessing a
481         pointer to a deallocated UIView and crashing.
482
483         I don't know how to reproduce such a crash, but this patch guards against it by doing the
484         following:
485
486         1. Make _view a WeakObjCPtr in WKActionSheetAssistant to ensure it gets set to nil when the
487            UIView is deallocated.
488         2. Call -[WKActionSheetAssistant cleanupSheet] when a WKContentView or WKPDFView is
489            deallocated, or when the Web process crashes. This will ensure the action sheet is
490            dismissed and prevent the user from tapping on an action that's no longer valid.
491
492         * UIProcess/ios/WKActionSheetAssistant.mm:
493         (-[WKActionSheetAssistant superviewForSheet]):
494         (-[WKActionSheetAssistant _presentationRectForSheetGivenPoint:inHostView:]):
495         (-[WKActionSheetAssistant presentationRectForElementUsingClosestIndicatedRect]):
496         (-[WKActionSheetAssistant presentationRectForIndicatedElement]):
497         (-[WKActionSheetAssistant _shouldPresentAtTouchLocationForElementRect:]):
498         * UIProcess/ios/WKContentViewInteraction.mm:
499         (-[WKContentView cleanupInteraction]):
500         * UIProcess/ios/WKPDFView.mm:
501         (-[WKPDFView dealloc]):
502
503 2017-07-05  Frederic Wang  <fwang@igalia.com>
504
505         Move ScrolledContentsLayer property to ScrollingStateScrollingNode
506         https://bugs.webkit.org/show_bug.cgi?id=174134
507
508         Reviewed by Simon Fraser.
509
510         * Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp:
511         (ArgumentCoder<ScrollingStateScrollingNode>::encode): Add encoding for scrolled contents
512         layer.
513         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode): Remove encoding for scrolled
514         contents layer.
515         (ArgumentCoder<ScrollingStateOverflowScrollingNode>::encode): Ditto.
516         (ArgumentCoder<ScrollingStateScrollingNode>::decode): Add decoding for scrolled contents
517         layer.
518         (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode): Remove decoding for scrolled
519         contents layer.
520         (ArgumentCoder<ScrollingStateOverflowScrollingNode>::decode): Ditto.
521         (WebKit::dump): Move dumping of scrolled contents layer from overflow/frame nodes to
522         scrolling node.
523         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
524         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers): Adjust enum value to use
525         ScrollingStateScrollingNode::ScrolledContentsLayer.
526         * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
527         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateBeforeChildren): Ditto.
528         * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:
529         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers): Ditto.
530
531 2017-07-05  Ada Chan  <adachan@apple.com>
532
533         Fix crash in UIKit: +[UIViewController _viewControllerForFullScreenPresentationFromView:]
534         https://bugs.webkit.org/show_bug.cgi?id=174143
535         <rdar://problem/28384582>
536
537         Reviewed by Wenson Hsieh.
538
539         In -[WKActionSheet willRotate], we can't guarantee that the action sheet belongs
540         in a window, and passing nil to +[UIViewController _viewControllerForFullScreenPresentationFromView:]
541         throws an exception. To fix this, bail early if the result from -hostViewForSheet is nil.
542
543         * UIProcess/ios/WKActionSheet.mm:
544         (-[WKActionSheet willRotate]):
545
546 2017-07-05  Eric Carlson  <eric.carlson@apple.com>
547
548         [MediaStream] Protect request and web view during gUM client callback
549         https://bugs.webkit.org/show_bug.cgi?id=174096
550         <rdar://problem/32833102>
551
552         Reviewed by Youenn Fablet.
553
554         Retain the message and WebView during asynchronous calls so they won't be 
555         released if a navigation happens during a call to the UA for getUserMedia 
556         or enumerateMediaDevices.
557
558         * UIProcess/Cocoa/UIDelegate.mm:
559         (WebKit::requestUserMediaAuthorizationForDevices):
560         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
561         (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin):
562
563 2017-07-05  Matt Lewis  <jlewis3@apple.com>
564
565         Unreviewed, rolling out r219128.
566
567         Spoke with engineer who originally submitted, Patch for APi
568         test to follow.
569
570         Reverted changeset:
571
572         "Unreviewed, rolling out r219070."
573         https://bugs.webkit.org/show_bug.cgi?id=174082
574         http://trac.webkit.org/changeset/219128
575
576 2017-07-05  Matt Lewis  <jlewis3@apple.com>
577
578         Unreviewed, rolling out r219070.
579
580         This revision caused consistent failures of the API test
581         UIPasteboardTests.DoNotPastePlainTextAsURL on iOS.
582
583         Reverted changeset:
584
585         "Pasting single words copied to UIPasteboard inserts URLs in
586         editable areas"
587         https://bugs.webkit.org/show_bug.cgi?id=174082
588         http://trac.webkit.org/changeset/219070
589
590 2017-07-05  Zan Dobersek  <zdobersek@igalia.com>
591
592         [GLib] Incorrect <glib/gi18n.h> include in WebKitWebsiteData
593         https://bugs.webkit.org/show_bug.cgi?id=174093
594
595         Reviewed by Michael Catanzaro.
596
597         * UIProcess/API/glib/WebKitWebsiteData.cpp: Include <glib/gi18n-lib.h>
598         rather than <glib/gi18n.h>, since the former has to be included in a
599         library while the latter should only be included in a standalone application.
600
601 2017-07-04  Joseph Pecoraro  <pecoraro@apple.com>
602
603         Cleanup some StringBuilder use
604         https://bugs.webkit.org/show_bug.cgi?id=174118
605
606         Reviewed by Andreas Kling.
607
608         * NetworkProcess/capture/NetworkCaptureManager.cpp:
609         (WebKit::NetworkCapture::Manager::hashToPath):
610         * UIProcess/WebPageProxy.cpp:
611
612 2017-07-03  Wenson Hsieh  <wenson_hsieh@apple.com>
613
614         [iOS DnD] [WK2] Callout bar should reappear after dragging ends for a text selection
615         https://bugs.webkit.org/show_bug.cgi?id=174116
616         <rdar://problem/33017845>
617
618         Reviewed by Ryosuke Niwa.
619
620         -willStartScrollingOverflow -didEndScrollingOverflow are helper methods on both the UIWKTextInteractionAssistant
621         and UIWebSelectionAssistant that handle hiding selection and callout bar UI during overflow scrolling and making
622         it reappear after scrolling ends. However, these hooks do not contain logic specific to scrolling, and simply
623         tell the inner UIWebSelectionView to either show or hide and are safe to invoke outside of the context of
624         scrolling.
625
626         This patch invokes these hooks when beginning a drag on a selection, and when a dragging ends, if it called
627         -willStartScrollingOverflow to begin with. We should rename these in the future to be something along the lines
628         of -hideSelectionViewAndControls and -showSelectionViewAndControls, respectively, and adopt these new names in
629         WebKit. We also move logic to hide the callout out of -itemsForBeginningSession: and into
630         -willAnimateLiftWithAnimator:, when the lift actually begins.
631
632         * UIProcess/ios/WKContentViewInteraction.h:
633         * UIProcess/ios/WKContentViewInteraction.mm:
634         (-[WKContentView cleanUpDragSourceSessionState]):
635         (-[WKContentView _restoreCalloutBarIfNeeded]):
636         (-[WKContentView dragInteraction:itemsForBeginningSession:]):
637         (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
638         (-[WKContentView dragInteraction:session:didEndWithOperation:]):
639
640 2017-07-03  Matt Rajca  <mrajca@apple.com>
641
642         Add/remove appropriate media element behavior restrictions when updateWebsitePolicies is called
643         https://bugs.webkit.org/show_bug.cgi?id=174103
644
645         Reviewed by Alex Christensen.
646
647         Currently, when -[WKWebView evaluateJavaScript:completionHandler:] is invoked, we end up simulating
648         a user gesture unconditionally. This is not desireable for some tests, so I added a private variant
649         of this method that takes a boolean that is ultimately passed to `executeScript` for the
650         `forceUserGesture` parameter (instead of unconditionally passing `true`).
651
652         * UIProcess/API/C/WKPage.cpp:
653         (WKPageRunJavaScriptInMainFrame):
654         * UIProcess/API/Cocoa/WKWebView.mm:
655         (-[WKWebView evaluateJavaScript:completionHandler:]):
656         (-[WKWebView _evaluateJavaScript:forceUserGesture:completionHandler:]):
657         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
658         * UIProcess/WebPageProxy.cpp:
659         (WebKit::WebPageProxy::runJavaScriptInMainFrame):
660         * UIProcess/WebPageProxy.h:
661         * WebProcess/WebPage/WebPage.cpp:
662         (WebKit::WebPage::runJavaScriptInMainFrame):
663         (WebKit::WebPage::updateWebsitePolicies): Update behavior restrictions on any existing media elements.
664         * WebProcess/WebPage/WebPage.h:
665         * WebProcess/WebPage/WebPage.messages.in:
666
667 2017-07-03  Matt Lewis  <jlewis3@apple.com>
668
669         Unreviewed, rolling out r219103.
670
671         Caused multiple build failures.
672
673         Reverted changeset:
674
675         "Remove copy of ICU headers from WebKit"
676         https://bugs.webkit.org/show_bug.cgi?id=116407
677         http://trac.webkit.org/changeset/219103
678
679 2017-07-03  Myles C. Maxfield  <mmaxfield@apple.com>
680
681         Remove copy of ICU headers from WebKit
682         https://bugs.webkit.org/show_bug.cgi?id=116407
683
684         Reviewed by Alex Christensen.
685
686         Use WTF's copy of ICU headers.
687
688         * Configurations/BaseTarget.xcconfig:
689
690 2017-07-03  Brady Eidson  <beidson@apple.com>
691
692         Switch all WebKit API related to favicons from WebIconDatabase over to new WebCore::IconLoader mechanism.
693         https://bugs.webkit.org/show_bug.cgi?id=174073
694
695         Reviewed by Andy Estes.
696
697         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
698         (WebKit::WebFrameLoaderClient::getLoadDecisionForIcons):
699         (WebKit::WebFrameLoaderClient::dispatchDidReceiveIcon): Deleted.
700         (WebKit::WebFrameLoaderClient::registerForIconNotification): Deleted.
701         (WebKit::WebFrameLoaderClient::getLoadDecisionForIcon): Deleted.
702         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
703
704 2017-07-03  Sam Weinig  <sam@webkit.org>
705
706         [WebIDL] Remove more unnecessary uses of the preprocessor in idl files
707         https://bugs.webkit.org/show_bug.cgi?id=174083
708
709         Reviewed by Alex Christensen.
710
711         * Configurations/FeatureDefines.xcconfig:
712         Add ENABLE_NAVIGATOR_STANDALONE.
713
714 2017-07-03  Matt Lewis  <jlewis3@apple.com>
715
716         Unreviewed, rolling out r219083.
717
718         The revision caused an API failure on all testing platforms.
719
720         Reverted changeset:
721
722         "[MediaStream] Protect request and web view during gUM client
723         callback"
724         https://bugs.webkit.org/show_bug.cgi?id=174096
725         http://trac.webkit.org/changeset/219083
726
727 2017-07-03  Ryosuke Niwa  <rniwa@webkit.org>
728
729         WebContent processes crash when the network process crashes with pending connection requests
730         https://bugs.webkit.org/show_bug.cgi?id=174065
731         <rdar://problem/30359835>
732
733         Reviewed by Tim Horton.
734
735         The bug was caused by the UI process clearing away pending network connection requests whenever the existing
736         network process crashed. This resulted in WebContent process killing itself inside ensureNetworkProcessConnection.
737
738         Fixed the bug by re-launching a new network process when this happens. We don't try to re-launch a new process
739         if the previous attempt to launch a network process had failed.
740
741         This patch splits NetworkProcessProxy::networkProcessCrashedOrFailedToLaunch into networkProcessFailedToLaunch
742         and networkProcessCrashed to differentiate those two cases, and invoke the respective callbacks in WebProcessPool.
743
744         * UIProcess/API/Cocoa/WKProcessPool.mm:
745         (-[WKProcessPool _networkProcessIdentifier]): Added.
746         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
747         * UIProcess/Network/NetworkProcessProxy.cpp:
748         (WebKit::NetworkProcessProxy::networkProcessCrashed): Added.
749         (WebKit::NetworkProcessProxy::networkProcessCrashedOrFailedToLaunch): Split into the two following functions.
750         (WebKit::NetworkProcessProxy::networkProcessFailedToLaunch): Extracted from networkProcessCrashedOrFailedToLaunch.
751         (WebKit::NetworkProcessProxy::clearCallbackStates): Extracted from networkProcessCrashedOrFailedToLaunch
752         (WebKit::NetworkProcessProxy::didClose): Call networkProcessCrashed.
753         (WebKit::NetworkProcessProxy::didFinishLaunching): Call networkProcessFailedToLaunch.
754         * UIProcess/Network/NetworkProcessProxy.h:
755         * UIProcess/WebProcessPool.cpp:
756         (WebKit::WebProcessPool::networkProcessCrashed): Start a new network process when there are pending connection
757         requests the crached network failed to fullfil.
758         (WebKit::WebProcessPool::networkProcessFailedToLaunch):
759         * UIProcess/WebProcessPool.h:
760
761 2017-07-03  Eric Carlson  <eric.carlson@apple.com>
762
763         [MediaStream] Protect request and web view during gUM client callback
764         https://bugs.webkit.org/show_bug.cgi?id=174096
765         <rdar://problem/32833102>
766
767         Reviewed by Youenn Fablet.
768
769         Retain the message and WebView during asynchronous calls so they won't be 
770         released if a navigation happens during a call to the UA for getUserMedia 
771         or enumerateMediaDevices.
772
773         * UIProcess/Cocoa/UIDelegate.mm:
774         (WebKit::requestUserMediaAuthorizationForDevices):
775         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
776         (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin):
777
778 2017-07-03  Andy Estes  <aestes@apple.com>
779
780         [Xcode] Add an experimental setting to build with ccache
781         https://bugs.webkit.org/show_bug.cgi?id=173875
782
783         Reviewed by Tim Horton.
784
785         * Configurations/DebugRelease.xcconfig: Included ccache.xcconfig.
786
787 2017-07-03  Chris Dumez  <cdumez@apple.com>
788
789         Drop ResourceLoadStatisticsStore's statisticsLock
790         https://bugs.webkit.org/show_bug.cgi?id=174080
791
792         Reviewed by Brent Fulgham.
793
794         Drop ResourceLoadStatisticsStore's statisticsLock. It added complexity and was only needed
795         do that the SPI exposed to WebKitTestRunner would query the store synchronously from the
796         main thread. Instead, I made the SPI asynchronous and make sure we always access the store
797         from the same background thread. As a result, there is no longer any need for locking.
798
799         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
800         (-[WKWebsiteDataStore _resourceLoadStatisticsIsPrevalentResource:completionHandler:]):
801         (-[WKWebsiteDataStore _resourceLoadStatisticsHadUserInteraction:completionHandler:]):
802         (-[WKWebsiteDataStore _resourceLoadStatisticsIsGrandfathered:completionHandler:]):
803         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
804         * UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
805         (WebKit::ResourceLoadStatisticsStore::isPrevalentResource):
806         (WebKit::ResourceLoadStatisticsStore::isGrandFathered):
807         (WebKit::ResourceLoadStatisticsStore::ensureResourceStatisticsForPrimaryDomain):
808         (WebKit::ResourceLoadStatisticsStore::createEncoderFromData):
809         (WebKit::ResourceLoadStatisticsStore::readDataFromDecoder):
810         (WebKit::ResourceLoadStatisticsStore::clearInMemory):
811         (WebKit::ResourceLoadStatisticsStore::mergeStatistics):
812         (WebKit::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
813         (WebKit::ResourceLoadStatisticsStore::processStatistics):
814         (WebKit::ResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor):
815         (WebKit::ResourceLoadStatisticsStore::sortedPrevalentResourceTelemetry):
816         (WebKit::ResourceLoadStatisticsStore::updateStatisticsForRemovedDataRecords):
817         (WebKit::ResourceLoadStatisticsStore::handleFreshStartWithEmptyOrNoStore):
818         * UIProcess/Storage/ResourceLoadStatisticsStore.h:
819         * UIProcess/WebResourceLoadStatisticsStore.cpp:
820         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
821         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded):
822         (WebKit::WebResourceLoadStatisticsStore::refreshFromDisk):
823         (WebKit::WebResourceLoadStatisticsStore::clearInMemoryData):
824         (WebKit::WebResourceLoadStatisticsStore::submitTelemetry):
825         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
826         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
827         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
828         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
829         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
830         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
831         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
832         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
833         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
834         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
835         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
836         * UIProcess/WebResourceLoadStatisticsStore.h:
837
838 2017-07-03  Wenson Hsieh  <wenson_hsieh@apple.com>
839
840         Pasting single words copied to UIPasteboard inserts URLs in editable areas
841         https://bugs.webkit.org/show_bug.cgi?id=174082
842         <rdar://problem/33046992>
843
844         Reviewed by Tim Horton.
845
846         Add a hook to WKPreferences to allow programatic pasting.
847
848         * UIProcess/API/Cocoa/WKPreferences.mm:
849         (-[WKPreferences _setDOMPasteAllowed:]):
850         (-[WKPreferences _domPasteAllowed]):
851         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
852
853 2017-07-03  Zan Dobersek  <zdobersek@igalia.com>
854
855         Unreviewed GTK+ and WPE build fix when building with GCC 4.9.
856
857         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
858         (WebKit::CoordinatedLayerTreeHost::renderNextFrame): Don't use brace-list
859         initialization to override the m_forceRepaintAsync struct. Instead, manually
860         assign the OptionalCallbackID() value to the m_forceRepaintAsync.callbackID
861         member variable, and override the m_forceRepaintAsync.needsFreshFlush member
862         variable with `false`.
863
864 2017-07-03  Zan Dobersek  <zdobersek@igalia.com>
865
866         [ThreadedCompositor] Update and retrieve scene attributes under a Lock
867         https://bugs.webkit.org/show_bug.cgi?id=173762
868
869         Reviewed by Carlos Garcia Campos.
870
871         Instead of dispatching separate tasks on the composition run loop, update
872         various scene attributes by locking a common lock object and updating the
873         appropriate attribute.
874
875         In ThreadedCompositor::renderLayerTree(), where these attributes are used
876         in scene composition, the lock is again obtained and the attributes copied
877         into local variables, releasing the lock afterwards. The attribute values
878         in local copies are then used for that renderLayerTree() invocation.
879
880         This approach is more efficient than dispatching separate tasks that can
881         race against renderLayerTree() dispatches.
882
883         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
884         (WebKit::ThreadedCompositor::ThreadedCompositor):
885         (WebKit::m_displayRefreshMonitor):
886         (WebKit::ThreadedCompositor::setScaleFactor):
887         (WebKit::ThreadedCompositor::setScrollPosition):
888         (WebKit::ThreadedCompositor::setViewportSize):
889         (WebKit::ThreadedCompositor::setDrawsBackground):
890         (WebKit::ThreadedCompositor::renderLayerTree):
891         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
892
893 2017-07-01  Dan Bernstein  <mitz@apple.com>
894
895         [iOS] Remove code only needed when building for iOS 9.x
896         https://bugs.webkit.org/show_bug.cgi?id=174068
897
898         Reviewed by Tim Horton.
899
900         * Configurations/FeatureDefines.xcconfig:
901         * Configurations/WebKit.xcconfig:
902         * Platform/spi/ios/UIKitSPI.h:
903         * UIProcess/API/Cocoa/WKWebView.mm:
904         (-[WKWebView dealloc]):
905         * UIProcess/ios/WKContentViewInteraction.mm:
906         (-[WKFormInputSession setSuggestions:]):
907         (-[WKFormInputSession invalidate]):
908         (-[WKContentView insertTextSuggestion:]):
909         (contentTypeFromFieldName):
910         (-[WKContentView textInputTraits]):
911         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
912         * WebProcess/WebPage/ios/WebPageIOS.mm:
913         (WebKit::WebPage::getPositionInformation):
914         * config.h:
915
916 2017-07-01  Brady Eidson  <beidson@apple.com>
917
918         When setting a custom cookie storage location on a WKWebsiteDataStore, cookies aren't actually removed.
919         <rdar://problem/32410662> and https://bugs.webkit.org/show_bug.cgi?id=174035
920
921         Reviewed by Alex Christensen.
922
923         * UIProcess/API/Cocoa/WKProcessPool.mm:
924         (-[WKProcessPool _terminateNetworkProcess]):
925         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
926         
927         * UIProcess/WebProcessPool.cpp:
928         (WebKit::WebProcessPool::ensureNetworkProcess): Take an optional WebsiteDataStore. If one is passed in,
929           send it to either the existing or new network process.
930         * UIProcess/WebProcessPool.h:
931         
932         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
933         (WebKit::WebsiteDataStore::parameters): Resolve paths first.
934
935         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
936         (WebKit::WebsiteDataStore::fetchDataAndApply):
937         (WebKit::WebsiteDataStore::removeData):
938
939 2017-07-01  Ryosuke Niwa  <rniwa@webkit.org>
940
941         Frame.h doesn't need to include FrameLoader.h, IntRect.h, and NavigationScheduler.h
942         https://bugs.webkit.org/show_bug.cgi?id=174004
943
944         Reviewed by Simon Fraser.
945
946         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
947         * WebProcess/WebPage/WebInspector.cpp:
948
949 2017-07-01  Dan Bernstein  <mitz@apple.com>
950
951         [macOS] Remove code only needed when building for OS X Yosemite
952         https://bugs.webkit.org/show_bug.cgi?id=174067
953
954         Reviewed by Tim Horton.
955
956         * Configurations/Base.xcconfig:
957         * Configurations/BaseTarget.xcconfig:
958         * Configurations/BaseXPCService.xcconfig:
959         * Configurations/DebugRelease.xcconfig:
960         * Configurations/FeatureDefines.xcconfig:
961         * Configurations/NetworkService.xcconfig:
962         * Configurations/PluginService.32.xcconfig:
963         * Configurations/PluginService.64.xcconfig:
964         * Configurations/Version.xcconfig:
965         * Configurations/WebContentService.xcconfig:
966         * Configurations/WebKit.xcconfig:
967         * DatabaseProcess/mac/com.apple.WebKit.Databases.sb.in:
968         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX-10.9-10.10.plist: Removed.
969         * NetworkProcess/NetworkProcessCreationParameters.cpp:
970         (WebKit::NetworkProcessCreationParameters::encode):
971         (WebKit::NetworkProcessCreationParameters::decode):
972         * NetworkProcess/NetworkProcessCreationParameters.h:
973         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
974         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
975         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
976         * Platform/IPC/Connection.h:
977         * Platform/IPC/mac/ConnectionMac.mm:
978         (IPC::Connection::platformInvalidate):
979         (IPC::Connection::platformInitialize):
980         (IPC::Connection::open):
981         (IPC::Connection::exceptionSourceEventHandler): Deleted.
982         (IPC::Connection::setShouldCloseConnectionOnMachExceptions): Deleted.
983         * Platform/mac/LayerHostingContext.h:
984         * Platform/mac/LayerHostingContext.mm:
985         (WebKit::LayerHostingContext::createFencePort):
986         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64-10.9-10.10.Info.plist: Removed.
987         * PluginProcess/mac/PluginControllerProxyMac.mm:
988         (WebKit::PluginControllerProxy::updateLayerHostingContext):
989         * PluginProcess/mac/PluginProcessShim.mm:
990         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
991         * Shared/ChildProcess.h:
992         * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
993         (WebKit::getPluginInfoFromPropertyLists):
994         (WebKit::NetscapePluginModule::getPluginInfo):
995         (WebKit::contentsOfPropertyListAtURL): Deleted.
996         (WebKit::getMIMETypesFromPluginBundle): Deleted.
997         * Shared/Plugins/PluginProcessCreationParameters.cpp:
998         (WebKit::PluginProcessCreationParameters::encode):
999         (WebKit::PluginProcessCreationParameters::decode):
1000         * Shared/Plugins/PluginProcessCreationParameters.h:
1001         * Shared/WebProcessCreationParameters.cpp:
1002         (WebKit::WebProcessCreationParameters::encode):
1003         (WebKit::WebProcessCreationParameters::decode):
1004         * Shared/WebProcessCreationParameters.h:
1005         * Shared/mac/ChildProcessMac.mm:
1006         (WebKit::ChildProcess::setSharedHTTPCookieStorage):
1007         * UIProcess/API/C/WKPage.cpp:
1008         (WKPageSetPageUIClient):
1009         (fixUpBotchedPageUIClient): Deleted.
1010         * UIProcess/ChildProcessProxy.cpp:
1011         (WebKit::ChildProcessProxy::didFinishLaunching):
1012         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1013         (WebKit::WebProcessPool::platformInitializeWebProcess):
1014         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1015         (WebKit::WebProcessPool::resetHSTSHostsAddedAfterDate):
1016         * UIProcess/Cocoa/WebViewImpl.h:
1017         * UIProcess/Cocoa/WebViewImpl.mm:
1018         (WebKit::WebViewImpl::updateLayer):
1019         (WebKit::WebViewImpl::startWindowDrag):
1020         * UIProcess/DrawingAreaProxy.h:
1021         (WebKit::DrawingAreaProxy::waitForPossibleGeometryUpdate): Deleted.
1022         * UIProcess/Plugins/PluginProcessProxy.cpp:
1023         (WebKit::PluginProcessProxy::didFinishLaunching):
1024         * UIProcess/Plugins/PluginProcessProxy.h:
1025         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
1026         (WebKit::PluginProcessProxy::platformInitializePluginProcess):
1027         (WebKit::PluginProcessProxy::createPropertyListFile): Deleted.
1028         * UIProcess/WebPageProxy.cpp:
1029         (WebKit::WebPageProxy::setTopContentInset):
1030         * UIProcess/mac/PageClientImpl.mm:
1031         (WebKit::PageClientImpl::rootViewToWindow):
1032         (WebKit::PageClientImpl::startWindowDrag):
1033         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
1034         (WebKit::RemoteWebInspectorProxy::platformStartWindowDrag):
1035         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
1036         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
1037         (WebKit::TiledCoreAnimationDrawingAreaProxy::createFence):
1038         (WebKit::TiledCoreAnimationDrawingAreaProxy::waitForPossibleGeometryUpdate): Deleted.
1039         * UIProcess/mac/WebInspectorProxyMac.mm:
1040         (WebKit::WebInspectorProxy::createFrontendWindow):
1041         (WebKit::WebInspectorProxy::platformStartWindowDrag):
1042         * UIProcess/mac/WebPopupMenuProxyMac.mm:
1043         (WebKit::WebPopupMenuProxyMac::showPopupMenu):
1044         * WebKit2.xcodeproj/project.pbxproj:
1045         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX-10.9-10.10.plist: Removed.
1046         * WebProcess/WebPage/WebPage.cpp:
1047         * WebProcess/WebPage/WebPage.h:
1048         * WebProcess/WebPage/WebPage.messages.in:
1049         * WebProcess/WebPage/mac/PlatformCAAnimationRemote.mm:
1050         (WebKit::addAnimationToLayer):
1051         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
1052         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
1053         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1054         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
1055         (WebKit::TiledCoreAnimationDrawingArea::updateGeometry):
1056         * WebProcess/cocoa/WebProcessCocoa.mm:
1057         (WebKit::WebProcess::platformInitializeWebProcess):
1058         * WebProcess/com.apple.WebProcess.sb.in:
1059
1060 2017-07-01  Chris Dumez  <cdumez@apple.com>
1061
1062         Replace ResourceLoadStatisticsStore C API with Cocoa SPI
1063         https://bugs.webkit.org/show_bug.cgi?id=174060
1064
1065         Reviewed by Brent Fulgham.
1066
1067         Replace ResourceLoadStatisticsStore C API by Cocoa SPI. The new Cocoa SPI is on
1068         WKWebsiteDataStore, which allows us to get rid of the WebResourceLoadStatisticsManager
1069         singleton as the SPI can now interact directly with the WebResourceLoadStatisticsStore.
1070
1071         * UIProcess/API/C/WKResourceLoadStatisticsManager.cpp: Removed.
1072         * UIProcess/API/C/WKResourceLoadStatisticsManager.h: Removed.
1073         Drop old C API.
1074
1075         * UIProcess/WebResourceLoadStatisticsManager.cpp: Removed.
1076         * UIProcess/WebResourceLoadStatisticsManager.h: Removed.
1077         Drop WebResourceLoadStatisticsManager singleton which was only required by the
1078         C API. This is because the C API was global, rather than working on a specific
1079         store.
1080
1081         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1082         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1083         Add new Cocoa SPI on WKWebsiteDataStore. This is only used for testing.
1084
1085         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1086         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
1087         Stop registering the store with the WebResourceLoadStatisticsManager singleton,
1088         as this singleton is gone.
1089
1090         * UIProcess/WebsiteData/WebsiteDataStore.h:
1091         (WebKit::WebsiteDataStore::resourceLoadStatistics):
1092         Add new getter to retrieve the WebResourceLoadStatisticsStore from the
1093         WebsiteDataStore. This is needed by the new Cocoa SPI.
1094
1095         * WebKit2.xcodeproj/project.pbxproj:
1096         Drop some files.
1097
1098 2017-06-30  Megan Gardner  <megan_gardner@apple.com>
1099
1100         Unreviewed mac build fix.
1101
1102         * UIProcess/API/Cocoa/_WKActivatedElementInfo.mm:
1103         * UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h:
1104
1105 2017-06-30  Megan Gardner  <megan_gardner@apple.com>
1106
1107         Add API to get WKActivatedElementInfo
1108         https://bugs.webkit.org/show_bug.cgi?id=174001
1109         <rdar://problem/29165518>
1110         
1111         Adding a way to get a WKActivatedElementInfo for a point on a WKWebView.
1112
1113         Reviewed by Tim Horton.
1114
1115         * UIProcess/API/Cocoa/WKWebView.mm:
1116         (-[WKWebView requestActivatedElementAtPosition:completionBlock:]):
1117         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1118         * UIProcess/API/Cocoa/_WKActivatedElementInfo.mm:
1119         (+[_WKActivatedElementInfo infoWithType:withInteractionInformationAtPosition:]):
1120         (-[_WKActivatedElementInfo infoWithType:withInteractionInformationAtPosition:]):
1121         * UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h:
1122
1123 2017-06-30  Tim Horton  <timothy_horton@apple.com>
1124
1125         Use API instead of SPI for content inset adjustment behavior
1126         https://bugs.webkit.org/show_bug.cgi?id=174050
1127
1128         Reviewed by Sam Weinig.
1129
1130         * Platform/spi/ios/UIKitSPI.h:
1131         * UIProcess/ios/WKScrollView.mm:
1132         (-[WKScrollView initWithFrame:]):
1133         (-[WKScrollView setContentInsetAdjustmentBehavior:]):
1134         (-[WKScrollView _setContentInsetAdjustmentBehaviorInternal:]):
1135         (-[WKScrollView _setContentInsetAdjustmentBehavior:]): Deleted.
1136         Switch over to the API. The old SPI calls the API internally, so our
1137         override will now cover all callers.
1138
1139 2017-06-30  Chris Dumez  <cdumez@apple.com>
1140
1141         Move store logic from WebResourceLoadStatisticsManager to WebResourceLoadStatisticsStore
1142         https://bugs.webkit.org/show_bug.cgi?id=174038
1143
1144         Reviewed by Brent Fulgham.
1145
1146         Move store logic from WebResourceLoadStatisticsManager to WebResourceLoadStatisticsStore.
1147         WebResourceLoadStatisticsManager is now essentially a proxy to the
1148         WebResourceLoadStatisticsStore to support the current C API.
1149
1150         In a follow-up, I plan to to replace the C API with a Cocoa SPI which works on a
1151         WebResourceLoadStatisticsStore directly instead of requiring a
1152         WebResourceLoadStatisticsManager singleton.
1153
1154         * UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
1155         (WKResourceLoadStatisticsManagerSetMinimumTimeBetweenDataRecordsRemoval):
1156         (WKResourceLoadStatisticsManagerResetToConsistentState):
1157         * UIProcess/API/C/WKResourceLoadStatisticsManager.h:
1158         * UIProcess/Cocoa/WebResourceLoadStatisticsManagerCocoa.mm: Removed.
1159         * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
1160         (WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
1161         * UIProcess/WebResourceLoadStatisticsManager.cpp:
1162         (WebKit::WebResourceLoadStatisticsManager::WebResourceLoadStatisticsManager):
1163         (WebKit::WebResourceLoadStatisticsManager::~WebResourceLoadStatisticsManager):
1164         (WebKit::WebResourceLoadStatisticsManager::setStatisticsStore):
1165         (WebKit::WebResourceLoadStatisticsManager::clearInMemoryStore):
1166         (WebKit::WebResourceLoadStatisticsManager::clearInMemoryAndPersistentStore):
1167         (WebKit::WebResourceLoadStatisticsManager::logUserInteraction):
1168         (WebKit::WebResourceLoadStatisticsManager::clearUserInteraction):
1169         (WebKit::WebResourceLoadStatisticsManager::hasHadUserInteraction):
1170         (WebKit::WebResourceLoadStatisticsManager::setPrevalentResource):
1171         (WebKit::WebResourceLoadStatisticsManager::isPrevalentResource):
1172         (WebKit::WebResourceLoadStatisticsManager::clearPrevalentResource):
1173         (WebKit::WebResourceLoadStatisticsManager::setGrandfathered):
1174         (WebKit::WebResourceLoadStatisticsManager::isGrandfathered):
1175         (WebKit::WebResourceLoadStatisticsManager::setSubframeUnderTopFrameOrigin):
1176         (WebKit::WebResourceLoadStatisticsManager::setSubresourceUnderTopFrameOrigin):
1177         (WebKit::WebResourceLoadStatisticsManager::setSubresourceUniqueRedirectTo):
1178         (WebKit::WebResourceLoadStatisticsManager::setTimeToLiveUserInteraction):
1179         (WebKit::WebResourceLoadStatisticsManager::setTimeToLiveCookiePartitionFree):
1180         (WebKit::WebResourceLoadStatisticsManager::setMinimumTimeBetweenDataRecordsRemoval):
1181         (WebKit::WebResourceLoadStatisticsManager::setGrandfatheringTime):
1182         (WebKit::WebResourceLoadStatisticsManager::fireDataModificationHandler):
1183         (WebKit::WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler):
1184         (WebKit::WebResourceLoadStatisticsManager::fireTelemetryHandler):
1185         * UIProcess/WebResourceLoadStatisticsManager.h:
1186         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1187         (WebKit::primaryDomain):
1188         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
1189         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
1190         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
1191         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
1192         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
1193         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
1194         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
1195         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
1196         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
1197         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
1198         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
1199         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
1200         (WebKit::WebResourceLoadStatisticsStore::fireDataModificationHandler):
1201         (WebKit::WebResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
1202         (WebKit::WebResourceLoadStatisticsStore::fireTelemetryHandler):
1203         (WebKit::WebResourceLoadStatisticsStore::clearInMemory):
1204         (WebKit::WebResourceLoadStatisticsStore::clearInMemoryAndPersistent):
1205         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
1206         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree):
1207         (WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
1208         (WebKit::WebResourceLoadStatisticsStore::setGrandfatheringTime):
1209         * UIProcess/WebResourceLoadStatisticsStore.h:
1210         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1211         (WebKit::WebsiteDataStore::removeData):
1212         * WebKit2.xcodeproj/project.pbxproj:
1213
1214 2017-06-30  John Wilander  <wilander@apple.com>
1215
1216         [WK2] Resource load statistics code is spamming the WebProcess with a test-only message 
1217         https://bugs.webkit.org/show_bug.cgi?id=174048
1218         <rdar://problem/33062376>
1219
1220         Reviewed by Brent Fulgham.
1221
1222         Fix the telemetry data message send so that it is not generated during normal operations.
1223         This is only meant to be used by WebKitTestRunner.
1224
1225         * UIProcess/WebResourceLoadStatisticsTelemetry.cpp:
1226         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit): 
1227
1228 2017-06-30  Daniel Bates  <dabates@apple.com>
1229
1230         Attempt to fix the WPE build following <https://trac.webkit.org/changeset/219013>
1231         (https://bugs.webkit.org/show_bug.cgi?id=165160)
1232
1233         Update the prototype of UIClient::createNewPage() to take a API::FrameInfo& instead of
1234         a WebFrameProxy* and a const WebCore::SecurityOriginData&.
1235
1236         * UIProcess/API/glib/WebKitUIClient.cpp:
1237
1238 2017-06-30  Alex Christensen  <achristensen@webkit.org>
1239
1240         Stop soft linking with CFNetwork
1241         https://bugs.webkit.org/show_bug.cgi?id=174029
1242
1243         Reviewed by Jer Noble.
1244
1245         * Shared/mac/CookieStorageShim.mm:
1246
1247 2017-06-30  Daniel Bates  <dabates@apple.com>
1248
1249         API::FrameInfo should know the web page that contains the frame; add API property webView to WKFrameInfo
1250         https://bugs.webkit.org/show_bug.cgi?id=165160
1251         <rdar://problem/29451999>
1252
1253         Reviewed by Brady Eidson.
1254
1255         Expose a property on WKFrameInfo to retrieve the WKWebView of the web page that contains the
1256         frame. This will allow an embedding client to know the web view that initiated the navigation
1257         request as well as differentiate between a navigation initiated by web content from one
1258         initiated via API.
1259
1260         The majority of this change is passing the document D that initiated the targeted navigation
1261         or called window.open() through the loading machinery to the FrameLoaderClient. The changes
1262         to pass this information to the FrameLoaderClient when creating a new window are straightforward.
1263         For targeted navigation, the WebKit2 FrameLoaderClient implementation now computes the info
1264         for the originating frame regardless of the navigation type (NavigationAction::type()).
1265         (Currently we only compute the originating frame for hyperlink activated navigations,
1266         form submissions, and form resubmissions). The WebProcess computes the page ID of the page
1267         that contains the originating frame and sends that to the UIProcess so that it can create
1268         an API::FrameInfo for the originating frame and associate the page that contains the frame,
1269         if the navigation was triggered by web content. If the navigation was triggered by API
1270         (e.g. -[WKWebView goBack]) then the created API::FrameInfo does not have an associated page
1271         so that an embedding client can distinguish between a navigation initiated by web content
1272         from a navigation that it initiated via API depending on whether API::FrameInfo::page() is
1273         nullptr. We expose property webView on the Mac and iOS API class WKFrameInfo to return the
1274         WKWebView corresponding to API::FrameInfo::page().
1275
1276         A small change that this patch makes is to have the WebProcess compute the originating frame
1277         info (call WebFrame::info()) and send it over to the UIProcess as opposed to sending the frame
1278         ID of the originating frame and having the UIProcess compute the frame info from it. We do this
1279         because the UIProcess may not be able to compute the frame info for the originating frame if
1280         the window that it was contained in was closed between the time the WebProcess sent the frame
1281         ID to the UIProcess and the UIProcess received it.
1282
1283         * UIProcess/API/APIFrameInfo.cpp:
1284         (API::FrameInfo::create):
1285         (API::FrameInfo::FrameInfo):
1286         (API::FrameInfo::clearPage):
1287         * UIProcess/API/APIFrameInfo.h:
1288         * UIProcess/API/APIUIClient.h:
1289         (API::UIClient::createNewPage):
1290         (API::UIClient::createNewPageAsync):
1291         * UIProcess/API/C/WKPage.cpp:
1292         (WKPageSetPageUIClient):
1293         * UIProcess/API/Cocoa/WKFrameInfo.h:
1294         * UIProcess/API/Cocoa/WKFrameInfo.mm:
1295         (-[WKFrameInfo description]):
1296         (-[WKFrameInfo webView]):
1297         * UIProcess/API/Cocoa/WKUserContentController.mm:
1298         * UIProcess/Cocoa/UIDelegate.h:
1299         * UIProcess/Cocoa/UIDelegate.mm:
1300         (WebKit::UIDelegate::UIClient::createNewPageCommon):
1301         (WebKit::UIDelegate::UIClient::createNewPage):
1302         (WebKit::UIDelegate::UIClient::createNewPageAsync):
1303         * UIProcess/WebPageProxy.cpp:
1304         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1305         (WebKit::WebPageProxy::createNewPage):
1306         * UIProcess/WebPageProxy.h:
1307         * UIProcess/WebPageProxy.messages.in:
1308         * WebProcess/Plugins/PluginView.cpp:
1309         (WebKit::PluginView::loadURL):
1310         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1311         (WebKit::WebChromeClient::createWindow):
1312         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1313         (WebKit::WebFrameLoaderClient::dispatchCreatePage):
1314         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1315         * WebProcess/WebPage/WebInspector.cpp:
1316         (WebKit::WebInspector::openInNewTab):
1317
1318 2017-06-29  Jer Noble  <jer.noble@apple.com>
1319
1320         Make Legacy EME API controlled by RuntimeEnabled setting.
1321         https://bugs.webkit.org/show_bug.cgi?id=173994
1322
1323         Reviewed by Sam Weinig.
1324
1325         Add a new WKWebViewConfiguration property, as well as a new WKPreferences function, both able to control
1326         WebCore's new RuntimeEnabledFeature setting for the Legacy EME API.
1327
1328         * Configurations/FeatureDefines.xcconfig:
1329         * Shared/WebPreferencesDefinitions.h:
1330         * UIProcess/API/C/WKPreferences.cpp:
1331         (WKPreferencesGetLegacyEncryptedMediaAPIEnabled):
1332         (WKPreferencesSetLegacyEncryptedMediaAPIEnabled):
1333         * UIProcess/API/C/WKPreferencesRef.h:
1334         * UIProcess/API/Cocoa/WKWebView.mm:
1335         (-[WKWebView _initializeWithConfiguration:]):
1336         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1337         (-[WKWebViewConfiguration init]):
1338         (-[WKWebViewConfiguration copyWithZone:]):
1339         (-[WKWebViewConfiguration _setLegacyEncryptedMediaAPIEnabled:]):
1340         (-[WKWebViewConfiguration _legacyEncryptedMediaAPIEnabled]):
1341         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1342         * WebProcess/WebPage/WebPage.cpp:
1343         (WebKit::WebPage::updatePreferences):
1344
1345 2017-06-30  Jer Noble  <jer.noble@apple.com>
1346
1347         REGRESSION (r218757): Touch Bar's media scrubber timeline runs from 00:00 to 00:00 and has no playhead
1348         https://bugs.webkit.org/show_bug.cgi?id=174032
1349
1350         Reviewed by Eric Carlson.
1351
1352         Fix a copypasta error where durationChange notifications were changing the value of muted.
1353
1354         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm:
1355         (WebKit::WebPlaybackSessionManagerProxy::durationChanged):
1356
1357 2017-06-30  Chris Dumez  <cdumez@apple.com>
1358
1359         Move ResourceLoadStatisticsStore to WebKit2/UIProcess
1360         https://bugs.webkit.org/show_bug.cgi?id=174033
1361
1362         Reviewed by Brent Fulgham.
1363
1364         Move ResourceLoadStatisticsStore to WebKit2/UIProcess since it is only
1365         used in the WebKit2 UIProcess.
1366
1367         * CMakeLists.txt:
1368         * UIProcess/Storage/ResourceLoadStatisticsStore.cpp: Renamed from Source/WebCore/loader/ResourceLoadStatisticsStore.cpp.
1369         (WebKit::ResourceLoadStatisticsStore::createEncoderFromData):
1370         (WebKit::ResourceLoadStatisticsStore::readDataFromDecoder):
1371         (WebKit::ResourceLoadStatisticsStore::clearInMemory):
1372         (WebKit::ResourceLoadStatisticsStore::clearInMemoryAndPersistent):
1373         (WebKit::ResourceLoadStatisticsStore::mergeStatistics):
1374         (WebKit::ResourceLoadStatisticsStore::fireDataModificationHandler):
1375         (WebKit::ResourceLoadStatisticsStore::fireTelemetryHandler):
1376         (WebKit::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
1377         (WebKit::ResourceLoadStatisticsStore::processStatistics):
1378         (WebKit::ResourceLoadStatisticsStore::sortedPrevalentResourceTelemetry):
1379         (WebKit::ResourceLoadStatisticsStore::shouldRemoveDataRecords):
1380         (WebKit::ResourceLoadStatisticsStore::dataRecordsBeingRemoved):
1381         (WebKit::ResourceLoadStatisticsStore::dataRecordsWereRemoved):
1382         (WebKit::ResourceLoadStatisticsStore::statisticsLock):
1383         * UIProcess/Storage/ResourceLoadStatisticsStore.h: Renamed from Source/WebCore/loader/ResourceLoadStatisticsStore.h.
1384         * UIProcess/WebResourceLoadStatisticsManager.cpp:
1385         (WebKit::primaryDomain):
1386         * UIProcess/WebResourceLoadStatisticsManager.h:
1387         * UIProcess/WebResourceLoadStatisticsStore.h:
1388         * UIProcess/WebResourceLoadStatisticsTelemetry.cpp:
1389         * UIProcess/WebResourceLoadStatisticsTelemetry.h:
1390         * WebKit2.xcodeproj/project.pbxproj:
1391
1392 2017-06-30  Ryosuke Niwa  <rniwa@webkit.org>
1393
1394         Ran sort-Xcode-project-file.
1395
1396         * WebKit2.xcodeproj/project.pbxproj:
1397
1398 2017-06-30  Chris Dumez  <cdumez@apple.com>
1399
1400         ResourceLoadObserver does not need a ResourceLoadStatisticsStore
1401         https://bugs.webkit.org/show_bug.cgi?id=174013
1402
1403         Reviewed by Brent Fulgham.
1404
1405         ResourceLoadObserver does not need a ResourceLoadStatisticsStore. ResourceLoadStatisticsStore is too complicated for its needs.
1406         ResourceLoadStatisticsStore can then be moved to WebKit2/UIProcess in a follow-up.
1407
1408         * WebProcess/WebProcess.cpp:
1409         (WebKit::m_webSQLiteDatabaseTracker):
1410         (WebKit::WebProcess::statisticsChangedTimerFired):
1411         * WebProcess/WebProcess.h:
1412
1413 2017-06-30  Brent Fulgham  <bfulgham@apple.com>
1414
1415         [WK2][iOS][macOS] Update XPC services process launch dictionary
1416         https://bugs.webkit.org/show_bug.cgi?id=173995
1417         <rdar://problem/32797264>
1418
1419         Reviewed by Alex Christensen.
1420
1421         Update the WebProcess and Plugin Process XPC launch dictionaries to activate
1422         improved ALSR features when launching.
1423
1424         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist:
1425         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist:
1426         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist:
1427
1428 2017-06-30  Chris Dumez  <cdumez@apple.com>
1429
1430         Merge WebResourceLoadStatisticsManager and WebResourceLoadObserver
1431         https://bugs.webkit.org/show_bug.cgi?id=174008
1432
1433         Reviewed by Brent Fulgham.
1434
1435         Merge WebResourceLoadStatisticsManager and WebResourceLoadObserver. One was basically
1436         a proxy to the other.
1437
1438         * UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
1439         (WKResourceLoadStatisticsManagerSetPrevalentResource):
1440         (WKResourceLoadStatisticsManagerIsPrevalentResource):
1441         (WKResourceLoadStatisticsManagerSetHasHadUserInteraction):
1442         (WKResourceLoadStatisticsManagerIsHasHadUserInteraction):
1443         (WKResourceLoadStatisticsManagerSetGrandfathered):
1444         (WKResourceLoadStatisticsManagerIsGrandfathered):
1445         (WKResourceLoadStatisticsManagerSetSubframeUnderTopFrameOrigin):
1446         (WKResourceLoadStatisticsManagerSetSubresourceUnderTopFrameOrigin):
1447         (WKResourceLoadStatisticsManagerSetSubresourceUniqueRedirectTo):
1448         (WKResourceLoadStatisticsManagerSetTimeToLiveUserInteraction):
1449         (WKResourceLoadStatisticsManagerSetTimeToLiveCookiePartitionFree):
1450         (WKResourceLoadStatisticsManagerSetMinimumTimeBetweeenDataRecordsRemoval):
1451         (WKResourceLoadStatisticsManagerSetGrandfatheringTime):
1452         (WKResourceLoadStatisticsManagerFireDataModificationHandler):
1453         (WKResourceLoadStatisticsManagerFireShouldPartitionCookiesHandler):
1454         (WKResourceLoadStatisticsManagerFireShouldPartitionCookiesHandlerForOneDomain):
1455         (WKResourceLoadStatisticsManagerFireTelemetryHandler):
1456         (WKResourceLoadStatisticsManagerSetNotifyPagesWhenDataRecordsWereScanned):
1457         (WKResourceLoadStatisticsManagerSetShouldClassifyResourcesBeforeDataRecordsRemoval):
1458         (WKResourceLoadStatisticsManagerSetNotifyPagesWhenTelemetryWasCaptured):
1459         (WKResourceLoadStatisticsManagerSetShouldSubmitTelemetry):
1460         (WKResourceLoadStatisticsManagerClearInMemoryAndPersistentStore):
1461         (WKResourceLoadStatisticsManagerClearInMemoryAndPersistentStoreModifiedSinceHours):
1462         (WKResourceLoadStatisticsManagerResetToConsistentState):
1463         * UIProcess/API/C/WKResourceLoadStatisticsManager.h:
1464         * UIProcess/Cocoa/WebResourceLoadStatisticsManagerCocoa.mm:
1465         (WebKit::WebResourceLoadStatisticsManager::registerUserDefaultsIfNeeded):
1466         * UIProcess/WebResourceLoadObserver.cpp: Removed.
1467         * UIProcess/WebResourceLoadObserver.h: Removed.
1468         * UIProcess/WebResourceLoadStatisticsManager.cpp:
1469         (WebKit::primaryDomain):
1470         (WebKit::WebResourceLoadStatisticsManager::shared):
1471         (WebKit::WebResourceLoadStatisticsManager::setStatisticsStore):
1472         (WebKit::WebResourceLoadStatisticsManager::setStatisticsQueue):
1473         (WebKit::WebResourceLoadStatisticsManager::clearInMemoryStore):
1474         (WebKit::WebResourceLoadStatisticsManager::clearInMemoryAndPersistentStore):
1475         (WebKit::WebResourceLoadStatisticsManager::logUserInteraction):
1476         (WebKit::WebResourceLoadStatisticsManager::clearUserInteraction):
1477         (WebKit::WebResourceLoadStatisticsManager::hasHadUserInteraction):
1478         (WebKit::WebResourceLoadStatisticsManager::setPrevalentResource):
1479         (WebKit::WebResourceLoadStatisticsManager::isPrevalentResource):
1480         (WebKit::WebResourceLoadStatisticsManager::clearPrevalentResource):
1481         (WebKit::WebResourceLoadStatisticsManager::setGrandfathered):
1482         (WebKit::WebResourceLoadStatisticsManager::isGrandfathered):
1483         (WebKit::WebResourceLoadStatisticsManager::setSubframeUnderTopFrameOrigin):
1484         (WebKit::WebResourceLoadStatisticsManager::setSubresourceUnderTopFrameOrigin):
1485         (WebKit::WebResourceLoadStatisticsManager::setSubresourceUniqueRedirectTo):
1486         (WebKit::WebResourceLoadStatisticsManager::setTimeToLiveUserInteraction):
1487         (WebKit::WebResourceLoadStatisticsManager::setTimeToLiveCookiePartitionFree):
1488         (WebKit::WebResourceLoadStatisticsManager::setMinimumTimeBetweeenDataRecordsRemoval):
1489         (WebKit::WebResourceLoadStatisticsManager::setGrandfatheringTime):
1490         (WebKit::WebResourceLoadStatisticsManager::fireDataModificationHandler):
1491         (WebKit::WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler):
1492         (WebKit::WebResourceLoadStatisticsManager::fireTelemetryHandler):
1493         * UIProcess/WebResourceLoadStatisticsManager.h:
1494         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1495         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
1496         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1497         (WebKit::WebsiteDataStore::removeData):
1498         * WebKit2.xcodeproj/project.pbxproj:
1499
1500 2017-06-30  Wenson Hsieh  <wenson_hsieh@apple.com>
1501
1502         [iOS DnD] Drag caret rect is incorrectly computed when dropping in editable content in iframes
1503         https://bugs.webkit.org/show_bug.cgi?id=174017
1504         <rdar://problem/32959782>
1505
1506         Reviewed by Simon Fraser.
1507
1508         Send the drag caret rect in root view coordinates over to the UI process.
1509
1510         * UIProcess/API/Cocoa/WKWebView.mm:
1511         (-[WKWebView _dragCaretRect]):
1512         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1513
1514         Add basic test plumbing to fetch the current drag caret rect.
1515
1516         * WebProcess/WebPage/WebPage.cpp:
1517         (WebKit::WebPage::performDragControllerAction):
1518
1519 2017-06-30  Youenn Fablet  <youenn@apple.com>
1520
1521         Support PeerConnectionStates::BundlePolicy::MaxBundle when setting rtc configuration
1522         https://bugs.webkit.org/show_bug.cgi?id=169389
1523
1524         Reviewed by Alex Christensen.
1525
1526         * fast/mediastream/RTCPeerConnection-getConfiguration-expected.txt:
1527
1528 2017-06-29  Ryosuke Niwa  <rniwa@webkit.org>
1529
1530         Assert that callback ID is not 0 or -1 during encoding and decoding
1531         https://bugs.webkit.org/show_bug.cgi?id=173803
1532
1533         Reviewed by Brady Eidson.
1534
1535         To diagnosing the hang inside Safari (<rdar://problem/32841256>), add assertions for the callback ID
1536         to be not 0 or -1 during encoding and decoding of IPC messages since the latest analysis seems to
1537         indicate the hang is caused by the hash map getting corrupted by the insertion of 0 (empty value).
1538
1539         Wrapped the uint64_t in CallbackID and OptionalCallbackID to add assertions.
1540
1541         * NetworkProcess/soup/NetworkProcessSoup.cpp:
1542         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
1543         * Shared/CallbackID.h: Added.
1544         (WebKit::CallbackID::CallbackID):
1545         (WebKit::CallbackID::operator==):
1546         (WebKit::CallbackID::toInteger):
1547         (WebKit::CallbackID::isValid):
1548         (WebKit::CallbackID::isValidCallbackID): A callback ID is valid when it's neither 0 nor -1.
1549         (WebKit::CallbackID::fromInteger): Create a CallbackID object from potentially unsafe value.
1550         (WebKit::CallbackID::generateID): Generates the next callback ID. Moved from CallbackBase.
1551         (WebKit::CallbackID::encode): Added. Assert that it's neither 0 nor -1.
1552         (WebKit::CallbackID::decode): Ditto.
1553         (WTF::CallbackIDHash::hash):
1554         (WTF::CallbackIDHash::equal):
1555         (WTF::HashTraits<WebKit::CallbackID>::emptyValue):
1556         (WTF::HashTraits<WebKit::CallbackID>::constructDeletedValue):
1557         (WTF::HashTraits<WebKit::CallbackID>::isDeletedValue):
1558         * Shared/OptionalCallbackID.h: Added. Unlike CallbackID, callback ID here can be 0.
1559         (WebKit::OptionalCallbackID::OptionalCallbackID):
1560         (WebKit::OptionalCallbackID::toInteger):
1561         (WebKit::OptionalCallbackID::callbackID): Returns a valid CallbackID object. The caller of
1562         this function must have verified that the ID is neither 0 or -1 before calling this function.
1563         (WebKit::OptionalCallbackID::operator bool):
1564         (WebKit::OptionalCallbackID::isValid):
1565         (WebKit::OptionalCallbackID::isValidCallbackID):
1566         (WebKit::OptionalCallbackID::encode): Since OptionalCallbackID can be 0, only assert that it's not -1.
1567         (WebKit::OptionalCallbackID::decode): Ditto.
1568         * Shared/mac/RemoteLayerTreeTransaction.h:
1569         * Shared/mac/RemoteLayerTreeTransaction.h:
1570         * UIProcess/GenericCallback.h:
1571         (WebKit::CallbackBase::callbackID): Returns a CallbackID object instead of uint64_t.
1572         (WebKit::CallbackBase::CallbackBase):
1573         (WebKit::CallbackBase::generateCallbackID): Deleted.
1574         (WebKit::CallbackMap::put): Returns a callback ID. Also added a version that doesn't take activity token
1575         as used in WebCookieManagerProxy
1576         (WebKit::CallbackMap::take): Takes a callback ID.
1577         * UIProcess/WebCookieManagerProxy.cpp: Updated the code as callback maps are merged.
1578         (WebKit::WebCookieManagerProxy::processPoolDestroyed):
1579         (WebKit::WebCookieManagerProxy::processDidClose):
1580         (WebKit::WebCookieManagerProxy::getHostnamesWithCookies):
1581         (WebKit::WebCookieManagerProxy::didGetHostnamesWithCookies):
1582         (WebKit::WebCookieManagerProxy::deleteCookie):
1583         (WebKit::WebCookieManagerProxy::deleteAllCookiesModifiedSince):
1584         (WebKit::WebCookieManagerProxy::setCookie):
1585         (WebKit::WebCookieManagerProxy::setCookies):
1586         (WebKit::WebCookieManagerProxy::getAllCookies):
1587         (WebKit::WebCookieManagerProxy::getCookies):
1588         (WebKit::WebCookieManagerProxy::didSetCookies):
1589         (WebKit::WebCookieManagerProxy::didGetCookies):
1590         (WebKit::WebCookieManagerProxy::didDeleteCookies):
1591         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
1592         (WebKit::WebCookieManagerProxy::getHTTPCookieAcceptPolicy):
1593         (WebKit::WebCookieManagerProxy::didGetHTTPCookieAcceptPolicy):
1594         (WebKit::WebCookieManagerProxy::didSetHTTPCookieAcceptPolicy):
1595         * UIProcess/WebCookieManagerProxy.h:
1596         * UIProcess/WebCookieManagerProxy.messages.in:
1597         * UIProcess/WebPageProxy.cpp:
1598         (WebKit::WebPageProxy::setInitialFocus):
1599         (WebKit::WebPageProxy::validateCommand):
1600         (WebKit::WebPageProxy::runJavaScriptInMainFrame):
1601         (WebKit::WebPageProxy::getRenderTreeExternalRepresentation):
1602         (WebKit::WebPageProxy::getSourceForFrame):
1603         (WebKit::WebPageProxy::getContentsAsString):
1604         (WebKit::WebPageProxy::getBytecodeProfile):
1605         (WebKit::WebPageProxy::getSamplingProfilerOutput):
1606         (WebKit::WebPageProxy::getContentsAsMHTMLData):
1607         (WebKit::WebPageProxy::getSelectionOrContentsAsString):
1608         (WebKit::WebPageProxy::getSelectionAsWebArchiveData):
1609         (WebKit::WebPageProxy::getMainResourceDataOfFrame):
1610         (WebKit::WebPageProxy::getResourceDataFromFrame):
1611         (WebKit::WebPageProxy::getWebArchiveOfFrame):
1612         (WebKit::WebPageProxy::forceRepaint):
1613         (WebKit::WebPageProxy::clearLoadDependentCallbacks):
1614         (WebKit::WebPageProxy::voidCallback):
1615         (WebKit::WebPageProxy::dataCallback):
1616         (WebKit::WebPageProxy::imageCallback):
1617         (WebKit::WebPageProxy::stringCallback):
1618         (WebKit::WebPageProxy::invalidateStringCallback):
1619         (WebKit::WebPageProxy::scriptValueCallback):
1620         (WebKit::WebPageProxy::computedPagesCallback):
1621         (WebKit::WebPageProxy::validateCommandCallback):
1622         (WebKit::WebPageProxy::unsignedCallback):
1623         (WebKit::WebPageProxy::editingRangeCallback):
1624         (WebKit::WebPageProxy::machSendRightCallback):
1625         (WebKit::WebPageProxy::rectForCharacterRangeCallback):
1626         (WebKit::WebPageProxy::printFinishedCallback):
1627         (WebKit::WebPageProxy::computePagesForPrinting):
1628         (WebKit::WebPageProxy::drawRectToImage):
1629         (WebKit::WebPageProxy::drawPagesToPDF):
1630         (WebKit::WebPageProxy::drawPagesForPrinting):
1631         (WebKit::WebPageProxy::getMarkedRangeAsync):
1632         (WebKit::WebPageProxy::getSelectedRangeAsync):
1633         (WebKit::WebPageProxy::characterIndexForPointAsync):
1634         (WebKit::WebPageProxy::firstRectForCharacterRangeAsync):
1635         (WebKit::WebPageProxy::takeSnapshot):
1636         (WebKit::WebPageProxy::installActivityStateChangeCompletionHandler):
1637         (WebKit::WebPageProxy::getLoadDecisionForIcon):
1638         (WebKit::WebPageProxy::finishedLoadingIcon):
1639         * UIProcess/WebPageProxy.h:
1640         * UIProcess/WebPageProxy.messages.in:
1641         * UIProcess/ios/WebPageProxyIOS.mm:
1642         (WebKit::WebPageProxy::gestureCallback):
1643         (WebKit::WebPageProxy::touchesCallback):
1644         (WebKit::WebPageProxy::autocorrectionDataCallback):
1645         (WebKit::WebPageProxy::selectionContextCallback):
1646         (WebKit::WebPageProxy::autocorrectionContextCallback):
1647         (WebKit::WebPageProxy::selectionRectsCallback):
1648         (WebKit::WebPageProxy::selectWithGesture):
1649         (WebKit::WebPageProxy::updateSelectionWithTouches):
1650         (WebKit::WebPageProxy::requestAutocorrectionData):
1651         (WebKit::WebPageProxy::applyAutocorrection):
1652         (WebKit::WebPageProxy::executeEditCommand):
1653         (WebKit::WebPageProxy::selectTextWithGranularityAtPoint):
1654         (WebKit::WebPageProxy::selectPositionAtBoundaryWithDirection):
1655         (WebKit::WebPageProxy::moveSelectionAtBoundaryWithDirection):
1656         (WebKit::WebPageProxy::selectPositionAtPoint):
1657         (WebKit::WebPageProxy::beginSelectionInDirection):
1658         (WebKit::WebPageProxy::updateSelectionWithExtentPoint):
1659         (WebKit::WebPageProxy::updateSelectionWithExtentPointAndBoundary):
1660         (WebKit::WebPageProxy::requestDictationContext):
1661         (WebKit::WebPageProxy::requestAutocorrectionContext):
1662         (WebKit::WebPageProxy::getSelectionContext):
1663         (WebKit::WebPageProxy::selectWithTwoTouches):
1664         (WebKit::WebPageProxy::requestRectsForGranularityWithSelectionOffset):
1665         (WebKit::WebPageProxy::requestRectsAtSelectionOffsetWithText):
1666         (WebKit::WebPageProxy::moveSelectionByOffset):
1667         (WebKit::WebPageProxy::focusNextAssistedNode):
1668         (WebKit::WebPageProxy::computePagesForPrintingAndDrawToPDF):
1669         (WebKit::WebPageProxy::drawToPDFCallback):
1670         * UIProcess/mac/WKPrintingView.mm:
1671         (-[WKPrintingView _preparePDFDataForPrintingOnSecondaryThread]):
1672         (-[WKPrintingView _askPageToComputePageRects]):
1673         (-[WKPrintingView _drawPreview:]):
1674         * UIProcess/mac/WebPageProxyMac.mm:
1675         (WebKit::WebPageProxy::attributedSubstringForCharacterRangeAsync):
1676         (WebKit::WebPageProxy::attributedStringForCharacterRangeCallback):
1677         (WebKit::WebPageProxy::fontAtSelection):
1678         (WebKit::WebPageProxy::fontAtSelectionCallback):
1679         * WebKit2.xcodeproj/project.pbxproj:
1680         * WebProcess/Cookies/WebCookieManager.cpp:
1681         (WebKit::WebCookieManager::getHostnamesWithCookies):
1682         (WebKit::WebCookieManager::deleteCookie):
1683         (WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
1684         (WebKit::WebCookieManager::getAllCookies):
1685         (WebKit::WebCookieManager::getCookies):
1686         (WebKit::WebCookieManager::setCookie):
1687         (WebKit::WebCookieManager::setCookies):
1688         (WebKit::WebCookieManager::setHTTPCookieAcceptPolicy):
1689         (WebKit::WebCookieManager::getHTTPCookieAcceptPolicy):
1690         * WebProcess/Cookies/WebCookieManager.h:
1691         * WebProcess/Cookies/WebCookieManager.messages.in:
1692         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1693         (WebKit::WebFrameLoaderClient::getLoadDecisionForIcon):
1694         (WebKit::WebFrameLoaderClient::finishedLoadingIcon):
1695         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
1696         (WebKit::AcceleratedDrawingArea::forceRepaintAsync):
1697         (WebKit::AcceleratedDrawingArea::activityStateDidChange):
1698         * WebProcess/WebPage/AcceleratedDrawingArea.h:
1699         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
1700         (WebKit::CoordinatedLayerTreeHost::forceRepaintAsync):
1701         (WebKit::CoordinatedLayerTreeHost::renderNextFrame):
1702         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
1703         * WebProcess/WebPage/DrawingArea.h:
1704         (WebKit::DrawingArea::forceRepaintAsync):
1705         (WebKit::DrawingArea::activityStateDidChange):
1706         (WebKit::DrawingArea::addTransactionCallbackID):
1707         * WebProcess/WebPage/DrawingArea.messages.in:
1708         * WebProcess/WebPage/LayerTreeHost.h:
1709         (WebKit::LayerTreeHost::forceRepaintAsync):
1710         * WebProcess/WebPage/WebPage.cpp:
1711         (WebKit::WebPage::reinitializeWebPage):
1712         (WebKit::WebPage::takeSnapshot):
1713         (WebKit::WebPage::validateCommand):
1714         (WebKit::WebPage::setInitialFocus):
1715         (WebKit::WebPage::setActivityState):
1716         (WebKit::WebPage::runJavaScriptInMainFrame):
1717         (WebKit::WebPage::getContentsAsString):
1718         (WebKit::WebPage::getContentsAsMHTMLData):
1719         (WebKit::WebPage::getRenderTreeExternalRepresentation):
1720         (WebKit::WebPage::getSelectionAsWebArchiveData):
1721         (WebKit::WebPage::getSelectionOrContentsAsString):
1722         (WebKit::WebPage::getSourceForFrame):
1723         (WebKit::WebPage::getMainResourceDataOfFrame):
1724         (WebKit::WebPage::getResourceDataFromFrame):
1725         (WebKit::WebPage::getWebArchiveOfFrame):
1726         (WebKit::WebPage::forceRepaint):
1727         (WebKit::WebPage::computePagesForPrinting):
1728         (WebKit::WebPage::drawRectToImage):
1729         (WebKit::WebPage::drawPagesToPDF):
1730         (WebKit::WebPage::drawPagesForPrinting):
1731         (WebKit::WebPage::didFinishPrintOperation):
1732         (WebKit::WebPage::getMarkedRangeAsync):
1733         (WebKit::WebPage::getSelectedRangeAsync):
1734         (WebKit::WebPage::characterIndexForPointAsync):
1735         (WebKit::WebPage::firstRectForCharacterRangeAsync):
1736         (WebKit::WebPage::getBytecodeProfile):
1737         (WebKit::WebPage::getSamplingProfilerOutput):
1738         (WebKit::WebPage::didGetLoadDecisionForIcon):
1739         * WebProcess/WebPage/WebPage.h:
1740         * WebProcess/WebPage/WebPage.messages.in:
1741         * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:
1742         (WebKit::WebPrintOperationGtk::WebPrintOperationGtk):
1743         * WebProcess/WebPage/gtk/WebPrintOperationGtk.h:
1744         * WebProcess/WebPage/ios/WebPageIOS.mm:
1745         (WebKit::WebPage::getSelectionContext):
1746         (WebKit::WebPage::selectWithGesture):
1747         (WebKit::WebPage::updateSelectionWithTouches):
1748         (WebKit::WebPage::selectWithTwoTouches):
1749         (WebKit::WebPage::moveSelectionByOffset):
1750         (WebKit::WebPage::getRectsForGranularityWithSelectionOffset):
1751         (WebKit::WebPage::getRectsAtSelectionOffsetWithText):
1752         (WebKit::WebPage::selectPositionAtPoint):
1753         (WebKit::WebPage::selectPositionAtBoundaryWithDirection):
1754         (WebKit::WebPage::moveSelectionAtBoundaryWithDirection):
1755         (WebKit::WebPage::selectTextWithGranularityAtPoint):
1756         (WebKit::WebPage::beginSelectionInDirection):
1757         (WebKit::WebPage::updateSelectionWithExtentPointAndBoundary):
1758         (WebKit::WebPage::updateSelectionWithExtentPoint):
1759         (WebKit::WebPage::requestDictationContext):
1760         (WebKit::WebPage::requestAutocorrectionData):
1761         (WebKit::WebPage::applyAutocorrection):
1762         (WebKit::WebPage::executeEditCommandWithCallback):
1763         (WebKit::WebPage::requestAutocorrectionContext):
1764         (WebKit::WebPage::focusNextAssistedNode):
1765         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
1766         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
1767         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
1768         (WebKit::RemoteLayerTreeDrawingArea::activityStateDidChange):
1769         (WebKit::RemoteLayerTreeDrawingArea::addTransactionCallbackID):
1770         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
1771         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1772         (WebKit::TiledCoreAnimationDrawingArea::forceRepaintAsync):
1773         (WebKit::TiledCoreAnimationDrawingArea::activityStateDidChange):
1774         (WebKit::TiledCoreAnimationDrawingArea::didUpdateActivityStateTimerFired):
1775         * WebProcess/WebPage/mac/WebPageMac.mm:
1776         (WebKit::WebPage::attributedSubstringForCharacterRangeAsync):
1777         (WebKit::WebPage::fontAtSelection):
1778
1779 2017-06-29  Andy Estes  <aestes@apple.com>
1780
1781         [iOS] Don't confuse coordinate spaces when computing the size of PDF snapshots
1782         https://bugs.webkit.org/show_bug.cgi?id=173996
1783         <rdar://problem/32961028>
1784
1785         Reviewed by Tim Horton.
1786
1787         When computing the printing rect for PDF snapshots, we were getting the width the
1788         WKContentView's bounds and the height from the WKScrollView's contentSize. These sizes are
1789         in different coordinate spaces, leading to incorrect clipping on sites that have a non-1
1790         scale factor.
1791
1792         Fix this by using the WKContentView's bounds for both width and height.
1793
1794         * UIProcess/ios/WKContentView.mm:
1795         (-[WKContentView _wk_pageCountForPrintFormatter:]):
1796
1797 2017-06-29  Matt Lewis  <jlewis3@apple.com>
1798
1799         Unreviewed, rolling out r218903.
1800
1801         This patch and its fix cause immediate flakiness on all WK2
1802         testers
1803
1804         Reverted changeset:
1805
1806         "Support PeerConnectionStates::BundlePolicy::MaxBundle when
1807         setting rtc configuration"
1808         https://bugs.webkit.org/show_bug.cgi?id=169389
1809         http://trac.webkit.org/changeset/218903
1810
1811 2017-06-29  Chris Dumez  <cdumez@apple.com>
1812
1813         Split ResourceLoadObserver into 2 classes: one for WebCore and one for the UIProcess
1814         https://bugs.webkit.org/show_bug.cgi?id=173990
1815
1816         Reviewed by Brent Fulgham.
1817
1818         Split ResourceLoadObserver into 2 classes: one for WebCore and one for the UIProcess.
1819         They really have different API and there is therefore close to no code duplication.
1820
1821         * CMakeLists.txt:
1822         * UIProcess/Cocoa/WebResourceLoadStatisticsManagerCocoa.mm:
1823         (WebKit::WebResourceLoadStatisticsManager::registerUserDefaultsIfNeeded):
1824         * UIProcess/WebResourceLoadObserver.cpp: Added.
1825         (WebKit::primaryDomain):
1826         (WebKit::WebResourceLoadObserver::sharedObserver):
1827         (WebKit::WebResourceLoadObserver::setStatisticsStore):
1828         (WebKit::WebResourceLoadObserver::setStatisticsQueue):
1829         (WebKit::WebResourceLoadObserver::clearInMemoryStore):
1830         (WebKit::WebResourceLoadObserver::clearInMemoryAndPersistentStore):
1831         (WebKit::WebResourceLoadObserver::logUserInteraction):
1832         (WebKit::WebResourceLoadObserver::clearUserInteraction):
1833         (WebKit::WebResourceLoadObserver::hasHadUserInteraction):
1834         (WebKit::WebResourceLoadObserver::setPrevalentResource):
1835         (WebKit::WebResourceLoadObserver::isPrevalentResource):
1836         (WebKit::WebResourceLoadObserver::clearPrevalentResource):
1837         (WebKit::WebResourceLoadObserver::setGrandfathered):
1838         (WebKit::WebResourceLoadObserver::isGrandfathered):
1839         (WebKit::WebResourceLoadObserver::setSubframeUnderTopFrameOrigin):
1840         (WebKit::WebResourceLoadObserver::setSubresourceUnderTopFrameOrigin):
1841         (WebKit::WebResourceLoadObserver::setSubresourceUniqueRedirectTo):
1842         (WebKit::WebResourceLoadObserver::setTimeToLiveUserInteraction):
1843         (WebKit::WebResourceLoadObserver::setTimeToLiveCookiePartitionFree):
1844         (WebKit::WebResourceLoadObserver::setMinimumTimeBetweeenDataRecordsRemoval):
1845         (WebKit::WebResourceLoadObserver::setGrandfatheringTime):
1846         (WebKit::WebResourceLoadObserver::fireDataModificationHandler):
1847         (WebKit::WebResourceLoadObserver::fireShouldPartitionCookiesHandler):
1848         (WebKit::WebResourceLoadObserver::fireTelemetryHandler):
1849         * UIProcess/WebResourceLoadObserver.h: Added.
1850         * UIProcess/WebResourceLoadStatisticsManager.cpp:
1851         (WebKit::WebResourceLoadStatisticsManager::setPrevalentResource):
1852         (WebKit::WebResourceLoadStatisticsManager::isPrevalentResource):
1853         (WebKit::WebResourceLoadStatisticsManager::setHasHadUserInteraction):
1854         (WebKit::WebResourceLoadStatisticsManager::hasHadUserInteraction):
1855         (WebKit::WebResourceLoadStatisticsManager::setGrandfathered):
1856         (WebKit::WebResourceLoadStatisticsManager::isGrandfathered):
1857         (WebKit::WebResourceLoadStatisticsManager::setSubframeUnderTopFrameOrigin):
1858         (WebKit::WebResourceLoadStatisticsManager::setSubresourceUnderTopFrameOrigin):
1859         (WebKit::WebResourceLoadStatisticsManager::setSubresourceUniqueRedirectTo):
1860         (WebKit::WebResourceLoadStatisticsManager::setTimeToLiveUserInteraction):
1861         (WebKit::WebResourceLoadStatisticsManager::setTimeToLiveCookiePartitionFree):
1862         (WebKit::WebResourceLoadStatisticsManager::setMinimumTimeBetweeenDataRecordsRemoval):
1863         (WebKit::WebResourceLoadStatisticsManager::setGrandfatheringTime):
1864         (WebKit::WebResourceLoadStatisticsManager::fireDataModificationHandler):
1865         (WebKit::WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler):
1866         (WebKit::WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandlerForOneDomain):
1867         (WebKit::WebResourceLoadStatisticsManager::fireTelemetryHandler):
1868         (WebKit::WebResourceLoadStatisticsManager::clearInMemoryAndPersistentStore):
1869         (WebKit::WebResourceLoadStatisticsManager::clearInMemoryAndPersistentStoreModifiedSinceHours):
1870         (WebKit::WebResourceLoadStatisticsManager::resetToConsistentState):
1871         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1872         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
1873         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1874         (WebKit::WebsiteDataStore::removeData):
1875         * WebKit2.xcodeproj/project.pbxproj:
1876
1877 2017-06-29  Sam Weinig  <sam@webkit.org>
1878
1879         [WebIDL] Remove custom binding for UserMessageHandlersNamespace
1880         https://bugs.webkit.org/show_bug.cgi?id=173956
1881
1882         Reviewed by Darin Adler.
1883
1884         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.cpp:
1885         (webkit_dom_dom_window_webkit_message_handlers_post_message):
1886         Update for name change.
1887
1888 2017-06-29  John Wilander  <wilander@apple.com>
1889
1890         Fix for intermittent Layout Test fail http/tests/loading/resourceLoadStatistics/telemetry-generation.html
1891         https://bugs.webkit.org/show_bug.cgi?id=173940
1892         <rdar://problem/33018125>
1893
1894         Reviewed by Brent Fulgham.
1895
1896         This change allows the TestController to turn off
1897         regular resource load statistics telemetry submission
1898         and to manually control when telemetry is calculated
1899         and submitted.
1900
1901         * UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
1902         (WKResourceLoadStatisticsManagerSetShouldSubmitTelemetry):
1903             New test infrastructure.
1904         * UIProcess/API/C/WKResourceLoadStatisticsManager.h:
1905         * UIProcess/WebResourceLoadStatisticsManager.cpp:
1906         (WebKit::WebResourceLoadStatisticsManager::setShouldSubmitTelemetry):
1907             New test infrastructure.
1908         * UIProcess/WebResourceLoadStatisticsManager.h:
1909         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1910         (WebKit::WebResourceLoadStatisticsStore::setShouldSubmitTelemetry):
1911             New test infrastructure.
1912         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
1913             The test function now calls
1914             WebResourceLoadStatisticsStore::submitTelemetry() directly
1915             instead of firing the timer.
1916         (WebKit::WebResourceLoadStatisticsStore::telemetryTimerFired):
1917             Now checks whether it should submit telemetry or not.
1918         (WebKit::WebResourceLoadStatisticsStore::submitTelemetry):
1919             Split out so that the test code doesn't have to fire the timer.
1920         * UIProcess/WebResourceLoadStatisticsStore.h:
1921         * UIProcess/WebResourceLoadStatisticsTelemetry.cpp:
1922         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
1923             Now doesn't submit if it's executed by test code.
1924
1925 2017-06-29  Chris Dumez  <cdumez@apple.com>
1926
1927         Slight clean up of WebResourceLoadStatisticsStore
1928         https://bugs.webkit.org/show_bug.cgi?id=173976
1929
1930         Reviewed by Brent Fulgham.
1931
1932         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1933         (WebKit::dataTypesToRemove):
1934         (WebKit::WebResourceLoadStatisticsStore::classifyResource):
1935         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
1936         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsEnabled):
1937         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
1938         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
1939         (WebKit::WebResourceLoadStatisticsStore::stopMonitoringStatisticsStorage):
1940         (WebKit::initializeDataTypesToRemove): Deleted.
1941         * UIProcess/WebResourceLoadStatisticsStore.h:
1942         (WebKit::WebResourceLoadStatisticsStore::coreStore): Deleted.
1943
1944 2017-06-29  Alex Christensen  <achristensen@webkit.org>
1945
1946         WKContentRuleLists with if-top-url or unless-top-url should run regex against entire top URL
1947         https://bugs.webkit.org/show_bug.cgi?id=173980
1948
1949         Reviewed by Tim Horton.
1950
1951         if-top-url and unless-top-url were broken inside WebKit2 apps.  This fixes them and adds a test.
1952         ContentExtension::populateConditionCacheIfNeeded was calling WebCompiledContentRuleList::conditionsApplyOnlyToDomain
1953         but m_data.conditionsApplyOnlyToDomainOffset was always 0 instead of ConditionsApplyOnlyToDomainOffset because 
1954         it wasn't being encoded and decoded when telling the WebProcess about the content rule list.  This was causing us
1955         to use whatever was at offset 0 in the file instead of the correct value stored in the file to determine
1956         whether to run regular expressions against the entire top URL for if-top-url or unless-top-url or against
1957         just the domain for if-top-domain or unless-top-domain.  Luckily, offset 0 in the file is always 
1958         ContentRuleListStore::CurrentContentRuleListFileVersion, so it was deterministic and easy to debug.
1959
1960         I should have added a LayoutTest with r213669 to verify correct behavior in an actual WKWebView,
1961         but I didn't because it wouldn't have caught regressions since the contentextension tests are
1962         marked as flaky since r206914, but once that is fixed the new test http/tests/contentextensions/top-url.html
1963         will verify that this feature is behaving correctly.  It failed before this change and passes after.
1964
1965         * Shared/WebCompiledContentRuleListData.cpp:
1966         (WebKit::WebCompiledContentRuleListData::encode):
1967         (WebKit::WebCompiledContentRuleListData::decode):
1968
1969 2017-06-29  Chris Dumez  <cdumez@apple.com>
1970
1971         statistics.mostRecentUserInteraction should be of type WallTime
1972         https://bugs.webkit.org/show_bug.cgi?id=173974
1973
1974         Reviewed by Brent Fulgham.
1975
1976         statistics.mostRecentUserInteraction should be of type WallTime for clarity.
1977
1978         * Shared/WebCoreArgumentCoders.cpp:
1979         (IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
1980         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
1981
1982 2017-06-29  Wenson Hsieh  <wenson_hsieh@apple.com>
1983
1984         Replace staging-prefixed UIKit drag and drop delegate methods with their public SDK versions
1985         https://bugs.webkit.org/show_bug.cgi?id=173959
1986
1987         Reviewed by Sam Weinig.
1988
1989         Remove references to _api_-prefixed UIDragInteractionDelegate and UIDropInteractionDelegate methods,
1990         and replace them with their counterparts in the public SDK.
1991
1992         * UIProcess/ios/WKContentViewInteraction.mm:
1993         (-[WKContentView dragInteraction:previewForLiftingItem:session:]):
1994         (-[WKContentView dragInteraction:session:didEndWithOperation:]):
1995         (-[WKContentView dragInteraction:item:willAnimateCancelWithAnimator:]):
1996         (-[WKContentView dropInteraction:sessionDidEnter:]):
1997         (-[WKContentView dropInteraction:sessionDidUpdate:]):
1998         (-[WKContentView _simulateDataInteractionEntered:]):
1999         (-[WKContentView _simulateDataInteractionUpdated:]):
2000         (-[WKContentView _simulateDataInteractionSessionDidEnd:]):
2001         (-[WKContentView _api_dragInteraction:previewForLiftingItem:session:]): Deleted.
2002         (-[WKContentView _api_dragInteraction:session:didEndWithOperation:]): Deleted.
2003         (-[WKContentView _api_dragInteraction:item:willAnimateCancelWithAnimator:]): Deleted.
2004         (-[WKContentView _api_dropInteraction:sessionDidEnter:]): Deleted.
2005         (-[WKContentView _api_dropInteraction:sessionDidUpdate:]): Deleted.
2006
2007 2017-06-29  Carlos Garcia Campos  <cgarcia@igalia.com>
2008
2009         Unreviewed. Fix GTK+ unit tests crashing after r218922.
2010
2011         We need to check if icon database exists and is open now on dispose and API entry points.
2012
2013         * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
2014         (webkitFaviconDatabaseDispose):
2015         (webkit_favicon_database_get_favicon_uri):
2016         (webkit_favicon_database_clear):
2017
2018 2017-06-29  Carlos Garcia Campos  <cgarcia@igalia.com>
2019
2020         [GTK][WPE] Implement API::IconLoadingClient and rework WebKitFaviconDatabase to use IconDatabase directly
2021         https://bugs.webkit.org/show_bug.cgi?id=173877
2022
2023         Reviewed by Brady Eidson.
2024
2025         This way IconDatabase and its related classes can be removed from WebCore, as well as the WebKit2 implementation
2026         and C API. For now I've copied IconDatabase from WebCore to WebKit2 under the glib API directory, adding the
2027         related classes as private inside IconDatabase, and removing some methods that are not used by the GLib API.
2028
2029         * PlatformGTK.cmake:
2030         * UIProcess/API/glib/IconDatabase.cpp: Added.
2031         (WebKit::urlForLogging):
2032         (WebKit::defaultClient):
2033         (WebKit::IconDatabase::IconRecord::IconRecord):
2034         (WebKit::IconDatabase::IconRecord::~IconRecord):
2035         (WebKit::IconDatabase::IconRecord::image):
2036         (WebKit::IconDatabase::IconRecord::setImageData):
2037         (WebKit::IconDatabase::IconRecord::loadImageFromResource):
2038         (WebKit::IconDatabase::IconRecord::imageDataStatus):
2039         (WebKit::IconDatabase::IconRecord::snapshot):
2040         (WebKit::IconDatabase::PageURLRecord::PageURLRecord):
2041         (WebKit::IconDatabase::PageURLRecord::~PageURLRecord):
2042         (WebKit::IconDatabase::PageURLRecord::setIconRecord):
2043         (WebKit::IconDatabase::PageURLRecord::snapshot):
2044         (WebKit::IconDatabase::setClient):
2045         (WebKit::IconDatabase::open):
2046         (WebKit::IconDatabase::close):
2047         (WebKit::IconDatabase::removeAllIcons):
2048         (WebKit::documentCanHaveIcon):
2049         (WebKit::IconDatabase::synchronousIconForPageURL):
2050         (WebKit::IconDatabase::synchronousIconURLForPageURL):
2051         (WebKit::IconDatabase::retainIconForPageURL):
2052         (WebKit::IconDatabase::performRetainIconForPageURL):
2053         (WebKit::IconDatabase::releaseIconForPageURL):
2054         (WebKit::IconDatabase::performReleaseIconForPageURL):
2055         (WebKit::IconDatabase::setIconDataForIconURL):
2056         (WebKit::IconDatabase::setIconURLForPageURL):
2057         (WebKit::IconDatabase::synchronousLoadDecisionForIconURL):
2058         (WebKit::IconDatabase::synchronousIconDataKnownForIconURL):
2059         (WebKit::IconDatabase::setEnabled):
2060         (WebKit::IconDatabase::isEnabled):
2061         (WebKit::IconDatabase::setPrivateBrowsingEnabled):
2062         (WebKit::IconDatabase::isPrivateBrowsingEnabled):
2063         (WebKit::IconDatabase::delayDatabaseCleanup):
2064         (WebKit::IconDatabase::allowDatabaseCleanup):
2065         (WebKit::IconDatabase::checkIntegrityBeforeOpening):
2066         (WebKit::IconDatabase::IconDatabase):
2067         (WebKit::IconDatabase::~IconDatabase):
2068         (WebKit::IconDatabase::wakeSyncThread):
2069         (WebKit::IconDatabase::scheduleOrDeferSyncTimer):
2070         (WebKit::IconDatabase::syncTimerFired):
2071         (WebKit::IconDatabase::isOpen):
2072         (WebKit::IconDatabase::isOpenBesidesMainThreadCallbacks):
2073         (WebKit::IconDatabase::databasePath):
2074         (WebKit::IconDatabase::defaultDatabaseFilename):
2075         (WebKit::IconDatabase::getOrCreateIconRecord):
2076         (WebKit::IconDatabase::getOrCreatePageURLRecord):
2077         (WebKit::IconDatabase::shouldStopThreadActivity):
2078         (WebKit::IconDatabase::iconDatabaseSyncThread):
2079         (WebKit::databaseVersionNumber):
2080         (WebKit::isValidDatabase):
2081         (WebKit::createDatabaseTables):
2082         (WebKit::IconDatabase::performOpenInitialization):
2083         (WebKit::IconDatabase::checkIntegrity):
2084         (WebKit::IconDatabase::performURLImport):
2085         (WebKit::IconDatabase::syncThreadMainLoop):
2086         (WebKit::IconDatabase::performPendingRetainAndReleaseOperations):
2087         (WebKit::IconDatabase::readFromDatabase):
2088         (WebKit::IconDatabase::writeToDatabase):
2089         (WebKit::IconDatabase::pruneUnretainedIcons):
2090         (WebKit::IconDatabase::checkForDanglingPageURLs):
2091         (WebKit::IconDatabase::removeAllIconsOnThread):
2092         (WebKit::IconDatabase::deleteAllPreparedStatements):
2093         (WebKit::IconDatabase::cleanupSyncThread):
2094         (WebKit::readySQLiteStatement):
2095         (WebKit::IconDatabase::setIconURLForPageURLInSQLDatabase):
2096         (WebKit::IconDatabase::setIconIDForPageURLInSQLDatabase):
2097         (WebKit::IconDatabase::removePageURLFromSQLDatabase):
2098         (WebKit::IconDatabase::getIconIDForIconURLFromSQLDatabase):
2099         (WebKit::IconDatabase::addIconURLToSQLDatabase):
2100         (WebKit::IconDatabase::getImageDataForIconURLFromSQLDatabase):
2101         (WebKit::IconDatabase::removeIconFromSQLDatabase):
2102         (WebKit::IconDatabase::writeIconSnapshotToSQLDatabase):
2103         (WebKit::IconDatabase::checkClosedAfterMainThreadCallback):
2104         (WebKit::IconDatabase::dispatchDidImportIconURLForPageURLOnMainThread):
2105         (WebKit::IconDatabase::dispatchDidImportIconDataForPageURLOnMainThread):
2106         (WebKit::IconDatabase::dispatchDidRemoveAllIconsOnMainThread):
2107         (WebKit::IconDatabase::dispatchDidFinishURLImportOnMainThread):
2108         * UIProcess/API/glib/IconDatabase.h: Added.
2109         (WebKit::IconDatabaseClient::didImportIconURLForPageURL):
2110         (WebKit::IconDatabaseClient::didImportIconDataForPageURL):
2111         (WebKit::IconDatabaseClient::didChangeIconForPageURL):
2112         (WebKit::IconDatabaseClient::didRemoveAllIcons):
2113         (WebKit::IconDatabaseClient::didFinishURLImport):
2114         (WebKit::IconDatabaseClient::didClose):
2115         (WebKit::IconDatabase::IconSnapshot::IconSnapshot):
2116         (WebKit::IconDatabase::IconSnapshot::iconURL):
2117         (WebKit::IconDatabase::IconSnapshot::timestamp):
2118         (WebKit::IconDatabase::IconSnapshot::data):
2119         (WebKit::IconDatabase::IconRecord::create):
2120         (WebKit::IconDatabase::IconRecord::getTimestamp):
2121         (WebKit::IconDatabase::IconRecord::setTimestamp):
2122         (WebKit::IconDatabase::IconRecord::iconURL):
2123         (WebKit::IconDatabase::IconRecord::retainingPageURLs):
2124         (WebKit::IconDatabase::PageURLSnapshot::PageURLSnapshot):
2125         (WebKit::IconDatabase::PageURLSnapshot::pageURL):
2126         (WebKit::IconDatabase::PageURLSnapshot::iconURL):
2127         (WebKit::IconDatabase::PageURLRecord::url):
2128         (WebKit::IconDatabase::PageURLRecord::iconRecord):
2129         (WebKit::IconDatabase::PageURLRecord::retain):
2130         (WebKit::IconDatabase::PageURLRecord::release):
2131         (WebKit::IconDatabase::PageURLRecord::retainCount):
2132         * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
2133         (_WebKitFaviconDatabasePrivate::~_WebKitFaviconDatabasePrivate):
2134         (getIconSurfaceSynchronously):
2135         (webkitFaviconDatabaseSetIconURLForPageURL):
2136         (webkitFaviconDatabaseCreate):
2137         (webkitFaviconDatabaseOpen):
2138         (webkitFaviconDatabaseIsOpen):
2139         (webkitFaviconDatabaseSetPrivateBrowsingEnabled):
2140         (webkitFaviconDatabaseGetLoadDecisionForIcon):
2141         (webkitFaviconDatabaseSetIconForPageURL):
2142         (webkit_favicon_database_get_favicon):
2143         (webkit_favicon_database_get_favicon_uri):
2144         * UIProcess/API/glib/WebKitFaviconDatabasePrivate.h:
2145         * UIProcess/API/glib/WebKitIconLoadingClient.cpp: Added.
2146         (IconLoadingClient::IconLoadingClient):
2147         (attachIconLoadingClientToView):
2148         * UIProcess/API/glib/WebKitIconLoadingClient.h: Copied from Source/WebKit2/UIProcess/API/glib/WebKitFaviconDatabasePrivate.h.
2149         * UIProcess/API/glib/WebKitWebContext.cpp:
2150         (ensureFaviconDatabase):
2151         (webkitWebContextEnableIconDatabasePrivateBrowsingIfNeeded):
2152         (webkitWebContextDisableIconDatabasePrivateBrowsingIfNeeded):
2153         (webkit_web_context_set_favicon_database_directory):
2154         * UIProcess/API/glib/WebKitWebView.cpp:
2155         (webkitWebViewConstructed):
2156         (webkitWebViewGetLoadDecisionForIcon):
2157         (webkitWebViewSetIcon):
2158         * UIProcess/API/glib/WebKitWebViewPrivate.h:
2159
2160 2017-06-28  Tim Horton  <timothy_horton@apple.com>
2161
2162         MobileSafari was constantly using 10-15% CPU viewing a PDF
2163         https://bugs.webkit.org/show_bug.cgi?id=173944
2164         <rdar://problem/33039910>
2165
2166         Reviewed by Simon Fraser.
2167
2168         * UIProcess/API/Cocoa/WKWebView.mm:
2169         (-[WKWebView _doAfterNextStablePresentationUpdate:]):
2170         (-[WKWebView _doAfterNextPresentationUpdate:]):
2171         (-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForPainting:]):
2172         Bail early and just dispatch_async the completion block if we are using a custom
2173         content view; these methods are very specific to the implementation of WKContentView
2174         and don't make sense with custom content views.
2175
2176         doAfterNextStablePresentationUpdate is particularly egregious because, since
2177         we will never call the stable update callbacks (because we bail from didCommitLayerTree
2178         if we aren't using WKContentView), it will keep calling doAfterNextPresentationUpdate
2179         over and over again.
2180
2181 2017-06-28  Brent Fulgham  <bfulgham@apple.com>
2182
2183         [WK2][macOS][iOS] Don't request microphone access for clients that don't need it.
2184         https://bugs.webkit.org/show_bug.cgi?id=173948
2185         <rdar://problem/32103275>
2186
2187         Reviewed by Eric Carlson.
2188
2189         Don't bother requesting a sandbox extension to access the microphone for any clients
2190         on the Cocoa platform that are not Safari. Other clients don't have the necessary
2191         system entitlements, and always fail leading to annoying SandboxViolation reports.
2192
2193         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2194         (WebKit::WebProcessPool::platformInitializeWebProcess): 
2195
2196 2017-06-29  Zalan Bujtas  <zalan@apple.com>
2197
2198         Move RenderEmbeddedObject::isReplacementObscured to HTMLPlugInElement
2199         https://bugs.webkit.org/show_bug.cgi?id=173802
2200         <rdar://problem/32884389>
2201
2202         Reviewed by Simon Fraser.
2203
2204         * WebProcess/WebPage/WebPage.cpp:
2205         (WebKit::WebPage::createPlugin):
2206
2207 2017-06-28  Ryosuke Niwa  <rniwa@webkit.org>
2208
2209         REGRESSION (r218842): com.apple.WebKit crash in WebKit::ProcessLauncher::launchProcess
2210         https://bugs.webkit.org/show_bug.cgi?id=173950
2211
2212         Reviewed by Chris Dumez.
2213
2214         Added a null check as m_xpcConnection could be nullptr here in the case platformInvalidate had been called.
2215
2216         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2217         (WebKit::ProcessLauncher::launchProcess):
2218
2219 2017-06-28  Youenn Fablet  <youenn@apple.com>
2220
2221         Support PeerConnectionStates::BundlePolicy::MaxBundle when setting rtc configuration
2222         https://bugs.webkit.org/show_bug.cgi?id=169389
2223
2224         Reviewed by Alex Christensen.
2225
2226         Updating according new WebCore LIbWebRTCProvider API.
2227
2228         * WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
2229         (WebKit::LibWebRTCProvider::createPeerConnection):
2230         * WebProcess/Network/webrtc/LibWebRTCProvider.h:
2231
2232 2017-06-28  Chris Dumez  <cdumez@apple.com>
2233
2234         [iOS] Allow WKWebView clients to play audio in the background
2235         https://bugs.webkit.org/show_bug.cgi?id=173932
2236         <rdar://problem/32851547>
2237
2238         Reviewed by Ryosuke Niwa.
2239
2240         Allow WKWebView clients (such as MobileSafari) to play audio in the background
2241         by taking a process assertion whenever a WebPage is audible.
2242
2243         * UIProcess/WebPageProxy.cpp:
2244         (WebKit::WebPageProxy::updateThrottleState):
2245
2246 2017-06-28  Brent Fulgham  <bfulgham@apple.com>
2247
2248         Teach ResourceLoadStatistics to recognize changes in the file system
2249         https://bugs.webkit.org/show_bug.cgi?id=173800
2250         <rdar://problem/32937842>
2251
2252         Reviewed by Chris Dumez.
2253
2254         We want to support the case where multiple UI processes choose to share the same
2255         statistics file. To support this, update the ResourceLoadStatistics logic to be aware
2256         that the statistics data file might change underneath it, and to take appropriate
2257         action when it does.
2258
2259         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2260         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsEnabled): When we enable
2261         the statistics, read in the data and then watch for changes.
2262         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver): Add a
2263         'delete data' handler to remove the file on disk, not just write an empty store.
2264         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded): Use ASCIILiteral.
2265         (WebKit::WebResourceLoadStatisticsStore::refreshFromDisk): Convenience function.
2266         (WebKit::WebResourceLoadStatisticsStore::writeStoreToDisk): Sync with any on-disk
2267         storage before writing out.
2268         (WebKit::openAndLockFile): Convenience function.
2269         (WebKit::closeAndUnlockFile): Ditto.
2270         (WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk): Revise to lock file (on
2271         platforms that support it) before writing to disk.
2272         (WebKit::WebResourceLoadStatisticsStore::deleteStoreFromDisk): Added convenience function.
2273         (WebKit::WebResourceLoadStatisticsStore::clearInMemoryData): Ditto.
2274         (WebKit::WebResourceLoadStatisticsStore::startMonitoringStatisticsStorage): Create a
2275         file system monitor to watch for file changes.
2276         (WebKit::WebResourceLoadStatisticsStore::syncWithExistingStatisticsStorageIfNeeded): Added
2277         convenience function.
2278         (WebKit::WebResourceLoadStatisticsStore::createDecoderFromDisk): Revise to read data
2279         directly so we can control file locking.
2280         * UIProcess/WebResourceLoadStatisticsStore.h:
2281
2282 2017-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2283
2284         Followup to r218885: adjust for further UIKit SPI changes
2285         https://bugs.webkit.org/show_bug.cgi?id=173927
2286         <rdar://problem/33020792>
2287
2288         Reviewed by Tim Horton.
2289
2290         On ToT, UIKit now invokes -_dragInteraction:item:shouldDelaySetDownAnimationWithCompletion: before the
2291         completion block of -dragInteraction:willAnimateLiftWithAnimator:session: is called. This means we now need to
2292         store the completion block in -shouldDelaySetDownAnimationWithCompletion: and wait until the UIDragAnimating
2293         completion block in -willAnimateCancelWithAnimator: before invoking it.
2294
2295         * UIProcess/ios/WKContentViewInteraction.h:
2296         * UIProcess/ios/WKContentViewInteraction.mm:
2297         (-[WKContentView cleanUpDragSourceSessionState]):
2298
2299         Ensure that the set-down completion block is invoked when a drag session ends (e.g., if the web content process
2300         crashes).
2301
2302         (-[WKContentView _dragInteraction:item:shouldDelaySetDownAnimationWithCompletion:]):
2303         (-[WKContentView _api_dragInteraction:item:willAnimateCancelWithAnimator:]):
2304
2305 2017-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2306
2307         dropInteraction:sessionDidEnd: invokes dragEnded with a UIDragOperation rather than a WebCore::DragOperation
2308         https://bugs.webkit.org/show_bug.cgi?id=173935
2309
2310         Reviewed by Tim Horton.
2311
2312         Replaces a use of UIDragOperationNone with DragOperationNone.
2313         Currently, there is no change in behavior since these are currently the same value (0).
2314
2315         * UIProcess/ios/WKContentViewInteraction.mm:
2316         (-[WKContentView dropInteraction:sessionDidEnd:]):
2317
2318 2017-06-28  Alex Christensen  <achristensen@webkit.org>
2319
2320         WebsitePolicies given with navigation policy for redirects should apply to the provisional document
2321         https://bugs.webkit.org/show_bug.cgi?id=173886
2322         <rdar://problem/32543191>
2323
2324         Reviewed by Andy Estes.
2325         
2326         If, for example, we deny video autoplay for the initial request but allow it for the redirect destination
2327         location, the document should allow video autoplay.  We were putting these settings onto the wrong DocumentLoader.
2328         When a navigation policy is given to a response of a redirect location, we currently have the DocumentLoader
2329         for the loading document in the FrameLoader's provisionalDocumentLoader, not the documentLoader.
2330         
2331         Covered by a new API test.
2332
2333         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2334         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2335
2336 2017-06-28  Konstantin Tokarev  <annulen@yandex.ru>
2337
2338         [cmake] Improve configuration tests for librt and libatomic
2339         https://bugs.webkit.org/show_bug.cgi?id=173921
2340
2341         Reviewed by Michael Catanzaro.
2342
2343         1. Both tests are converted to use specialized CMake modules
2344         2. Both libraries are now linked only if they are really needed and usable
2345            by compiler
2346         3. librt is no more required to be detected by find_library(), which may fail
2347            in case of cross-compilation
2348         4. libatomic test moved to port-independent CMakeLists.txt
2349
2350         * CMakeLists.txt:
2351         * PlatformGTK.cmake:
2352
2353 2017-06-28  Alex Christensen  <achristensen@webkit.org>
2354
2355         Fix CMake build.
2356
2357         * PlatformMac.cmake:
2358
2359 2017-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2360
2361         [iOS DnD] [WK2] Dragged content flashes after the preview sets down when cancelling a drag
2362         https://bugs.webkit.org/show_bug.cgi?id=173927
2363         <rdar://problem/33020792>
2364
2365         Reviewed by Tim Horton.
2366
2367         When a drag is cancelled, UIKit normally animates fly-back and set-down animations back-to-back. However, for
2368         WebKit2, we need to call out to the web process in order to trigger a repaint of the dragged content at normal
2369         opacity when the drag cancel animation completes. Thus, we can hook into UIKit SPI to split the cancellation
2370         animation into two discrete phases: the fly-back and the set-down (the latter of which may be deferred using a
2371         completion block).
2372
2373         To do this, we implement a new SPI hook, _dragInteraction:item:shouldDelaySetDownAnimationWithCompletion:, to
2374         indicate that the set-down should be deferred, and call the completion block after the next layer tree commit.
2375         Since -shouldDelaySetDownAnimationWithCompletion: is invoked after the UIDragAnimating completion block in
2376         -willAnimateCancelWithAnimator:, this layer tree commit is guaranteed to come after we've told the web process
2377         to repaint at full opacity.
2378
2379         This patch also accounts for additional changes in UIKit. Once -shouldDelaySetDownAnimationWithCompletion:
2380         becomes available, -sessionDidEnd: will no longer be invoked after a cancelled drag lift if the user did not
2381         begin moving. This means that our cleanup logic in -sessionDidEnd: will no longer be executed in this case,
2382         leaving the view with an inconsistent dragging state. To fix this, we need to implement
2383         -dragInteraction:willAnimateLiftWithAnimator:session: to perform drag session cleanup following a cancelled drag
2384         lift, for which the drag animator's final position will be UIViewAnimatingPositionStart.
2385
2386         * UIProcess/ios/WKContentViewInteraction.mm:
2387         (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
2388         (-[WKContentView _dragInteraction:item:shouldDelaySetDownAnimationWithCompletion:]):
2389
2390 2017-06-28  Chris Dumez  <cdumez@apple.com>
2391
2392         Avoid double thread dispatch in WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains()
2393         https://bugs.webkit.org/show_bug.cgi?id=173904
2394
2395         Reviewed by Brent Fulgham.
2396
2397         Avoid double thread dispatch in WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains().
2398         It calls fetchData() which dispatches to the main queue, then fetchDataForTopPrivatelyControlledDomains()
2399         dispatches to the background queue. It should be possible to get fetchData() to dispatch directly
2400         on the right queue.
2401
2402         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2403         (WebKit::WebsiteDataStore::fetchData):
2404         (WebKit::WebsiteDataStore::fetchDataAndApply):
2405         (WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains):
2406         * UIProcess/WebsiteData/WebsiteDataStore.h:
2407
2408 2017-06-27  Chris Dumez  <cdumez@apple.com>
2409
2410         [ResourceLoadStatistics] Update minimumTimeBetweeenDataRecordsRemoval to 1 hour instead of 1 minute
2411         https://bugs.webkit.org/show_bug.cgi?id=173895
2412         <rdar://problem/32984366>
2413
2414         Reviewed by Brent Fulgham.
2415
2416         Update minimumTimeBetweeenDataRecordsRemoval to 1 hour instead of 1 minute to save battery.
2417         Also port code to modern time types.
2418
2419         * UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
2420         (WKResourceLoadStatisticsManagerSetTimeToLiveUserInteraction):
2421         (WKResourceLoadStatisticsManagerSetTimeToLiveCookiePartitionFree):
2422         (WKResourceLoadStatisticsManagerSetMinimumTimeBetweeenDataRecordsRemoval):
2423         (WKResourceLoadStatisticsManagerSetGrandfatheringTime):
2424         * UIProcess/WebResourceLoadStatisticsManager.cpp:
2425         (WebKit::WebResourceLoadStatisticsManager::setTimeToLiveUserInteraction):
2426         (WebKit::WebResourceLoadStatisticsManager::setTimeToLiveCookiePartitionFree):
2427         (WebKit::WebResourceLoadStatisticsManager::setMinimumTimeBetweeenDataRecordsRemoval):
2428         (WebKit::WebResourceLoadStatisticsManager::setGrandfatheringTime):
2429         * UIProcess/WebResourceLoadStatisticsManager.h:
2430         * UIProcess/WebResourceLoadStatisticsStore.h:
2431
2432 2017-06-27  Chris Dumez  <cdumez@apple.com>
2433
2434         Port HysteresisActivity to Seconds type
2435         https://bugs.webkit.org/show_bug.cgi?id=173902
2436
2437         Reviewed by Simon Fraser.
2438
2439         * WebProcess/WebPage/WebPage.cpp:
2440         (WebKit::m_pageScrolledHysteresis):
2441
2442 2017-06-27  Chris Dumez  <cdumez@apple.com>
2443
2444         Move WebsiteDataRecord processing off-thread in WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains()
2445         https://bugs.webkit.org/show_bug.cgi?id=173882
2446         <rdar://problem/32984366>
2447
2448         Reviewed by Darin Adler.
2449
2450         Move WebsiteDataRecord processing off-thread in WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains()
2451         as we have data showing it is slow and hangs the UIProcess' main thread.
2452
2453         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2454         (WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains):
2455
2456 2017-06-27  Brent Fulgham  <bfulgham@apple.com>
2457
2458         [WK2][macOS] Expand sandbox to allow access to the CoreMedia volume control endpoint
2459         https://bugs.webkit.org/show_bug.cgi?id=173898
2460         <rdar://problem/32930754>
2461
2462         Reviewed by Ryosuke Niwa.
2463
2464         * WebProcess/com.apple.WebProcess.sb.in:
2465
2466 2017-06-27  Wenson Hsieh  <wenson_hsieh@apple.com>
2467
2468         [iOS DnD] Support dragging out of contenteditable areas without a prior selection
2469         https://bugs.webkit.org/show_bug.cgi?id=173854
2470         <rdar://problem/32236827>
2471
2472         Reviewed by Ryosuke Niwa and Tim Horton.
2473
2474         Instead of allowing a drag to occur only if a position information request discovers a clickable node, remove
2475         the position information request entirely and just call into WebCore to try and begin the drag. Currently, the
2476         position information request serves two purposes:
2477         1. To adjust the hit-test location to account for nearby clickable nodes.
2478         2. To obtain information about the content being dragged.
2479
2480         The first requirement is fulfilled by performing the drag location adjustment in WebCore instead (see
2481         ChangeLogs for more detail). The second requirement is fulfilled by refactoring in
2482         https://bugs.webkit.org/show_bug.cgi?id=173832 to fold all information relevant to starting a drag into the
2483         DragItem struct, and then propagating the DragItem struct. The relevant information from the position
2484         information update is now populated when the UI process receives the drag start response.
2485
2486         * UIProcess/ios/WKContentViewInteraction.h:
2487         * UIProcess/ios/WKContentViewInteraction.mm:
2488         (-[WKContentView _startDrag:item:]):
2489         (-[WKContentView computeClientAndGlobalPointsForDropSession:outClientPoint:outGlobalPoint:]):
2490         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
2491         (-[WKContentView _api_dropInteraction:sessionDidEnter:]):
2492         (-[WKContentView _api_dropInteraction:sessionDidUpdate:]):
2493         (positionInformationMayStartDataInteraction): Deleted.
2494
2495 2017-06-27  Chris Dumez  <cdumez@apple.com>
2496
2497         [iOS] Avoid taking / releasing process assertions too quickly due to database activity
2498         https://bugs.webkit.org/show_bug.cgi?id=173879
2499         <rdar://problem/32412701>
2500
2501         Reviewed by Antti Koivisto.
2502
2503         Specify an activity name when taking the process assertion to facilitate
2504         debugging in the future. It took me a while to figure out this assertion
2505         was the one that was too aggressive because it was anonymous.
2506
2507         * UIProcess/API/Cocoa/WKWebView.mm:
2508         (-[WKWebView _setUpSQLiteDatabaseTrackerClient]):
2509
2510 2017-06-27  Don Olmstead  <don.olmstead@sony.com>
2511
2512         [PAL] Add symbol export macros for PAL
2513         https://bugs.webkit.org/show_bug.cgi?id=171519
2514
2515         Reviewed by Konstantin Tokarev.
2516
2517         * config.h:
2518
2519 2017-06-27  Ryosuke Niwa  <rniwa@webkit.org>
2520
2521         ProcessLauncherMac could leak a xpc connection when the process had failed to launch
2522         https://bugs.webkit.org/show_bug.cgi?id=173865
2523
2524         Reviewed by Antti Koivisto.
2525
2526         Explicitly cancel the XPC connection even When the process launch had failed to avoid a leak.
2527
2528         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2529         (WebKit::ProcessLauncher::launchProcess):
2530
2531 2017-06-27  John Wilander  <wilander@apple.com>
2532
2533         Resource Load Statistics: Add telemetry
2534         https://bugs.webkit.org/show_bug.cgi?id=173499
2535         <rdar://problem/32826094>
2536
2537         Reviewed by Brent Fulgham.
2538
2539         * PlatformGTK.cmake:
2540             Added UIProcess/WebResourceLoadStatisticsTelemetry.cpp
2541         * PlatformMac.cmake:
2542             Added UIProcess/WebResourceLoadStatisticsTelemetry.cpp
2543         * PlatformWPE.cmake:
2544             Added UIProcess/WebResourceLoadStatisticsTelemetry.cpp
2545         * UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
2546         (WKResourceLoadStatisticsManagerFireTelemetryHandler):
2547         (WKResourceLoadStatisticsManagerSetNotifyPagesWhenTelemetryWasCaptured):
2548             Test infrastructure.
2549         * UIProcess/API/C/WKResourceLoadStatisticsManager.h:
2550         * UIProcess/WebProcessProxy.cpp:
2551         (WebKit::WebProcessProxy::notifyPageStatisticsTelemetryFinished):
2552             Test infrastructure.
2553         * UIProcess/WebProcessProxy.h:
2554         * UIProcess/WebResourceLoadStatisticsManager.cpp:
2555         (WebKit::WebResourceLoadStatisticsManager::fireTelemetryHandler):
2556         (WebKit::WebResourceLoadStatisticsManager::setNotifyPagesWhenTelemetryWasCaptured):
2557         (WebKit::WebResourceLoadStatisticsManager::resetToConsistentState):
2558             Test infrastructure.
2559         * UIProcess/WebResourceLoadStatisticsManager.h:
2560         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2561         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
2562             Configures a timer for telemetry capture. Fires 5 seconds after launch
2563             and then every 24 hours.
2564         (WebKit::WebResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned):
2565             Variable renamed notifyPages -> notifyPagesWhenDataRecordsWereScanned.
2566         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
2567             Variable renamed notifyPages -> notifyPagesWhenDataRecordsWereScanned.
2568         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
2569             Variable renamed notifyPages -> notifyPagesWhenDataRecordsWereScanned.
2570         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
2571             Variable renamed notifyPages -> notifyPagesWhenDataRecordsWereScanned.
2572         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
2573             Variable renamed notifyPages -> notifyPagesWhenDataRecordsWereScanned.
2574         (WebKit::WebResourceLoadStatisticsStore::telemetryTimerFired):
2575              Calls WebResourceLoadStatisticsTelemetry::calculateAndSubmit().
2576         * UIProcess/WebResourceLoadStatisticsStore.h:
2577         * UIProcess/WebResourceLoadStatisticsTelemetry.cpp: Added.
2578         (WebKit::numberOfResourcesWithUserInteraction):
2579         (WebKit::median):
2580         (WebKit::nonEphemeralWebPageProxy):
2581         (WebKit::submitTopList):
2582         (WebKit::submitTopLists):
2583         (WebKit::notifyPages):
2584         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
2585         (WebKit::WebResourceLoadStatisticsTelemetry::setNotifyPagesWhenTelemetryWasCaptured):
2586         * UIProcess/WebResourceLoadStatisticsTelemetry.h: Added.
2587         * WebKit2.xcodeproj/project.pbxproj:
2588
2589 2017-06-27  Ting-Wei Lan  <lantw44@gmail.com>
2590
2591         Add missing includes to fix compilation error on FreeBSD
2592         https://bugs.webkit.org/show_bug.cgi?id=172919
2593
2594         Reviewed by Mark Lam.
2595
2596         * UIProcess/API/C/WKContextPrivate.h:
2597         * UIProcess/API/C/WKPagePrivate.h:
2598         * UIProcess/ProcessAssertion.h:
2599
2600 2017-06-27  Wenson Hsieh  <wenson_hsieh@apple.com>
2601
2602         Refactor drag start codepaths to plumb a DragItem to client layers
2603         https://bugs.webkit.org/show_bug.cgi?id=173832
2604         Work towards <rdar://problem/32236827>
2605
2606         Reviewed by Ryosuke Niwa and Tim Horton.
2607
2608         Add support for serializing a DragItem over IPC. This encodes and decodes all members of DragItem except for the
2609         PasteboardWriterData and the DragImage's image. The DragItem is sent over to the UI process in
2610         WebDragClient::startDrag via the WebPageProxy::startDrag IPC message (renamed from WebPageProxy::setDragImage)
2611         which now takes a DragItem.
2612
2613         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2614         (WebKit::WebPageProxy::startDrag):
2615         (WebKit::WebPageProxy::setDragImage): Deleted.
2616         * UIProcess/PageClient.h:
2617         * UIProcess/WebPageProxy.h:
2618         * UIProcess/WebPageProxy.messages.in:
2619
2620         Rename SetDragImage to StartDrag and refactor to receive only a DragItem and shareable bitmap handle.
2621
2622         * UIProcess/ios/PageClientImplIOS.h:
2623         * UIProcess/ios/PageClientImplIOS.mm:
2624         (WebKit::PageClientImpl::startDrag):
2625         (WebKit::PageClientImpl::startDataInteractionWithImage): Deleted.
2626         * UIProcess/ios/WKContentViewInteraction.h:
2627         * UIProcess/ios/WKContentViewInteraction.mm:
2628         (-[WKContentView _startDrag:item:]):
2629         (-[WKContentView _startDataInteractionWithImage:withIndicatorData:atClientPosition:anchorPoint:action:]): Deleted.
2630
2631         Rename startDataInteractionWithImage to startDrag.
2632
2633         * UIProcess/mac/WebPageProxyMac.mm:
2634         (WebKit::WebPageProxy::startDrag):
2635         (WebKit::WebPageProxy::setDragImage): Deleted.
2636         * WebProcess/WebCoreSupport/WebDragClient.cpp:
2637         (WebKit::WebDragClient::startDrag):
2638         * WebProcess/WebCoreSupport/WebDragClient.h:
2639         * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
2640         (WebKit::WebDragClient::startDrag):
2641         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
2642         (WebKit::WebDragClient::startDrag):
2643
2644 2017-06-27  Wenson Hsieh  <wenson_hsieh@apple.com>
2645
2646         [iOS DnD] [WK2] WKWebView does not handle drag sessions that exit and re-enter
2647         https://bugs.webkit.org/show_bug.cgi?id=173856
2648         <rdar://problem/32957100>
2649
2650         Reviewed by Ryosuke Niwa.
2651
2652         Upon exiting a WKContentView, the dropSession tracked by _dataInteractionState is not cleared out. If the drag
2653         session re-enters the WKWebView, a _different_ UIDropSession is sent to the drop delegate, causing us to bail
2654         from handling the session altogether in -dropInteraction:canHandleSession:. To fix this, we need to clear out
2655         the dropSession when the drag session exits the view.
2656
2657         * UIProcess/ios/WKContentViewInteraction.mm:
2658         (-[WKContentView dropInteraction:sessionDidExit:]):
2659
2660 2017-06-26  Chris Dumez  <cdumez@apple.com>
2661
2662         WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains() is inefficient
2663         https://bugs.webkit.org/show_bug.cgi?id=173850
2664
2665         Reviewed by Ryosuke Niwa.
2666
2667         Update WebsiteDataRecord::matchesTopPrivatelyControlledDomain() to rely on
2668         SecurityOriginData::host rather than SecurityOriginData::securityOrigin()->host().
2669         SecurityOriginData::securityOrigin() is expensive and it seems unnecessary to call
2670         it here since we already have the host.
2671
2672         Also update WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains() to return
2673         domains as a HashSet rather than a Vector to avoid having duplicate domains.
2674
2675         * UIProcess/WebProcessProxy.cpp:
2676         (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
2677         * UIProcess/WebProcessProxy.h:
2678         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2679         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
2680         * UIProcess/WebsiteData/WebsiteDataRecord.cpp:
2681         (WebKit::WebsiteDataRecord::matchesTopPrivatelyControlledDomain):
2682         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2683         (WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains):
2684         (WebKit::WebsiteDataStore::removeDataForTopPrivatelyControlledDomains):
2685         * UIProcess/WebsiteData/WebsiteDataStore.h:
2686
2687 2017-06-26  Jeremy Jones  <jeremyj@apple.com>
2688
2689         Invalidate WebVideoFullscreenManager when WebPage is destroyed.
2690         https://bugs.webkit.org/show_bug.cgi?id=173835
2691         rdar://problem/32969161
2692
2693         Reviewed by Jer Noble.
2694
2695         WebVideoFullscreenManager has a pointer to WebPage, and even null checks it in a few places,
2696         but the only place it is nulled out is in the destructor. This allows a dangling reference.
2697
2698         This changes invalidates that reference when WebPage is destructed and adds nullchecks
2699         or asserts throughout WebVideoFullscreenManager as appropriate.
2700
2701         * WebProcess/WebPage/WebPage.cpp:
2702         (WebKit::WebPage::~WebPage):
2703         * WebProcess/cocoa/WebVideoFullscreenManager.h:
2704         (WebKit::WebVideoFullscreenManager::invalidate):
2705         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
2706         (WebKit::WebVideoFullscreenManager::~WebVideoFullscreenManager):
2707         (WebKit::WebVideoFullscreenManager::enterVideoFullscreenForVideoElement):
2708         (WebKit::WebVideoFullscreenManager::exitVideoFullscreenForVideoElement):
2709         (WebKit::WebVideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation):
2710         (WebKit::WebVideoFullscreenManager::hasVideoChanged):
2711         (WebKit::WebVideoFullscreenManager::videoDimensionsChanged):
2712         (WebKit::WebVideoFullscreenManager::didSetupFullscreen):
2713         (WebKit::WebVideoFullscreenManager::didEnterFullscreen):
2714         (WebKit::WebVideoFullscreenManager::didCleanupFullscreen):
2715         (WebKit::WebVideoFullscreenManager::fullscreenMayReturnToInline):
2716
2717 2017-06-26  Chris Dumez  <cdumez@apple.com>
2718
2719         Disable diagnostic logging in ephemeral sessions
2720         https://bugs.webkit.org/show_bug.cgi?id=173849
2721         <rdar://problem/32987341>
2722
2723         Reviewed by Geoffrey Garen.
2724
2725         * UIProcess/WebPageProxy.cpp:
2726         (WebKit::WebPageProxy::setDiagnosticLoggingClient):
2727         Construct a dummy logging client if the page's session is ephemeral.
2728
2729         (WebKit::WebPageProxy::logDiagnosticMessage):
2730         (WebKit::WebPageProxy::logDiagnosticMessageWithResult):
2731         (WebKit::WebPageProxy::logDiagnosticMessageWithValue):
2732         (WebKit::WebPageProxy::logDiagnosticMessageWithEnhancedPrivacy):
2733         Slight cleanup to make the code look a bit safer.
2734
2735 2017-06-26  Zan Dobersek  <zdobersek@igalia.com>
2736
2737         [GCrypt] Properly initialize libgcrypt before using it
2738         https://bugs.webkit.org/show_bug.cgi?id=173589
2739
2740         Reviewed by Michael Catanzaro.
2741
2742         Initialize libgcrypt in the Unix-specific main() entrypoint. This is early enough
2743         to ensure no other libgcrypt API function is invoked and to also ensure this is
2744         done in a thread-safe manner.
2745
2746         Initialization is initiated through the gcry_check_version() call. 16 kilobytes of
2747         secure memory is pre-allocated before we mark the initialization as complete, as
2748         recommended by the libgcrypt documentation.
2749
2750         * WebProcess/EntryPoint/unix/WebProcessMain.cpp:
2751         (main):
2752
2753 2017-06-26  Jeremy Jones  <jeremyj@apple.com>
2754
2755         When Mission Control closes fullscreen window, allow media element to update its state.
2756         https://bugs.webkit.org/show_bug.cgi?id=173671
2757         rdar://problem/32892671
2758
2759         Reviewed by Eric Carlson.
2760
2761         When Mission Control closes element fullscreen without an animation, we need to notify the
2762         media element that fullscreen has exited.
2763
2764         Without this change, the page still behaves like the element is in fullscreen.
2765
2766         * UIProcess/mac/WKFullScreenWindowController.mm:
2767         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
2768         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
2769
2770 2017-06-26  Wenson Hsieh  <wenson_hsieh@apple.com>
2771
2772         [iOS DnD] [WK2] Beginning a drag session should prevent clicking via long press
2773         https://bugs.webkit.org/show_bug.cgi?id=173838
2774
2775         Reviewed by Tim Horton.
2776
2777         After r218579, WebKit no longer attempts to replace out-of-the-box UIKit long-press/drag lift disambiguation by
2778         firing events immediately. However, this means that dragging will defer the highlight long press gesture
2779         recognizer until dragging ends rather than cancel it immediately, which causes WKContentView to dispatch a
2780         synthetic click immediately upon lift. To fix this, we should bail out of the highlight long press gesture when
2781         beginning a drag.
2782
2783         * UIProcess/ios/WKContentViewInteraction.mm:
2784         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
2785
2786 2017-06-26  Konstantin Tokarev  <annulen@yandex.ru>
2787
2788         Unreviewed, add missing header icncludes
2789
2790         * WebProcess/soup/WebKitSoupRequestInputStream.cpp:
2791
2792 2017-06-26  Konstantin Tokarev  <annulen@yandex.ru>
2793
2794         [GTK] Unreviewed, added missing includes to fix debug build
2795
2796         * NetworkProcess/NetworkSession.cpp:
2797
2798 2017-06-25  Konstantin Tokarev  <annulen@yandex.ru>
2799
2800         Remove excessive headers from WebCore/platform
2801         https://bugs.webkit.org/show_bug.cgi?id=173822
2802
2803         Reviewed by Tim Horton.
2804
2805         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
2806
2807 2017-06-25  Michael Catanzaro  <mcatanzaro@igalia.com>
2808
2809         Unreviewed, rolling out r215190.
2810
2811         Broke product select element on GNOME Bugzilla
2812
2813         Reverted changeset:
2814
2815         "[GTK] Misplaced right click menu on web page due to
2816         deprecated gtk_menu_popup()"
2817         https://bugs.webkit.org/show_bug.cgi?id=170553
2818         http://trac.webkit.org/changeset/215190
2819
2820 2017-06-25  Michael Catanzaro  <mcatanzaro@igalia.com>
2821
2822         [GTK][WPE] Unreviewed, fix typo in translatable string
2823
2824         Thanks to Yuri Chornoivan for reporting this typo.
2825
2826         * UIProcess/API/glib/WebKitWebView.cpp:
2827         (webkit_web_view_class_init):
2828
2829 2017-06-25  Konstantin Tokarev  <annulen@yandex.ru>
2830
2831         Remove excessive headers from JavaScriptCore
2832         https://bugs.webkit.org/show_bug.cgi?id=173812
2833
2834         Reviewed by Darin Adler.
2835
2836         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
2837
2838 2017-06-24  Chris Dumez  <cdumez@apple.com>
2839
2840         [WK2] Make sure encodeClientTypesAndData() / decodeClientTypesAndData() match exactly
2841         https://bugs.webkit.org/show_bug.cgi?id=173813
2842
2843         Reviewed by Ryosuke Niwa.
2844
2845         Make sure encodeClientTypesAndData() / decodeClientTypesAndData() match exactly. The previous
2846         IPC encoder code would assume types and data vector have the same length. It would first encode
2847         the length of data using |data.size()| but then would encode types.size() values from the
2848         data vector. While there are debug assertions to ensure both vectors have the same size, this
2849         seems unnecessarily fragile in release builds. If both vectors happen to have different sizes,
2850         this will lead to weird IPC bugs.
2851
2852         * Shared/WebCoreArgumentCoders.cpp:
2853         (IPC::encodeClientTypesAndData):
2854         (IPC::decodeClientTypesAndData):
2855
2856 2017-06-24  Michael Catanzaro  <mcatanzaro@igalia.com>
2857
2858         [GTK] Introspection: webkit_web_view_new_with_related_view needs to be marked as a constructor
2859         https://bugs.webkit.org/show_bug.cgi?id=173765
2860
2861         Reviewed by Carlos Garcia Campos.
2862
2863         Because the first parameter to this WebKitWebView constructor is itself a WebKitWebView,
2864         the gi-scanner's heuristics decide that it's probably an object method rather than a
2865         constructor, resulting in improper introspection generation. Annotate it with (constructor)
2866         to override this behavior.
2867
2868         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
2869         * UIProcess/API/wpe/WebKitWebViewWPE.cpp:
2870
2871 2017-06-24  Commit Queue  <commit-queue@webkit.org>
2872
2873         Unreviewed, rolling out r218785.
2874         https://bugs.webkit.org/show_bug.cgi?id=173808
2875
2876         This change broke the macOS Sierra build (Requested by
2877         annulen|home on #webkit).
2878
2879         Reverted changeset:
2880
2881         "Removed unused lambda captures from WebKit2"
2882         https://bugs.webkit.org/show_bug.cgi?id=173555
2883         http://trac.webkit.org/changeset/218785
2884
2885 2017-06-24  Konstantin Tokarev  <annulen@yandex.ru>
2886
2887         Removed unused lambda captures from WebKit2
2888         https://bugs.webkit.org/show_bug.cgi?id=173555
2889
2890         Reviewed by Alex Christensen.
2891
2892         * UIProcess/Network/NetworkProcessProxy.cpp:
2893         (WebKit::NetworkProcessProxy::fetchWebsiteData):
2894         (WebKit::NetworkProcessProxy::deleteWebsiteData):
2895         (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
2896         * UIProcess/WebProcessProxy.cpp:
2897         (WebKit::WebProcessProxy::fetchWebsiteData):
2898         (WebKit::WebProcessProxy::deleteWebsiteData):
2899         (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
2900         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2901         (WebKit::WebsiteDataStore::topPrivatelyControlledDomainsWithWebsiteData):
2902
2903 2017-06-23  Chris Dumez  <cdumez@apple.com>
2904
2905         Add release assertion to make sure callbackIdentifier is not 0 in DocumentLoader::finishedLoadingIcon()
2906         https://bugs.webkit.org/show_bug.cgi?id=173792
2907
2908         Reviewed by Ryosuke Niwa.
2909
2910         Add release assertion to make sure callbackIdentifier is not 0 in DocumentLoader::finishedLoadingIcon()
2911         as this could cause HashTable corruption on WebPageProxy side.
2912
2913         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2914         (WebKit::WebFrameLoaderClient::finishedLoadingIcon):
2915         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2916
2917 2017-06-23  Chris Dumez  <cdumez@apple.com>
2918
2919         Stop passing Vector by value in WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores()
2920         https://bugs.webkit.org/show_bug.cgi?id=173782
2921
2922         Reviewed by Brent Fulgham.
2923
2924         * UIProcess/WebProcessProxy.cpp:
2925         (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
2926         * UIProcess/WebProcessProxy.h:
2927         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2928         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
2929
2930 2017-06-23  Chris Dumez  <cdumez@apple.com>
2931
2932         Avoid copying HashSet to Vector in WebPageProxy::clearLoadDependentCallbacks()
2933         https://bugs.webkit.org/show_bug.cgi?id=173786
2934
2935         Reviewed by Geoffrey Garen.
2936
2937         Avoid copying HashSet to Vector in WebPageProxy::clearLoadDependentCallbacks().
2938         Instead, just move the HashSet and iterate on that. This is OK since we were
2939         clearing the HashSet right after copying it to the vector anyway.
2940
2941         * UIProcess/WebPageProxy.cpp:
2942         (WebKit::WebPageProxy::clearLoadDependentCallbacks):
2943
2944 2017-06-23  Chris Dumez  <cdumez@apple.com>
2945
2946         Unreviewed, fix Debug build after r218763
2947
2948         * NetworkProcess/NetworkDataTask.cpp:
2949
2950 2017-06-23  Chris Dumez  <cdumez@apple.com>
2951
2952         Add more release logging for process assertions
2953         https://bugs.webkit.org/show_bug.cgi?id=173624
2954         <rdar://problem/32412701>
2955
2956         Reviewed by Geoffrey Garen.
2957
2958         Add more release logging for process assertions to help debug issues such
2959         as <rdar://problem/32412701>.
2960
2961         * UIProcess/ProcessThrottler.cpp:
2962         (WebKit::ProcessThrottler::didConnectToProcess):
2963         * UIProcess/ios/ProcessAssertionIOS.mm:
2964         (WebKit::ProcessAssertion::ProcessAssertion):
2965         (WebKit::ProcessAssertion::~ProcessAssertion):
2966         (WebKit::ProcessAssertion::setState):
2967
2968 2017-06-23  Chris Dumez  <cdumez@apple.com>
2969
2970         Consistently use RunLoop::isMain() in WebKit2
2971         https://bugs.webkit.org/show_bug.cgi?id=173745
2972         <rdar://problem/32936527>
2973
2974         Reviewed by Brent Fulgham.
2975
2976         Consistently use RunLoop:isMain() on WebKit2 instead of WTF::isMainThread().
2977         WTF::isMainThread() returns true for the WebThread instead of the UIThread
2978         in WebKit1. Therefore WTF::isMainThread() is unsafe to use in the UIProcess
2979         as the application may be using WebKit1 as well and have a WebThread.
2980
2981         Technically, we only *need* to move from WTF::isMainThread() to
2982         RunLoop::isMain() in the UIProcess code but I ported all of WebKit2 for
2983         consistency. RunLoop::isMain() is always safe in WebKit2.
2984
2985         * NetworkProcess/NetworkDataTask.cpp:
2986         (WebKit::NetworkDataTask::NetworkDataTask):
2987         (WebKit::NetworkDataTask::~NetworkDataTask):
2988         * NetworkProcess/NetworkDataTaskBlob.cpp:
2989         (WebKit::NetworkDataTaskBlob::getSizeForNext):
2990         (WebKit::NetworkDataTaskBlob::didGetSize):
2991         (WebKit::NetworkDataTaskBlob::seek):
2992         (WebKit::NetworkDataTaskBlob::read):
2993         * NetworkProcess/NetworkLoad.cpp:
2994         (WebKit::NetworkLoad::didReceiveResponseNetworkSession):
2995         (WebKit::NetworkLoad::notifyDidReceiveResponse):
2996         * NetworkProcess/NetworkSession.cpp:
2997         (WebKit::NetworkSession::defaultSession):
2998         * NetworkProcess/cache/NetworkCache.cpp:
2999         (WebKit::NetworkCache::resourceType):
3000         (WebKit::NetworkCache::Cache::initialize):
3001         * NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:
3002         (WebKit::NetworkCache::IOChannel::read):
3003         (WebKit::NetworkCache::IOChannel::readSyncInThread):
3004         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3005         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
3006         (WebKit::NetworkSessionCocoa::defaultSession):
3007         (WebKit::NetworkSessionCocoa::dataTaskForIdentifier):
3008         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3009         (WebKit::CoordinatedGraphicsScene::dispatchOnMainThread):
3010         (WebKit::CoordinatedGraphicsScene::syncRemoteContent):
3011         (WebKit::CoordinatedGraphicsScene::detach):
3012         (WebKit::CoordinatedGraphicsScene::appendUpdate):
3013         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
3014         (WebKit::WorkQueuePool::singleton):
3015         (WebKit::WorkQueuePool::dispatch):
3016         (WebKit::CompositingRunLoop::~CompositingRunLoop):
3017         (WebKit::CompositingRunLoop::performTask):
3018         (WebKit::CompositingRunLoop::performTaskSync):
3019         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
3020         (WebKit::ThreadedCompositor::createGLContext):
3021         (WebKit::ThreadedCompositor::renderNextFrame):
3022         (WebKit::ThreadedCompositor::commitScrollOffset):
3023         (WebKit::ThreadedCompositor::updateSceneState):
3024         (WebKit::ThreadedCompositor::releaseUpdateAtlases):
3025         (WebKit::ThreadedCompositor::frameComplete):
3026         * Shared/Plugins/NPObjectProxy.cpp:
3027         (WebKit::NPObjectProxy::NP_Deallocate):
3028         * UIProcess/Storage/LocalStorageDatabaseTracker.cpp:
3029         (WebKit::LocalStorageDatabaseTracker::deleteDatabasesModifiedSince):
3030         * UIProcess/WebProcessProxy.cpp:
3031         (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
3032         (WebKit::WebProcessProxy::topPrivatelyControlledDomainsWithWebiteData):
3033         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3034         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
3035         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
3036         (WebKit::WebResourceLoadStatisticsStore::writeStoreToDisk):
3037         (WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk):
3038         * UIProcess/ios/WKPDFView.mm:
3039         (-[WKPDFView _highlightLinkAnnotation:forDuration:completionHandler:]):
3040         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3041         (-[WKFileUploadPanel _uploadItemForImageData:imageName:successBlock:failureBlock:]):
3042         * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp:
3043         (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
3044         * WebProcess/soup/WebKitSoupRequestInputStream.cpp:
3045         (webkitSoupRequestInputStreamReadAsync):
3046
3047 2017-06-23  David Kilzer  <ddkilzer@apple.com>
3048
3049         v3: REGRESSION (r218419): 3 NSMutableDictionary leaks calling -[WKProcessPool _pluginLoadClientPolicies]
3050         <https://webkit.org/b/173689>
3051
3052         Reviewed by Tim Horton.
3053
3054         * UIProcess/API/Cocoa/WKProcessPool.mm:
3055         (policiesHashMapToDictionary): Use adoptNS().get() to avoid
3056         dumping objects into autoreleasepools unnecessarily.
3057         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3058         (-[WKProcessPool _pluginLoadClientPolicies]): Add back 'copy'
3059         attribute to document that we're returning a new object on each
3060         invocation.  I shouldn't have removed it in the v2 patch.
3061
3062 2017-06-23  Youenn Fablet  <youenn@apple.com>
3063
3064         LibWebRTCSocketClient should not destroy its socket within signalClose callback
3065         https://bugs.webkit.org/show_bug.cgi?id=173739
3066
3067         Reviewed by Brent Fulgham.
3068
3069         * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp:
3070         (WebKit::LibWebRTCSocketClient::signalClose): Destroy 'this' asynchronously to make the caller of signalClose valid until it is not used.
3071
3072 2017-06-23  Chris Dumez  <cdumez@apple.com>
3073
3074         Fix typo in WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData() naming
3075         https://bugs.webkit.org/show_bug.cgi?id=173781
3076
3077         Reviewed by Brent Fulgham.
3078
3079         * UIProcess/WebProcessProxy.cpp:
3080         (WebKit::WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData):
3081         (WebKit::WebProcessProxy::topPrivatelyControlledDomainsWithWebiteData): Deleted.
3082         * UIProcess/WebProcessProxy.h:
3083         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3084         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
3085
3086 2017-06-23  Jer Noble  <jer.noble@apple.com>
3087
3088         [WK2] Support -[WebAVPlayerController setMuted:]
3089         https://bugs.webkit.org/show_bug.cgi?id=173777
3090
3091         Reviewed by Eric Carlson.
3092
3093         Add a SetMuted message to WebPlaybackSessionManager.
3094
3095         Drive-by refactoring: Because the new setMuted() method conflicts with the existing setMuted()
3096         notification, do a giant rename of the notificiation methods from set(Value) -> (value)Changed.
3097
3098         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h:
3099         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.messages.in:
3100         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm:
3101         (WebKit::WebPlaybackSessionModelContext::setMuted):
3102         (WebKit::WebPlaybackSessionModelContext::playbackStartedTimeChanged):
3103         (WebKit::WebPlaybackSessionModelContext::durationChanged):
3104         (WebKit::WebPlaybackSessionModelContext::currentTimeChanged):
3105         (WebKit::WebPlaybackSessionModelContext::bufferedTimeChanged):
3106         (WebKit::WebPlaybackSessionModelContext::rateChanged):
3107         (WebKit::WebPlaybackSessionModelContext::seekableRangesChanged):
3108         (WebKit::WebPlaybackSessionModelContext::canPlayFastReverseChanged):
3109         (WebKit::WebPlaybackSessionModelContext::audioMediaSelectionOptionsChanged):
3110         (WebKit::WebPlaybackSessionModelContext::legibleMediaSelectionOptionsChanged):
3111         (WebKit::WebPlaybackSessionModelContext::audioMediaSelectionIndexChanged):
3112         (WebKit::WebPlaybackSessionModelContext::legibleMediaSelectionIndexChanged):
3113         (WebKit::WebPlaybackSessionModelContext::externalPlaybackChanged):
3114         (WebKit::WebPlaybackSessionModelContext::wirelessVideoPlaybackDisabledChanged):
3115         (WebKit::WebPlaybackSessionModelContext::mutedChanged):
3116         (WebKit::WebPlaybackSessionManagerProxy::currentTimeChanged):
3117         (WebKit::WebPlaybackSessionManagerProxy::bufferedTimeChanged):
3118         (WebKit::WebPlaybackSessionManagerProxy::seekableRangesVectorChanged):
3119         (WebKit::WebPlaybackSessionManagerProxy::canPlayFastReverseChanged):
3120         (WebKit::WebPlaybackSessionManagerProxy::audioMediaSelectionOptionsChanged):
3121         (WebKit::WebPlaybackSessionManagerProxy::legibleMediaSelectionOptionsChanged):
3122         (WebKit::WebPlaybackSessionManagerProxy::audioMediaSelectionIndexChanged):
3123         (WebKit::WebPlaybackSessionManagerProxy::legibleMediaSelectionIndexChanged):
3124         (WebKit::WebPlaybackSessionManagerProxy::externalPlaybackPropertiesChanged):
3125         (WebKit::WebPlaybackSessionManagerProxy::wirelessVideoPlaybackDisabledChanged):
3126         (WebKit::WebPlaybackSessionManagerProxy::mutedChanged):
3127         (WebKit::WebPlaybackSessionManagerProxy::durationChanged):
3128         (WebKit::WebPlaybackSessionManagerProxy::playbackStartedTimeChanged):
3129         (WebKit::WebPlaybackSessionManagerProxy::rateChanged):
3130         (WebKit::WebPlaybackSessionManagerProxy::setMuted):
3131         (WebKit::WebPlaybackSessionManagerProxy::controlsManagerInterface):
3132         (WebKit::WebPlaybackSessionModelContext::setPlaybackStartedTime): Deleted.
3133         (WebKit::WebPlaybackSessionModelContext::setDuration): Deleted.
3134         (WebKit::WebPlaybackSessionModelContext::setCurrentTime): Deleted.
3135         (WebKit::WebPlaybackSessionModelContext::setBufferedTime): Deleted.
3136         (WebKit::WebPlaybackSessionModelContext::setRate): Deleted.
3137         (WebKit::WebPlaybackSessionModelContext::setSeekableRanges): Deleted.
3138         (WebKit::WebPlaybackSessionModelContext::setCanPlayFastReverse): Deleted.
3139         (WebKit::WebPlaybackSessionModelContext::setAudioMediaSelectionOptions): Deleted.
3140         (WebKit::WebPlaybackSessionModelContext::setLegibleMediaSelectionOptions): Deleted.
3141         (WebKit::WebPlaybackSessionModelContext::setAudioMediaSelectionIndex): Deleted.
3142         (WebKit::WebPlaybackSessionModelContext::setLegibleMediaSelectionIndex): Deleted.
3143         (WebKit::WebPlaybackSessionModelContext::setExternalPlayback): Deleted.
3144         (WebKit::WebPlaybackSessionModelContext::setWirelessVideoPlaybackDisabled): Deleted.
3145         (WebKit::WebPlaybackSessionManagerProxy::setCurrentTime): Deleted.
3146         (WebKit::WebPlaybackSessionManagerProxy::setBufferedTime): Deleted.
3147         (WebKit::WebPlaybackSessionManagerProxy::setSeekableRangesVector): Deleted.
3148         (WebKit::WebPlaybackSessionManagerProxy::setCanPlayFastReverse): Deleted.
3149         (WebKit::WebPlaybackSessionManagerProxy::setAudioMediaSelectionOptions): Deleted.
3150         (WebKit::WebPlaybackSessionManagerProxy::setLegibleMediaSelectionOptions): Deleted.
3151         (WebKit::WebPlaybackSessionManagerProxy::setAudioMediaSelectionIndex): Deleted.
3152         (WebKit::WebPlaybackSessionManagerProxy::setLegibleMediaSelectionIndex): Deleted.
3153         (WebKit::WebPlaybackSessionManagerProxy::setExternalPlaybackProperties): Deleted.
3154         (WebKit::WebPlaybackSessionManagerProxy::setWirelessVideoPlaybackDisabled): Deleted.
3155         (WebKit::WebPlaybackSessionManagerProxy::setDuration): Deleted.
3156         (WebKit::WebPlaybackSessionManagerProxy::setPlaybackStartedTime): Deleted.
3157         (WebKit::WebPlaybackSessionManagerProxy::setRate): Deleted.
3158         * WebProcess/cocoa/WebPlaybackSessionManager.h:
3159         * WebProcess/cocoa/WebPlaybackSessionManager.messages.in:
3160         * WebProcess/cocoa/WebPlaybackSessionManager.mm:
3161         (WebKit::WebPlaybackSessionManager::durationChanged):
3162         (WebKit::WebPlaybackSessionManager::currentTimeChanged):
3163         (WebKit::WebPlaybackSessionManager::bufferedTimeChanged):
3164         (WebKit::WebPlaybackSessionManager::playbackStartedTimeChanged):
3165         (WebKit::WebPlaybackSessionManager::rateChanged):
3166         (WebKit::WebPlaybackSessionManager::seekableRangesChanged):
3167         (WebKit::WebPlaybackSessionManager::canPlayFastReverseChanged):
3168         (WebKit::WebPlaybackSessionManager::audioMediaSelectionOptionsChanged):
3169         (WebKit::WebPlaybackSessionManager::legibleMediaSelectionOptionsChanged):
3170         (WebKit::WebPlaybackSessionManager::externalPlaybackChanged):
3171         (WebKit::WebPlaybackSessionManager::audioMediaSelectionIndexChanged):
3172         (WebKit::WebPlaybackSessionManager::legibleMediaSelectionIndexChanged):
3173         (WebKit::WebPlaybackSessionManager::wirelessVideoPlaybackDisabledChanged):
3174         (WebKit::WebPlaybackSessionManager::mutedChanged):
3175         (WebKit::WebPlaybackSessionManager::setMuted):
3176
3177 2017-06-23  Frederic Wang  <fwang@igalia.com>
3178
3179         Use window.internals instead of overridePreference to set WebCore settings in tests
3180         https://bugs.webkit.org/show_bug.cgi?id=173714
3181
3182         Reviewed by Simon Fraser.
3183
3184         This commit remove preference to settings mapping in overrideBoolPreferenceForTestRunner that
3185         are no longer necessary after the changes done in LayoutTests.
3186
3187         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3188         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): Remove mapping for preferences
3189         that no longer require testRunner.overridePreference calls in tests.
3190
3191 2017-06-23  Brent Fulgham  <bfulgham@apple.com>
3192
3193         Avoid moving the same vector multiple times
3194         https://bugs.webkit.org/show_bug.cgi?id=173748
3195         <rdar://problem/32936804>
3196
3197         Reviewed by Chris Dumez.
3198
3199         We discovered that a Vector<String> was being moved inside a loop, causing it to be moved more than once.
3200         We should never do this!
3201
3202         * UIProcess/WebProcessProxy.cpp:
3203         (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
3204         Do not perform a move at each step of the iteration.
3205         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3206         (WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains): Receive vector of top privately
3207         controlled domains as a const reference. Copy this vector into the completion handler. Do not move
3208         origins out of the vector in the inner loop.
3209         (WebKit::WebsiteDataStore::removeDataForTopPrivatelyControlledDomains): Receive vector of top privately
3210         controlled domains as a const reference.
3211         * UIProcess/WebsiteData/WebsiteDataStore.h:
3212
3213 2017-06-23  Alex Christensen  <achristensen@webkit.org>
3214
3215         Add SPI to WKURLSchemeTask for redirection
3216         https://bugs.webkit.org/show_bug.cgi?id=173730
3217
3218         Reviewed by Brady Eidson.
3219
3220         This is needed for testing an upcoming fix for redirect callbacks, and it might be
3221         necessary for loading with custom schemes in general. Right now just responding with
3222          an HTTP 301/302/307/308 response code doesn't work because there is nothing that
3223         synthesizes an NSURLRequest from the Location header like we do in 
3224         SynchronousResourceHandleCFURLConnectionDelegate::willSendRequest et al. for HSTS, 
3225         and that would require using an NSHTTPURLResponse for non-HTTP responses, which is 
3226         conceptually wrong.  Instead of waiting for a completion handler in the API, we are
3227         following the pattern of WKNavigationDelegate.didReceiveServerRedirectForProvisionalNavigation
3228         and allowing the SPI to indicate that a redirect has happened to update the state of
3229         WebKit, but not allowing the SPI to wait for a processed request and slow down loading.
3230
3231         This adds WKURLSchemeTaskPrivate._didPerformRedirection which is covered by new API tests.
3232
3233         * UIProcess/API/Cocoa/WKURLSchemeTask.mm:
3234         (raiseExceptionIfNecessary):
3235         (-[WKURLSchemeTaskImpl _didPerformRedirection:newRequest:completionHandler:]):
3236         * UIProcess/API/Cocoa/WKURLSchemeTaskInternal.h:
3237         * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h: Added.
3238         * UIProcess/WebPageProxy.cpp:
3239         (WebKit::WebPageProxy::startURLSchemeTask):
3240         (WebKit::WebPageProxy::stopURLSchemeTask):
3241         * UIProcess/WebPageProxy.h:
3242         * UIProcess/WebPageProxy.messages.in:
3243         * UIProcess/WebURLSchemeHandler.cpp:
3244         (WebKit::WebURLSchemeHandler::startTask):
3245         (WebKit::WebURLSchemeHandler::stopTask):
3246         * UIProcess/WebURLSchemeHandler.h:
3247         * UIProcess/WebURLSchemeTask.cpp:
3248         (WebKit::WebURLSchemeTask::didReceiveResponse): Deleted.
3249         (WebKit::WebURLSchemeTask::didReceiveData): Deleted.
3250         (WebKit::WebURLSchemeTask::didComplete): Deleted.
3251         * UIProcess/WebURLSchemeTask.h:
3252         * WebKit2.xcodeproj/project.pbxproj:
3253         * WebProcess/WebPage/WebPage.cpp:
3254         (WebKit::WebPage::urlSchemeTaskDidPerformRedirection):
3255         * WebProcess/WebPage/WebPage.h:
3256         * WebProcess/WebPage/WebPage.messages.in:
3257         * WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp:
3258         (WebKit::WebURLSchemeHandlerProxy::taskDidPerformRedirection):
3259         * WebProcess/WebPage/WebURLSchemeHandlerProxy.h:
3260         * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
3261         (WebKit::WebURLSchemeTaskProxy::didPerformRedirection):
3262         * WebProcess/WebPage/WebURLSchemeTaskProxy.h:
3263
3264 2017-06-23  Brent Fulgham  <bfulgham@apple.com>
3265
3266         [WK2][macOS] Support Mac Mini Flash Player Features
3267         https://bugs.webkit.org/show_bug.cgi?id=173581
3268         <rdar://problem/32804073>
3269
3270         Reviewed by Dean Jackson.
3271
3272         Revise the sandboxes for additional IOKit properties identified during Flash video player
3273         testing.
3274
3275         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
3276         * WebProcess/com.apple.WebProcess.sb.in:
3277
3278 2017-06-23  Zan Dobersek  <zdobersek@igalia.com>
3279
3280         [CoordinatedGraphics] Clean up type aliases in CoordinatedGraphicsScene
3281         https://bugs.webkit.org/show_bug.cgi?id=173764
3282
3283         Reviewed by Carlos Garcia Campos.
3284
3285         Drop the various type aliases created in the CoordinatedGraphicsScene
3286         class. We can leave without these by leveraging `auto` where necessary.
3287
3288         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3289         (WebKit::CoordinatedGraphicsScene::updateTilesIfNeeded):
3290         (WebKit::CoordinatedGraphicsScene::updateImageBacking):
3291         (WebKit::CoordinatedGraphicsScene::clearImageBackingContents):
3292         (WebKit::CoordinatedGraphicsScene::assignImageBackingToLayer):
3293         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
3294
3295 2017-06-23  Carlos Garcia Campos  <cgarcia@igalia.com>
3296
3297         [WPE] Crash in wpe_view_backend_get_renderer_host_fd
3298         https://bugs.webkit.org/show_bug.cgi?id=173760
3299
3300         Reviewed by Žan Doberšek.
3301
3302         This can happen if views are created and destroyed quickly. The problem is that CompositingManagerProxy adds a
3303         message receiver but never removes it, so it's possible that the message arrives right after the view has been
3304         destroyed. This is happening most of the times running /wpe/WebKitAutomationSession/request-session that creates
3305         3 web views in a row that are deleted when the test finishes.
3306
3307         Fixes /wpe/WebKitAutomationSession/request-session.
3308
3309         * UIProcess/API/wpe/CompositingManagerProxy.cpp:
3310         (WebKit::CompositingManagerProxy::finalize): Remove the message handler.
3311         * UIProcess/API/wpe/CompositingManagerProxy.h:
3312         * UIProcess/API/wpe/WPEView.cpp:
3313         (WKWPE::View::~View): Call CompositingManagerProxy::finalize().
3314
3315 2017-06-23  Carlos Garcia Campos  <cgarcia@igalia.com>
3316
3317         [WPE] User script messages don't work
3318         https://bugs.webkit.org/show_bug.cgi?id=173712
3319
3320         Reviewed by Žan Doberšek.
3321
3322         When a user script message is received we need to create a WebKitJavascriptResult to deserialize the script
3323         value. WebKitJavascriptResult is created with a WebKitWebView for two reasons: to get its JavaScript global
3324         context and to take a reference that ensures the JavaScript context will be alive while the results is
3325         alive. However, we could create the WebKitJavascriptResult with the JavaScript global context and take a
3326         reference of the context itself. This way we don't need to access the WebKitWebView from the
3327         WebScriptMessageHandler client. But we still need access to the JavaScript context, so I've added a
3328         javascriptGlobalContext() method to WebPageProxy for GTK+ and WPE that is implemented from the page client.
3329
3330         Fixes /wpe/WebKitUserContentManager/script-message-received.
3331
3332         * UIProcess/API/glib/WebKitJavascriptResult.cpp:
3333         (_WebKitJavascriptResult::_WebKitJavascriptResult): Create the WebKitJavascriptResult with a JSGlobalContextRef
3334         instead of a WEbKitWebView.
3335         (webkitJavascriptResultCreate): Pass the js context to the constructor.
3336         (webkit_javascript_result_get_global_context): Return the js context.
3337         * UIProcess/API/glib/WebKitJavascriptResultPrivate.h:
3338         * UIProcess/API/glib/WebKitUserContentManager.cpp:
3339         * UIProcess/API/glib/WebKitWebView.cpp:
3340         (_WebKitWebViewPrivate::~_WebKitWebViewPrivate): Use JSRetainPtr
3341         (webkit_web_view_get_javascript_global_context):
3342         (webkitWebViewRunJavaScriptCallback):
3343         * UIProcess/API/gtk/PageClientImpl.cpp:
3344         (WebKit::PageClientImpl::javascriptGlobalContext):
3345         * UIProcess/API/gtk/PageClientImpl.h:
3346         * UIProcess/API/wpe/APIViewClient.h:
3347         (API::ViewClient::javascriptGlobalContext):
3348         * UIProcess/API/wpe/PageClientImpl.cpp:
3349         (WebKit::PageClientImpl::javascriptGlobalContext):
3350         * UIProcess/API/wpe/PageClientImpl.h:
3351         * UIProcess/API/wpe/WPEView.cpp:
3352         (WKWPE::View::javascriptGlobalContext):
3353         * UIProcess/API/wpe/WPEView.h:
3354         * UIProcess/PageClient.h:
3355         (WebKit::PageClient::javascriptGlobalContext):
3356         * UIProcess/WebPageProxy.h:
3357         * UIProcess/gtk/WebPageProxyGtk.cpp:
3358         (WebKit::WebPageProxy::javascriptGlobalContext):
3359         * UIProcess/wpe/WebPageProxyWPE.cpp:
3360         (WebKit::WebPageProxy::javascriptGlobalContext):
3361
3362 2017-06-22  Wenson Hsieh  <wenson_hsieh@apple.com>
3363
3364         [iOS DnD] [WK2] Enable in-app dragging from WKWebView on the phone
3365         https://bugs.webkit.org/show_bug.cgi?id=173736
3366         <rdar://problem/32873545>
3367
3368         Reviewed by Tim Horton.
3369
3370         Flip the drag interaction enabled switch on when initializing WKContentView's UIDragInteraction.
3371
3372         * UIProcess/ios/WKContentViewInteraction.mm:
3373         (-[WKContentView setupDataInteractionDelegates]):
3374
3375 2017-06-22  Chris Dumez  <cdumez@apple.com>
3376
3377         isMainThread() assertions in CallbackMap are incorrectly failing on some iOS apps
3378         https://bugs.webkit.org/show_bug.cgi?id=173738
3379         <rdar://problem/32923933>
3380
3381         Reviewed by Brady Eidson.
3382
3383         The assertions hit on certain iOS apps even though the crash traces clearly
3384         show them on the main thread. We have verified locally that RunLoop::isMain()
3385         propertly return true in this case (while WTF::isMainThread() returns false).
3386         Update the assertions to use RunLoop::isMain() instead.
3387
3388         * UIProcess/GenericCallback.h:
3389         (WebKit::CallbackMap::put):
3390         (WebKit::CallbackMap::take):
3391         (WebKit::CallbackMap::invalidate):
3392
3393 2017-06-22  Daniel Bates  <dabates@apple.com>
3394
3395         Make FrameLoadRequest a move-only type
3396         https://bugs.webkit.org/show_bug.cgi?id=173682
3397
3398         Reviewed by Alex Christensen and Darin Adler.
3399
3400         A FrameLoadRequest groups together the information to perform a load into a single object
3401         that is more manageable to pass around than its constituent parts. Code that receives a
3402         FrameLoadRequest is expected to extract out the information it needs to complete its task.
3403         And it does not make sense to re-use the same FrameLoadRequest object for more than one
3404         load. Therefore, it is sufficient to make FrameLoadRequest a move-only type.
3405
3406         * WebProcess/Plugins/PluginView.cpp:
3407         (WebKit::PluginView::URLRequest::create):
3408         (WebKit::PluginView::URLRequest::URLRequest):
3409         (WebKit::PluginView::performFrameLoadURLRequest):
3410         (WebKit::PluginView::loadURL):
3411         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3412         (WebKit::WebFrameLoaderClient::dispatchCreatePage):
3413         * WebProcess/WebPage/WebInspector.cpp:
3414         (WebKit::WebInspector::openInNewTab):
3415         * WebProcess/WebPage/WebPage.cpp:
3416         (WebKit::WebPage::loadRequest):
3417
3418 2017-06-22  Chris Dumez  <cdumez@apple.com>
3419
3420         Add release assertion in CallbackMap::invalidate()
3421         https://bugs.webkit.org/show_bug.cgi?id=173722
3422
3423         Reviewed by Brady Eidson.
3424
3425         Add release assertion in CallbackMap::invalidate() to make sure it is called on the main thread.
3426
3427         * UIProcess/GenericCallback.h:
3428         (WebKit::CallbackMap::invalidate):
3429
3430 2017-06-22  Brady Eidson  <beidson@apple.com>
3431
3432         Add some thread safety guards to GenericCallback.
3433         https://bugs.webkit.org/show_bug.cgi?id=173693
3434
3435         Reviewed by Sam Weinig.
3436
3437         A callback should be created, performed, invalidated, and/or destroyed all on the same thread.
3438         Let's write code to notify us if that doesn't happen.
3439
3440         * UIProcess/GenericCallback.h:
3441         (WebKit::GenericCallback::~GenericCallback):
3442         (WebKit::GenericCallback::performCallbackWithReturnValue):
3443         (WebKit::GenericCallback::invalidate):
3444
3445 2017-06-22  David Kilzer  <ddkilzer@apple.com>
3446
3447         v2: REGRESSION (r218419): 3 NSMutableDictionary leaks calling -[WKProcessPool _pluginLoadClientPolicies]
3448         <https://webkit.org/b/173689>
3449
3450         Reviewed by Chris Dumez.
3451
3452         * UIProcess/API/Cocoa/WKProcessPool.mm:
3453         (policiesHashMapToDictionary): Use -dictionaryWithCapacity:
3454         instead of -new since the former returns an autoreleased object
3455         while the latter does not.  This has the added benefit of tuning