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