UI process sometimes crashes under -[WKContentView _lookupForWebView:]
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-02-03  Tim Horton  <timothy_horton@apple.com>
2
3         UI process sometimes crashes under -[WKContentView _lookupForWebView:]
4         https://bugs.webkit.org/show_bug.cgi?id=182460
5         <rdar://problem/33260602>
6
7         Reviewed by Wenson Hsieh.
8
9         * UIProcess/ios/WKContentViewInteraction.mm:
10         (-[WKContentView _lookupForWebView:]):
11         If you have a range selection, but no rects for the selection, retrieving
12         the 0th element of selectionRects will crash the UI process. To fix, in
13         this case, use the rect for the starting caret instead.
14
15         It doesn't seem like the presentationRect is actually currently used for
16         the Lookup service, so the only impact is that we shouldn't crash anymore.
17
18 2018-02-02  Michael Catanzaro  <mcatanzaro@igalia.com>
19
20         Remove remaining dead !USE(NETWORK_SESSION) code
21         https://bugs.webkit.org/show_bug.cgi?id=182451
22
23         Reviewed by Alex Christensen.
24
25         DownloadCurl.cpp and AuthenticationManagerSoup.cpp have been dead code since NETWORK_SESSION
26         became mandatory.
27
28         * NetworkProcess/Downloads/curl/DownloadCurl.cpp: Removed.
29         * PlatformGTK.cmake:
30         * PlatformWPE.cmake:
31         * PlatformWin.cmake:
32         * Shared/Authentication/soup/AuthenticationManagerSoup.cpp: Removed.
33
34 2018-02-02  Youenn Fablet  <youenn@apple.com>
35
36         CacheStorage should check for origin file presence when computing the origin of a folder
37         https://bugs.webkit.org/show_bug.cgi?id=182454
38
39         Reviewed by Chris Dumez.
40
41         In case caches is opened for an origin but no cache is added, we do not have a caches name file but we do have an origin filename.
42         We should be checking the origin filename anyway since we will be reading it afterwards.
43
44         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
45         (WebKit::CacheStorage::Caches::retrieveOriginFromDirectory):
46
47 2018-02-02  Youenn Fablet  <youenn@apple.com>
48
49         Configure serviceWorkerRegistrationDirectory on the web site data store and move it to a Caches subfolder as a default
50         https://bugs.webkit.org/show_bug.cgi?id=182403
51         <rdar://problem/36673358>
52
53         Reviewed by Alex Christensen.
54
55         * UIProcess/WebProcessPool.cpp:
56         (WebKit::legacyWebsiteDataStoreConfiguration): Setting serviceWorkerRegistrationDirectory for legacy stores.
57
58 2018-02-02  Youenn Fablet  <youenn@apple.com>
59
60         Clearing all service worker registrations should wait for importing service worker registration to finish
61         https://bugs.webkit.org/show_bug.cgi?id=182407
62
63         Reviewed by Chris Dumez.
64
65         Updating API to take a completion handler.
66
67         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
68         (WKWebsiteDataStoreRemoveAllServiceWorkerRegistrations):
69         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
70
71 2018-02-02  Fujii Hironori  <Hironori.Fujii@sony.com>
72
73         [Win] MSVC doesn't seem to like "friend class NeverDestroyed<Foo>"
74         https://bugs.webkit.org/show_bug.cgi?id=182081
75
76         Reviewed by Yusuke Suzuki.
77
78         The template friend class, which belongs to a different namespace,
79         can't access private member if its friend declaration is specified
80         without the namespace and with class keyword.
81
82         Replaced "friend class NeverDestroyed<Foo>" with "friend NeverDestroyed<Foo>".
83
84         * NetworkProcess/NetworkProcess.h:
85         * NetworkProcess/capture/NetworkCaptureManager.h:
86         * PluginProcess/PluginProcess.h:
87         * Shared/CallbackID.h:
88         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
89         * StorageProcess/StorageProcess.h:
90         * UIProcess/Plugins/PluginProcessManager.h:
91         * UIProcess/Plugins/gtk/PluginInfoCache.h:
92         * UIProcess/WebPageProxy.cpp:
93         * UIProcess/WebPasteboardProxy.h:
94         * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
95         * UIProcess/gtk/HardwareAccelerationManager.h:
96         * UIProcess/gtk/WaylandCompositor.h:
97         * UIProcess/linux/MemoryPressureMonitor.h:
98         * UIProcess/mac/ServicesController.h:
99         * WebProcess/InjectedBundle/API/glib/WebKitExtensionManager.h:
100         * WebProcess/Plugins/WebPluginInfoProvider.h:
101         * WebProcess/WebCoreSupport/WebPasteboardOverrides.h:
102         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
103
104 2018-02-02  Youenn Fablet  <youenn@apple.com>
105
106         Configure serviceWorkerRegistrationDirectory on the web site data store and move it to a Caches subfolder as a default
107         https://bugs.webkit.org/show_bug.cgi?id=182403
108
109         Reviewed by Alex Christensen.
110
111         WebsiteDataStore is the place to set configuration information such as service worker registration path.
112         This patch updates WebKit code accordingly.
113         By default, the service worker registration path is in a Caches subfolder, similarly to cache API path.
114
115         * UIProcess/API/APIProcessPoolConfiguration.cpp:
116         (API::ProcessPoolConfiguration::createWithLegacyOptions):
117         (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
118         (API::ProcessPoolConfiguration::ProcessPoolConfiguration):
119         (API::ProcessPoolConfiguration::copy):
120         * UIProcess/API/APIProcessPoolConfiguration.h:
121         * UIProcess/API/C/WKContextConfigurationRef.cpp:
122         (WKContextConfigurationCopyServiceWorkerDatabaseDirectory): Deleted.
123         (WKContextConfigurationSetServiceWorkerDatabaseDirectory): Deleted.
124         * UIProcess/API/C/WKContextConfigurationRef.h:
125         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
126         (API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):
127         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
128         (-[WKWebsiteDataStore _serviceWorkerRegistrationDirectory]):
129         (-[WKWebsiteDataStore _setServiceWorkerRegistrationDirectory:]):
130         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
131         * UIProcess/WebProcessPool.cpp:
132         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
133         (WebKit::WebProcessPool::initializeNewWebProcess):
134         * UIProcess/WebsiteData/WebsiteDataStore.h:
135         (WebKit::WebsiteDataStore::serviceWorkerRegistrationDirectory const):
136         (WebKit::WebsiteDataStore::setServiceWorkerRegistrationDirectory):
137         * UIProcess/gtk/WebProcessPoolGtk.cpp:
138         * UIProcess/gtk/WebProcessPoolWPE.cpp:
139
140 2018-02-02  Wenson Hsieh  <wenson_hsieh@apple.com>
141
142         [Extra Zoom Mode] Implement support for indirect mainframe scrolling
143         https://bugs.webkit.org/show_bug.cgi?id=182421
144         <rdar://problem/35142694>
145
146         Reviewed by Tim Horton.
147
148         Makes a few small adjustments to WKScrollView to improve mainframe scrolling, and disable the pinch gesture for
149         zooming. See below for more details.
150
151         * UIProcess/API/Cocoa/WKWebView.mm:
152
153         Remove a now-unneeded WebKitAdditions import.
154
155         * UIProcess/ios/WKScrollView.mm:
156         (-[WKScrollView initWithFrame:]):
157
158         Add imports for -Before and -After versions of WKScrollViewAdditions.
159
160         (-[WKScrollView addGestureRecognizer:]):
161
162         Override -addGestureRecognizer here to prevent touches on the pinch gesture recognizer from being recognized.
163         I chose this approach instead of just disabling the gesture in -initWithFrame: because (1) the pinch gesture
164         recognizer is lazily created when setting minimum or maximum zoom scales, rather than immediately in
165         -initWithFrame:, and (2) even if we set the -enabled to NO, UIKit later resets it to YES in other codepaths.
166
167 2018-02-01  Tim Horton  <timothy_horton@apple.com>
168
169         WebKit fails to build (_startAssistingNode has conflicting parameters)
170         https://bugs.webkit.org/show_bug.cgi?id=182417
171         <rdar://problem/36965318>
172
173         Reviewed by Dan Bernstein.
174
175         * UIProcess/ios/WKContentViewInteraction.h:
176         Use Big BOOL like in the implementation.
177
178 2018-02-01  Brent Fulgham  <bfulgham@apple.com>
179
180         Improve NetworkResourceLogger to report blocked (versus non-partitioned) cookies
181         https://bugs.webkit.org/show_bug.cgi?id=182408
182         <rdar://problem/36918028>
183
184         Reviewed by Chris Dumez.
185
186         Update the logging method to report blocked origins, rather than logging them as non-partitioned
187         loads that have no cookies or other content.
188
189         * NetworkProcess/NetworkResourceLoader.cpp:
190         (WebKit::NetworkResourceLoader::logCookieInformation const):
191
192 2018-02-01  David Kilzer  <ddkilzer@apple.com>
193
194         REGRESSION (r222824): UI process crashes in WebKit::WebBackForwardList::backItem const
195         <https://webkit.org/b/182409>
196         <rdar://problem/35495094>
197
198         Reviewed by Alex Christensen.
199
200         * UIProcess/WebBackForwardList.cpp:
201         (WebKit::WebBackForwardList::goToItem): Fix typo so the for loop
202         actually checks each value in m_entries.
203
204 2018-02-01  Youenn Fablet  <youenn@apple.com>
205
206         Delay service worker process creation until actually needed by SWServer
207         https://bugs.webkit.org/show_bug.cgi?id=182301
208
209         Reviewed by Chris Dumez.
210
211         Do not create a service worker process at creation of the first SWServerConnection.
212         Wait for a WebProcess message that needs it:
213         - postMessage message
214         - fetchEvent message
215         - job scheduling.
216
217         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
218         (WebKit::WebSWServerConnection::startFetch):
219         (WebKit::WebSWServerConnection::postMessageToServiceWorker):
220         (WebKit::WebSWServerConnection::scheduleJobInServer):
221         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
222         * StorageProcess/StorageToWebProcessConnection.cpp:
223         (WebKit::StorageToWebProcessConnection::establishSWServerConnection):
224
225 2018-02-01  Wenson Hsieh  <wenson_hsieh@apple.com>
226
227         [Extra zoom mode] Implement basic support for interacting with text form controls
228         https://bugs.webkit.org/show_bug.cgi?id=182401
229         <rdar://problem/35143035>
230
231         Reviewed by Tim Horton.
232
233         Add UI support for interacting with and editing text form controls when extra zoom mode is enabled. See below
234         for more details.
235
236         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
237         (-[WKWebViewConfiguration init]):
238         (-[WKWebViewConfiguration encodeWithCoder:]):
239         (-[WKWebViewConfiguration initWithCoder:]):
240         (-[WKWebViewConfiguration copyWithZone:]):
241         (-[WKWebViewConfiguration _textInteractionGesturesEnabled]):
242         (-[WKWebViewConfiguration _setTextInteractionGesturesEnabled:]):
243         (-[WKWebViewConfiguration _longPressActionsEnabled]):
244         (-[WKWebViewConfiguration _setLongPressActionsEnabled:]):
245
246         Introduce two new web view configuration flags: `textInteractionGesturesEnabled` and `longPressActionsEnabled`.
247         The former determines whether text interaction gestures (i.e. text selection, moving the caret, showing UI for
248         IME, etc.) are enabled. The latter determines whether or not long press actions (i.e. touch callout, share
249         sheet, etc.) are enabled. These are disabled by default only in extra zoom mode.
250
251         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
252         * UIProcess/WebPageProxy.cpp:
253         (WebKit::WebPageProxy::setTextAsync):
254
255         Add a way to set the text value of a currently edited text form control. This will either set the text value of
256         an input, a. la. autofill, or overwrite the contents of a contenteditable area by selecting everything and
257         inserting the given text.
258
259         * UIProcess/WebPageProxy.h:
260         (WebKit::WebPageProxy::focusNextAssistedNode):
261
262         Add a default argument for the completion callback.
263
264         * UIProcess/ios/WKContentViewInteraction.h:
265         * UIProcess/ios/WKContentViewInteraction.mm:
266         (-[WKContentView setupInteraction]):
267         (-[WKContentView _displayFormNodeInputView]):
268         (-[WKContentView _actionForLongPressFromPositionInformation:]):
269         (-[WKContentView hasSelectablePositionAtPoint:]):
270         (-[WKContentView pointIsNearMarkedText:]):
271         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
272         (-[WKContentView insertionPointColor]):
273
274         Respect the web view configuration flags above by bailing early from text interaction and long press action
275         sheet methods.
276
277         (-[WKContentView _startAssistingKeyboard]):
278         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
279
280         Add a flag indicating whether we are in the process of changing focus from one node to another. We use this to
281         decide whether or not we want to present the text input view controller right away, or just reload the focused
282         form control overlay. When we stop "assisting" a node, we also keep the focused form control overlay up if we're
283         only changing focus to another form control.
284
285         (-[WKContentView _stopAssistingNode]):
286         (-[WKContentView presentFocusedFormControlViewController:]):
287         (-[WKContentView dismissFocusedFormControlViewController:]):
288         (-[WKContentView shouldPresentTextInputViewController:]):
289         (-[WKContentView presentTextInputViewController:]):
290         (-[WKContentView dismissTextInputViewController:]):
291
292         Introduce helpers for managing presentation of the focused form control overlay and text input view controller.
293         All -present and -dismiss helpers here are idempotent. These view controllers are presented from the content
294         view's view controller for fullscreen presentation.
295
296         (-[WKContentView textInputController:didCommitText:]):
297         (-[WKContentView textInputController:didRequestDismissalWithAction:]):
298         (-[WKContentView focusedFormControlControllerDidSubmit:]):
299         (-[WKContentView focusedFormControlControllerDidCancel:]):
300         (-[WKContentView focusedFormControlControllerDidBeginEditing:]):
301         (-[WKContentView highlightedRectForFocusedFormControlController:inCoordinateSpace:]):
302         (-[WKContentView actionNameForFocusedFormControlController:]):
303         (-[WKContentView focusedFormControlControllerDidRequestNextNode:]):
304         (-[WKContentView focusedFormControlControllerDidRequestPreviousNode:]):
305         (-[WKContentView hasNextNodeForFocusedFormControlController:]):
306         (-[WKContentView hasPreviousNodeForFocusedFormControlController:]):
307
308         Implement delegate methods for the focused form control and text input view controllers. This mainly involves
309         straightforward plumbing of pieces of AssistedNodeInformation on the content view.
310
311         (-[WKContentView pointIsInAssistedNode:]): Deleted.
312
313         Remove a method that was still implemented only for binary compatibility with iOS 10.
314
315         * WebProcess/WebPage/WebPage.cpp:
316         (WebKit::WebPage::setTextAsync):
317         * WebProcess/WebPage/WebPage.h:
318         * WebProcess/WebPage/WebPage.messages.in:
319
320 2018-02-01  Carlos Garcia Campos  <cgarcia@igalia.com>
321
322         [GTK] Shift + mouse scroll should scroll horizontally
323         https://bugs.webkit.org/show_bug.cgi?id=181629
324
325         Reviewed by Michael Catanzaro.
326
327         Swap scroll direction when Shift is pressed for consistency with GtkScrolledWindow.
328
329         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
330         (webkitWebViewBaseScrollEvent):
331
332 2018-02-01  Carlos Garcia Campos  <cgarcia@igalia.com>
333
334         REGRESSION(r227893): fast/events/touch/touch-stale-node-crash.html and other tests crash
335         https://bugs.webkit.org/show_bug.cgi?id=182350
336
337         Reviewed by Carlos Alberto Lopez Perez.
338
339         Ensure events synthesized from touch gestures have a valid window, screen and device.
340
341         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
342         * UIProcess/gtk/GestureController.h: Add virtual destructor to GestureControllerclient.
343
344 2018-01-31  Simon Fraser  <simon.fraser@apple.com>
345
346         Use different debug red colors for different contexts
347         https://bugs.webkit.org/show_bug.cgi?id=182362
348
349         Reviewed by Tim Horton.
350         
351         Pure red is used elsehwere in the system as a debug color indicator, so use different
352         shades of red for WebKit in the two places where we paint a reddish wash in debug builds,
353         so they are identifiable.
354
355         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
356         (WebKit::RemoteLayerBackingStore::drawInContext):
357
358 2018-01-31  Don Olmstead  <don.olmstead@sony.com>
359
360         [CMake] Make JavaScriptCore headers copies
361         https://bugs.webkit.org/show_bug.cgi?id=182303
362
363         Reviewed by Alex Christensen.
364
365         * CMakeLists.txt:
366         * Scripts/generate-forwarding-headers.pl:
367
368 2018-01-31  Alex Christensen  <achristensen@webkit.org>
369
370         Unreviewed, rolling out r227942.
371
372         r227875 should not have been rolled out.
373
374         Reverted changeset:
375
376         "Unreviewed, rolling out r227875."
377         https://bugs.webkit.org/show_bug.cgi?id=182357
378         https://trac.webkit.org/changeset/227942
379
380 2018-01-31  Michael Catanzaro  <mcatanzaro@igalia.com>
381
382         Unreviewed, rolling out r227875.
383         https://bugs.webkit.org/show_bug.cgi?id=182357
384
385         Missing cross-platform TestController implementation
386
387         Reverted changeset:
388
389         "Add callbacks to testRunner.statisticsSetShouldPartitionCookiesForHost() and testRunner.statisticsUpdateCookiePartitioning()"
390         https://bugs.webkit.org/show_bug.cgi?id=181958
391         https://trac.webkit.org/changeset/227875
392
393         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
394         (WKWebsiteDataStoreStatisticsUpdateCookiePartitioning):
395         (WKWebsiteDataStoreSetStatisticsShouldPartitionCookiesForHost):
396         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
397         (-[WKWebsiteDataStore _resourceLoadStatisticsUpdateCookiePartitioning]):
398         (-[WKWebsiteDataStore _resourceLoadStatisticsSetShouldPartitionCookies:forHost:]):
399         (-[WKWebsiteDataStore _resourceLoadStatisticsUpdateCookiePartitioning:]): Deleted.
400         (-[WKWebsiteDataStore _resourceLoadStatisticsSetShouldPartitionCookies:forHost:completionHandler:]): Deleted.
401         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
402         * UIProcess/WebResourceLoadStatisticsStore.cpp:
403         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
404         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
405         (WebKit::WebResourceLoadStatisticsStore::logNonRecentUserInteraction):
406         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdate):
407         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdateForDomains):
408         (WebKit::WebResourceLoadStatisticsStore::scheduleClearPartitioningStateForDomains):
409         (WebKit::WebResourceLoadStatisticsStore::mergeWithDataFromDecoder):
410         (WebKit::WebResourceLoadStatisticsStore::clearInMemory):
411         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning):
412         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains):
413         (WebKit::WebResourceLoadStatisticsStore::clearPartitioningStateForDomains):
414         * UIProcess/WebResourceLoadStatisticsStore.h:
415
416 2018-01-31  Brent Fulgham  <bfulgham@apple.com>
417
418         Follow-up to r227939.
419         https://bugs.webkit.org/show_bug.cgi?id=182354
420         <rdar://problem/37046844>
421
422         Make sure the correct sandbox is used on iOS as well.
423
424         * StorageProcess/ios/StorageProcessIOS.mm:
425         (WebKit::StorageProcess::initializeSandbox):
426
427 2018-01-31  Brent Fulgham  <bfulgham@apple.com>
428
429         REGRESSION(r220094): com.apple.WebKit.Storage lost its sandbox
430         https://bugs.webkit.org/show_bug.cgi?id=182354
431         <rdar://problem/37046844>
432
433         Reviewed by Ryosuke Niwa.
434
435         The Database process was renamed to Storage, but it's sandbox was not updated.
436
437         * Configurations/WebKit.xcconfig: Update for sandbox rename.
438         * DerivedSources.make: Ditto.
439         * Resources/SandboxProfiles/ios/com.apple.WebKit.Databases.sb: Removed.
440         * Resources/SandboxProfiles/ios/com.apple.WebKit.Storage.sb: Copied from Resources/SandboxProfiles/ios/com.apple.WebKit.Databases.sb.
441         * StorageProcess/mac/com.apple.WebKit.Databases.sb.in: Removed.
442         * StorageProcess/mac/com.apple.WebKit.Storage.sb.in: Copied from StorageProcess/mac/com.apple.WebKit.Databases.sb.in.
443         * WebKit.xcodeproj/project.pbxproj: Update for sandbox rename.
444
445 2018-01-31  Michael Catanzaro  <mcatanzaro@igalia.com>
446
447         REGRESSION(r227223): http/tests/resourceLoadStatistics/clear-in-memory-and-persistent-store-one-hour.html, http/tests/resourceLoadStatistics/grandfathering.html timing out on GTK, WPE
448         https://bugs.webkit.org/show_bug.cgi?id=182222
449
450         Reviewed by Alex Christensen.
451
452         Add callbacks to notify when resource load statistics deletion is complete.
453
454         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
455         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
456         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
457         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
458
459 2018-01-31  Tim Horton  <timothy_horton@apple.com>
460
461         Occasional null deref under WebPageProxy::updateBackingStoreDiscardableState()
462         https://bugs.webkit.org/show_bug.cgi?id=182349
463         <rdar://problem/27822258>
464
465         Reviewed by Simon Fraser.
466
467         * UIProcess/WebPageProxy.cpp:
468         (WebKit::WebPageProxy::updateBackingStoreDiscardableState):
469         m_drawingArea can be null during process launch and relaunch.
470
471         Cocoa ports don't use the result of setBackingStoreIsDiscardable(),
472         but they do run this code to keep it up to date.
473
474 2018-01-31  Michael Catanzaro  <mcatanzaro@igalia.com>
475
476         [GTK] Move gir and typelib generation into ENABLE_INTROSPECTION conditional
477         https://bugs.webkit.org/show_bug.cgi?id=182308
478
479         Reviewed by Carlos Garcia Campos.
480
481         * PlatformGTK.cmake:
482
483 2018-01-31  Youenn Fablet  <youenn@apple.com>
484
485         Remove StorageToWebProcessConnection::removeSWServerConnection
486         https://bugs.webkit.org/show_bug.cgi?id=182305
487
488         Reviewed by Chris Dumez.
489
490         * StorageProcess/StorageToWebProcessConnection.cpp:
491         (WebKit::StorageToWebProcessConnection::removeSWServerConnection): Deleted.
492         * StorageProcess/StorageToWebProcessConnection.h:
493         * StorageProcess/StorageToWebProcessConnection.messages.in:
494
495 2018-01-31  Carlos Garcia Campos  <cgarcia@igalia.com>
496
497         REGRESSION(r227544): [GTK] contextMenuEvent is NULL on CONTEXT_MENU call
498         https://bugs.webkit.org/show_bug.cgi?id=182224
499
500         Reviewed by Michael Catanzaro.
501
502         Move the gestures handling to WebKitWebViewBase. This patch adds GestureControllerClient class, created and
503         implemented by WebKitWebViewBase and used by GestureController instead of the WebPageProxy. This way we ensure
504         events are handled consistently.
505
506         * UIProcess/API/gtk/PageClientImpl.cpp:
507         (WebKit::PageClientImpl::doneWithTouchEvent): Cast the GdkEvent since GestureController no longer works wirth
508         const GdkEvents.
509         (WebKit::PageClientImpl::zoom): Use webkit_web_view_set_zoom_level() in case of WebKitWebView or
510         WebPageProxy::setPageZoomFactor() otherwise.
511         * UIProcess/API/gtk/PageClientImpl.h:
512         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
513         (ClickCounter::currentClickCountForGdkButtonEvent): Receive a GdkEvent to avoid casts.
514         (webkitWebViewBaseHandleMouseEvent): Helper function to handle mouse events.
515         (webkitWebViewBaseButtonPressEvent): Use webkitWebViewBaseHandleMouseEvent.
516         (webkitWebViewBaseButtonReleaseEvent): Ditto.
517         (webkitWebViewBaseHandleWheelEvent): Helper function to handle wheel events.
518         (webkitWebViewBaseScrollEvent): Use webkitWebViewBaseHandleWheelEvent.
519         (webkitWebViewBaseMotionNotifyEvent): Use webkitWebViewBaseHandleMouseEvent.
520         (webkitWebViewBaseCrossingNotifyEvent): Ditto.
521         (webkitWebViewBaseGestureController): Pass the widget and client to GestureController.
522         * UIProcess/gtk/GestureController.cpp:
523         (WebKit::GestureController::GestureController): Receives a widget and client now.
524         (WebKit::GestureController::handleEvent): Remove the const.
525         (WebKit::GestureController::Gesture::Gesture): Initialize client.
526         (WebKit::GestureController::Gesture::handleEvent): Remove the const.
527         (WebKit::GestureController::DragGesture::startDrag): Use the client instead of WebPageProxy.
528         (WebKit::GestureController::DragGesture::handleDrag): Ditto.
529         (WebKit::GestureController::DragGesture::handleTap): Ditto.
530         (WebKit::GestureController::DragGesture::begin): Ignore the const returned by gtk_gesture_get_last_event().
531         (WebKit::GestureController::DragGesture::update): Ditto.
532         (WebKit::GestureController::DragGesture::end): Ditto.
533         (WebKit::GestureController::DragGesture::DragGesture): Receives a widget and client now.
534         (WebKit::GestureController::SwipeGesture::startMomentumScroll): Use the client instead of WebPageProxy.
535         (WebKit::GestureController::SwipeGesture::swipe): Ignore the const returned by gtk_gesture_get_last_event().
536         (WebKit::GestureController::SwipeGesture::SwipeGesture): Receives a widget and client now.
537         (WebKit::GestureController::ZoomGesture::begin): Start the zoom.
538         (WebKit::GestureController::ZoomGesture::startZoom): Use the client instead of WebPageProxy.
539         (WebKit::GestureController::ZoomGesture::handleZoom): Ditto.
540         (WebKit::GestureController::ZoomGesture::ZoomGesture): Receives a widget and client now.
541         (WebKit::GestureController::LongPressGesture::longPressed): Use the client instead of WebKitWebView.
542         (WebKit::GestureController::LongPressGesture::pressed): Ignore the const returned by gtk_gesture_get_last_event().
543         (WebKit::GestureController::LongPressGesture::LongPressGesture): Receives a widget and client now.
544         (WebKit::GestureController::Gesture::simulateMouseClick): Deleted.
545         (WebKit::createScrollEvent): Deleted.
546         * UIProcess/gtk/GestureController.h:
547
548 2018-01-31  Carlos Garcia Campos  <cgarcia@igalia.com>
549
550         Web Automation: cookies returned by automation should have expiry time in seconds
551         https://bugs.webkit.org/show_bug.cgi?id=182293
552
553         Reviewed by Brian Burg.
554
555         When creating a WebCore::Cookie from a WebDriver object we convert the given expiry time to milliseconds, but
556         when creating a WebDriver object from a WebCore::Cookie we are keeping the milliseconds. We should convert to
557         seconds for consistency, so that the WebDriver always handles seconds.
558
559         Fixes: imported/w3c/webdriver/tests/cookies/get_named_cookie.py::test_get_named_cookie
560
561         * UIProcess/Automation/WebAutomationSession.cpp:
562         (WebKit::buildObjectForCookie): Convert expiry to seconds.
563
564 2018-01-31  Ryosuke Niwa  <rniwa@webkit.org>
565
566         Unreviewed iOS build fix.
567
568         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
569
570 2018-01-30  John Wilander  <wilander@apple.com>
571
572         Add callbacks to testRunner.statisticsSetShouldPartitionCookiesForHost() and testRunner.statisticsUpdateCookiePartitioning()
573         https://bugs.webkit.org/show_bug.cgi?id=181958
574         https://bugs.webkit.org/show_bug.cgi?id=182072
575         <rdar://problem/36801804>
576         <rdar://problem/36845795>
577
578         Reviewed by Brent Fulgham.
579
580         Because of the asynchronous nature of XPC and cookies,
581         we need callbacks in these TestRunner functions so that
582         the layout tests can wait for state changes to finish
583         before checking test conditions.
584
585         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
586         (WKWebsiteDataStoreStatisticsUpdateCookiePartitioning):
587         (WKWebsiteDataStoreSetStatisticsShouldPartitionCookiesForHost):
588         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
589         (-[WKWebsiteDataStore _resourceLoadStatisticsUpdateCookiePartitioning]):
590         (-[WKWebsiteDataStore _resourceLoadStatisticsUpdateCookiePartitioning:]):
591         (-[WKWebsiteDataStore _resourceLoadStatisticsSetShouldPartitionCookies:forHost:]):
592         (-[WKWebsiteDataStore _resourceLoadStatisticsSetShouldPartitionCookies:forHost:completionHandler:]):
593         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
594         * UIProcess/WebResourceLoadStatisticsStore.cpp:
595         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
596         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
597         (WebKit::WebResourceLoadStatisticsStore::logNonRecentUserInteraction):
598         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdate):
599         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdateForDomains):
600         (WebKit::WebResourceLoadStatisticsStore::scheduleClearPartitioningStateForDomains):
601         (WebKit::WebResourceLoadStatisticsStore::mergeWithDataFromDecoder):
602         (WebKit::WebResourceLoadStatisticsStore::clearInMemory):
603         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning):
604         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains):
605         (WebKit::WebResourceLoadStatisticsStore::clearPartitioningStateForDomains):
606         * UIProcess/WebResourceLoadStatisticsStore.h:
607
608 2018-01-30  Ryosuke Niwa  <rniwa@webkit.org>
609
610         REGRESSION(r227550): Resource timing API is disabled on macOS
611         https://bugs.webkit.org/show_bug.cgi?id=182318
612
613         Reviewed by Chris Dumez.
614
615         Resource timing API should be enabled by default all versions of macOS we support now.
616
617         * Shared/WebPreferences.yaml:
618         * Shared/WebPreferencesDefaultValues.h:
619
620 2018-01-30  Tim Horton  <timothy_horton@apple.com>
621
622         WKWebView layout is sometimes wrong after rotation on iPhone X
623         https://bugs.webkit.org/show_bug.cgi?id=182304
624         <rdar://problem/34158671>
625
626         Reviewed by Simon Fraser.
627
628         * Platform/spi/ios/UIKitSPI.h:
629         * UIProcess/API/Cocoa/WKWebView.mm:
630         (-[WKWebView _computedContentInset]):
631         (-[WKWebView _scrollViewSystemContentInset]):
632         (activeMinimumLayoutSize):
633         It turns out that it is not always safe to look at the safe area insets of
634         children from inside layoutSubviews, even after the call to super.
635
636         Instead, make use of the fact that WKScrollView and WKWebView have identical
637         coordinate spaces, and map WKWebView's safe area insets into the WKScrollView.
638         It's safe to use the scroll view's affected-edges and contentScrollInset,
639         because those aren't updated at the same outside-of-layout time that
640         safe area insets are.
641
642         We could alternatively move all calls to activeMinimumLayoutSize outside
643         of layoutSubviews, but that seems like a larger and riskier change.
644
645         All attempts to write a test have failed; this depends heavily on use of
646         autolayout and the mechanism by which the system updates system-owned
647         safe area insets during device rotation.
648
649 2018-01-30  Don Olmstead  <don.olmstead@sony.com>
650
651         JSExports.h should be included as <JavaScriptCore/JSExportMacros.h>
652         https://bugs.webkit.org/show_bug.cgi?id=182312
653
654         Reviewed by Michael Catanzaro.
655
656         * config.h:
657
658 2018-01-30  Brent Fulgham  <bfulgham@apple.com>
659
660         Add telemetry to track storage access API adoption
661         https://bugs.webkit.org/show_bug.cgi?id=182197
662         <rdar://problem/35803309>
663
664         Reviewed by Chris Dumez.
665
666         Part 2: Add telemetry for the Storage Access API case
667
668         This change increments a counter when an origin is loaded in a first part context because
669         it was granted Storage Access API permissions.
670
671         * NetworkProcess/NetworkResourceLoader.cpp:
672         (WebKit::NetworkResourceLoader::logCookieInformation const): Add logging to indicate
673         loads that happened with the Storage Access API enabled.
674         * UIProcess/WebResourceLoadStatisticsStore.cpp:
675         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess): Increment counter for
676         loads using the new API.
677
678 2018-01-30  Megan Gardner  <megan_gardner@apple.com>
679
680         Make preserve and restore focus more likely to be symmetrical
681         https://bugs.webkit.org/show_bug.cgi?id=182264
682         <rdar://problem/36948473>
683         
684         Reviewed by Tim Horton.
685
686         Keep a stack of if we actually increment the focusState, so that
687         changes to the web content do not result in asymmetric decrements to the focus state. 
688         To work around problems associated with <rdar://problem/37000122>.
689
690         * UIProcess/ios/WKContentViewInteraction.h:
691         * UIProcess/ios/WKContentViewInteraction.mm:
692         (-[WKContentView _restoreFocusWithToken:]):
693         (-[WKContentView _preserveFocusWithToken:destructively:]):
694
695 2018-01-30  Brent Fulgham  <bfulgham@apple.com>
696
697         Add telemetry to track storage access API adoption
698         https://bugs.webkit.org/show_bug.cgi?id=182197
699         <rdar://problem/35803309>
700
701         Reviewed by Chris Dumez.
702         
703         This patch also handled aggregating the counts in the UIProcess, which has access to
704         the right data.
705
706         The original patch assumed the WebContent process kept track of user interaction. This is
707         only tracked in the UIProcess, so we can get rid of some of the logging code adding in
708         r227755.
709
710         * Shared/WebProcessCreationParameters.cpp:
711         (WebKit::WebProcessCreationParameters::encode const): Rollout of r227755 changes not
712         needed to track the statistics.
713         (WebKit::WebProcessCreationParameters::decode): Ditto.
714         * Shared/WebProcessCreationParameters.h:
715         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
716         (WebKit::WebProcessPool::platformInitializeWebProcess): Ditto.
717         * UIProcess/WebResourceLoadStatisticsStore.cpp:
718         (WebKit::WebResourceLoadStatisticsStore::wasAccessedAsFirstPartyDueToUserInteraction): Moved from
719         the WebContent process, which does not keep track of user interaction.
720         (WebKit::WebResourceLoadStatisticsStore::mergeStatistics): Aggregate counts while processing
721         the statistics.
722         * UIProcess/WebResourceLoadStatisticsStore.h:
723         * WebProcess/WebProcess.cpp:
724         (WebKit::WebProcess::initializeWebProcess):
725
726 2018-01-30  Chris Dumez  <cdumez@apple.com>
727
728         Make sure we never create a WebSWClientConnection with an invalid sessionID
729         https://bugs.webkit.org/show_bug.cgi?id=182276
730         <rdar://problem/36582633>
731
732         Reviewed by Alex Christensen.
733
734         Make sure we never create a WebSWClientConnection with an invalid sessionID as this
735         could corrupt our hash tables.
736
737         * StorageProcess/StorageProcess.cpp:
738         (WebKit::StorageProcess::swServerForSession):
739         * UIProcess/WebProcessPool.cpp:
740         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
741         * WebProcess/Storage/WebSWClientConnection.cpp:
742         (WebKit::WebSWClientConnection::WebSWClientConnection):
743         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
744         (WebKit::WebServiceWorkerProvider::serviceWorkerConnectionForSession):
745         (WebKit::WebServiceWorkerProvider::existingServiceWorkerConnectionForSession):
746         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
747         (WebKit::WebToStorageProcessConnection::serviceWorkerConnectionForSession):
748
749 2018-01-30  Basuke Suzuki  <Basuke.Suzuki@sony.com>
750
751         [WinCairo] Fix forwarding header conflict of WebKit on WinCairo
752         https://bugs.webkit.org/show_bug.cgi?id=177202
753
754         Reviewed by Alex Christensen.
755
756         * PlatformWin.cmake:
757
758 2018-01-29  Carlos Garcia Campos  <cgarcia@igalia.com>
759
760         WebDriver: evaluateJavaScriptFunction should return null when return value is undefined
761         https://bugs.webkit.org/show_bug.cgi?id=180350
762
763         Reviewed by Carlos Alberto Lopez Perez.
764
765         undefined can't be converted to JSON string, in which case JSON.stringify() returns undefined and we handle that
766         case to return an empty string. We currently handle this case for execute script commands, but not in all other
767         cases where we use evaluateJavaScriptFunction. It would be simpler if evaluateJavaScriptFunction returned null,
768         because in that case we wouldn't need to handle it as a special case.
769
770         15.2 Executing Script
771         https://w3c.github.io/webdriver/webdriver-spec.html#dfn-json-clone
772
773         Fixes: imported/w3c/webdriver/tests/state/get_element_property.py::test_element_non_existent
774
775         * WebProcess/Automation/WebAutomationSessionProxy.js:
776         (let.AutomationSessionProxy.prototype._jsonStringify): Return "null" instead of "" when undefined is given.
777
778 2018-01-29  Ryosuke Niwa  <rniwa@webkit.org>
779
780         Release assert in updateLayout while waiting for sync reply to WebPageProxy::HasInsecureContent
781         https://bugs.webkit.org/show_bug.cgi?id=182273
782
783         Reviewed by Chris Dumez.
784
785         The assertion was caused by unrelated sync IPCs being processed while WebContent process is waiting for
786         the reply to WebPageProxy::HasInsecureContent. Since this IPC can be used while creating CachedFrame,
787         it's not safe to execute arbitrary code.
788
789         Fixed the bug by using DoNotProcessIncomingMessagesWhenWaitingForSyncReply added in r227566.
790
791         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
792         (WebKit::WebFrameLoaderClient::savePlatformDataToCachedFrame):
793
794 2018-01-29  Wenson Hsieh  <wenson_hsieh@apple.com>
795
796         Add a build step to copy resources from WebKitAdditions as bundle resources in WebKit
797         https://bugs.webkit.org/show_bug.cgi?id=182268
798         <rdar://problem/37003784>
799
800         Reviewed by Tim Horton and Dan Bernstein.
801
802         Adds a "Copy Additional Resources" phase when building WebKit. This phase copies resources from
803         usr/local/include/WebKitAdditions/WebKit/AdditionalResources in the build directory into the
804         unlocalized resources directory. If the AdditionalResources directory does not exist in the build
805         directory, we fall back to searching the SDK.
806
807         * WebKit.xcodeproj/project.pbxproj:
808
809 2018-01-29  Youenn Fablet  <youenn@apple.com>
810
811         ServiceWorkerClientFetch should not consider responses without Location headers as redirection responses
812         https://bugs.webkit.org/show_bug.cgi?id=182134
813
814         Reviewed by Chris Dumez.
815
816         As per fetch spec, a response with a redirection status code but no Location header should not be considered as a redirection.
817         This is also consistent with SubresourceLoader::didReceiveResponse.
818
819         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
820         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
821
822 2018-01-29  Youenn Fablet  <youenn@apple.com>
823
824         Cache API should make sure to resolve caches.open promises in the same order as called
825         https://bugs.webkit.org/show_bug.cgi?id=182193
826         <rdar://problem/36930363>
827
828         Reviewed by Chris Dumez.
829
830         Covered by added test.
831         Whenever opening/removing a cache requires writing to disk, wait to finish the task
832         until any disk writing task is done.
833         Applying this strategy when clearing data so that we also clear data that is pending to be written.
834         For removing cache, we now return whether a cache was actually deleted by returning zero as removed cache identifier.
835         WebCore uses that information to return true/false as promise resolution value.
836
837         * NetworkProcess/cache/CacheStorageEngine.cpp:
838         (WebKit::CacheStorage::Engine::retrieveCaches):
839         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
840         (WebKit::CacheStorage::Caches::clear):
841         (WebKit::CacheStorage::Caches::open):
842         (WebKit::CacheStorage::Caches::remove):
843         (WebKit::CacheStorage::Caches::writeCachesToDisk):
844         (WebKit::CacheStorage::Caches::cacheInfos):
845         (WebKit::CacheStorage::Caches::cacheInfos const): Deleted.
846         * NetworkProcess/cache/CacheStorageEngineCaches.h:
847         (WebKit::CacheStorage::Caches::createWeakPtr):
848
849 2018-01-29  Alex Christensen  <achristensen@webkit.org>
850
851         Clean up API after bugs 178240 and 176474
852         https://bugs.webkit.org/show_bug.cgi?id=182259
853
854         Reviewed by Dan Bernstein.
855
856         NS_OPTIONS should be NSUInteger, not NSInteger.  This is how all other NS_OPTIONS in WebKit are,
857         and it's necessary if we get really big numbers as options.  Changing them won't cause binary
858         incompatibility unless someone does signed integer comparison with currently invalid values.
859
860         Added availability macros I forgot to add earlier.
861
862         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
863         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
864
865 2018-01-29  Jiewen Tan  <jiewen_tan@apple.com>
866
867         [WebAuthN] Add a compile-time feature flag
868         https://bugs.webkit.org/show_bug.cgi?id=182211
869         <rdar://problem/36936365>
870
871         Reviewed by Brent Fulgham.
872
873         * Configurations/FeatureDefines.xcconfig:
874
875 2018-01-29  John Wilander  <wilander@apple.com>
876
877         Resource Load Statistics: Introduce debug mode as experimental feature
878         https://bugs.webkit.org/show_bug.cgi?id=182199
879         <rdar://problem/36930364>
880
881         Reviewed by Alex Christensen.
882
883         The only changes to default behavior are:
884         - Increased resolution on timestamps which is needed to be able to set shorter
885           timeouts in debug mode.
886         - Only update partitioning and blocking table when needed. This is an optimization
887           which pays off in less XPC with shorter timeouts.
888
889         * Shared/WebPreferences.yaml:
890         * UIProcess/API/APIWebsiteDataStore.cpp:
891         (API::WebsiteDataStore::resourceLoadStatisticsDebugMode const):
892         (API::WebsiteDataStore::setResourceLoadStatisticsDebugMode):
893         * UIProcess/API/APIWebsiteDataStore.h:
894         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
895         (WKWebsiteDataStoreSetResourceLoadStatisticsDebugMode):
896         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
897         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
898         (-[WKWebsiteDataStore _resourceLoadStatisticsDebugMode]):
899         (-[WKWebsiteDataStore _setResourceLoadStatisticsDebugMode:]):
900         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
901         * UIProcess/WebResourceLoadStatisticsStore.cpp:
902         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
903         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
904         * UIProcess/WebResourceLoadStatisticsStore.h:
905         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
906         (WebKit::WebsiteDataStore::resourceLoadStatisticsDebugMode const):
907         (WebKit::WebsiteDataStore::setResourceLoadStatisticsDebugMode):
908         * UIProcess/WebsiteData/WebsiteDataStore.h:
909
910 2018-01-29  Andy Estes  <aestes@apple.com>
911
912         [iOS] Restrict synthetic clicks to the origin that handled the underlying touch event
913         https://bugs.webkit.org/show_bug.cgi?id=182252
914         <rdar://problem/21555881>
915
916         Reviewed by Tim Horton.
917
918         * WebProcess/WebPage/WebPage.cpp:
919         (WebKit::WebPage::dispatchTouchEvent):
920         (WebKit::WebPage::updatePotentialTapSecurityOrigin):
921
922         Record the target frame origin of touch events that are potential taps, are
923         TouchStart events, are targeted in frames that have touch event listeners, and are not
924         handled by those listeners.
925
926         * WebProcess/WebPage/WebPage.h:
927         * WebProcess/WebPage/ios/WebPageIOS.mm:
928         (WebKit::WebPage::potentialTapAtPosition):
929         (WebKit::WebPage::commitPotentialTap):
930         (WebKit::WebPage::cancelPotentialTapInFrame):
931
932         Passed the target frame origin to Frame::nodeRespondingToClickEvents() then cleared it.
933
934 2018-01-29  Alex Christensen  <achristensen@webkit.org>
935
936         Make policy checks more robust against null pointer dereferencing
937         https://bugs.webkit.org/show_bug.cgi?id=182263
938         <rdar://problem/34895714>
939
940         Reviewed by Tim Horton.
941
942         We're still dereferencing null.  Check everything.
943
944         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
945         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
946
947 2018-01-29  Brent Fulgham  <bfulgham@apple.com>
948
949         Add telemetry to track storage access API adoption
950         https://bugs.webkit.org/show_bug.cgi?id=182197
951         <rdar://problem/35803309>
952
953         Reviewed by Chris Dumez.
954
955         Part 1: Add telemetry for the user interaction case
956         
957         This patch adds telemetry to track how frequently third-party cookies are
958         used in a first party context due to user interaction. This will help
959         understand cases where the new Storage Access API can help, and to help
960         us understand if we have considered relevant use cases in its design.
961
962         * Shared/WebProcessCreationParameters.cpp:
963         (WebKit::WebProcessCreationParameters::encode const):
964         (WebKit::WebProcessCreationParameters::decode):
965         * Shared/WebProcessCreationParameters.h:
966         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
967         (WebKit::WebProcessPool::platformInitializeWebProcess):
968         * UIProcess/WebResourceLoadStatisticsTelemetry.cpp:
969         (WebKit::sortedPrevalentResourceTelemetry): Update for new telemetry.
970         (WebKit::submitTopList): Update for new data types.
971         * WebProcess/WebProcess.cpp:
972         (WebKit::WebProcess::initializeWebProcess): Handle the partitioning time
973         passed from the UIProcess.
974
975 2018-01-29  Alex Christensen  <achristensen@webkit.org>
976
977         Fix crash when during canAuthenticateAgainstProtectionSpace
978         https://bugs.webkit.org/show_bug.cgi?id=182260
979         <rdar://problem/34911343>
980
981         Reviewed by Chris Dumez.
982
983         If we have a valid network load with no challenge completion handler and we are
984         telling it to continue with the challenge handling, something has gone wrong.
985         Maybe we've just recovered from a crashed network process.  If this happens, do nothing.
986
987         * NetworkProcess/NetworkLoad.cpp:
988         (WebKit::NetworkLoad::continueCanAuthenticateAgainstProtectionSpace):
989
990 2018-01-29  Zach Li  <zacharyli323@gmail.com>
991
992         Warning in 32-bit WebKit build when trying to link to SafariSafeBrowsing
993         https://bugs.webkit.org/show_bug.cgi?id=182251
994         rdar://problem/36964995
995
996         Reviewed by Alex Christensen.
997
998         * Configurations/WebKit.xcconfig:
999         Only link against SafariSafeBrowsing framework in 64-bit architecture.
1000
1001         * Platform/spi/Cocoa/SafeBrowsingSPI.h:
1002         Guard the Safe Browsing code with WK_API_ENABLED.
1003
1004 2018-01-29  Chris Dumez  <cdumez@apple.com>
1005
1006         Make sure we do not re-enter Webcore during StorageToWebProcessConnection::EstablishSWServerConnection Sync IPC
1007         https://bugs.webkit.org/show_bug.cgi?id=182256
1008         <rdar://problem/36689233>
1009
1010         Reviewed by Simon Fraser.
1011
1012         Make sure we do not re-enter Webcore during StorageToWebProcessConnection::EstablishSWServerConnection Sync IPC as
1013         this can lead to crashes such as the one in <rdar://problem/36689233>.
1014
1015         * WebProcess/Storage/WebSWClientConnection.cpp:
1016         (WebKit::WebSWClientConnection::WebSWClientConnection):
1017
1018 2018-01-29  Jan-Michael Brummer  <jan.brummer@tabos.org>
1019
1020         [GTK] Zooming gesture incorrectly uses scale instead of zoom 
1021         https://bugs.webkit.org/show_bug.cgi?id=182174
1022
1023         Reviewed by Michael Catanzaro.
1024
1025         Switch zooming gesture to use zoom instead of scale function.
1026
1027         * UIProcess/gtk/GestureController.cpp:
1028         (WebKit::GestureController::ZoomGesture::begin):
1029         (WebKit::GestureController::ZoomGesture::handleZoom):
1030
1031 2018-01-29  Brady Eidson  <beidson@apple.com>
1032
1033         Make it possible for apps that use both WK1 and WK2 to use MessagePorts.
1034         https://bugs.webkit.org/show_bug.cgi?id=182229
1035
1036         Reviewed by Chris Dumez.
1037
1038         * UIProcess/UIMessagePortChannelProvider.cpp:
1039         (WebKit::UIMessagePortChannelProvider::UIMessagePortChannelProvider):
1040
1041         * UIProcess/WebPageProxy.cpp:
1042         (WebKit::m_configurationPreferenceValues): The UI process does not need to override the 
1043           global singleton provider. It can remain the default ProviderImpl to allow WK1 views 
1044           to work fine, too.
1045
1046 2018-01-29  Carlos Garcia Campos  <cgarcia@igalia.com>
1047
1048         WebDriver: ASSERTION FAILED: !m_loadTimer.isActive()
1049         https://bugs.webkit.org/show_bug.cgi?id=182237
1050
1051         Reviewed by Carlos Alberto Lopez Perez.
1052
1053         We should stop the load timer when we dispatch the pending navigation callbacks due to an alert open.
1054
1055         * UIProcess/Automation/WebAutomationSession.cpp:
1056         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
1057
1058 2018-01-29  Zan Dobersek  <zdobersek@igalia.com>
1059
1060         [Cairo] Add GraphicsContextImplCairo::createFactory() helpers
1061         https://bugs.webkit.org/show_bug.cgi?id=182238
1062
1063         Reviewed by Carlos Garcia Campos.
1064
1065         Use GraphicsContextImplCairo::createFactory() helpers throughout the
1066         Cairo-specific GraphicsContext constructors in the WebKit layer.
1067
1068         * Shared/cairo/ShareableBitmapCairo.cpp:
1069         (WebKit::ShareableBitmap::createGraphicsContext):
1070         * UIProcess/cairo/BackingStoreCairo.cpp:
1071         (WebKit::BackingStore::incorporateUpdate):
1072         * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:
1073         (WebKit::WebPrintOperationGtk::renderPage):
1074
1075 2018-01-29  Zan Dobersek  <zdobersek@igalia.com>
1076
1077         [Cairo] Remove the GraphicsContext(cairo_t*) constructor
1078         https://bugs.webkit.org/show_bug.cgi?id=182234
1079
1080         Reviewed by Carlos Garcia Campos.
1081
1082         Call sites of the GraphicsContext(cairo_t*) constructor are adjusted to
1083         instead provide a factory function that returns a fresh
1084         GraphicsContextImplCairo object, passing that cairo_t object to its
1085         constructor.
1086
1087         * Shared/cairo/ShareableBitmapCairo.cpp:
1088         (WebKit::ShareableBitmap::createGraphicsContext):
1089         * UIProcess/cairo/BackingStoreCairo.cpp:
1090         (WebKit::BackingStore::incorporateUpdate):
1091         * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:
1092         (WebKit::WebPrintOperationGtk::renderPage):
1093
1094 2018-01-26  Megan Gardner  <megan_gardner@apple.com>
1095
1096         Don't retain focus for input peripheral views
1097         https://bugs.webkit.org/show_bug.cgi?id=182204
1098
1099         Reviewed by Tim Horton.
1100
1101         Retaining focus on input peripheral views makes it so they cannot dismiss themselves with
1102         the current architecture. This should probably be fixed in UIKit, as there is no reason for
1103         focus to be retained on these views anyways, as they don't have keyboard input, but this
1104         guards against over-aggressive retain requests.
1105
1106         * UIProcess/ios/WKContentViewInteraction.mm:
1107         (-[WKContentView _restoreFocusWithToken:]):
1108         (-[WKContentView _preserveFocusWithToken:destructively:]):
1109
1110 2018-01-26  Chris Dumez  <cdumez@apple.com>
1111
1112         Make sure service worker code does not launch a StorageProcess unnecessarily
1113         https://bugs.webkit.org/show_bug.cgi?id=182192
1114         <rdar://problem/36927427>
1115
1116         Reviewed by Geoffrey Garen.
1117
1118         When calling WebProcess::existingWebToStorageProcessConnection(), make sure we do not
1119         force the creation of a WebProcess connection to the StorageProcess. If there is
1120         no WebProcess, just return false right away.
1121
1122         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
1123         (WebKit::WebServiceWorkerProvider::existingServiceWorkerConnectionForSession):
1124         * WebProcess/WebProcess.h:
1125
1126 2018-01-26  Alex Christensen  <achristensen@webkit.org>
1127
1128         Allow cellular access for default-created ephemeral sessions
1129         https://bugs.webkit.org/show_bug.cgi?id=182179
1130         <rdar://problem/36572023>
1131
1132         Reviewed by Andy Estes.
1133
1134         This makes it so when we recover from a NetworkProcess crash (see r227590) on iOS, we will
1135         be able to continue browsing using cell data.
1136
1137         * Shared/WebsiteDataStoreParameters.cpp:
1138         (WebKit::WebsiteDataStoreParameters::privateSessionParameters):
1139         * UIProcess/WebProcessPool.cpp:
1140         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
1141         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1142         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
1143
1144 2018-01-26  Alex Christensen  <achristensen@webkit.org>
1145
1146         Clean up more networking code
1147         https://bugs.webkit.org/show_bug.cgi?id=182161
1148
1149         Reviewed by Anders Carlsson.
1150
1151         Two cleanups:
1152         1. The WebProcess doesn't need to initialize NetworkSessions.
1153         2. WebFrameNetworkingContext doesn't need to have the NetworkingContext functions to support ResourceHandles in WebKit any more.
1154
1155         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1156         * NetworkProcess/NetworkLoad.h:
1157         * NetworkProcess/RemoteNetworkingContext.h:
1158         (): Deleted.
1159         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1160         * NetworkProcess/curl/RemoteNetworkingContextCurl.cpp:
1161         (WebKit::RemoteNetworkingContext::~RemoteNetworkingContext): Deleted.
1162         (WebKit::RemoteNetworkingContext::isValid const): Deleted.
1163         (WebKit::RemoteNetworkingContext::storageSession const): Deleted.
1164         * NetworkProcess/mac/RemoteNetworkingContext.mm:
1165         (WebKit::RemoteNetworkingContext::~RemoteNetworkingContext): Deleted.
1166         (WebKit::RemoteNetworkingContext::isValid const): Deleted.
1167         (WebKit::RemoteNetworkingContext::localFileContentSniffingEnabled const): Deleted.
1168         (WebKit::RemoteNetworkingContext::storageSession const): Deleted.
1169         (WebKit::RemoteNetworkingContext::sourceApplicationAuditData const): Deleted.
1170         (WebKit::RemoteNetworkingContext::sourceApplicationIdentifier const): Deleted.
1171         (WebKit::RemoteNetworkingContext::blockedError const): Deleted.
1172         * NetworkProcess/soup/RemoteNetworkingContextSoup.cpp:
1173         (WebKit::RemoteNetworkingContext::~RemoteNetworkingContext): Deleted.
1174         (WebKit::RemoteNetworkingContext::isValid const): Deleted.
1175         (WebKit::RemoteNetworkingContext::storageSession const): Deleted.
1176         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
1177         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
1178         * WebProcess/WebProcess.cpp:
1179         (WebKit::WebProcess::initializeWebProcess):
1180         (WebKit::WebProcess::clearCachedCredentials):
1181
1182 2018-01-26  Jan-Michael Brummer  <jan.brummer@tabos.org>
1183
1184         [GTK] Support using long-tap gesture to open context menu
1185         https://bugs.webkit.org/show_bug.cgi?id=140747
1186
1187         Reviewed by Carlos Garcia Campos.
1188
1189         Add long press gesture which simulates a secondary mouse press to open context menu.
1190
1191         * UIProcess/gtk/GestureController.cpp:
1192         (WebKit::GestureController::GestureController):
1193         (WebKit::GestureController::handleEvent):
1194         (WebKit::GestureController::isProcessingGestures const):
1195         (WebKit::GestureController::Gesture::simulateMousePress):
1196         (WebKit::GestureController::DragGesture::handleTap):
1197         (WebKit::GestureController::LongPressGesture::longPressed):
1198         (WebKit::GestureController::LongPressGesture::pressed):
1199         (WebKit::GestureController::LongPressGesture::LongPressGesture):
1200         * UIProcess/gtk/GestureController.h:
1201         (WebKit::GestureController::reset):
1202
1203 2018-01-26  Carlos Garcia Campos  <cgarcia@igalia.com>
1204
1205         Unreviewed. REGRESSION(r227647): window.open() is broken in GTK and WPE after r227647.
1206
1207         In r227647, API::UIClient::createNewPage() was changed to use CompletionHandler instead of Function. All
1208         implementations were updated expect the GLib one, and we didn't notice it because the method doesn't have the
1209         final/override mark.
1210
1211         * UIProcess/API/glib/WebKitUIClient.cpp:
1212         (UIClient::createNewPage):
1213
1214 2018-01-25  Sergio Villar Senin  <svillar@igalia.com>
1215
1216         [WebVR] Make WebVR available by default for developer builds
1217         https://bugs.webkit.org/show_bug.cgi?id=182101
1218
1219         Reviewed by Michael Catanzaro.
1220
1221         Moved WebVR setting to the experimental features section and make it
1222         available by default for developer builds for GTK and WPE.
1223
1224         * Shared/WebPreferences.yaml:
1225
1226 2018-01-25  Alex Christensen  <achristensen@webkit.org>
1227
1228         REGRESSION (r221899): Web Content process hangs when webpage tries to make a new window if the WKWebView doesn’t have a UI delegate
1229         https://bugs.webkit.org/show_bug.cgi?id=182152
1230
1231         Reviewed by Joseph Pecoraro.
1232
1233         Call the completion handler of the default API::UIClient::createNewPage.
1234
1235         * UIProcess/API/APIUIClient.h:
1236         (API::UIClient::createNewPage):
1237         * UIProcess/API/C/WKPage.cpp:
1238         (WKPageSetPageUIClient):
1239         * UIProcess/Cocoa/UIDelegate.h:
1240         * UIProcess/Cocoa/UIDelegate.mm:
1241         (WebKit::UIDelegate::UIClient::createNewPage):
1242
1243 2018-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
1244
1245         [iOS] [WK2] Introduce new views and view controllers to support extra-zoomed text form controls
1246         https://bugs.webkit.org/show_bug.cgi?id=182000
1247         <rdar://problem/35143035>
1248
1249         Reviewed by Tim Horton.
1250
1251         Add new files to support text form control editing while extra-zoomed.
1252
1253         * UIProcess/ios/forms/WKFocusedFormControlView.h: Added.
1254         * UIProcess/ios/forms/WKFocusedFormControlView.mm: Added.
1255         * UIProcess/ios/forms/WKFocusedFormControlViewController.h: Added.
1256         * UIProcess/ios/forms/WKFocusedFormControlViewController.mm: Added.
1257         * UIProcess/ios/forms/WKTextFormControlViewController.h: Added.
1258         * UIProcess/ios/forms/WKTextFormControlViewController.mm: Added.
1259         * UIProcess/ios/forms/WKTextInputViewController.h: Added.
1260         * UIProcess/ios/forms/WKTextInputViewController.mm: Added.
1261         * UIProcess/ios/forms/WKTextSuggestionButton.h: Added.
1262         * UIProcess/ios/forms/WKTextSuggestionButton.mm: Added.
1263         * WebKit.xcodeproj/project.pbxproj:
1264
1265 2018-01-25  Chris Dumez  <cdumez@apple.com>
1266
1267         Clients.get(id) should only returns clients in the service worker's origin
1268         https://bugs.webkit.org/show_bug.cgi?id=182149
1269         <rdar://problem/36882310>
1270
1271         Reviewed by Youenn Fablet.
1272
1273         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1274         (WebKit::WebSWServerConnection::postMessageToServiceWorker):
1275
1276 2018-01-25  Youenn Fablet  <youenn@apple.com>
1277
1278         WebPluginInfoProvider should handle null host queries
1279         https://bugs.webkit.org/show_bug.cgi?id=182112
1280
1281         Reviewed by Chris Dumez.
1282
1283         Return early if host is null.
1284
1285         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
1286         (WebKit::WebPluginInfoProvider::populatePluginCache):
1287
1288 2018-01-25  Simon Fraser  <simon.fraser@apple.com>
1289
1290         ASSERT(CGSizeEqualToSize(m_resizeScrollOffset, CGSizeZero)) in WebViewImpl::setFrameAndScrollBy()
1291         https://bugs.webkit.org/show_bug.cgi?id=182082
1292         rdar://problem/13971838
1293
1294         Reviewed by Tim Horton.
1295
1296         Safari could call WebViewImpl::setFrameAndScrollBy() multiple times with different scroll offsets,
1297         triggering this assertion.
1298
1299         Rename to m_resizeScrollOffset to m_scrollOffsetAdjustment to reduce confusion with actual scroll offsets.
1300         This parameter has no effect on macOS, but is used by the -[WKWebView setFrame:andScrollBy:] so at some point
1301         needs to be hooked up to allow synchronous view resize and scroll adjustment (e.g. for the Find bar animation).
1302         
1303         Remove DrawingAreaProxy's m_layerPosition which was unused, and remove the parameters from the UpdateGeometry message.
1304
1305         * UIProcess/API/Cocoa/WKWebView.mm:
1306         (-[WKWebView _frameOrBoundsChanged]):
1307         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
1308         * UIProcess/Cocoa/WebViewImpl.h:
1309         * UIProcess/Cocoa/WebViewImpl.mm:
1310         (WebKit::WebViewImpl::setFrameAndScrollBy):
1311         (WebKit::WebViewImpl::setDrawingAreaSize):
1312         * UIProcess/DrawingAreaProxy.cpp:
1313         (WebKit::DrawingAreaProxy::setSize):
1314         * UIProcess/DrawingAreaProxy.h:
1315         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
1316         (WebKit::RemoteLayerTreeDrawingAreaProxy::sendUpdateGeometry):
1317         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
1318         (WebKit::TiledCoreAnimationDrawingAreaProxy::sendUpdateGeometry):
1319         * WebProcess/WebPage/DrawingArea.h:
1320         (WebKit::DrawingArea::updateGeometry):
1321         * WebProcess/WebPage/DrawingArea.messages.in:
1322         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
1323         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1324         (WebKit::RemoteLayerTreeDrawingArea::updateGeometry):
1325         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
1326         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1327         (WebKit::TiledCoreAnimationDrawingArea::updateGeometry):
1328
1329 2018-01-25  Keith Rollin  <krollin@apple.com>
1330
1331         Add logging to facilitate binding of WebContent and Network processes to UI process
1332         https://bugs.webkit.org/show_bug.cgi?id=182066
1333
1334         Reviewed by Brent Fulgham.
1335
1336         When examining sysdiagnose logs and tracing events from one process to
1337         another, it would be helpful to know which WebKit processes were
1338         related to each other. When Safari, Mail, Messages, etc. are all
1339         running at the same time, it may otherwise be difficult to know if a
1340         particular Network process, for example was associated with Safari or
1341         some other application. Add some logging to the creation of WebContent
1342         and Network processes to identify their "presenting process" (parent
1343         application).
1344
1345         * NetworkProcess/NetworkProcess.cpp:
1346         (WebKit::NetworkProcess::initializeNetworkProcess):
1347         * Platform/Logging.h:
1348         * WebProcess/WebProcess.cpp:
1349         (WebKit::WebProcess::initializeWebProcess):
1350
1351 2018-01-25  Youenn Fablet  <youenn@apple.com>
1352
1353         DocumentLoader should interrupt ongoing load when getting a redirection from network that matches a service worker
1354         https://bugs.webkit.org/show_bug.cgi?id=182115
1355
1356         Reviewed by Alex Christensen.
1357
1358         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
1359         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
1360
1361 2018-01-25  Alex Christensen  <achristensen@webkit.org>
1362
1363         Fix crash when preconnecting while closing private browsing
1364         https://bugs.webkit.org/show_bug.cgi?id=182114
1365         <rdar://problem/35637284>
1366
1367         Reviewed by Joseph Pecoraro.
1368
1369         * NetworkProcess/PreconnectTask.cpp:
1370         There is a race condition when destroying a session while a page is initiating a preconnect.
1371         If this happens, fail gracefully instead of trying to preconnect with a null session.
1372
1373 2018-01-25  Dan Bernstein  <mitz@apple.com>
1374
1375         [Mac] Enable library validation for Networking & Storage XPC services
1376         https://bugs.webkit.org/show_bug.cgi?id=173424
1377         <rdar://problem/32386565>
1378
1379         Reviewed by Joseph Pecoraro.
1380
1381         * Configurations/BaseXPCService.xcconfig: Moved the definitions of
1382           WK_LIBRARY_VALIDATION_ENABLED and WK_LIBRARY_VALIDATION_CODE_SIGN_FLAGS from
1383           WebContentService.xcconfig to here and made them Mac-only at this level.
1384         * Configurations/NetworkService.xcconfig: Also set OTHER_CODE_SIGN_FLAGS to
1385           WK_LIBRARY_VALIDATION_CODE_SIGN_FLAGS.
1386         * Configurations/StorageService.xcconfig: Ditto.
1387         * Configurations/WebContentService.xcconfig: Moved definitions from here to
1388           BaseXPCService.xcconfig.
1389
1390 2018-01-25  David Hyatt  <hyatt@apple.com>
1391
1392         Enable lines clamp support for Apple Mail by default
1393         https://bugs.webkit.org/show_bug.cgi?id=182113
1394
1395         Reviewed by Dean Jackson.
1396
1397         * Shared/WebPageCreationParameters.cpp:
1398         (WebKit::WebPageCreationParameters::encode const):
1399         (WebKit::WebPageCreationParameters::decode):
1400         * Shared/WebPageCreationParameters.h:
1401         * UIProcess/WebPageProxy.cpp:
1402         (WebKit::WebPageProxy::creationParameters):
1403         * UIProcess/WebPageProxy.h:
1404         * UIProcess/mac/WebPageProxyMac.mm:
1405         (WebKit::WebPageProxy::appleMailLinesClampEnabled):
1406         * WebProcess/WebPage/WebPage.cpp:
1407         (WebKit::m_cpuLimit):
1408
1409 2018-01-25  Sergio Villar Senin  <svillar@igalia.com>
1410
1411         [WebVR][GTK][WPE] Remove the WebVR public API added in r227518
1412         https://bugs.webkit.org/show_bug.cgi?id=182102
1413
1414         Reviewed by Carlos Garcia Campos.
1415
1416         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
1417
1418 2018-01-25  Sergio Villar Senin  <svillar@igalia.com>
1419
1420         [WebVR][GTK][WPE] Remove the WebVR public API added in r227518
1421         https://bugs.webkit.org/show_bug.cgi?id=182102
1422
1423         Reviewed by Carlos Garcia Campos.
1424
1425         This new public API was not supposed to be included in the patch
1426         that added OpenVR to the tree and to the build.
1427
1428         * UIProcess/API/glib/WebKitSettings.cpp:
1429         (webKitSettingsSetProperty):
1430         (webKitSettingsGetProperty):
1431         (webkit_settings_class_init):
1432         (webkit_settings_get_enable_webvr): Deleted.
1433         (webkit_settings_set_enable_webvr): Deleted.
1434         * UIProcess/API/gtk/WebKitSettings.h:
1435         * UIProcess/API/wpe/WebKitSettings.h:
1436
1437 2018-01-25  Claudio Saavedra  <csaavedra@igalia.com>
1438
1439         [GTK] Fix build with touch events disabled
1440
1441         Unreviewed build fix.
1442
1443         Explicitly include gtk.h in files that were indirectly getting it
1444         only when touch events were enabled.
1445         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
1446         * UIProcess/gtk/WaylandCompositor.h:
1447
1448 2018-01-25  Carlos Garcia Campos  <cgarcia@igalia.com>
1449
1450         WebDriver: test imported/selenium/py/test/selenium/webdriver/common/alerts_tests.py crashes in debug
1451         https://bugs.webkit.org/show_bug.cgi?id=182096
1452
1453         Reviewed by Carlos Alberto Lopez Perez.
1454
1455         It's an assert in HashTable iterators checkValidity(). The problem is that we get the keys to iterate the values
1456         and the map is modified inside the loop. We need to use copyToVector to copy the keys.
1457
1458         * UIProcess/Automation/WebAutomationSession.cpp:
1459         (WebKit::WebAutomationSession::respondToPendingPageNavigationCallbacksWithTimeout):
1460         (WebKit::WebAutomationSession::respondToPendingFrameNavigationCallbacksWithTimeout):
1461         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
1462
1463 2018-01-24  Alex Christensen  <achristensen@webkit.org>
1464
1465         Gracefully recover from NetworkProcess crashes in private browsing
1466         https://bugs.webkit.org/show_bug.cgi?id=182073
1467         <rdar://problem/36572023>
1468
1469         Reviewed by Geoff Garen.
1470
1471         If we're using a non-persistent WKWebsiteDataStore and the NetworkProcess crashes and we try to do a load,
1472         then the WebProcess restarts the NetworkProcess but doesn't recreate the ephemeral session in the NetworkProcess.
1473         When this happens, we've already lost the browsing state in memory in the NetworkProcess, but we don't want to hang.
1474         If this is the problem, then just recreate the ephemeral session and continue loading.
1475
1476         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1477         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForFrame):
1478         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage):
1479         * NetworkProcess/NetworkResourceLoader.cpp:
1480         (WebKit::NetworkResourceLoader::startNetworkLoad):
1481         * Shared/WebsiteDataStoreParameters.cpp:
1482         (WebKit::WebsiteDataStoreParameters::privateSessionParameters):
1483         (WebKit::WebsiteDataStoreParameters::legacyPrivateSessionParameters): Deleted.
1484         * Shared/WebsiteDataStoreParameters.h:
1485         (WebKit::WebsiteDataStoreParameters::legacyPrivateSessionParameters):
1486
1487 2018-01-24  Dan Bernstein  <mitz@apple.com>
1488
1489         Enable library validation on the Web Content service
1490         Part 1 of https://bugs.webkit.org/show_bug.cgi?id=172365
1491         <rdar://problem/26470661>
1492
1493         Reviewed by David Kilzer.
1494
1495         This makes the Web Content process signed with the Library Validation flag in production
1496         builds. Because doing so would prevent engineering builds of Apple apps that use an
1497         injected bundle from working, this also adds a Development version of the service, which
1498         does not enforce Library Validation. The UI process chooses to use the Development service
1499         iff it would need to load an injected bundle that is not part of the OS.
1500
1501         * Configurations/DebugRelease.xcconfig: Disable Library Validation in engineering builds.
1502
1503         * Configurations/WebContentService.Development.xcconfig: Added. Like the normal service, but
1504           only installed when WebKit is installed in the OS, and uses a Development variant.
1505
1506         * Configurations/WebContentService.xcconfig: For the Development variant, append
1507           ".Development" to the product name, which is also the service identifier. Enable Library
1508           Validation for the Normal variant of the service when WK_LIBRARY_VALIDATION_ENABLED allows
1509           it.
1510
1511         * UIProcess/Launcher/ProcessLauncher.h: Add nonValidInjectedCodeAllowed member to
1512           LaunchOptions, false by default.
1513
1514         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1515         (WebKit::serviceName): Use the Development variant if nonValidInjectedCodeAllowed is true.
1516
1517         * UIProcess/WebProcessProxy.cpp:
1518         (WebKit::WebProcessProxy::getLaunchOptions): Initialize nonValidInjectedCodeAllowed using
1519            the new shouldAllowNonValidInjectedCode().
1520         (WebKit::WebProcessProxy::shouldAllowNonValidInjectedCode const): Generic implementation
1521           that returns false.
1522         * UIProcess/WebProcessProxy.h: Declared shouldAllowNonValidInjectedCode.
1523         * UIProcess/mac/WebProcessProxyMac.mm:
1524         (WebKit::WebProcessProxy::shouldAllowNonValidInjectedCode const): Return true if this is
1525           system WebKit with a non-system injected bundle.
1526
1527         * WebKit.xcodeproj/project.pbxproj: Added new service target.
1528
1529 2018-01-24  Chris Dumez  <cdumez@apple.com>
1530
1531         Add a IPC::SendSyncOption indicating we should not process incoming IPC while waiting for the sync reply
1532         https://bugs.webkit.org/show_bug.cgi?id=182021
1533         <rdar://problem/21629943>
1534
1535         Reviewed by Ryosuke Niwa.
1536
1537         Add a new DoNotProcessIncomingMessagesWhenWaitingForSyncReply SendSyncOption that the caller can
1538         set when calling sendSync(). This indicates that the sendSync() should return only when we receive
1539         the response to our sync IPC message, and that we should not process ANY incoming IPC in the meantime.
1540
1541         This patch also starts using this flag in 3 places where we know processing incoming IPC is an issue
1542         and is causing crashes.
1543
1544         * Platform/IPC/Connection.cpp:
1545         (IPC::Connection::sendSyncMessage):
1546         When DoNotProcessIncomingMessagesWhenWaitingForSyncReply SendSyncOption is set, make sure
1547         we set the ShouldDispatchMessageWhenWaitingForSyncReply flag on the encoder. If we did not set this
1548         flag then it could cause deadlocks when the destination process is also waiting on a synchronous
1549         IPC from us. Normally, this flag already gets set for sync messages because sendSyncMessage() calls
1550         sendMessage() with DispatchMessageEvenWhenWaitingForSyncReply SyncOption. However, sendMessage()
1551         ignores the DispatchMessageEvenWhenWaitingForSyncReply flag if the
1552         m_onlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage flag is set on the
1553         connection. Note that this flag is set on the connection from the WebProcess to the UIProcess at
1554         the moment, which is why we saw deadlocks on the previous iteration of this patch.
1555
1556         (IPC::Connection::waitForSyncReply):
1557         If DoNotProcessIncomingMessagesWhenWaitingForSyncReply SendSyncOption is set, do not
1558         process incoming IPC messages while waiting for our sync IPC reply.
1559
1560         * Platform/IPC/Connection.h:
1561         Add new SendSyncOption.
1562
1563         * UIProcess/WebProcessProxy.cpp:
1564         (WebKit::WebProcessProxy::testIncomingSyncIPCMessageWhileWaitingForSyncReply):
1565         * UIProcess/WebProcessProxy.h:
1566         * UIProcess/WebProcessProxy.messages.in:
1567         Testing infrastructure.
1568
1569         * WebProcess/Network/WebLoaderStrategy.cpp:
1570         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
1571         Use new flag.
1572
1573         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1574         (WebKit::WebChromeClient::testIncomingSyncIPCMessageWhileWaitingForSyncReply):
1575         * WebProcess/WebCoreSupport/WebChromeClient.h:
1576         Testing infrastructure.
1577
1578         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1579         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue):
1580         Use new flag.
1581
1582         * WebProcess/WebProcess.cpp:
1583         (WebKit::WebProcess::syncIPCMessageWhileWaitingForSyncReplyForTesting):
1584         Testing infrastructure.
1585
1586         (WebKit::WebProcess::ensureNetworkProcessConnection):
1587         Use new flag.
1588
1589         * WebProcess/WebProcess.h:
1590         * WebProcess/WebProcess.messages.in:
1591         Testing infrastructure.
1592
1593 2018-01-24  Joseph Pecoraro  <pecoraro@apple.com>
1594
1595         Web Inspector: Remove duplicate preference update for WebAuthentication value
1596         https://bugs.webkit.org/show_bug.cgi?id=182058
1597
1598         Reviewed by Brian Burg.
1599
1600         * WebProcess/WebPage/WebPage.cpp:
1601         (WebKit::WebPage::updatePreferences):
1602         An identical update already happens in generated code.
1603
1604 2018-01-24  Alex Christensen  <achristensen@webkit.org>
1605
1606         Remove WebProcess access to QTKit
1607         https://bugs.webkit.org/show_bug.cgi?id=182035
1608
1609         Reviewed by Alexey Proskuryakov.
1610
1611         * WebProcess/com.apple.WebProcess.sb.in:
1612         This isn't needed any more.  We only have a little bit of code that uses QTKit which we should remove,
1613         and it's only used for fullscreen controls in WebKitLegacy.  Let's tighten up the sandbox!
1614
1615 2018-01-24  Alex Christensen  <achristensen@webkit.org>
1616
1617         Remove pre-Sierra-OS-specific code in WebKit
1618         https://bugs.webkit.org/show_bug.cgi?id=182024
1619
1620         Reviewed by Tim Horton.
1621
1622         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
1623         * Shared/Cocoa/DataDetectionResult.mm:
1624         (WebKit::DataDetectionResult::encode const):
1625         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
1626         (IPC::ArgumentCoder<WebCore::Payment>::encode):
1627         (IPC::ArgumentCoder<WebCore::PaymentContact>::encode):
1628         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::encode):
1629         (IPC::ArgumentCoder<WebCore::PaymentMethod>::encode):
1630         * Shared/WebPreferencesDefaultValues.h:
1631         * Shared/cg/ShareableBitmapCG.cpp:
1632         (WebKit::wantsExtendedRange):
1633         * Shared/ios/InteractionInformationAtPosition.mm:
1634         (WebKit::InteractionInformationAtPosition::encode const):
1635         * Shared/mac/CodeSigning.mm:
1636         (WebKit::codeSigningIdentifier):
1637         (WebKit::codeSigningIdentifierForCurrentProcess):
1638         * Shared/mac/ColorSpaceData.mm:
1639         (WebKit::ColorSpaceData::encode const):
1640         * Shared/mac/PasteboardTypes.mm:
1641         (WebKit::PasteboardTypes::forURL):
1642         * Shared/mac/WebCoreArgumentCodersMac.mm:
1643         (IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData):
1644         (IPC::ArgumentCoder<Credential>::encodePlatformData):
1645         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::encode):
1646         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData):
1647         * Shared/mac/WebHitTestResultData.mm:
1648         (WebKit::WebHitTestResultData::platformEncode const):
1649         * UIProcess/API/Cocoa/WKProcessPool.mm:
1650         (-[WKProcessPool _setObject:forBundleParameter:]):
1651         (-[WKProcessPool _setObjectsForBundleParametersWithDictionary:]):
1652         * UIProcess/API/Cocoa/WKWebView.mm:
1653         (-[WKWebView _handleAcceptedCandidate:]):
1654         * UIProcess/Cocoa/WebViewImpl.h:
1655         * UIProcess/Cocoa/WebViewImpl.mm:
1656         (WebKit::WebViewImpl::handleAcceptedCandidate):
1657         (WebKit::WebViewImpl::performDragOperation):
1658         * UIProcess/mac/WebPopupMenuProxyMac.mm:
1659         (WebKit::WebPopupMenuProxyMac::showPopupMenu):
1660         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1661         (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]):
1662         * WebProcess/com.apple.WebProcess.sb.in:
1663
1664 2018-01-24  Alex Christensen  <achristensen@webkit.org>
1665
1666         Stop using AuthenticationClient in WebKit
1667         https://bugs.webkit.org/show_bug.cgi?id=182016
1668
1669         Reviewed by Brady Eidson.
1670
1671         It was necessary to support ResourceHandle use in WebKit, but now we're using NetworkSession everywhere in WebKit.
1672
1673         * Shared/Authentication/AuthenticationManager.cpp:
1674         (WebKit::AuthenticationManager::useCredentialForSingleChallenge):
1675         (WebKit::AuthenticationManager::continueWithoutCredentialForSingleChallenge):
1676         (WebKit::AuthenticationManager::cancelSingleChallenge):
1677         (WebKit::AuthenticationManager::performDefaultHandlingForSingleChallenge):
1678         (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge):
1679
1680 2018-01-24  Alex Christensen  <achristensen@webkit.org>
1681
1682         Remove WebProcess authentication code
1683         https://bugs.webkit.org/show_bug.cgi?id=182020
1684
1685         Reviewed by Brady Eidson.
1686
1687         * Shared/Authentication/AuthenticationManager.cpp:
1688         * Shared/Authentication/AuthenticationManager.h:
1689         * UIProcess/WebPageProxy.cpp:
1690         (WebKit::WebPageProxy::didReceiveAuthenticationChallenge): Deleted.
1691         * UIProcess/WebPageProxy.h:
1692         * UIProcess/WebPageProxy.messages.in:
1693         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1694         (WebKit::WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge):
1695         * WebProcess/WebProcess.cpp:
1696         (WebKit::m_webSQLiteDatabaseTracker):
1697
1698 2018-01-24  Jan-Michael Brummer  <jan.brummer@tabos.org>
1699
1700         [GTK] Page crash after swipe gesture running GNOME3 under wayland
1701         https://bugs.webkit.org/show_bug.cgi?id=181996
1702
1703         Reviewed by Michael Catanzaro.
1704
1705         Add missing GDK_TOUCH_CANCEL support which fixes page crashes due to cancelled gestures.
1706         * Shared/gtk/WebEventFactory.cpp:
1707         (WebKit::WebEventFactory::createWebTouchEvent):
1708         * UIProcess/API/gtk/PageClientImpl.cpp:
1709         (WebKit::PageClientImpl::doneWithTouchEvent):
1710         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1711         (touchPointStateForEvents):
1712         (webkitWebViewBaseGetTouchPointsForEvent):
1713         (webkitWebViewBaseTouchEvent):
1714         * UIProcess/gtk/GestureController.cpp:
1715         (WebKit::GestureController::handleEvent):
1716
1717 2018-01-24  Alex Christensen  <achristensen@webkit.org>
1718
1719         Remove unused QTKit preference
1720         https://bugs.webkit.org/show_bug.cgi?id=181968
1721
1722         Reviewed by Alexey Proskuryakov.
1723
1724         * Shared/API/c/WKDeprecatedFunctions.cpp:
1725         (WKPreferencesSetQTKitEnabled):
1726         (WKPreferencesGetQTKitEnabled):
1727         * Shared/WebPreferences.yaml:
1728         * UIProcess/API/C/WKPreferences.cpp:
1729         (WKPreferencesSetQTKitEnabled): Deleted.
1730         (WKPreferencesGetQTKitEnabled): Deleted.
1731         * UIProcess/API/Cocoa/WKPreferences.mm:
1732         (-[WKPreferences _setQTKitEnabled:]): Deleted.
1733         (-[WKPreferences _qtKitEnabled]): Deleted.
1734         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1735
1736 2018-01-24  Youenn Fablet  <youenn@apple.com>
1737
1738         Fetch response should copy its url from the request if null
1739         https://bugs.webkit.org/show_bug.cgi?id=182048
1740
1741         Reviewed by Chris Dumez.
1742
1743         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
1744         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
1745
1746 2018-01-24  Sergio Villar Senin  <svillar@igalia.com>
1747
1748         Unreviewed build fix after r227518. I forgot to add the function declarations to the WPE
1749         header.
1750
1751         * UIProcess/API/wpe/WebKitSettings.h: Added webkit_settings_get/set_enable_webvr.
1752
1753 2018-01-24  Youenn Fablet  <youenn@apple.com>
1754
1755         Add Cache Storage engine assertion following on bug 181887
1756         https://bugs.webkit.org/show_bug.cgi?id=181925
1757
1758         Reviewed by Alex Christensen.
1759
1760         In a normal environment, the folderPath should be the same as the path computed from the ClientOrigin.
1761         Add assertion to verify this.
1762
1763         * NetworkProcess/cache/CacheStorageEngine.cpp:
1764         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
1765
1766 2018-01-24  Michael Catanzaro  <mcatanzaro@igalia.com>
1767
1768         [GTK] Use GDK_EVENT_PROPAGATE and GDK_EVENT_STOP in WebKitWebViewBase.cpp
1769         https://bugs.webkit.org/show_bug.cgi?id=182031
1770
1771         Reviewed by Carlos Garcia Campos.
1772
1773         No functional changes, this just replaces TRUE with GDK_EVENT_STOP and FALSE with
1774         GDK_EVENT_PROPAGATE, to improve readability.
1775
1776         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1777         (webkitWebViewBaseKeyPressEvent):
1778         (webkitWebViewBaseKeyReleaseEvent):
1779         (webkitWebViewBaseButtonPressEvent):
1780         (webkitWebViewBaseButtonReleaseEvent):
1781         (webkitWebViewBaseScrollEvent):
1782         (webkitWebViewBaseMotionNotifyEvent):
1783         (webkitWebViewBaseCrossingNotifyEvent):
1784         (webkitWebViewBaseTouchEvent):
1785
1786 2018-01-23  Eric Carlson  <eric.carlson@apple.com>
1787
1788         Resign NowPlaying status when no media element is eligible
1789         https://bugs.webkit.org/show_bug.cgi?id=181914
1790         <rdar://problem/35294116>
1791
1792         Reviewed by Jer Noble.
1793
1794         * UIProcess/API/Cocoa/WKWebView.mm:
1795         (-[WKWebView _requestActiveNowPlayingSessionInfo:]): Return registeredAsNowPlayingApplication
1796         status.
1797         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1798
1799         * UIProcess/WebPageProxy.cpp:
1800         (WebKit::WebPageProxy::nowPlayingInfoCallback): Ditto.
1801         * UIProcess/WebPageProxy.h:
1802         * UIProcess/WebPageProxy.messages.in:
1803         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
1804         (WebKit::WebPage::requestActiveNowPlayingSessionInfo): Ditto.
1805
1806 2018-01-23  Alex Christensen  <achristensen@webkit.org>
1807
1808         Use CompletionHandlers for ResourceHandleClient::didReceiveResponseAsync
1809         https://bugs.webkit.org/show_bug.cgi?id=181961
1810
1811         Reviewed by Michael Catanzaro.
1812
1813         * NetworkProcess/Downloads/Download.h:
1814         * NetworkProcess/NetworkLoad.cpp:
1815         * NetworkProcess/NetworkLoad.h:
1816         * NetworkProcess/NetworkResourceLoadParameters.h:
1817         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1818         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
1819         * WebProcess/WebPage/mac/WebPageMac.mm:
1820         * WebProcess/WebProcess.cpp:
1821
1822 2018-01-23  Chris Dumez  <cdumez@apple.com>
1823
1824         Unreviewed, rollout r227216 as it seems to be causing deadlocks
1825         https://bugs.webkit.org/show_bug.cgi?id=182013
1826
1827         * Platform/IPC/Connection.cpp:
1828         (IPC::Connection::waitForSyncReply):
1829         * Platform/IPC/Connection.h:
1830         (IPC::Connection::setShouldProcessIncomingMessagesWhileWaitingForSyncReply): Deleted.
1831         * UIProcess/WebProcessProxy.cpp:
1832         (WebKit::WebProcessProxy::testIncomingSyncIPCMessageWhileWaitingForSyncReply): Deleted.
1833         * UIProcess/WebProcessProxy.h:
1834         * UIProcess/WebProcessProxy.messages.in:
1835         * WebProcess/Network/NetworkProcessConnection.cpp:
1836         (WebKit::NetworkProcessConnection::NetworkProcessConnection):
1837         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
1838         (WebKit::WebToStorageProcessConnection::WebToStorageProcessConnection):
1839         * WebProcess/WebConnectionToUIProcess.cpp:
1840         (WebKit::WebConnectionToUIProcess::WebConnectionToUIProcess):
1841         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1842         (WebKit::WebChromeClient::testIncomingSyncIPCMessageWhileWaitingForSyncReply): Deleted.
1843         * WebProcess/WebCoreSupport/WebChromeClient.h:
1844         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1845         (WebKit::WebEditorClient::undo):
1846         (WebKit::WebEditorClient::redo):
1847         * WebProcess/WebProcess.cpp:
1848         (WebKit::WebProcess::syncIPCMessageWhileWaitingForSyncReplyForTesting): Deleted.
1849         * WebProcess/WebProcess.h:
1850         * WebProcess/WebProcess.messages.in:
1851
1852 2018-01-23  Commit Queue  <commit-queue@webkit.org>
1853
1854         Unreviewed, rolling out r227437.
1855         https://bugs.webkit.org/show_bug.cgi?id=182011
1856
1857         broke build (Requested by alexchristensen on #webkit).
1858
1859         Reverted changeset:
1860
1861         "Remove unused QTKit preference"
1862         https://bugs.webkit.org/show_bug.cgi?id=181968
1863         https://trac.webkit.org/changeset/227437
1864
1865 2018-01-23  Alex Christensen  <achristensen@webkit.org>
1866
1867         Remove compile guard around beacon API
1868         https://bugs.webkit.org/show_bug.cgi?id=182002
1869
1870         Reviewed by Sam Weinig.
1871
1872         It's enabled everywhere now.
1873
1874         * Shared/WebPreferences.yaml:
1875         * UIProcess/API/C/WKPreferences.cpp:
1876         (WKPreferencesSetBeaconAPIEnabled):
1877         (WKPreferencesGetBeaconAPIEnabled):
1878         * config.h:
1879
1880 2018-01-23  Alex Christensen  <achristensen@webkit.org>
1881
1882         Remove unused QTKit preference
1883         https://bugs.webkit.org/show_bug.cgi?id=181968
1884
1885         Reviewed by Alexey Proskuryakov.
1886
1887         * Shared/API/c/WKDeprecatedFunctions.cpp:
1888         (WKPreferencesSetQTKitEnabled):
1889         (WKPreferencesGetQTKitEnabled):
1890         * Shared/WebPreferences.yaml:
1891         * UIProcess/API/C/WKPreferences.cpp:
1892         (WKPreferencesSetQTKitEnabled): Deleted.
1893         (WKPreferencesGetQTKitEnabled): Deleted.
1894         * UIProcess/API/Cocoa/WKPreferences.mm:
1895         (-[WKPreferences _setQTKitEnabled:]): Deleted.
1896         (-[WKPreferences _qtKitEnabled]): Deleted.
1897         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1898
1899 2018-01-23  Brent Fulgham  <bfulgham@apple.com>
1900
1901         [macOS] WebProcess needs TCC entitlements for media capture
1902         https://bugs.webkit.org/show_bug.cgi?id=181995
1903         <rdar://problem/36674649>
1904
1905         Reviewed by Eric Carlson.
1906
1907         * Configurations/WebContent-OSX.entitlements: Add delegated services needed to support media
1908         capture features.
1909
1910 2018-01-23  Dan Bernstein  <mitz@apple.com>
1911
1912         [Cocoa] Disable header postprocessing when building for macOS High Sierra
1913         https://bugs.webkit.org/show_bug.cgi?id=181972
1914
1915         Reviewed by Anders Carlsson.
1916
1917         * Configurations/WebKit.xcconfig: Adopt macOSTargetConditionals.xcconfig helpers and disable postprocessing
1918           when building for macOS 10.13.
1919
1920 2018-01-23  Joseph Pecoraro  <pecoraro@apple.com>
1921
1922         Web Inspector: Window resizing is broken after detaching to separate window
1923         https://bugs.webkit.org/show_bug.cgi?id=181992
1924         <rdar://problem/36714840>
1925
1926         Reviewed by Brian Burg.
1927
1928         * UIProcess/mac/WebInspectorProxyMac.mm:
1929         (WebKit::WebInspectorProxy::platformDetach):
1930         Restore the inspector view's autoresizingMask to the initial value
1931         that works with a detached window. This gets changed when the view
1932         gets attached to bottom/side, so we need to revert it on detaching.
1933
1934 2018-01-23  Brady Eidson  <beidson@apple.com>
1935
1936         Allow passing MessagePorts across processes (e.g. ServiceWorkers).
1937         https://bugs.webkit.org/show_bug.cgi?id=181178
1938
1939         Reviewed by Andy Estes.
1940
1941         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1942         (WebKit::WebSWServerConnection::postMessageToServiceWorker):
1943         (WebKit::WebSWServerConnection::postMessageToServiceWorkerClient):
1944         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1945         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
1946
1947         * StorageProcess/StorageProcess.cpp:
1948         (WebKit::StorageProcess::postMessageToServiceWorkerClient):
1949         * StorageProcess/StorageProcess.h:
1950         * StorageProcess/StorageProcess.messages.in:
1951
1952         * UIProcess/WebProcessProxy.cpp:
1953         (WebKit::WebProcessProxy::entangleLocalPortInThisProcessToRemote):
1954         (WebKit::WebProcessProxy::postMessageToRemote):
1955
1956         * WebProcess/Storage/WebSWClientConnection.cpp:
1957         (WebKit::WebSWClientConnection::postMessageToServiceWorker):
1958         (WebKit::WebSWClientConnection::postMessageToServiceWorkerClient):
1959         * WebProcess/Storage/WebSWClientConnection.h:
1960         * WebProcess/Storage/WebSWClientConnection.messages.in:
1961
1962         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1963         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorker):
1964         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerClient):
1965         * WebProcess/Storage/WebSWContextManagerConnection.h:
1966         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
1967
1968 2018-01-23  Commit Queue  <commit-queue@webkit.org>
1969
1970         Unreviewed, rolling out r227279 and r227373.
1971         https://bugs.webkit.org/show_bug.cgi?id=181988
1972
1973         The LayoutTest crash fix introduced an API test failure.
1974         (Requested by ryanhaddad on #webkit).
1975
1976         Reverted changesets:
1977
1978         "Resign NowPlaying status when no media element is eligible"
1979         https://bugs.webkit.org/show_bug.cgi?id=181914
1980         https://trac.webkit.org/changeset/227279
1981
1982         "Resign NowPlaying status when no media element is eligible"
1983         https://bugs.webkit.org/show_bug.cgi?id=181914
1984         https://trac.webkit.org/changeset/227373
1985
1986 2018-01-23  Youenn Fablet  <youenn@apple.com>
1987
1988         REGRESSION (r227348): ASSERT_NOT_REACHED in WebKit::ServiceWorkerClientFetch::didFinish()
1989         https://bugs.webkit.org/show_bug.cgi?id=181956
1990         <rdar://problem/36755492>
1991
1992         Reviewed by Chris Dumez.
1993
1994         Covered by test no longer crashing in Debug builds.
1995         Reset m_redirectionStatus to None when starting an SW fetch.
1996
1997         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
1998         (WebKit::ServiceWorkerClientFetch::start):
1999         (WebKit::ServiceWorkerClientFetch::didFinish):
2000
2001 2018-01-23  Michael Catanzaro  <mcatanzaro@igalia.com>
2002
2003         [WPE] TestWebKitFindController asserts
2004         https://bugs.webkit.org/show_bug.cgi?id=181472
2005
2006         Reviewed by Carlos Garcia Campos.
2007
2008         Let's fix this in two independent ways.
2009
2010         First, use a GRefPtr to hold ownership of the WebKitWebViewBackend. This way, we don't need
2011         to change the order in which WebKitWebView destroys its priv struct members from what is
2012         used in WebKitGTK+, which can lead to odd bugs.
2013
2014         Additionally, just for good measure, stop resetting the find client when disposing
2015         WebKitFindController. This is unnecessary because it will never be destroyed before the
2016         WebKitWebView.
2017
2018         * UIProcess/API/glib/WebKitFindController.cpp:
2019         (webkit_find_controller_class_init):
2020         (webkitFindControllerDispose): Deleted.
2021         * UIProcess/API/glib/WebKitWebView.cpp:
2022         (_WebKitWebViewPrivate::~_WebKitWebViewPrivate):
2023         (webkitWebViewSetProperty):
2024         (webkitWebViewGetProperty):
2025         (webkitWebViewCreatePage):
2026         (webkit_web_view_get_backend):
2027         * UIProcess/API/wpe/WebKitWebViewBackend.cpp:
2028         (webkitWebViewBackendCreateDefault):
2029         (WTF::refGPtr):
2030         (WTF::derefGPtr):
2031         * UIProcess/API/wpe/WebKitWebViewBackendPrivate.h:
2032
2033 2018-01-22  Jon Lee  <jonlee@apple.com>
2034
2035         Update title label size
2036         https://bugs.webkit.org/show_bug.cgi?id=181962
2037         rdar://problem/36754744
2038
2039         Reviewed by Simon Fraser.
2040
2041         * UIProcess/ios/WKFullScreenWindowControllerIOS.mm:
2042         (-[_WKFullScreenViewController setLocation:secure:trustedName:trustedSite:]): Move titleLabel properties into
2043         createSubviews.
2044         (-[_WKFullScreenViewController createSubviews]): Set the title label for both the cancel and location buttons.
2045         Refer to a const CGFloat for the font size.
2046
2047 2018-01-22  Megan Gardner  <megan_gardner@apple.com>
2048
2049         Temporarily restore block selection code conditionally
2050         https://bugs.webkit.org/show_bug.cgi?id=181895
2051         <rdar://problem/36567325>
2052
2053         Reviewed by Tim Horton.
2054
2055         We need to restore this code temporarily to avoid a crash.
2056
2057         * Platform/spi/ios/UIKitSPI.h:
2058         * UIProcess/ios/WKContentViewInteraction.mm:
2059         (-[WKContentView changeBlockSelectionWithTouchAt:withSelectionTouch:forHandle:]):
2060
2061 2018-01-22  Zach Li  <zacharyli323@gmail.com>
2062
2063         We should not try to link against the Safe Browsing framework on watchOS and tvOS.
2064         https://bugs.webkit.org/show_bug.cgi?id=181965.
2065
2066         Reviewed by Tim Horton.
2067
2068         * Configurations/WebKit.xcconfig:
2069
2070 2018-01-22  Alex Christensen  <achristensen@webkit.org>
2071
2072         Remove pre-NetworkSession loading code
2073         https://bugs.webkit.org/show_bug.cgi?id=181944
2074
2075         Reviewed by Tim Horton.
2076
2077         We were keeping it around for El Capitan.
2078
2079         * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm:
2080         (WebKit::LegacyCustomProtocolManager::registerProtocolClass):
2081         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp:
2082         (WebKit::LegacyCustomProtocolManager::initialize):
2083         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h:
2084         * NetworkProcess/Downloads/BlobDownloadClient.cpp: Removed.
2085         * NetworkProcess/Downloads/BlobDownloadClient.h: Removed.
2086         * NetworkProcess/Downloads/Download.cpp:
2087         (WebKit::Download::~Download):
2088         (WebKit::Download::cancel):
2089         (WebKit::Download::didReceiveChallenge):
2090         (WebKit::Download::didFinish):
2091         (WebKit::Download::isAlwaysOnLoggingAllowed const):
2092         (WebKit::Download::start): Deleted.
2093         (WebKit::Download::startWithHandle): Deleted.
2094         (WebKit::Download::didStart): Deleted.
2095         (WebKit::Download::willSendRedirectedRequest): Deleted.
2096         (WebKit::Download::didReceiveAuthenticationChallenge): Deleted.
2097         (WebKit::Download::didReceiveResponse): Deleted.
2098         (WebKit::Download::shouldDecodeSourceDataOfMIMEType): Deleted.
2099         (WebKit::Download::decideDestinationWithSuggestedFilename): Deleted.
2100         (WebKit::Download::decideDestinationWithSuggestedFilenameAsync): Deleted.
2101         (WebKit::Download::didDecideDownloadDestination): Deleted.
2102         (WebKit::Download::continueDidReceiveResponse): Deleted.
2103         * NetworkProcess/Downloads/Download.h:
2104         (WebKit::Download::setBlobFileReferences): Deleted.
2105         (WebKit::Download::request const): Deleted.
2106         * NetworkProcess/Downloads/DownloadManager.cpp:
2107         (WebKit::DownloadManager::startDownload):
2108         (WebKit::DownloadManager::willDecidePendingDownloadDestination):
2109         (WebKit::DownloadManager::convertNetworkLoadToDownload):
2110         (WebKit::DownloadManager::continueDecidePendingDownloadDestination):
2111         (WebKit::DownloadManager::resumeDownload):
2112         (WebKit::DownloadManager::cancelDownload):
2113         * NetworkProcess/Downloads/DownloadManager.h:
2114         (WebKit::DownloadManager::startDownload):
2115         * NetworkProcess/Downloads/PendingDownload.cpp:
2116         * NetworkProcess/Downloads/PendingDownload.h:
2117         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
2118         * NetworkProcess/Downloads/ios/DownloadIOS.mm: Removed.
2119         * NetworkProcess/Downloads/mac/DownloadMac.mm: Removed.
2120         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
2121         * NetworkProcess/NetworkCORSPreflightChecker.h:
2122         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2123         (WebKit::NetworkConnectionToWebProcess::loadPing):
2124         * NetworkProcess/NetworkDataTask.cpp:
2125         * NetworkProcess/NetworkDataTask.h:
2126         * NetworkProcess/NetworkDataTaskBlob.cpp:
2127         * NetworkProcess/NetworkDataTaskBlob.h:
2128         * NetworkProcess/NetworkLoad.cpp:
2129         (WebKit::NetworkLoad::~NetworkLoad):
2130         (WebKit::NetworkLoad::setDefersLoading):
2131         (WebKit::NetworkLoad::cancel):
2132         (WebKit::NetworkLoad::continueWillSendRequest):
2133         (WebKit::NetworkLoad::continueDidReceiveResponse):
2134         (WebKit::NetworkLoad::shouldCaptureExtraNetworkLoadMetrics const):
2135         (WebKit::NetworkLoad::didReceiveResponseAsync): Deleted.
2136         (WebKit::NetworkLoad::didReceiveBuffer): Deleted.
2137         (WebKit::NetworkLoad::didFinishLoading): Deleted.
2138         (WebKit::NetworkLoad::didFail): Deleted.
2139         (WebKit::NetworkLoad::willSendRequestAsync): Deleted.
2140         (WebKit::NetworkLoad::canAuthenticateAgainstProtectionSpaceAsync): Deleted.
2141         (WebKit::NetworkLoad::shouldUseCredentialStorage): Deleted.
2142         (WebKit::NetworkLoad::didReceiveAuthenticationChallenge): Deleted.
2143         (WebKit::NetworkLoad::receivedCancellation): Deleted.
2144         * NetworkProcess/NetworkLoad.h:
2145         * NetworkProcess/NetworkLoadParameters.h:
2146         * NetworkProcess/NetworkProcess.cpp:
2147         (WebKit::NetworkProcess::initializeNetworkProcess):
2148         (WebKit::NetworkProcess::clearCachedCredentials):
2149         (WebKit::NetworkProcess::findPendingDownloadLocation):
2150         * NetworkProcess/NetworkProcess.h:
2151         * NetworkProcess/NetworkProcess.messages.in:
2152         * NetworkProcess/NetworkResourceLoader.cpp:
2153         (WebKit::NetworkResourceLoader::startNetworkLoad):
2154         * NetworkProcess/NetworkSession.cpp:
2155         * NetworkProcess/NetworkSession.h:
2156         * NetworkProcess/PingLoad.cpp:
2157         * NetworkProcess/PingLoad.h:
2158         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
2159         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
2160         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
2161         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2162         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2163         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2164         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
2165         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2166         * NetworkProcess/mac/NetworkLoadMac.mm: Removed.
2167         * NetworkProcess/mac/RemoteNetworkingContext.mm:
2168         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
2169         * Shared/Authentication/AuthenticationManager.cpp:
2170         (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
2171         (WebKit::AuthenticationManager::useCredentialForSingleChallenge):
2172         (WebKit::AuthenticationManager::continueWithoutCredentialForSingleChallenge):
2173         (WebKit::AuthenticationManager::cancelSingleChallenge):
2174         (WebKit::AuthenticationManager::performDefaultHandlingForSingleChallenge):
2175         (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge):
2176         * Shared/Authentication/AuthenticationManager.h:
2177         * Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm: Removed.
2178         * Shared/SessionTracker.cpp:
2179         (WebKit::SessionTracker::setSession):
2180         (WebKit::SessionTracker::destroySession):
2181         * Shared/SessionTracker.h:
2182         * Shared/mac/CookieStorageShim.h: Removed.
2183         * Shared/mac/CookieStorageShim.mm: Removed.
2184         * UIProcess/API/APIDownloadClient.h:
2185         (API::DownloadClient::didReceiveData):
2186         (API::DownloadClient::shouldDecodeSourceDataOfMIMEType): Deleted.
2187         * UIProcess/API/C/WKContext.cpp:
2188         (WKContextSetDownloadClient):
2189         * UIProcess/Cocoa/DownloadClient.h:
2190         * UIProcess/Cocoa/DownloadClient.mm:
2191         (WebKit::DownloadClient::shouldDecodeSourceDataOfMIMEType): Deleted.
2192         * UIProcess/Downloads/DownloadProxy.cpp:
2193         (WebKit::DownloadProxy::willSendRequest):
2194         (WebKit::DownloadProxy::didReceiveResponse):
2195         (WebKit::DownloadProxy::shouldDecodeSourceDataOfMIMEType): Deleted.
2196         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename): Deleted.
2197         * UIProcess/Downloads/DownloadProxy.h:
2198         * UIProcess/Downloads/DownloadProxy.messages.in:
2199         * WebKit.xcodeproj/project.pbxproj:
2200         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
2201         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
2202         * WebProcess/WebProcess.cpp:
2203         (WebKit::WebProcess::initializeWebProcess):
2204         (WebKit::WebProcess::clearCachedCredentials):
2205         * config.h:
2206
2207 2018-01-22  Youenn Fablet  <youenn@apple.com>
2208
2209         SW: Make sure ServiceWorker loading and requests are correctly cleared by ITP
2210         https://bugs.webkit.org/show_bug.cgi?id=181942
2211         <rdar://problem/35132091>
2212
2213         Reviewed by Chris Dumez.
2214
2215         Add ServiceWorkerRegistrations and DOMCache as persistent data to be cleared according ITP decisions.
2216
2217         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2218         (WebKit::WebResourceLoadStatisticsStore::monitoredDataTypes):
2219
2220 2018-01-22  Chris Dumez  <cdumez@apple.com>
2221
2222         Add release logging to help debug issues related to service workers
2223         https://bugs.webkit.org/show_bug.cgi?id=181935
2224         <rdar://problem/36735900>
2225
2226         Reviewed by Brady Eidson.
2227
2228         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2229         (WebKit::WebSWServerConnection::startFetch):
2230         (WebKit::WebSWServerConnection::didFinishFetch):
2231         (WebKit::WebSWServerConnection::didFailFetch):
2232         (WebKit::WebSWServerConnection::didNotHandleFetch):
2233
2234 2018-01-22  Brent Fulgham  <bfulgham@apple.com>
2235
2236         [iOS] REGRESSION (r225763): Allow access to power logging features
2237         https://bugs.webkit.org/show_bug.cgi?id=181938
2238         <rdar://problem/36442803>
2239
2240         Reviewed by Eric Carlson.
2241
2242         I denied access to the powerlog facility in r225763, not realizing that it
2243         gets activated in certain logging scenarios. This patch reverts this change.
2244
2245         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2246
2247 2018-01-22  Brent Fulgham  <bfulgham@apple.com>
2248
2249         [macOS, iOS] Allow accss to AVFoundation preference
2250         https://bugs.webkit.org/show_bug.cgi?id=181937
2251         <rdar://problem/33137029>
2252
2253         Reviewed by Eric Carlson.
2254
2255         Grant access to the 'com.apple.avfoundation.frecents' preference.
2256
2257         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2258         * WebProcess/com.apple.WebProcess.sb.in:
2259
2260 2018-01-22  Brady Eidson  <beidson@apple.com>
2261
2262         In WebKit2, make the MessagePortChannelRegistry live in the UI process.
2263         https://bugs.webkit.org/show_bug.cgi?id=181922
2264
2265         Reviewed by Andy Estes.
2266
2267         With all of the work that went into making MessagePorts be fully asynchronous
2268         and to be process-aware, formally moving them out-of-process is just a matter
2269         of adding WebKit IPC layers.
2270         
2271         The basic unit of asynchronicity is "MessagePortChannelProvider", and this patch
2272         adds both a WebMessagePortChannelProvider and UIMessagePortChannelProvider for
2273         each side of the process divide.
2274         
2275         * UIProcess/UIMessagePortChannelProvider.cpp: Added.
2276         (WebKit::UIMessagePortChannelProvider::singleton):
2277         (WebKit::UIMessagePortChannelProvider::UIMessagePortChannelProvider):
2278         (WebKit::UIMessagePortChannelProvider::~UIMessagePortChannelProvider):
2279         (WebKit::UIMessagePortChannelProvider::createNewMessagePortChannel):
2280         (WebKit::UIMessagePortChannelProvider::entangleLocalPortInThisProcessToRemote):
2281         (WebKit::UIMessagePortChannelProvider::messagePortDisentangled):
2282         (WebKit::UIMessagePortChannelProvider::messagePortClosed):
2283         (WebKit::UIMessagePortChannelProvider::takeAllMessagesForPort):
2284         (WebKit::UIMessagePortChannelProvider::postMessageToRemote):
2285         (WebKit::UIMessagePortChannelProvider::checkRemotePortForActivity):
2286         (WebKit::UIMessagePortChannelProvider::checkProcessLocalPortForActivity):
2287         * UIProcess/UIMessagePortChannelProvider.h: Added.
2288         (WebKit::UIMessagePortChannelProvider::registry):
2289
2290         * UIProcess/WebPageProxy.cpp:
2291         (WebKit::m_configurationPreferenceValues):
2292
2293         * UIProcess/WebProcessProxy.cpp:
2294         (WebKit::WebProcessProxy::processForIdentifier):
2295         (WebKit::m_userMediaCaptureManagerProxy):
2296         (WebKit::WebProcessProxy::~WebProcessProxy):
2297         (WebKit::WebProcessProxy::shutDown):
2298         (WebKit::WebProcessProxy::createNewMessagePortChannel):
2299         (WebKit::WebProcessProxy::entangleLocalPortInThisProcessToRemote):
2300         (WebKit::WebProcessProxy::messagePortDisentangled):
2301         (WebKit::WebProcessProxy::messagePortClosed):
2302         (WebKit::WebProcessProxy::takeAllMessagesForPort):
2303         (WebKit::WebProcessProxy::didDeliverMessagePortMessages):
2304         (WebKit::WebProcessProxy::postMessageToRemote):
2305         (WebKit::WebProcessProxy::checkRemotePortForActivity):
2306         (WebKit::WebProcessProxy::checkProcessLocalPortForActivity):
2307         (WebKit::WebProcessProxy::didCheckProcessLocalPortForActivity):
2308         * UIProcess/WebProcessProxy.h:
2309         * UIProcess/WebProcessProxy.messages.in:
2310
2311         * WebKit.xcodeproj/project.pbxproj:
2312
2313         * WebProcess/WebCoreSupport/WebMessagePortChannelProvider.cpp: Added.
2314         (WebKit::WebMessagePortChannelProvider::singleton):
2315         (WebKit::WebMessagePortChannelProvider::WebMessagePortChannelProvider):
2316         (WebKit::WebMessagePortChannelProvider::~WebMessagePortChannelProvider):
2317         (WebKit::WebMessagePortChannelProvider::createNewMessagePortChannel):
2318         (WebKit::WebMessagePortChannelProvider::entangleLocalPortInThisProcessToRemote):
2319         (WebKit::WebMessagePortChannelProvider::messagePortDisentangled):
2320         (WebKit::WebMessagePortChannelProvider::messagePortClosed):
2321         (WebKit::WebMessagePortChannelProvider::takeAllMessagesForPort):
2322         (WebKit::WebMessagePortChannelProvider::didTakeAllMessagesForPort):
2323         (WebKit::WebMessagePortChannelProvider::didCheckRemotePortForActivity):
2324         (WebKit::WebMessagePortChannelProvider::postMessageToRemote):
2325         (WebKit::WebMessagePortChannelProvider::checkProcessLocalPortForActivity):
2326         (WebKit::WebMessagePortChannelProvider::checkRemotePortForActivity):
2327         * WebProcess/WebCoreSupport/WebMessagePortChannelProvider.h: Added.
2328
2329         * WebProcess/WebProcess.cpp:
2330         (WebKit::WebProcess::initializeProcess):
2331         (WebKit::WebProcess::didTakeAllMessagesForPort):
2332         (WebKit::WebProcess::checkProcessLocalPortForActivity):
2333         (WebKit::WebProcess::didCheckRemotePortForActivity):
2334         (WebKit::WebProcess::messagesAvailableForPort):
2335         * WebProcess/WebProcess.h:
2336         * WebProcess/WebProcess.messages.in:
2337
2338 2018-01-22  Youenn Fablet  <youenn@apple.com>
2339
2340         Bump default cache storage quota to 50MB
2341         https://bugs.webkit.org/show_bug.cgi?id=181924
2342
2343         Reviewed by Chris Dumez.
2344
2345         Existing web sites use more than 20 MB.
2346
2347         * UIProcess/WebsiteData/WebsiteDataStore.h:
2348
2349 2018-01-22  Zan Dobersek  <zdobersek@igalia.com>
2350
2351         Unreviewed build fix after r227292. Fixing a bad copy-paste that broke
2352         the GTK+ debug builds.
2353
2354         * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
2355         (WebKit::convertCairoSurfaceToShareableBitmap):
2356
2357 2018-01-22  Zan Dobersek  <zdobersek@igalia.com>
2358
2359         [Cairo] Refactor PlatformContextCairo::drawSurfaceToContext() into a Cairo operation
2360         https://bugs.webkit.org/show_bug.cgi?id=181930
2361
2362         Reviewed by Carlos Garcia Campos.
2363
2364         Call sites of the PlatformContextCairo::drawSurfaceToContext() method
2365         are adjusted to now call Cairo::drawSurface() and properly pass the
2366         PlatformContextCairo object to the function.
2367
2368         * Shared/cairo/ShareableBitmapCairo.cpp:
2369         (WebKit::ShareableBitmap::paint):
2370         * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
2371         (WebKit::convertCairoSurfaceToShareableBitmap):
2372
2373 2018-01-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2374
2375         Unreviewed. Fix compile warning.
2376
2377         Use #include instead of #import in cross-platform code.
2378
2379         * Shared/WebPreferencesDefaultValues.cpp:
2380
2381 2018-01-21  Ryosuke Niwa  <rniwa@webkit.org>
2382
2383         Turning off custom pasteboard data doesn't actually turn it off in WK2
2384         https://bugs.webkit.org/show_bug.cgi?id=181920
2385         <rdar://problem/36686429>
2386
2387         Reviewed by Wenson Hsieh.
2388
2389         Moved the code to decide when to enable custom pasteboard data from WebCore
2390         since we never enable this feature in WebKit1.
2391
2392         * Shared/WebPreferences.yaml:
2393         * Shared/WebPreferencesDefaultValues.cpp:
2394         (defaultCustomPasteboardDataEnabled): Added.
2395         * Shared/WebPreferencesDefaultValues.h:
2396
2397 2018-01-21  Wenson Hsieh  <wenson_hsieh@apple.com>
2398
2399         Add a new feature flag for EXTRA_ZOOM_MODE and reintroduce AdditionalFeatureDefines.h
2400         https://bugs.webkit.org/show_bug.cgi?id=181918
2401
2402         Reviewed by Tim Horton.
2403
2404         Add EXTRA_ZOOM_MODE to FeatureDefines.xconfig (off by default).
2405
2406         * Configurations/FeatureDefines.xcconfig:
2407
2408 2018-01-21  Eric Carlson  <eric.carlson@apple.com>
2409
2410         Resign NowPlaying status when no media element is eligible
2411         https://bugs.webkit.org/show_bug.cgi?id=181914
2412         <rdar://problem/35294116>
2413
2414         Reviewed by Jer Noble.
2415
2416         * UIProcess/API/Cocoa/WKWebView.mm:
2417         (-[WKWebView _requestActiveNowPlayingSessionInfo:]): Return registeredAsNowPlayingApplication
2418         status.
2419         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2420
2421         * UIProcess/WebPageProxy.cpp:
2422         (WebKit::WebPageProxy::nowPlayingInfoCallback): Ditto.
2423         * UIProcess/WebPageProxy.h:
2424         * UIProcess/WebPageProxy.messages.in:
2425         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
2426         (WebKit::WebPage::requestActiveNowPlayingSessionInfo): Ditto.
2427
2428 2018-01-20  Andy Estes  <aestes@apple.com>
2429
2430         [Apple Pay] Stop eagerly loading PassKit.framework
2431         https://bugs.webkit.org/show_bug.cgi?id=181911
2432         <rdar://problem/36555369>
2433
2434         Reviewed by Tim Horton.
2435
2436         * Shared/WebPageCreationParameters.cpp:
2437         (WebKit::WebPageCreationParameters::encode const):
2438         (WebKit::WebPageCreationParameters::decode):
2439         * Shared/WebPageCreationParameters.h:
2440
2441         Removed availablePaymentNetworks from WebPageCreationParameters.
2442
2443         * UIProcess/API/C/WKPreferences.cpp:
2444         (WKPreferencesSetApplePayEnabled):
2445         * UIProcess/API/Cocoa/WKWebView.mm:
2446         (-[WKWebView _initializeWithConfiguration:]):
2447
2448         Stopped calling WebPaymentCoordinatorProxy::platformSupportsPayments().
2449
2450         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
2451         (WebKit::WebPaymentCoordinatorProxy::availablePaymentNetworks):
2452         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
2453         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in:
2454
2455         Added message AvailablePaymentNetworks, which synchronously returns a Vector of payment
2456         networks.
2457
2458         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2459         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
2460
2461         Returned false if PassKitLibrary() fails.
2462
2463         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard):
2464         (WebKit::WebPaymentCoordinatorProxy::platformOpenPaymentSetup):
2465
2466         Called completionHandler with false if PassKitLibrary() fails.
2467
2468         (WebKit::WebPaymentCoordinatorProxy::platformAvailablePaymentNetworks):
2469         (WebKit::WebPaymentCoordinatorProxy::availablePaymentNetworks):
2470
2471         Renamed availablePaymentNetworks to platformAvailablePaymentNetworks
2472
2473         (WebKit::WebPaymentCoordinatorProxy::platformSupportsPayments): Deleted.
2474
2475         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
2476         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
2477
2478         Called completionHandler with false if PassKitLibrary() fails.
2479
2480         * UIProcess/WebPageProxy.cpp:
2481         (WebKit::WebPageProxy::creationParameters):
2482
2483         Stopped calling WebPaymentCoordinatorProxy::availablePaymentNetworks().
2484
2485         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
2486         (WebKit::WebPaymentCoordinator::availablePaymentNetworks):
2487         (WebKit::WebPaymentCoordinator::validatedPaymentNetwork):
2488         * WebProcess/ApplePay/WebPaymentCoordinator.h:
2489
2490         Implemented PaymentCoordinatorClient::validatedPaymentNetwork(). m_availablePaymentNetworks
2491         starts off as std::nullopt, but is initialized by sending the AvailablePaymentNetworks sync
2492         message the first time it's accessed.
2493
2494         * WebProcess/WebPage/WebPage.cpp:
2495         (WebKit::WebPage::WebPage):
2496
2497         Stopped setting PageConfiguration::availablePaymentNetworks.
2498
2499 2018-01-20  Jer Noble  <jer.noble@apple.com>
2500
2501         Release ASSERT when reloading Vimeo page @ WebCore: WebCore::Document::updateLayout
2502         https://bugs.webkit.org/show_bug.cgi?id=181840
2503         <rdar://problem/36186214>
2504
2505         Reviewed by Simon Fraser.
2506
2507         Updating layout while the document is suspended or stopped is unsafe.
2508
2509         * WebProcess/cocoa/VideoFullscreenManager.mm:
2510         (WebKit::inlineVideoFrame):
2511
2512 2018-01-20  Chris Dumez  <cdumez@apple.com>
2513
2514         DOMCache data sometimes not properly removed when clearing data for a given origin
2515         https://bugs.webkit.org/show_bug.cgi?id=181887
2516         <rdar://problem/36671239>
2517
2518         Reviewed by Youenn Fablet.
2519
2520         * NetworkProcess/cache/CacheStorageEngine.cpp:
2521         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
2522         This code was iterating through folders on disk, then reading the folder's origin
2523         from the origin file on disk. Then, if the origin would match the one we want to
2524         delete, it would regenerate the folder path using cachesRootPath(*folderOrigin).
2525         I don't know how but on my machine, I was ended up in a state where the path
2526         generated by cachesRootPath(*folderOrigin) differed from the actual folder path
2527         we read the origin from (Likely a different salt?). To make the code more robust,
2528         I updated the code to delete "folderPath", which is the path we read the origin
2529         from.
2530
2531 2018-01-19  Zach Li  <zacharyli323@gmail.com>
2532
2533         Expose Safe Browsing SPI
2534         https://bugs.webkit.org/show_bug.cgi?id=181804
2535         <rdar://problem/36626946>
2536
2537         Reviewed by Dan Bernstein.
2538
2539         If client is using Apple internal SDK, then we can just import the header; if not,
2540         then we declare necessary symbols that client will need.
2541
2542         * Configurations/WebKit.xcconfig:
2543         Only link against SafariSafeBrowsing framework on macOS High Sierra
2544         and iOS 11 and above. Weak link against SafariSafeBrowsing framework
2545         because it is not present on the Base system.
2546
2547         * Platform/spi/Cocoa/SafeBrowsingSPI.h: Added.
2548
2549         * WebKit.xcodeproj/project.pbxproj:
2550         Added SafeBrowsingSPI.h.
2551
2552         * WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/11/SafariSafeBrowsing.framework/SafariSafeBrowsing.tbd:
2553         Added.
2554
2555 2018-01-19  Ryan Haddad  <ryanhaddad@apple.com>
2556
2557         Unreviewed build fix, removed unused lambda capture.
2558
2559         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2560         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
2561
2562 2018-01-19  John Wilander  <wilander@apple.com>
2563
2564         Resource Load Statistics: Remove unused calls to WebResourceLoadStatisticsStore:logTestingEvent() to fix API test
2565         https://bugs.webkit.org/show_bug.cgi?id=181890
2566         <rdar://problem/36674772>
2567
2568         Unreviewed API test fix.
2569
2570         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2571         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
2572
2573 2018-01-19  Youenn Fablet  <youenn@apple.com>
2574
2575         Do not go to the storage process when registering a service worker client if there is no service worker registered
2576         https://bugs.webkit.org/show_bug.cgi?id=181740
2577         <rdar://problem/36650400>
2578
2579         Reviewed by Chris Dumez.
2580
2581         UIProcess notifies all web processes to register their service worker clients when spinning the service worker process.
2582         Add private API to set the number of web processes for testing purposes.
2583
2584         * UIProcess/API/Cocoa/WKProcessPool.mm:
2585         (-[WKProcessPool _setMaximumNumberOfProcesses:]):
2586         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2587         * UIProcess/WebProcessPool.cpp:
2588         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
2589         * WebProcess/WebProcess.cpp:
2590         (WebKit::WebProcess::registerServiceWorkerClients):
2591         * WebProcess/WebProcess.h:
2592         * WebProcess/WebProcess.messages.in:
2593
2594 2018-01-19  Dean Jackson  <dino@apple.com>
2595
2596         REGRESSION (r221092): Swipe actions are hard to perform in FastMail app
2597         https://bugs.webkit.org/show_bug.cgi?id=181817
2598         <rdar://problem/35274055>
2599
2600         Reviewed by Simon Fraser.
2601
2602         Add a linked-on-or-after check to set passive touch listeners on document in WebCore.
2603
2604         * CMakeLists.txt:
2605         * Shared/WebPreferences.yaml:
2606         * Shared/WebPreferencesDefaultValues.cpp: Copied from Source/WebKit/UIProcess/Cocoa/VersionChecks.h.
2607         (defaultPassiveTouchListenersAsDefaultOnDocument):
2608         * Shared/WebPreferencesDefaultValues.h:
2609         * UIProcess/Cocoa/VersionChecks.h:
2610         * WebKit.xcodeproj/project.pbxproj:
2611
2612 2018-01-19  Joseph Pecoraro  <pecoraro@apple.com>
2613
2614         [Cocoa] _WKNSWindowExtras.h: Add missing availability annotation
2615         https://bugs.webkit.org/show_bug.cgi?id=181868
2616
2617         Reviewed by Dan Bernstein.
2618
2619         * Shared/API/Cocoa/_WKNSWindowExtras.h:
2620
2621 2018-01-19  John Wilander  <wilander@apple.com>
2622
2623         Resource Load Statistics: Add void to argument list to fix build with -Wstrict-prototypes
2624         https://bugs.webkit.org/show_bug.cgi?id=181870
2625         <rdar://problem/36666750>
2626
2627         Unreviewed build fix.
2628
2629         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2630
2631 2018-01-19  Ryan Haddad  <ryanhaddad@apple.com>
2632
2633         Unreviewed, rolling out r227211.
2634
2635         Breaks iOS Simulator tests.
2636
2637         Reverted changeset:
2638
2639         "Expose Safe Browsing SPI"
2640         https://bugs.webkit.org/show_bug.cgi?id=181804
2641         https://trac.webkit.org/changeset/227211
2642
2643 2018-01-19  John Wilander  <wilander@apple.com>
2644
2645         Resource Load Statistics: Implement callback support for removal of WebsiteDataType::ResourceLoadStatistics
2646         https://bugs.webkit.org/show_bug.cgi?id=181822
2647         https://bugs.webkit.org/show_bug.cgi?id=175263
2648         https://bugs.webkit.org/show_bug.cgi?id=178536
2649         https://bugs.webkit.org/show_bug.cgi?id=181223
2650         https://bugs.webkit.org/show_bug.cgi?id=181482
2651         <rdar://problem/33491222>
2652         <rdar://problem/33805293>
2653         <rdar://problem/36332683>
2654         <rdar://problem/36549026>
2655
2656         Reviewed by Alex Christensen.
2657
2658         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2659         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
2660         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
2661         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2662         (-[WKWebsiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStore]):
2663             Calls the new API with no-op completion handler.
2664         (-[WKWebsiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStore:]):
2665             New API with completion handler.
2666         (-[WKWebsiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours:]):
2667             Calls the new API with no-op completion handler.
2668         (-[WKWebsiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours:completionHandler:]):
2669             New API with completion handler.
2670         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2671         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
2672         (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk):
2673         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2674         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
2675         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
2676         * UIProcess/WebResourceLoadStatisticsStore.h:
2677         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2678         (WebKit::WebsiteDataStore::removeData):
2679         (WebKit::WebsiteDataStore::clearResourceLoadStatisticsInWebProcesses):
2680         * UIProcess/WebsiteData/WebsiteDataStore.h:
2681
2682 2018-01-19  Daniel Bates  <dabates@apple.com>
2683
2684         REGRESSION (r223149): Ref WebPageProxy objects before calling their functionality
2685         https://bugs.webkit.org/show_bug.cgi?id=181863
2686         <rdar://problem/36662452>
2687
2688         Reviewed by Chris Dumez.
2689
2690         More fix ups following r223149. When notifying all pages of a process state change we need to
2691         take care to ref all the pages before iterating over them and notifying them of the change.
2692         Notifying a page of such a state change may ultimately delegate to the embedding client. And
2693         the embedding client can do anything, including deallocating one or more pages.
2694
2695         * UIProcess/WebProcessProxy.cpp:
2696         (WebKit::WebProcessProxy::didBecomeUnresponsive):
2697         (WebKit::WebProcessProxy::didBecomeResponsive):
2698         (WebKit::WebProcessProxy::willChangeIsResponsive):
2699         (WebKit::WebProcessProxy::didChangeIsResponsive):
2700         (WebKit::WebProcessProxy::requestTermination):
2701
2702 2018-01-19  Chris Dumez  <cdumez@apple.com>
2703
2704         The WebContent process should not process incoming IPC while waiting for a sync IPC reply
2705         https://bugs.webkit.org/show_bug.cgi?id=181560
2706
2707         Reviewed by Ryosuke Niwa.
2708
2709         The WebContent process should not process incoming IPC while waiting for a sync IPC reply.
2710         This is causing hard-to-debug crashes because developers often assume the state does not
2711         change during a sendSync() call.
2712
2713         * Platform/IPC/Connection.cpp:
2714         (IPC::Connection::waitForSyncReply):
2715         * Platform/IPC/Connection.h:
2716         (IPC::Connection::setShouldProcessIncomingMessagesWhileWaitingForSyncReply):
2717         * UIProcess/WebProcessProxy.cpp:
2718         (WebKit::WebProcessProxy::testIncomingSyncIPCMessageWhileWaitingForSyncReply):
2719         * UIProcess/WebProcessProxy.h:
2720         * UIProcess/WebProcessProxy.messages.in:
2721         * WebProcess/Network/NetworkProcessConnection.cpp:
2722         (WebKit::NetworkProcessConnection::NetworkProcessConnection):
2723         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
2724         (WebKit::WebToStorageProcessConnection::WebToStorageProcessConnection):
2725         * WebProcess/WebConnectionToUIProcess.cpp:
2726         (WebKit::WebConnectionToUIProcess::WebConnectionToUIProcess):
2727         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2728         (WebKit::WebChromeClient::testIncomingSyncIPCMessageWhileWaitingForSyncReply):
2729         * WebProcess/WebCoreSupport/WebChromeClient.h:
2730         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
2731         (WebKit::WebEditorClient::undo):
2732         (WebKit::WebEditorClient::redo):
2733         * WebProcess/WebProcess.cpp:
2734         (WebKit::WebProcess::syncIPCMessageWhileWaitingForSyncReplyForTesting):
2735         * WebProcess/WebProcess.h:
2736         * WebProcess/WebProcess.messages.in:
2737
2738 2018-01-19  Keith Miller  <keith_miller@apple.com>
2739
2740         HaveInternalSDK includes should be "#include?"
2741         https://bugs.webkit.org/show_bug.cgi?id=179670
2742
2743         Reviewed by Dan Bernstein.
2744
2745         * Configurations/Base.xcconfig:
2746
2747 2018-01-19  Daniel Bates  <dabates@apple.com>
2748
2749         Fix misspelling; substitute willDetachRenderer for willDetatchRenderer.
2750
2751         * WebProcess/Plugins/PDF/PDFPlugin.h:
2752         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2753         (WebKit::PDFPlugin::willDetachRenderer):
2754         (WebKit::PDFPlugin::willDetatchRenderer): Deleted.
2755         * WebProcess/Plugins/Plugin.h:
2756         (WebKit::Plugin::willDetachRenderer):
2757         (WebKit::Plugin::willDetatchRenderer): Deleted.
2758         * WebProcess/Plugins/PluginView.cpp:
2759         (WebKit::PluginView::willDetachRenderer):
2760         (WebKit::PluginView::willDetatchRenderer): Deleted.
2761         * WebProcess/Plugins/PluginView.h:
2762
2763 2018-01-19  Zach Li  <zacharyli323@gmail.com>
2764
2765         Expose Safe Browsing SPI
2766         https://bugs.webkit.org/show_bug.cgi?id=181804
2767         <rdar://problem/36626946>
2768
2769         Reviewed by Alex Christensen.
2770
2771         If client is using Apple internal SDK, then we can just import the header; if not,
2772         then we declare necessary symbols that client will need.
2773
2774         * Configurations/WebKit.xcconfig:
2775         Only link against SafariSafeBrowsing framework on macOS High Sierra
2776         and iOS 11 and above. Weak link against SafariSafeBrowsing framework
2777         because it is not present on the Base system.
2778
2779         * Platform/spi/Cocoa/SafeBrowsingSPI.h: Added.
2780
2781         * WebKit.xcodeproj/project.pbxproj:
2782         Added SafeBrowsingSPI.h.
2783
2784         * WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/11/SafariSafeBrowsing.framework/SafariSafeBrowsing.tbd:
2785         Added.
2786
2787 2018-01-18  Chris Dumez  <cdumez@apple.com>
2788
2789         We should be able to terminate service workers that are unresponsive
2790         https://bugs.webkit.org/show_bug.cgi?id=181563
2791         <rdar://problem/35280031>
2792
2793         Reviewed by Alex Christensen.
2794
2795         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2796         (WebKit::WebSWContextManagerConnection::terminateWorker):
2797         Use a 10 second timeout for forcefully exiting the service worker process when
2798         the service worker in question fails to terminate.
2799
2800         (WebKit::WebSWContextManagerConnection::syncTerminateWorker):
2801         Use a 100ms timeout for forcefully exiting the service worker process when
2802         the service worker in question fails to terminate. This method is only called
2803         from the layout tests, which is why we use a very short timeout.
2804
2805 2018-01-18  Ryan Haddad  <ryanhaddad@apple.com>
2806
2807         Unreviewed, suppress deprecation warnings to fix the build with a newer SDK.
2808
2809         * UIProcess/ios/WKPDFPageNumberIndicator.mm:
2810         (-[WKPDFPageNumberIndicator _makeRoundedCorners]):
2811
2812 2018-01-18  Youenn Fablet  <youenn@apple.com>
2813
2814         Do not go to the storage process when loading a main resource if there is no service worker registered
2815         https://bugs.webkit.org/show_bug.cgi?id=181395
2816
2817         Reviewed by Chris Dumez.
2818
2819         Add a new web process creation parameter to know whether there is any service worker registered at web process creation time.
2820         If there is none, the web process will then start to load HTTP resources from the network.
2821         The connection to the storage process is then executed when receiving the first bytes of the main resource.
2822         This connection is needed as other web processes may create service workers at any given time.
2823         If there is one registered service worker, the web process will wait for its connection to the storage process to be active.
2824
2825         * Shared/WebProcessCreationParameters.cpp:
2826         (WebKit::WebProcessCreationParameters::encode const):
2827         (WebKit::WebProcessCreationParameters::decode):
2828         * Shared/WebProcessCreationParameters.h:
2829         * UIProcess/ServiceWorkerProcessProxy.cpp:
2830         (WebKit::ServiceWorkerProcessProxy::hasRegisteredServiceWorkers):
2831         * UIProcess/ServiceWorkerProcessProxy.h:
2832         * UIProcess/WebProcessPool.cpp:
2833         (WebKit::WebProcessPool::initializeNewWebProcess):
2834         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
2835         (WebKit::WebServiceWorkerProvider::existingServiceWorkerConnectionForSession):
2836         * WebProcess/Storage/WebServiceWorkerProvider.h:
2837         * WebProcess/Storage/WebToStorageProcessConnection.h:
2838         (WebKit::WebToStorageProcessConnection::existingServiceWorkerConnectionForSession):
2839         * WebProcess/WebProcess.cpp:
2840         (WebKit::WebProcess::initializeWebProcess):
2841
2842 2018-01-18  Chris Dumez  <cdumez@apple.com>
2843
2844         Regression(r223149): WebProcessProxy::didClose() no longer refs WebPageProxy objects
2845         https://bugs.webkit.org/show_bug.cgi?id=181771
2846         <rdar://problem/36566237>
2847
2848         Reviewed by Brady Eidson.
2849
2850         * UIProcess/WebProcessProxy.cpp:
2851         (WebKit::WebProcessProxy::didClose):
2852         Use copyToVectorOf<RefPtr<WebPageProxy>>() to maintain pre-r223149 behavior
2853         and ref the pages.
2854
2855 2018-01-18  Dan Bernstein  <mitz@apple.com>
2856
2857         [Xcode] Streamline and future-proof target-macOS-version-dependent build setting definitions
2858         https://bugs.webkit.org/show_bug.cgi?id=181803
2859
2860         Reviewed by Tim Horton.
2861
2862         * Configurations/Base.xcconfig: Updated.
2863         * Configurations/DebugRelease.xcconfig: Ditto.
2864         * Configurations/FeatureDefines.xcconfig: Adopted macOSTargetConditionals helpers.
2865         * Configurations/Version.xcconfig: Updated.
2866         * Configurations/macOSTargetConditionals.xcconfig: Added.  Defines helper build settings
2867           useful for defining settings that depend on the target macOS version.
2868
2869 2018-01-18  Chris Dumez  <cdumez@apple.com>
2870
2871         Service Workers restored from persistent storage have 'redundant' state
2872         https://bugs.webkit.org/show_bug.cgi?id=181749
2873         <rdar://problem/36556486>
2874
2875         Reviewed by Youenn Fablet.
2876
2877         Allow service workers to intercept custom protocol loads as this is useful for
2878         API testing.
2879
2880         * WebProcess/Network/WebLoaderStrategy.cpp:
2881         (WebKit::WebLoaderStrategy::scheduleLoad):
2882         (WebKit::WebLoaderStrategy::tryLoadingUsingURLSchemeHandler):
2883         * WebProcess/Network/WebLoaderStrategy.h:
2884
2885 2018-01-18  Brent Fulgham  <bfulgham@apple.com>
2886
2887         REGRESSION(r225858): Sandbox violations due to blocked access to Spotlight search preferences
2888         https://bugs.webkit.org/show_bug.cgi?id=181797
2889         <rdar://problem/36546412>
2890
2891         Reviewed by Eric Carlson.
2892
2893         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: Add the read permission for
2894         'com.apple.lookup.shared' to support DataDetectors.
2895
2896 2018-01-17  John Wilander  <wilander@apple.com>
2897
2898         Resource Load Statistics: Block cookies for prevalent resources without user interaction
2899         https://bugs.webkit.org/show_bug.cgi?id=177394
2900         <rdar://problem/34613960>
2901
2902         Reviewed by Alex Christensen.
2903
2904         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
2905             Now has m_hasBeenSetToUseStatelessCookieStorage to handle
2906             cookie blocking.
2907         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2908         (WebKit::NetworkDataTaskCocoa::statelessCookieStorage):
2909             Returns singleton empty, deny-all cookie storage for cookie blocking.
2910             The ugly pragma instructions for clang are because the NSString
2911             parameter for _initWithIdentifier was not marked nullable pre-Sierra.
2912         (WebKit::NetworkDataTaskCocoa::applyCookieBlockingPolicy):
2913             Instead of just decision making, this now applies the policy.
2914         (WebKit::NetworkDataTaskCocoa::applyCookiePartitioningPolicy):
2915             New method.
2916         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
2917             Now blocks cookies for domains where cookies will be purged anyway.
2918         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
2919             Now blocks cookies for domains where cookies will be purged anyway.
2920         (WebKit::shouldChangePartition): Deleted.
2921         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2922         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
2923             Now downgrades for blocked cookies instead of partitioned cookies.
2924         (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
2925             Now downgrades for blocked cookies instead of partitioned cookies.
2926
2927
2928 2018-01-17  Stephan Szabo  <stephan.szabo@sony.com>
2929
2930         [Curl] Use ResourceRequest::encodeWithPlatformData()
2931         https://bugs.webkit.org/show_bug.cgi?id=181768
2932
2933         Reviewed by Alex Christensen.
2934
2935         * Shared/curl/WebCoreArgumentCodersCurl.cpp:
2936         (IPC::ArgumentCoder<ResourceRequest>::encodePlatformData):
2937         (IPC::ArgumentCoder<ResourceRequest>::decodePlatformData):
2938
2939 2018-01-17  Matt Lewis  <jlewis3@apple.com>
2940
2941         Unreviewed, rolling out r227076.
2942
2943         This breaks internal builds
2944
2945         Reverted changeset:
2946
2947         "Resource Load Statistics: Block cookies for prevalent
2948         resources without user interaction"
2949         https://bugs.webkit.org/show_bug.cgi?id=177394
2950         https://trac.webkit.org/changeset/227076
2951
2952 2018-01-17  Michael Catanzaro  <mcatanzaro@igalia.com>
2953
2954         WEBKIT_FRAMEWORK should not modify file-global include directories
2955         https://bugs.webkit.org/show_bug.cgi?id=181656
2956
2957         Reviewed by Konstantin Tokarev.
2958
2959         * PlatformGTK.cmake:
2960         * PlatformWPE.cmake:
2961
2962 2018-01-17  Youenn Fablet  <youenn@apple.com>
2963
2964         Put fetch request keepAlive behind a runtime flag
2965         https://bugs.webkit.org/show_bug.cgi?id=181592
2966
2967         Reviewed by Chris Dumez.
2968
2969         * Shared/WebPreferences.yaml:
2970         * UIProcess/API/C/WKPreferences.cpp:
2971         (WKPreferencesSetFetchAPIKeepAliveEnabled):
2972         (WKPreferencesGetFetchAPIKeepAliveEnabled):
2973         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2974
2975 2018-01-17  John Wilander  <wilander@apple.com>
2976
2977         Resource Load Statistics: Block cookies for prevalent resources without user interaction
2978         https://bugs.webkit.org/show_bug.cgi?id=177394
2979         <rdar://problem/34613960>
2980
2981         Reviewed by Alex Christensen.
2982
2983         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
2984             Now has m_hasBeenSetToUseStatelessCookieStorage to handle
2985             cookie blocking.
2986         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2987         (WebKit::NetworkDataTaskCocoa::statelessCookieStorage):
2988             Returns singleton empty, deny-all cookie storage for cookie blocking.
2989         (WebKit::NetworkDataTaskCocoa::applyCookieBlockingPolicy):
2990             Instead of just decision making, this now applies the policy.
2991         (WebKit::NetworkDataTaskCocoa::applyCookiePartitioningPolicy):
2992             New method.
2993         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
2994             Now blocks cookies for domains where cookies will be purged anyway.
2995         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
2996             Now blocks cookies for domains where cookies will be purged anyway.
2997         (WebKit::shouldChangePartition): Deleted.
2998         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2999         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
3000             Now downgrades for blocked cookies instead of partitioned cookies.
3001         (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
3002             Now downgrades for blocked cookies instead of partitioned cookies.
3003
3004 2018-01-17  Daniel Bates  <dabates@apple.com>
3005
3006         REGRESSION (r222795): Cardiogram never signs in
3007         https://bugs.webkit.org/show_bug.cgi?id=181693
3008         <rdar://problem/36286293>
3009
3010         Reviewed by Ryosuke Niwa.
3011
3012         Exempt Cardiogram from the XHR header restrictions in r222795.
3013
3014         Following r222795 only Dashboard widgets are allowed to set arbitrary XHR headers.
3015         However Cardiogram also depends on such functionality.
3016
3017         * Shared/WebPreferences.yaml:
3018         * UIProcess/API/Cocoa/WKWebView.mm:
3019         (shouldAllowSettingAnyXHRHeaderFromFileURLs):
3020         (-[WKWebView _initializeWithConfiguration:]):
3021         * UIProcess/Cocoa/VersionChecks.h:
3022
3023 2018-01-17  Wenson Hsieh  <wenson_hsieh@apple.com>
3024
3025         Add injected bundle SPI to replace subresource URLs when dropping or pasting rich content
3026         https://bugs.webkit.org/show_bug.cgi?id=181637
3027         <rdar://problem/36508471>
3028
3029         Reviewed by Tim Horton.
3030
3031         Add new injected bundle SPI, replacementURLForResource, which clients may use to provide a replacement URL to
3032         represent an archive resource, given the resource's data and MIME type.
3033
3034         * WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h:
3035         (API::InjectedBundle::EditorClient::replacementURLForResource):
3036         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h:
3037         * WebProcess/InjectedBundle/API/c/WKBundlePageEditorClient.h:
3038
3039         Add replacementURLForResource, and also bump the current injected bundle editor client version to 2.
3040
3041         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
3042         (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]):
3043         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
3044         (WebKit::InjectedBundlePageEditorClient::replacementURLForResource):
3045         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h:
3046         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
3047         (WebKit::WebEditorClient::replacementURLForResource):
3048         * WebProcess/WebCoreSupport/WebEditorClient.h:
3049
3050 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
3051
3052         [Cairo] Don't mirror global alpha and image interpolation quality state values in PlatformContextCairo
3053         https://bugs.webkit.org/show_bug.cgi?id=181725
3054
3055         Reviewed by Carlos Garcia Campos.
3056
3057         * Shared/cairo/ShareableBitmapCairo.cpp:
3058         (WebKit::ShareableBitmap::paint):
3059         Adjust the PlatformContextCairo::drawSurfaceToContext() invocation.
3060         * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
3061         (WebKit::convertCairoSurfaceToShareableBitmap): Ditto.
3062
3063 2018-01-17  Carlos Garcia Campos  <cgarcia@igalia.com>
3064
3065         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.19.6 release.
3066
3067         * gtk/NEWS: Add release notes for 2.19.6.
3068
3069 2018-01-17  Carlos Garcia Campos  <cgarcia@igalia.com>
3070
3071         [GTK] Duplicated symbols in libjavascriptcoregtk and libwebkit2gtk can cause crashes in production builds
3072         https://bugs.webkit.org/show_bug.cgi?id=179914
3073
3074         Reviewed by Žan Doberšek.
3075
3076         Add symbols detected by check-for-global-bss-symbols-in-webkigtk-libs to the version script.
3077
3078         * webkitglib-symbols.map:
3079
3080 2018-01-17  Youenn Fablet  <youenn@apple.com>
3081
3082         Clear Caches volatile storage as a memory optimization.
3083         https://bugs.webkit.org/show_bug.cgi?id=181643
3084
3085         Reviewed by Chris Dumez.
3086
3087         clearMemoryRepresentation clears m_caches which exposes data potentially stored in m_volatileStorage.
3088         Clearing m_volatileStorage allows releasing some memory.
3089
3090         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
3091         (WebKit::CacheStorage::Caches::clearMemoryRepresentation):
3092
3093 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
3094
3095         [Cairo] Use one-time ShadowBlur objects when performing shadowing
3096         https://bugs.webkit.org/show_bug.cgi?id=181720
3097
3098         Reviewed by Carlos Garcia Campos.
3099
3100         * Shared/cairo/ShareableBitmapCairo.cpp:
3101         (WebKit::ShareableBitmap::paint):
3102         Adjust the PlatformContextCairo::drawSurfaceToContext() invocation.
3103         * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
3104         (WebKit::convertCairoSurfaceToShareableBitmap): Ditto.
3105
3106 2018-01-16  Fujii Hironori  <Hironori.Fujii@sony.com>
3107
3108         [CMake] Remove WebCoreDerivedSources library target
3109         https://bugs.webkit.org/show_bug.cgi?id=181664
3110
3111         Reviewed by Carlos Garcia Campos.
3112
3113         * CMakeLists.txt: Do not link WebCoreDerivedSources.
3114         * PlatformGTK.cmake: Appended WebCore after WebCorePlatformGTK in WebKit_LIBRARIES.
3115         * PlatformWin.cmake: Ditto.
3116
3117 2018-01-16  Alex Christensen  <achristensen@webkit.org>
3118
3119         Merge sync and async code paths for getting context menus
3120         https://bugs.webkit.org/show_bug.cgi?id=181423
3121
3122         Reviewed by Joseph Pecoraro.
3123
3124         What a mess.  We had a code path for asynchronous context menu generation and a different one for synchronous context menu generation.
3125         This makes it so there is just one.  At the API level we see if there is an asynchronous delegate to call, then synchronous.
3126         There is a subtle theoretical change in behaviour because m_page.contextMenuClient().showContextMenu is now called for the asynchronous
3127         case and it wasn't before, but the one C API client that uses this has nullptr as it's WKPageShowContextMenuCallback, so we won't break anything!
3128
3129         * UIProcess/API/APIContextMenuClient.h:
3130         (API::ContextMenuClient::getContextMenuFromProposedMenu):
3131         (API::ContextMenuClient::getContextMenuFromProposedMenuAsync): Deleted.
3132         * UIProcess/API/C/WKPage.cpp:
3133         (WKPageSetPageContextMenuClient):
3134         * UIProcess/API/glib/WebKitContextMenuClient.cpp:
3135         * UIProcess/WebContextMenuProxy.h:
3136         * UIProcess/gtk/WebContextMenuProxyGtk.cpp:
3137         (WebKit::WebContextMenuProxyGtk::show):
3138         (WebKit::WebContextMenuProxyGtk::showContextMenuWithItems):
3139         * UIProcess/gtk/WebContextMenuProxyGtk.h:
3140         * UIProcess/mac/WebContextMenuProxyMac.h:
3141         * UIProcess/mac/WebContextMenuProxyMac.mm:
3142         (WebKit::WebContextMenuProxyMac::showContextMenuWithItems):
3143         (WebKit::WebContextMenuProxyMac::showContextMenu):
3144         * UIProcess/wpe/WebContextMenuProxyWPE.h:
3145
3146 2018-01-16  Michael Catanzaro  <mcatanzaro@igalia.com>
3147
3148         Don't link WebKit target directly to JavaScriptCore
3149         https://bugs.webkit.org/show_bug.cgi?id=181688
3150
3151         Reviewed by Alex Christensen.
3152
3153         It's safer if we only link to the next lower-layered lib in the stack, so let's just link
3154         directly to WebCore instead.
3155
3156         And WPE doesn't need to specify it twice.
3157
3158         * CMakeLists.txt:
3159         * PlatformMac.cmake:
3160         * PlatformWPE.cmake:
3161
3162 2018-01-16  Eric Carlson  <eric.carlson@apple.com>
3163
3164         AVSampleBufferDisplayLayer should be flushed when application activates
3165         https://bugs.webkit.org/show_bug.cgi?id=181623
3166         <rdar://problem/36487738>
3167
3168         Reviewed by Darin Adler.
3169
3170         * WebProcess/WebPage/ios/WebPageIOS.mm:
3171         (WebKit::WebPage::applicationWillResignActive): Call page.
3172         (WebKit::WebPage::applicationDidEnterBackground): Ditto, let it call libWebRTCProvider.
3173         (WebKit::WebPage::applicationWillEnterForeground): Call page.
3174         (WebKit::WebPage::applicationDidBecomeActive): Ditto, let it call libWebRTCProvider.
3175
3176 2018-01-16  Zach Li  <zachli@apple.com>
3177
3178         Add pop-up policy support in website policies.
3179         https://bugs.webkit.org/show_bug.cgi?id=181544.
3180         rdar://problem/30521400.
3181
3182         Reviewed by Alex Christensen.
3183
3184         * Shared/WebsitePoliciesData.cpp: Encode and decode
3185         pop-up policy.
3186         (WebKit::WebsitePoliciesData::encode const):
3187         (WebKit::WebsitePoliciesData::decode):
3188         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
3189         Apply the pop-up policy from website policies to the
3190         document loader.
3191
3192         * Shared/WebsitePoliciesData.h:
3193
3194         * Shared/WebsitePopUpPolicy.h:
3195         Added for declaring enum WebsitePopUpPolicy.
3196
3197         * UIProcess/API/APIWforebsitePolicies.cpp:
3198         Include pop-up policy in website policies.
3199         (API::WebsitePolicies::WebsitePolicies):
3200         (API::WebsitePolicies::data):
3201         * UIProcess/API/APIWebsitePolicies.h:
3202
3203         * UIProcess/API/C/WKWebsitePolicies.cpp:
3204         Added C API to get and set pop-up policy on
3205         website policies.
3206         (WKWebsitePoliciesGetPopUpPolicy):
3207         (WKWebsitePoliciesSetPopUpPolicy):
3208         * UIProcess/API/C/WKWebsitePolicies.h:
3209
3210         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
3211         Added Obj-C API to get and set pop-up policy
3212         on website policies.
3213         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
3214         (-[_WKWebsitePolicies setPopUpPolicy:]):
3215         (-[_WKWebsitePolicies popUpPolicy]):
3216
3217         * WebKit.xcodeproj/project.pbxproj:
3218         Added WebsitePopUpPolicy.h.
3219
3220 2018-01-16  Fujii Hironori  <Hironori.Fujii@sony.com>
3221
3222         [CMake][Mac] Fix the build errors
3223         https://bugs.webkit.org/show_bug.cgi?id=181665
3224
3225         Reviewed by Alex Christensen.
3226
3227         * CMakeLists.txt: Added TouchBarMenuData.cpp and TouchBarMenuItemData.cpp to compile.
3228         * PlatformMac.cmake: Added _WKApplicationManifest.mm, WKInspectorWKWebView.mm and WKInspectorWindow.mm to compile.
3229         * UIProcess/API/Cocoa/WKProcessPool.mm:
3230         (-[WKProcessPool _webPageContentProcessCount]): Call WebProcessPool::serviceWorkerProxy() only if ENABLE(SERVICE_WORKER).
3231
3232 2018-01-16  Wenson Hsieh  <wenson_hsieh@apple.com>
3233
3234         [Attachment Support] Provide the `src` of an attachment to the UI delegate when an attachment is inserted
3235         https://bugs.webkit.org/show_bug.cgi?id=181638
3236         <rdar://problem/36508702>
3237
3238         Reviewed by Dan Bernstein.
3239
3240         Add a `source` parameter to the `didInsertAttachment` codepath for notifying WebKit2 clients when attachment
3241         elements are inserted into the document.
3242
3243         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3244         * UIProcess/API/Cocoa/WKWebView.mm:
3245         (-[WKWebView _didInsertAttachment:withSource:]):
3246         (-[WKWebView _didInsertAttachment:]): Deleted.
3247         * UIProcess/API/Cocoa/WKWebViewInternal.h:
3248         * UIProcess/Cocoa/PageClientImplCocoa.h:
3249         * UIProcess/Cocoa/PageClientImplCocoa.mm:
3250         (WebKit::PageClientImplCocoa::didInsertAttachment):
3251         * UIProcess/PageClient.h:
3252         (WebKit::PageClient::didInsertAttachment):
3253         * UIProcess/WebPageProxy.cpp:
3254         (WebKit::WebPageProxy::didInsertAttachment):
3255         * UIProcess/WebPageProxy.h:
3256         * UIProcess/WebPageProxy.messages.in:
3257         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
3258         (WebKit::WebEditorClient::didInsertAttachment):
3259         * WebProcess/WebCoreSupport/WebEditorClient.h:
3260
3261 2018-01-15  Youenn Fablet  <youenn@apple.com>
3262
3263         ASSERTION FAILED: m_ptr under WebKit::CacheStorage::Caches::writeRecord
3264         https://bugs.webkit.org/show_bug.cgi?id=181401
3265         <rdar://problem/36379022>
3266
3267         Reviewed by Darin Adler.
3268
3269         m_isInitialized is true but m_storage is set to nullptr when calling writeRecord.
3270         The only case seems to be if:
3271         - We are doing persistent storage
3272         - We are traversing the storage to do the initialization. At that point m_storage is set to a correct value.
3273         - clearMemoryRepresentation is called, thus setting m_storage to nullptr and m_isInitialized to false.
3274         We fix this by making clearMemoryRepresentation a no-op if we are initializing the caches.
3275         clearMemoryRepresentation is about cleaning the in-memory information of the caches and the memory representation is empty at init time.
3276         Nullifying m_storage is a memory consumption optimization.
3277
3278         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
3279         (WebKit::CacheStorage::Caches::clearMemoryRepresentation):
3280
3281 2018-01-12  Wenson Hsieh  <wenson_hsieh@apple.com>
3282
3283         Unreviewed, speculative build fix after r226899.
3284
3285         Add an empty implementation for PageClient::startDrag.
3286
3287         * UIProcess/PageClient.h:
3288         (WebKit::PageClient::startDrag):
3289
3290 2018-01-12  Brent Fulgham  <bfulgham@apple.com>
3291
3292         [iOS] Remove unneeded accessibility-related sandbox rules
3293         https://bugs.webkit.org/show_bug.cgi?id=181619
3294         <rdar://problem/36485356>
3295
3296         Reviewed by Eric Carlson.
3297
3298         Remove a number of sandbox exceptions that were in place for accessibility support. These are
3299         not needed in the WebContent process, since Safari (not WebKit) handles the accessibility
3300         interactions.
3301
3302         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3303
3304 2018-01-12  Keith Rollin  <krollin@apple.com>
3305
3306         Logged JSON should escape "'s and \'s in strings.
3307         https://bugs.webkit.org/show_bug.cgi?id=181608
3308
3309         Reviewed by Brent Fulgham.
3310
3311         * NetworkProcess/NetworkResourceLoader.cpp:
3312         (WebKit::NetworkResourceLoader::logCookieInformation const):
3313
3314 2018-01-12  Megan Gardner  <megan_gardner@apple.com>
3315
3316         Unreviewed, fixing error in UIKitSPI.h.
3317
3318         * Platform/spi/ios/UIKitSPI.h:
3319         
3320 2018-01-12  Megan Gardner  <megan_gardner@apple.com>
3321
3322         Implement MultiDocument protocol for restoring focus to a WKWebView
3323         https://bugs.webkit.org/show_bug.cgi?id=181510
3324
3325         Reviewed by Dan Bernstein.
3326
3327         Support the UIKit protocol for restoring focus to a what previously had focus.
3328         WebKit already knows what node was previously being focused by the DOM, we merely
3329         need to be asked to turn the focus on again.
3330         Resubmitting https://trac.webkit.org/changeset/226826 as it broke internal builds
3331
3332         * Platform/spi/ios/UIKitSPI.h:
3333         * UIProcess/ios/WKContentViewInteraction.h:
3334         * UIProcess/ios/WKContentViewInteraction.mm:
3335         (-[WKContentView _restoreFocusWithToken:]):
3336         (-[WKContentView _preserveFocusWithToken:destructively:]):
3337
3338 2018-01-12  Youenn Fablet  <youenn@apple.com>
3339
3340         WebProcess should pass the registration identifier and not the worker identifier for fetch events
3341         https://bugs.webkit.org/show_bug.cgi?id=181591
3342
3343         Reviewed by Chris Dumez.
3344
3345         Use service worker registration identifier to compute the active service worker identifier responsible to handle the fetch event.
3346
3347         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3348         (WebKit::WebSWServerConnection::startFetch):
3349         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
3350         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
3351         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
3352         (WebKit::ServiceWorkerClientFetch::start):
3353         * WebProcess/Storage/WebSWClientConnection.cpp:
3354         (WebKit::WebSWClientConnection::startFetch):
3355         * WebProcess/Storage/WebSWClientConnection.h:
3356         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
3357         (WebKit::shouldHandleFetch):
3358
3359 2018-01-12  Ryan Haddad  <ryanhaddad@apple.com>
3360
3361         Unreviewed, rolling out r226826.
3362
3363         Breaks internal builds.
3364
3365         Reverted changeset:
3366
3367         "Implement MultiDocument protocol for restoring focus to a
3368         WKWebView"
3369         https://bugs.webkit.org/show_bug.cgi?id=181510
3370         https://trac.webkit.org/changeset/226826
3371
3372 2018-01-12  Wenson Hsieh  <wenson_hsieh@apple.com>
3373
3374         [WK2] Unify macOS and iOS codepaths in the UI process when starting a drag
3375         https://bugs.webkit.org/show_bug.cgi?id=181574
3376
3377         Reviewed by Tim Horton.
3378
3379         Rearrange some macOS drag start logic in the UI process so that it uses the same codepaths in WebPageProxy as
3380         iOS. Namely, startDrag should just forward the DragItem and drag image handle along to the appropriate views on
3381         each platform (WKContentView and WebViewImpl).
3382
3383         There should be no change in behavior.
3384
3385         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
3386
3387         Both macOS and iOS now funnel through this method.
3388
3389         * UIProcess/Cocoa/WebViewImpl.h:
3390         * UIProcess/Cocoa/WebViewImpl.mm:
3391         (WebKit::WebViewImpl::startDrag):
3392         (WebKit::WebViewImpl::dragImageForView): Deleted.
3393
3394         Rename dragImageForView to startDrag. Move the call to didStartDrag() here, and call dragCancelled() in the
3395         case where we bailed from starting the drag (due to failing to create a drag image).
3396
3397         * UIProcess/PageClient.h:
3398         * UIProcess/ios/PageClientImplIOS.h:
3399         * UIProcess/ios/PageClientImplIOS.mm:
3400         (WebKit::PageClientImpl::setDragImage): Deleted.
3401
3402         Rename setDragImage to startDrag.
3403
3404         * UIProcess/mac/PageClientImplMac.h:
3405         * UIProcess/mac/PageClientImplMac.mm:
3406         (WebKit::PageClientImpl::startDrag):
3407         (WebKit::PageClientImpl::setDragImage): Deleted.
3408         * UIProcess/mac/WebPageProxyMac.mm:
3409         (WebKit::WebPageProxy::startDrag): Deleted.
3410
3411 2018-01-12  Antoine Quint  <graouts@apple.com>
3412
3413         Add support for the frames() timing function
3414         https://bugs.webkit.org/show_bug.cgi?id=181585
3415         <rdar://problem/36463317>
3416
3417         Reviewed by Dean.
3418
3419         Add the ability to endode and decode the frames() timing function.
3420
3421         * Shared/WebCoreArgumentCoders.cpp:
3422         (IPC::ArgumentCoder<FramesTimingFunction>::encode):
3423         (IPC::ArgumentCoder<FramesTimingFunction>::decode):
3424         * Shared/WebCoreArgumentCoders.h:
3425         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
3426         (WebKit::PlatformCAAnimationRemote::Properties::encode const):
3427         (WebKit::PlatformCAAnimationRemote::Properties::decode):
3428
3429 2018-01-11  Keith Miller  <keith_miller@apple.com>
3430
3431         Rename ENABLE_ASYNC_ITERATION to ENABLE_JS_ASYNC_ITERATION
3432         https://bugs.webkit.org/show_bug.cgi?id=181573
3433
3434         Reviewed by Simon Fraser.
3435
3436         * Configurations/FeatureDefines.xcconfig:
3437
3438 2018-01-11  Brent Fulgham  <bfulgham@apple.com>
3439
3440         REGRESSION(r219530): ResourceLoadStatisticsPersistentStorage should be read-only in ephemeral sessions
3441         https://bugs.webkit.org/show_bug.cgi?id=181136
3442         <rdar://problem/36116604>
3443
3444         Reviewed by Chris Dumez.
3445
3446         Some uses of WebKit involve running a UIProcess as an ephemeral session for the life of the process. In this
3447         case, we do not initialize the data path for the set of load statistics triggering an assertion.
3448
3449         We actually intended ephemeral sessions to consume the existing resource load data (presumably captured during
3450         non-ephemeral browsing). This would be a read-only mode, where it would not add new entries to the load
3451         statistics, but would take advantage of existing observations. Currently that does not happen (for this type
3452         of WebKit embed), which forces each run as an ephemeral session to build up in-memory browsing data until it has
3453         enough observations to begin modifying loads.
3454
3455         We need to set the ResourceLoadStatisticsPersistentStorage object to a "read only" mode in this case, so
3456         that it read (but does not write) from this database.
3457
3458         Tested by ephemeral website data TestWebKitAPI tests.
3459
3460         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
3461         (WebKit::ResourceLoadStatisticsPersistentStorage::create): Added to allow creation of the right style of
3462         Persistent Storage.
3463         (WebKit::ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage): Initialize the
3464         new data member.
3465         (WebKit::ResourceLoadStatisticsPersistentStorage::asyncWriteTimerFired): RELEASE_ASSERT that we never run
3466         this method when in "read only" mode.
3467         (WebKit::ResourceLoadStatisticsPersistentStorage::writeMemoryStoreToDisk): Ditto.
3468         (WebKit::ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore): Return early if asked to
3469         schedule a write operation for a "read only" persistent store.
3470         (WebKit::ResourceLoadStatisticsPersistentStorage::finishAllPendingWorkSynchronously): RELEASE_ASSERT if we
3471         ever shut down in "read only" mode with an active write timer.
3472         * UIProcess/ResourceLoadStatisticsPersistentStorage.h:
3473         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3474         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore): Pass a flag indicating whether the
3475         storage session is ephemeral or not.
3476         * UIProcess/WebResourceLoadStatisticsStore.h:
3477
3478 2018-01-11  Keith Rollin  <krollin@apple.com>
3479
3480         Add optional logging of ITP-related user interaction information
3481         https://bugs.webkit.org/show_bug.cgi?id=181556
3482
3483         Reviewed by Brent Fulgham.
3484
3485         In order to support the tracking of the efficacy of Intelligent
3486         Tracking Protection, add some logging indicating whe