DocumentLoader should interrupt ongoing load when getting a redirection from network...
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-01-25  Youenn Fablet  <youenn@apple.com>
2
3         DocumentLoader should interrupt ongoing load when getting a redirection from network that matches a service worker
4         https://bugs.webkit.org/show_bug.cgi?id=182115
5
6         Reviewed by Alex Christensen.
7
8         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
9         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
10
11 2018-01-25  Alex Christensen  <achristensen@webkit.org>
12
13         Fix crash when preconnecting while closing private browsing
14         https://bugs.webkit.org/show_bug.cgi?id=182114
15         <rdar://problem/35637284>
16
17         Reviewed by Joseph Pecoraro.
18
19         * NetworkProcess/PreconnectTask.cpp:
20         There is a race condition when destroying a session while a page is initiating a preconnect.
21         If this happens, fail gracefully instead of trying to preconnect with a null session.
22
23 2018-01-25  Dan Bernstein  <mitz@apple.com>
24
25         [Mac] Enable library validation for Networking & Storage XPC services
26         https://bugs.webkit.org/show_bug.cgi?id=173424
27         <rdar://problem/32386565>
28
29         Reviewed by Joseph Pecoraro.
30
31         * Configurations/BaseXPCService.xcconfig: Moved the definitions of
32           WK_LIBRARY_VALIDATION_ENABLED and WK_LIBRARY_VALIDATION_CODE_SIGN_FLAGS from
33           WebContentService.xcconfig to here and made them Mac-only at this level.
34         * Configurations/NetworkService.xcconfig: Also set OTHER_CODE_SIGN_FLAGS to
35           WK_LIBRARY_VALIDATION_CODE_SIGN_FLAGS.
36         * Configurations/StorageService.xcconfig: Ditto.
37         * Configurations/WebContentService.xcconfig: Moved definitions from here to
38           BaseXPCService.xcconfig.
39
40 2018-01-25  David Hyatt  <hyatt@apple.com>
41
42         Enable lines clamp support for Apple Mail by default
43         https://bugs.webkit.org/show_bug.cgi?id=182113
44
45         Reviewed by Dean Jackson.
46
47         * Shared/WebPageCreationParameters.cpp:
48         (WebKit::WebPageCreationParameters::encode const):
49         (WebKit::WebPageCreationParameters::decode):
50         * Shared/WebPageCreationParameters.h:
51         * UIProcess/WebPageProxy.cpp:
52         (WebKit::WebPageProxy::creationParameters):
53         * UIProcess/WebPageProxy.h:
54         * UIProcess/mac/WebPageProxyMac.mm:
55         (WebKit::WebPageProxy::appleMailLinesClampEnabled):
56         * WebProcess/WebPage/WebPage.cpp:
57         (WebKit::m_cpuLimit):
58
59 2018-01-25  Sergio Villar Senin  <svillar@igalia.com>
60
61         [WebVR][GTK][WPE] Remove the WebVR public API added in r227518
62         https://bugs.webkit.org/show_bug.cgi?id=182102
63
64         Reviewed by Carlos Garcia Campos.
65
66         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
67
68 2018-01-25  Sergio Villar Senin  <svillar@igalia.com>
69
70         [WebVR][GTK][WPE] Remove the WebVR public API added in r227518
71         https://bugs.webkit.org/show_bug.cgi?id=182102
72
73         Reviewed by Carlos Garcia Campos.
74
75         This new public API was not supposed to be included in the patch
76         that added OpenVR to the tree and to the build.
77
78         * UIProcess/API/glib/WebKitSettings.cpp:
79         (webKitSettingsSetProperty):
80         (webKitSettingsGetProperty):
81         (webkit_settings_class_init):
82         (webkit_settings_get_enable_webvr): Deleted.
83         (webkit_settings_set_enable_webvr): Deleted.
84         * UIProcess/API/gtk/WebKitSettings.h:
85         * UIProcess/API/wpe/WebKitSettings.h:
86
87 2018-01-25  Claudio Saavedra  <csaavedra@igalia.com>
88
89         [GTK] Fix build with touch events disabled
90
91         Unreviewed build fix.
92
93         Explicitly include gtk.h in files that were indirectly getting it
94         only when touch events were enabled.
95         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
96         * UIProcess/gtk/WaylandCompositor.h:
97
98 2018-01-25  Carlos Garcia Campos  <cgarcia@igalia.com>
99
100         WebDriver: test imported/selenium/py/test/selenium/webdriver/common/alerts_tests.py crashes in debug
101         https://bugs.webkit.org/show_bug.cgi?id=182096
102
103         Reviewed by Carlos Alberto Lopez Perez.
104
105         It's an assert in HashTable iterators checkValidity(). The problem is that we get the keys to iterate the values
106         and the map is modified inside the loop. We need to use copyToVector to copy the keys.
107
108         * UIProcess/Automation/WebAutomationSession.cpp:
109         (WebKit::WebAutomationSession::respondToPendingPageNavigationCallbacksWithTimeout):
110         (WebKit::WebAutomationSession::respondToPendingFrameNavigationCallbacksWithTimeout):
111         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
112
113 2018-01-24  Alex Christensen  <achristensen@webkit.org>
114
115         Gracefully recover from NetworkProcess crashes in private browsing
116         https://bugs.webkit.org/show_bug.cgi?id=182073
117         <rdar://problem/36572023>
118
119         Reviewed by Geoff Garen.
120
121         If we're using a non-persistent WKWebsiteDataStore and the NetworkProcess crashes and we try to do a load,
122         then the WebProcess restarts the NetworkProcess but doesn't recreate the ephemeral session in the NetworkProcess.
123         When this happens, we've already lost the browsing state in memory in the NetworkProcess, but we don't want to hang.
124         If this is the problem, then just recreate the ephemeral session and continue loading.
125
126         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
127         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForFrame):
128         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage):
129         * NetworkProcess/NetworkResourceLoader.cpp:
130         (WebKit::NetworkResourceLoader::startNetworkLoad):
131         * Shared/WebsiteDataStoreParameters.cpp:
132         (WebKit::WebsiteDataStoreParameters::privateSessionParameters):
133         (WebKit::WebsiteDataStoreParameters::legacyPrivateSessionParameters): Deleted.
134         * Shared/WebsiteDataStoreParameters.h:
135         (WebKit::WebsiteDataStoreParameters::legacyPrivateSessionParameters):
136
137 2018-01-24  Dan Bernstein  <mitz@apple.com>
138
139         Enable library validation on the Web Content service
140         Part 1 of https://bugs.webkit.org/show_bug.cgi?id=172365
141         <rdar://problem/26470661>
142
143         Reviewed by David Kilzer.
144
145         This makes the Web Content process signed with the Library Validation flag in production
146         builds. Because doing so would prevent engineering builds of Apple apps that use an
147         injected bundle from working, this also adds a Development version of the service, which
148         does not enforce Library Validation. The UI process chooses to use the Development service
149         iff it would need to load an injected bundle that is not part of the OS.
150
151         * Configurations/DebugRelease.xcconfig: Disable Library Validation in engineering builds.
152
153         * Configurations/WebContentService.Development.xcconfig: Added. Like the normal service, but
154           only installed when WebKit is installed in the OS, and uses a Development variant.
155
156         * Configurations/WebContentService.xcconfig: For the Development variant, append
157           ".Development" to the product name, which is also the service identifier. Enable Library
158           Validation for the Normal variant of the service when WK_LIBRARY_VALIDATION_ENABLED allows
159           it.
160
161         * UIProcess/Launcher/ProcessLauncher.h: Add nonValidInjectedCodeAllowed member to
162           LaunchOptions, false by default.
163
164         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
165         (WebKit::serviceName): Use the Development variant if nonValidInjectedCodeAllowed is true.
166
167         * UIProcess/WebProcessProxy.cpp:
168         (WebKit::WebProcessProxy::getLaunchOptions): Initialize nonValidInjectedCodeAllowed using
169            the new shouldAllowNonValidInjectedCode().
170         (WebKit::WebProcessProxy::shouldAllowNonValidInjectedCode const): Generic implementation
171           that returns false.
172         * UIProcess/WebProcessProxy.h: Declared shouldAllowNonValidInjectedCode.
173         * UIProcess/mac/WebProcessProxyMac.mm:
174         (WebKit::WebProcessProxy::shouldAllowNonValidInjectedCode const): Return true if this is
175           system WebKit with a non-system injected bundle.
176
177         * WebKit.xcodeproj/project.pbxproj: Added new service target.
178
179 2018-01-24  Chris Dumez  <cdumez@apple.com>
180
181         Add a IPC::SendSyncOption indicating we should not process incoming IPC while waiting for the sync reply
182         https://bugs.webkit.org/show_bug.cgi?id=182021
183         <rdar://problem/21629943>
184
185         Reviewed by Ryosuke Niwa.
186
187         Add a new DoNotProcessIncomingMessagesWhenWaitingForSyncReply SendSyncOption that the caller can
188         set when calling sendSync(). This indicates that the sendSync() should return only when we receive
189         the response to our sync IPC message, and that we should not process ANY incoming IPC in the meantime.
190
191         This patch also starts using this flag in 3 places where we know processing incoming IPC is an issue
192         and is causing crashes.
193
194         * Platform/IPC/Connection.cpp:
195         (IPC::Connection::sendSyncMessage):
196         When DoNotProcessIncomingMessagesWhenWaitingForSyncReply SendSyncOption is set, make sure
197         we set the ShouldDispatchMessageWhenWaitingForSyncReply flag on the encoder. If we did not set this
198         flag then it could cause deadlocks when the destination process is also waiting on a synchronous
199         IPC from us. Normally, this flag already gets set for sync messages because sendSyncMessage() calls
200         sendMessage() with DispatchMessageEvenWhenWaitingForSyncReply SyncOption. However, sendMessage()
201         ignores the DispatchMessageEvenWhenWaitingForSyncReply flag if the
202         m_onlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage flag is set on the
203         connection. Note that this flag is set on the connection from the WebProcess to the UIProcess at
204         the moment, which is why we saw deadlocks on the previous iteration of this patch.
205
206         (IPC::Connection::waitForSyncReply):
207         If DoNotProcessIncomingMessagesWhenWaitingForSyncReply SendSyncOption is set, do not
208         process incoming IPC messages while waiting for our sync IPC reply.
209
210         * Platform/IPC/Connection.h:
211         Add new SendSyncOption.
212
213         * UIProcess/WebProcessProxy.cpp:
214         (WebKit::WebProcessProxy::testIncomingSyncIPCMessageWhileWaitingForSyncReply):
215         * UIProcess/WebProcessProxy.h:
216         * UIProcess/WebProcessProxy.messages.in:
217         Testing infrastructure.
218
219         * WebProcess/Network/WebLoaderStrategy.cpp:
220         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
221         Use new flag.
222
223         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
224         (WebKit::WebChromeClient::testIncomingSyncIPCMessageWhileWaitingForSyncReply):
225         * WebProcess/WebCoreSupport/WebChromeClient.h:
226         Testing infrastructure.
227
228         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
229         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue):
230         Use new flag.
231
232         * WebProcess/WebProcess.cpp:
233         (WebKit::WebProcess::syncIPCMessageWhileWaitingForSyncReplyForTesting):
234         Testing infrastructure.
235
236         (WebKit::WebProcess::ensureNetworkProcessConnection):
237         Use new flag.
238
239         * WebProcess/WebProcess.h:
240         * WebProcess/WebProcess.messages.in:
241         Testing infrastructure.
242
243 2018-01-24  Joseph Pecoraro  <pecoraro@apple.com>
244
245         Web Inspector: Remove duplicate preference update for WebAuthentication value
246         https://bugs.webkit.org/show_bug.cgi?id=182058
247
248         Reviewed by Brian Burg.
249
250         * WebProcess/WebPage/WebPage.cpp:
251         (WebKit::WebPage::updatePreferences):
252         An identical update already happens in generated code.
253
254 2018-01-24  Alex Christensen  <achristensen@webkit.org>
255
256         Remove WebProcess access to QTKit
257         https://bugs.webkit.org/show_bug.cgi?id=182035
258
259         Reviewed by Alexey Proskuryakov.
260
261         * WebProcess/com.apple.WebProcess.sb.in:
262         This isn't needed any more.  We only have a little bit of code that uses QTKit which we should remove,
263         and it's only used for fullscreen controls in WebKitLegacy.  Let's tighten up the sandbox!
264
265 2018-01-24  Alex Christensen  <achristensen@webkit.org>
266
267         Remove pre-Sierra-OS-specific code in WebKit
268         https://bugs.webkit.org/show_bug.cgi?id=182024
269
270         Reviewed by Tim Horton.
271
272         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
273         * Shared/Cocoa/DataDetectionResult.mm:
274         (WebKit::DataDetectionResult::encode const):
275         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
276         (IPC::ArgumentCoder<WebCore::Payment>::encode):
277         (IPC::ArgumentCoder<WebCore::PaymentContact>::encode):
278         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::encode):
279         (IPC::ArgumentCoder<WebCore::PaymentMethod>::encode):
280         * Shared/WebPreferencesDefaultValues.h:
281         * Shared/cg/ShareableBitmapCG.cpp:
282         (WebKit::wantsExtendedRange):
283         * Shared/ios/InteractionInformationAtPosition.mm:
284         (WebKit::InteractionInformationAtPosition::encode const):
285         * Shared/mac/CodeSigning.mm:
286         (WebKit::codeSigningIdentifier):
287         (WebKit::codeSigningIdentifierForCurrentProcess):
288         * Shared/mac/ColorSpaceData.mm:
289         (WebKit::ColorSpaceData::encode const):
290         * Shared/mac/PasteboardTypes.mm:
291         (WebKit::PasteboardTypes::forURL):
292         * Shared/mac/WebCoreArgumentCodersMac.mm:
293         (IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData):
294         (IPC::ArgumentCoder<Credential>::encodePlatformData):
295         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::encode):
296         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData):
297         * Shared/mac/WebHitTestResultData.mm:
298         (WebKit::WebHitTestResultData::platformEncode const):
299         * UIProcess/API/Cocoa/WKProcessPool.mm:
300         (-[WKProcessPool _setObject:forBundleParameter:]):
301         (-[WKProcessPool _setObjectsForBundleParametersWithDictionary:]):
302         * UIProcess/API/Cocoa/WKWebView.mm:
303         (-[WKWebView _handleAcceptedCandidate:]):
304         * UIProcess/Cocoa/WebViewImpl.h:
305         * UIProcess/Cocoa/WebViewImpl.mm:
306         (WebKit::WebViewImpl::handleAcceptedCandidate):
307         (WebKit::WebViewImpl::performDragOperation):
308         * UIProcess/mac/WebPopupMenuProxyMac.mm:
309         (WebKit::WebPopupMenuProxyMac::showPopupMenu):
310         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
311         (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]):
312         * WebProcess/com.apple.WebProcess.sb.in:
313
314 2018-01-24  Alex Christensen  <achristensen@webkit.org>
315
316         Stop using AuthenticationClient in WebKit
317         https://bugs.webkit.org/show_bug.cgi?id=182016
318
319         Reviewed by Brady Eidson.
320
321         It was necessary to support ResourceHandle use in WebKit, but now we're using NetworkSession everywhere in WebKit.
322
323         * Shared/Authentication/AuthenticationManager.cpp:
324         (WebKit::AuthenticationManager::useCredentialForSingleChallenge):
325         (WebKit::AuthenticationManager::continueWithoutCredentialForSingleChallenge):
326         (WebKit::AuthenticationManager::cancelSingleChallenge):
327         (WebKit::AuthenticationManager::performDefaultHandlingForSingleChallenge):
328         (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge):
329
330 2018-01-24  Alex Christensen  <achristensen@webkit.org>
331
332         Remove WebProcess authentication code
333         https://bugs.webkit.org/show_bug.cgi?id=182020
334
335         Reviewed by Brady Eidson.
336
337         * Shared/Authentication/AuthenticationManager.cpp:
338         * Shared/Authentication/AuthenticationManager.h:
339         * UIProcess/WebPageProxy.cpp:
340         (WebKit::WebPageProxy::didReceiveAuthenticationChallenge): Deleted.
341         * UIProcess/WebPageProxy.h:
342         * UIProcess/WebPageProxy.messages.in:
343         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
344         (WebKit::WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge):
345         * WebProcess/WebProcess.cpp:
346         (WebKit::m_webSQLiteDatabaseTracker):
347
348 2018-01-24  Jan-Michael Brummer  <jan.brummer@tabos.org>
349
350         [GTK] Page crash after swipe gesture running GNOME3 under wayland
351         https://bugs.webkit.org/show_bug.cgi?id=181996
352
353         Reviewed by Michael Catanzaro.
354
355         Add missing GDK_TOUCH_CANCEL support which fixes page crashes due to cancelled gestures.
356         * Shared/gtk/WebEventFactory.cpp:
357         (WebKit::WebEventFactory::createWebTouchEvent):
358         * UIProcess/API/gtk/PageClientImpl.cpp:
359         (WebKit::PageClientImpl::doneWithTouchEvent):
360         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
361         (touchPointStateForEvents):
362         (webkitWebViewBaseGetTouchPointsForEvent):
363         (webkitWebViewBaseTouchEvent):
364         * UIProcess/gtk/GestureController.cpp:
365         (WebKit::GestureController::handleEvent):
366
367 2018-01-24  Alex Christensen  <achristensen@webkit.org>
368
369         Remove unused QTKit preference
370         https://bugs.webkit.org/show_bug.cgi?id=181968
371
372         Reviewed by Alexey Proskuryakov.
373
374         * Shared/API/c/WKDeprecatedFunctions.cpp:
375         (WKPreferencesSetQTKitEnabled):
376         (WKPreferencesGetQTKitEnabled):
377         * Shared/WebPreferences.yaml:
378         * UIProcess/API/C/WKPreferences.cpp:
379         (WKPreferencesSetQTKitEnabled): Deleted.
380         (WKPreferencesGetQTKitEnabled): Deleted.
381         * UIProcess/API/Cocoa/WKPreferences.mm:
382         (-[WKPreferences _setQTKitEnabled:]): Deleted.
383         (-[WKPreferences _qtKitEnabled]): Deleted.
384         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
385
386 2018-01-24  Youenn Fablet  <youenn@apple.com>
387
388         Fetch response should copy its url from the request if null
389         https://bugs.webkit.org/show_bug.cgi?id=182048
390
391         Reviewed by Chris Dumez.
392
393         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
394         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
395
396 2018-01-24  Sergio Villar Senin  <svillar@igalia.com>
397
398         Unreviewed build fix after r227518. I forgot to add the function declarations to the WPE
399         header.
400
401         * UIProcess/API/wpe/WebKitSettings.h: Added webkit_settings_get/set_enable_webvr.
402
403 2018-01-24  Youenn Fablet  <youenn@apple.com>
404
405         Add Cache Storage engine assertion following on bug 181887
406         https://bugs.webkit.org/show_bug.cgi?id=181925
407
408         Reviewed by Alex Christensen.
409
410         In a normal environment, the folderPath should be the same as the path computed from the ClientOrigin.
411         Add assertion to verify this.
412
413         * NetworkProcess/cache/CacheStorageEngine.cpp:
414         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
415
416 2018-01-24  Michael Catanzaro  <mcatanzaro@igalia.com>
417
418         [GTK] Use GDK_EVENT_PROPAGATE and GDK_EVENT_STOP in WebKitWebViewBase.cpp
419         https://bugs.webkit.org/show_bug.cgi?id=182031
420
421         Reviewed by Carlos Garcia Campos.
422
423         No functional changes, this just replaces TRUE with GDK_EVENT_STOP and FALSE with
424         GDK_EVENT_PROPAGATE, to improve readability.
425
426         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
427         (webkitWebViewBaseKeyPressEvent):
428         (webkitWebViewBaseKeyReleaseEvent):
429         (webkitWebViewBaseButtonPressEvent):
430         (webkitWebViewBaseButtonReleaseEvent):
431         (webkitWebViewBaseScrollEvent):
432         (webkitWebViewBaseMotionNotifyEvent):
433         (webkitWebViewBaseCrossingNotifyEvent):
434         (webkitWebViewBaseTouchEvent):
435
436 2018-01-23  Eric Carlson  <eric.carlson@apple.com>
437
438         Resign NowPlaying status when no media element is eligible
439         https://bugs.webkit.org/show_bug.cgi?id=181914
440         <rdar://problem/35294116>
441
442         Reviewed by Jer Noble.
443
444         * UIProcess/API/Cocoa/WKWebView.mm:
445         (-[WKWebView _requestActiveNowPlayingSessionInfo:]): Return registeredAsNowPlayingApplication
446         status.
447         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
448
449         * UIProcess/WebPageProxy.cpp:
450         (WebKit::WebPageProxy::nowPlayingInfoCallback): Ditto.
451         * UIProcess/WebPageProxy.h:
452         * UIProcess/WebPageProxy.messages.in:
453         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
454         (WebKit::WebPage::requestActiveNowPlayingSessionInfo): Ditto.
455
456 2018-01-23  Alex Christensen  <achristensen@webkit.org>
457
458         Use CompletionHandlers for ResourceHandleClient::didReceiveResponseAsync
459         https://bugs.webkit.org/show_bug.cgi?id=181961
460
461         Reviewed by Michael Catanzaro.
462
463         * NetworkProcess/Downloads/Download.h:
464         * NetworkProcess/NetworkLoad.cpp:
465         * NetworkProcess/NetworkLoad.h:
466         * NetworkProcess/NetworkResourceLoadParameters.h:
467         * WebProcess/InjectedBundle/InjectedBundle.cpp:
468         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
469         * WebProcess/WebPage/mac/WebPageMac.mm:
470         * WebProcess/WebProcess.cpp:
471
472 2018-01-23  Chris Dumez  <cdumez@apple.com>
473
474         Unreviewed, rollout r227216 as it seems to be causing deadlocks
475         https://bugs.webkit.org/show_bug.cgi?id=182013
476
477         * Platform/IPC/Connection.cpp:
478         (IPC::Connection::waitForSyncReply):
479         * Platform/IPC/Connection.h:
480         (IPC::Connection::setShouldProcessIncomingMessagesWhileWaitingForSyncReply): Deleted.
481         * UIProcess/WebProcessProxy.cpp:
482         (WebKit::WebProcessProxy::testIncomingSyncIPCMessageWhileWaitingForSyncReply): Deleted.
483         * UIProcess/WebProcessProxy.h:
484         * UIProcess/WebProcessProxy.messages.in:
485         * WebProcess/Network/NetworkProcessConnection.cpp:
486         (WebKit::NetworkProcessConnection::NetworkProcessConnection):
487         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
488         (WebKit::WebToStorageProcessConnection::WebToStorageProcessConnection):
489         * WebProcess/WebConnectionToUIProcess.cpp:
490         (WebKit::WebConnectionToUIProcess::WebConnectionToUIProcess):
491         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
492         (WebKit::WebChromeClient::testIncomingSyncIPCMessageWhileWaitingForSyncReply): Deleted.
493         * WebProcess/WebCoreSupport/WebChromeClient.h:
494         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
495         (WebKit::WebEditorClient::undo):
496         (WebKit::WebEditorClient::redo):
497         * WebProcess/WebProcess.cpp:
498         (WebKit::WebProcess::syncIPCMessageWhileWaitingForSyncReplyForTesting): Deleted.
499         * WebProcess/WebProcess.h:
500         * WebProcess/WebProcess.messages.in:
501
502 2018-01-23  Commit Queue  <commit-queue@webkit.org>
503
504         Unreviewed, rolling out r227437.
505         https://bugs.webkit.org/show_bug.cgi?id=182011
506
507         broke build (Requested by alexchristensen on #webkit).
508
509         Reverted changeset:
510
511         "Remove unused QTKit preference"
512         https://bugs.webkit.org/show_bug.cgi?id=181968
513         https://trac.webkit.org/changeset/227437
514
515 2018-01-23  Alex Christensen  <achristensen@webkit.org>
516
517         Remove compile guard around beacon API
518         https://bugs.webkit.org/show_bug.cgi?id=182002
519
520         Reviewed by Sam Weinig.
521
522         It's enabled everywhere now.
523
524         * Shared/WebPreferences.yaml:
525         * UIProcess/API/C/WKPreferences.cpp:
526         (WKPreferencesSetBeaconAPIEnabled):
527         (WKPreferencesGetBeaconAPIEnabled):
528         * config.h:
529
530 2018-01-23  Alex Christensen  <achristensen@webkit.org>
531
532         Remove unused QTKit preference
533         https://bugs.webkit.org/show_bug.cgi?id=181968
534
535         Reviewed by Alexey Proskuryakov.
536
537         * Shared/API/c/WKDeprecatedFunctions.cpp:
538         (WKPreferencesSetQTKitEnabled):
539         (WKPreferencesGetQTKitEnabled):
540         * Shared/WebPreferences.yaml:
541         * UIProcess/API/C/WKPreferences.cpp:
542         (WKPreferencesSetQTKitEnabled): Deleted.
543         (WKPreferencesGetQTKitEnabled): Deleted.
544         * UIProcess/API/Cocoa/WKPreferences.mm:
545         (-[WKPreferences _setQTKitEnabled:]): Deleted.
546         (-[WKPreferences _qtKitEnabled]): Deleted.
547         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
548
549 2018-01-23  Brent Fulgham  <bfulgham@apple.com>
550
551         [macOS] WebProcess needs TCC entitlements for media capture
552         https://bugs.webkit.org/show_bug.cgi?id=181995
553         <rdar://problem/36674649>
554
555         Reviewed by Eric Carlson.
556
557         * Configurations/WebContent-OSX.entitlements: Add delegated services needed to support media
558         capture features.
559
560 2018-01-23  Dan Bernstein  <mitz@apple.com>
561
562         [Cocoa] Disable header postprocessing when building for macOS High Sierra
563         https://bugs.webkit.org/show_bug.cgi?id=181972
564
565         Reviewed by Anders Carlsson.
566
567         * Configurations/WebKit.xcconfig: Adopt macOSTargetConditionals.xcconfig helpers and disable postprocessing
568           when building for macOS 10.13.
569
570 2018-01-23  Joseph Pecoraro  <pecoraro@apple.com>
571
572         Web Inspector: Window resizing is broken after detaching to separate window
573         https://bugs.webkit.org/show_bug.cgi?id=181992
574         <rdar://problem/36714840>
575
576         Reviewed by Brian Burg.
577
578         * UIProcess/mac/WebInspectorProxyMac.mm:
579         (WebKit::WebInspectorProxy::platformDetach):
580         Restore the inspector view's autoresizingMask to the initial value
581         that works with a detached window. This gets changed when the view
582         gets attached to bottom/side, so we need to revert it on detaching.
583
584 2018-01-23  Brady Eidson  <beidson@apple.com>
585
586         Allow passing MessagePorts across processes (e.g. ServiceWorkers).
587         https://bugs.webkit.org/show_bug.cgi?id=181178
588
589         Reviewed by Andy Estes.
590
591         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
592         (WebKit::WebSWServerConnection::postMessageToServiceWorker):
593         (WebKit::WebSWServerConnection::postMessageToServiceWorkerClient):
594         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
595         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
596
597         * StorageProcess/StorageProcess.cpp:
598         (WebKit::StorageProcess::postMessageToServiceWorkerClient):
599         * StorageProcess/StorageProcess.h:
600         * StorageProcess/StorageProcess.messages.in:
601
602         * UIProcess/WebProcessProxy.cpp:
603         (WebKit::WebProcessProxy::entangleLocalPortInThisProcessToRemote):
604         (WebKit::WebProcessProxy::postMessageToRemote):
605
606         * WebProcess/Storage/WebSWClientConnection.cpp:
607         (WebKit::WebSWClientConnection::postMessageToServiceWorker):
608         (WebKit::WebSWClientConnection::postMessageToServiceWorkerClient):
609         * WebProcess/Storage/WebSWClientConnection.h:
610         * WebProcess/Storage/WebSWClientConnection.messages.in:
611
612         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
613         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorker):
614         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerClient):
615         * WebProcess/Storage/WebSWContextManagerConnection.h:
616         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
617
618 2018-01-23  Commit Queue  <commit-queue@webkit.org>
619
620         Unreviewed, rolling out r227279 and r227373.
621         https://bugs.webkit.org/show_bug.cgi?id=181988
622
623         The LayoutTest crash fix introduced an API test failure.
624         (Requested by ryanhaddad on #webkit).
625
626         Reverted changesets:
627
628         "Resign NowPlaying status when no media element is eligible"
629         https://bugs.webkit.org/show_bug.cgi?id=181914
630         https://trac.webkit.org/changeset/227279
631
632         "Resign NowPlaying status when no media element is eligible"
633         https://bugs.webkit.org/show_bug.cgi?id=181914
634         https://trac.webkit.org/changeset/227373
635
636 2018-01-23  Youenn Fablet  <youenn@apple.com>
637
638         REGRESSION (r227348): ASSERT_NOT_REACHED in WebKit::ServiceWorkerClientFetch::didFinish()
639         https://bugs.webkit.org/show_bug.cgi?id=181956
640         <rdar://problem/36755492>
641
642         Reviewed by Chris Dumez.
643
644         Covered by test no longer crashing in Debug builds.
645         Reset m_redirectionStatus to None when starting an SW fetch.
646
647         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
648         (WebKit::ServiceWorkerClientFetch::start):
649         (WebKit::ServiceWorkerClientFetch::didFinish):
650
651 2018-01-23  Michael Catanzaro  <mcatanzaro@igalia.com>
652
653         [WPE] TestWebKitFindController asserts
654         https://bugs.webkit.org/show_bug.cgi?id=181472
655
656         Reviewed by Carlos Garcia Campos.
657
658         Let's fix this in two independent ways.
659
660         First, use a GRefPtr to hold ownership of the WebKitWebViewBackend. This way, we don't need
661         to change the order in which WebKitWebView destroys its priv struct members from what is
662         used in WebKitGTK+, which can lead to odd bugs.
663
664         Additionally, just for good measure, stop resetting the find client when disposing
665         WebKitFindController. This is unnecessary because it will never be destroyed before the
666         WebKitWebView.
667
668         * UIProcess/API/glib/WebKitFindController.cpp:
669         (webkit_find_controller_class_init):
670         (webkitFindControllerDispose): Deleted.
671         * UIProcess/API/glib/WebKitWebView.cpp:
672         (_WebKitWebViewPrivate::~_WebKitWebViewPrivate):
673         (webkitWebViewSetProperty):
674         (webkitWebViewGetProperty):
675         (webkitWebViewCreatePage):
676         (webkit_web_view_get_backend):
677         * UIProcess/API/wpe/WebKitWebViewBackend.cpp:
678         (webkitWebViewBackendCreateDefault):
679         (WTF::refGPtr):
680         (WTF::derefGPtr):
681         * UIProcess/API/wpe/WebKitWebViewBackendPrivate.h:
682
683 2018-01-22  Jon Lee  <jonlee@apple.com>
684
685         Update title label size
686         https://bugs.webkit.org/show_bug.cgi?id=181962
687         rdar://problem/36754744
688
689         Reviewed by Simon Fraser.
690
691         * UIProcess/ios/WKFullScreenWindowControllerIOS.mm:
692         (-[_WKFullScreenViewController setLocation:secure:trustedName:trustedSite:]): Move titleLabel properties into
693         createSubviews.
694         (-[_WKFullScreenViewController createSubviews]): Set the title label for both the cancel and location buttons.
695         Refer to a const CGFloat for the font size.
696
697 2018-01-22  Megan Gardner  <megan_gardner@apple.com>
698
699         Temporarily restore block selection code conditionally
700         https://bugs.webkit.org/show_bug.cgi?id=181895
701         <rdar://problem/36567325>
702
703         Reviewed by Tim Horton.
704
705         We need to restore this code temporarily to avoid a crash.
706
707         * Platform/spi/ios/UIKitSPI.h:
708         * UIProcess/ios/WKContentViewInteraction.mm:
709         (-[WKContentView changeBlockSelectionWithTouchAt:withSelectionTouch:forHandle:]):
710
711 2018-01-22  Zach Li  <zacharyli323@gmail.com>
712
713         We should not try to link against the Safe Browsing framework on watchOS and tvOS.
714         https://bugs.webkit.org/show_bug.cgi?id=181965.
715
716         Reviewed by Tim Horton.
717
718         * Configurations/WebKit.xcconfig:
719
720 2018-01-22  Alex Christensen  <achristensen@webkit.org>
721
722         Remove pre-NetworkSession loading code
723         https://bugs.webkit.org/show_bug.cgi?id=181944
724
725         Reviewed by Tim Horton.
726
727         We were keeping it around for El Capitan.
728
729         * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm:
730         (WebKit::LegacyCustomProtocolManager::registerProtocolClass):
731         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp:
732         (WebKit::LegacyCustomProtocolManager::initialize):
733         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h:
734         * NetworkProcess/Downloads/BlobDownloadClient.cpp: Removed.
735         * NetworkProcess/Downloads/BlobDownloadClient.h: Removed.
736         * NetworkProcess/Downloads/Download.cpp:
737         (WebKit::Download::~Download):
738         (WebKit::Download::cancel):
739         (WebKit::Download::didReceiveChallenge):
740         (WebKit::Download::didFinish):
741         (WebKit::Download::isAlwaysOnLoggingAllowed const):
742         (WebKit::Download::start): Deleted.
743         (WebKit::Download::startWithHandle): Deleted.
744         (WebKit::Download::didStart): Deleted.
745         (WebKit::Download::willSendRedirectedRequest): Deleted.
746         (WebKit::Download::didReceiveAuthenticationChallenge): Deleted.
747         (WebKit::Download::didReceiveResponse): Deleted.
748         (WebKit::Download::shouldDecodeSourceDataOfMIMEType): Deleted.
749         (WebKit::Download::decideDestinationWithSuggestedFilename): Deleted.
750         (WebKit::Download::decideDestinationWithSuggestedFilenameAsync): Deleted.
751         (WebKit::Download::didDecideDownloadDestination): Deleted.
752         (WebKit::Download::continueDidReceiveResponse): Deleted.
753         * NetworkProcess/Downloads/Download.h:
754         (WebKit::Download::setBlobFileReferences): Deleted.
755         (WebKit::Download::request const): Deleted.
756         * NetworkProcess/Downloads/DownloadManager.cpp:
757         (WebKit::DownloadManager::startDownload):
758         (WebKit::DownloadManager::willDecidePendingDownloadDestination):
759         (WebKit::DownloadManager::convertNetworkLoadToDownload):
760         (WebKit::DownloadManager::continueDecidePendingDownloadDestination):
761         (WebKit::DownloadManager::resumeDownload):
762         (WebKit::DownloadManager::cancelDownload):
763         * NetworkProcess/Downloads/DownloadManager.h:
764         (WebKit::DownloadManager::startDownload):
765         * NetworkProcess/Downloads/PendingDownload.cpp:
766         * NetworkProcess/Downloads/PendingDownload.h:
767         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
768         * NetworkProcess/Downloads/ios/DownloadIOS.mm: Removed.
769         * NetworkProcess/Downloads/mac/DownloadMac.mm: Removed.
770         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
771         * NetworkProcess/NetworkCORSPreflightChecker.h:
772         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
773         (WebKit::NetworkConnectionToWebProcess::loadPing):
774         * NetworkProcess/NetworkDataTask.cpp:
775         * NetworkProcess/NetworkDataTask.h:
776         * NetworkProcess/NetworkDataTaskBlob.cpp:
777         * NetworkProcess/NetworkDataTaskBlob.h:
778         * NetworkProcess/NetworkLoad.cpp:
779         (WebKit::NetworkLoad::~NetworkLoad):
780         (WebKit::NetworkLoad::setDefersLoading):
781         (WebKit::NetworkLoad::cancel):
782         (WebKit::NetworkLoad::continueWillSendRequest):
783         (WebKit::NetworkLoad::continueDidReceiveResponse):
784         (WebKit::NetworkLoad::shouldCaptureExtraNetworkLoadMetrics const):
785         (WebKit::NetworkLoad::didReceiveResponseAsync): Deleted.
786         (WebKit::NetworkLoad::didReceiveBuffer): Deleted.
787         (WebKit::NetworkLoad::didFinishLoading): Deleted.
788         (WebKit::NetworkLoad::didFail): Deleted.
789         (WebKit::NetworkLoad::willSendRequestAsync): Deleted.
790         (WebKit::NetworkLoad::canAuthenticateAgainstProtectionSpaceAsync): Deleted.
791         (WebKit::NetworkLoad::shouldUseCredentialStorage): Deleted.
792         (WebKit::NetworkLoad::didReceiveAuthenticationChallenge): Deleted.
793         (WebKit::NetworkLoad::receivedCancellation): Deleted.
794         * NetworkProcess/NetworkLoad.h:
795         * NetworkProcess/NetworkLoadParameters.h:
796         * NetworkProcess/NetworkProcess.cpp:
797         (WebKit::NetworkProcess::initializeNetworkProcess):
798         (WebKit::NetworkProcess::clearCachedCredentials):
799         (WebKit::NetworkProcess::findPendingDownloadLocation):
800         * NetworkProcess/NetworkProcess.h:
801         * NetworkProcess/NetworkProcess.messages.in:
802         * NetworkProcess/NetworkResourceLoader.cpp:
803         (WebKit::NetworkResourceLoader::startNetworkLoad):
804         * NetworkProcess/NetworkSession.cpp:
805         * NetworkProcess/NetworkSession.h:
806         * NetworkProcess/PingLoad.cpp:
807         * NetworkProcess/PingLoad.h:
808         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
809         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
810         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
811         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
812         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
813         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
814         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
815         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
816         * NetworkProcess/mac/NetworkLoadMac.mm: Removed.
817         * NetworkProcess/mac/RemoteNetworkingContext.mm:
818         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
819         * Shared/Authentication/AuthenticationManager.cpp:
820         (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
821         (WebKit::AuthenticationManager::useCredentialForSingleChallenge):
822         (WebKit::AuthenticationManager::continueWithoutCredentialForSingleChallenge):
823         (WebKit::AuthenticationManager::cancelSingleChallenge):
824         (WebKit::AuthenticationManager::performDefaultHandlingForSingleChallenge):
825         (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge):
826         * Shared/Authentication/AuthenticationManager.h:
827         * Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm: Removed.
828         * Shared/SessionTracker.cpp:
829         (WebKit::SessionTracker::setSession):
830         (WebKit::SessionTracker::destroySession):
831         * Shared/SessionTracker.h:
832         * Shared/mac/CookieStorageShim.h: Removed.
833         * Shared/mac/CookieStorageShim.mm: Removed.
834         * UIProcess/API/APIDownloadClient.h:
835         (API::DownloadClient::didReceiveData):
836         (API::DownloadClient::shouldDecodeSourceDataOfMIMEType): Deleted.
837         * UIProcess/API/C/WKContext.cpp:
838         (WKContextSetDownloadClient):
839         * UIProcess/Cocoa/DownloadClient.h:
840         * UIProcess/Cocoa/DownloadClient.mm:
841         (WebKit::DownloadClient::shouldDecodeSourceDataOfMIMEType): Deleted.
842         * UIProcess/Downloads/DownloadProxy.cpp:
843         (WebKit::DownloadProxy::willSendRequest):
844         (WebKit::DownloadProxy::didReceiveResponse):
845         (WebKit::DownloadProxy::shouldDecodeSourceDataOfMIMEType): Deleted.
846         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename): Deleted.
847         * UIProcess/Downloads/DownloadProxy.h:
848         * UIProcess/Downloads/DownloadProxy.messages.in:
849         * WebKit.xcodeproj/project.pbxproj:
850         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
851         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
852         * WebProcess/WebProcess.cpp:
853         (WebKit::WebProcess::initializeWebProcess):
854         (WebKit::WebProcess::clearCachedCredentials):
855         * config.h:
856
857 2018-01-22  Youenn Fablet  <youenn@apple.com>
858
859         SW: Make sure ServiceWorker loading and requests are correctly cleared by ITP
860         https://bugs.webkit.org/show_bug.cgi?id=181942
861         <rdar://problem/35132091>
862
863         Reviewed by Chris Dumez.
864
865         Add ServiceWorkerRegistrations and DOMCache as persistent data to be cleared according ITP decisions.
866
867         * UIProcess/WebResourceLoadStatisticsStore.cpp:
868         (WebKit::WebResourceLoadStatisticsStore::monitoredDataTypes):
869
870 2018-01-22  Chris Dumez  <cdumez@apple.com>
871
872         Add release logging to help debug issues related to service workers
873         https://bugs.webkit.org/show_bug.cgi?id=181935
874         <rdar://problem/36735900>
875
876         Reviewed by Brady Eidson.
877
878         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
879         (WebKit::WebSWServerConnection::startFetch):
880         (WebKit::WebSWServerConnection::didFinishFetch):
881         (WebKit::WebSWServerConnection::didFailFetch):
882         (WebKit::WebSWServerConnection::didNotHandleFetch):
883
884 2018-01-22  Brent Fulgham  <bfulgham@apple.com>
885
886         [iOS] REGRESSION (r225763): Allow access to power logging features
887         https://bugs.webkit.org/show_bug.cgi?id=181938
888         <rdar://problem/36442803>
889
890         Reviewed by Eric Carlson.
891
892         I denied access to the powerlog facility in r225763, not realizing that it
893         gets activated in certain logging scenarios. This patch reverts this change.
894
895         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
896
897 2018-01-22  Brent Fulgham  <bfulgham@apple.com>
898
899         [macOS, iOS] Allow accss to AVFoundation preference
900         https://bugs.webkit.org/show_bug.cgi?id=181937
901         <rdar://problem/33137029>
902
903         Reviewed by Eric Carlson.
904
905         Grant access to the 'com.apple.avfoundation.frecents' preference.
906
907         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
908         * WebProcess/com.apple.WebProcess.sb.in:
909
910 2018-01-22  Brady Eidson  <beidson@apple.com>
911
912         In WebKit2, make the MessagePortChannelRegistry live in the UI process.
913         https://bugs.webkit.org/show_bug.cgi?id=181922
914
915         Reviewed by Andy Estes.
916
917         With all of the work that went into making MessagePorts be fully asynchronous
918         and to be process-aware, formally moving them out-of-process is just a matter
919         of adding WebKit IPC layers.
920         
921         The basic unit of asynchronicity is "MessagePortChannelProvider", and this patch
922         adds both a WebMessagePortChannelProvider and UIMessagePortChannelProvider for
923         each side of the process divide.
924         
925         * UIProcess/UIMessagePortChannelProvider.cpp: Added.
926         (WebKit::UIMessagePortChannelProvider::singleton):
927         (WebKit::UIMessagePortChannelProvider::UIMessagePortChannelProvider):
928         (WebKit::UIMessagePortChannelProvider::~UIMessagePortChannelProvider):
929         (WebKit::UIMessagePortChannelProvider::createNewMessagePortChannel):
930         (WebKit::UIMessagePortChannelProvider::entangleLocalPortInThisProcessToRemote):
931         (WebKit::UIMessagePortChannelProvider::messagePortDisentangled):
932         (WebKit::UIMessagePortChannelProvider::messagePortClosed):
933         (WebKit::UIMessagePortChannelProvider::takeAllMessagesForPort):
934         (WebKit::UIMessagePortChannelProvider::postMessageToRemote):
935         (WebKit::UIMessagePortChannelProvider::checkRemotePortForActivity):
936         (WebKit::UIMessagePortChannelProvider::checkProcessLocalPortForActivity):
937         * UIProcess/UIMessagePortChannelProvider.h: Added.
938         (WebKit::UIMessagePortChannelProvider::registry):
939
940         * UIProcess/WebPageProxy.cpp:
941         (WebKit::m_configurationPreferenceValues):
942
943         * UIProcess/WebProcessProxy.cpp:
944         (WebKit::WebProcessProxy::processForIdentifier):
945         (WebKit::m_userMediaCaptureManagerProxy):
946         (WebKit::WebProcessProxy::~WebProcessProxy):
947         (WebKit::WebProcessProxy::shutDown):
948         (WebKit::WebProcessProxy::createNewMessagePortChannel):
949         (WebKit::WebProcessProxy::entangleLocalPortInThisProcessToRemote):
950         (WebKit::WebProcessProxy::messagePortDisentangled):
951         (WebKit::WebProcessProxy::messagePortClosed):
952         (WebKit::WebProcessProxy::takeAllMessagesForPort):
953         (WebKit::WebProcessProxy::didDeliverMessagePortMessages):
954         (WebKit::WebProcessProxy::postMessageToRemote):
955         (WebKit::WebProcessProxy::checkRemotePortForActivity):
956         (WebKit::WebProcessProxy::checkProcessLocalPortForActivity):
957         (WebKit::WebProcessProxy::didCheckProcessLocalPortForActivity):
958         * UIProcess/WebProcessProxy.h:
959         * UIProcess/WebProcessProxy.messages.in:
960
961         * WebKit.xcodeproj/project.pbxproj:
962
963         * WebProcess/WebCoreSupport/WebMessagePortChannelProvider.cpp: Added.
964         (WebKit::WebMessagePortChannelProvider::singleton):
965         (WebKit::WebMessagePortChannelProvider::WebMessagePortChannelProvider):
966         (WebKit::WebMessagePortChannelProvider::~WebMessagePortChannelProvider):
967         (WebKit::WebMessagePortChannelProvider::createNewMessagePortChannel):
968         (WebKit::WebMessagePortChannelProvider::entangleLocalPortInThisProcessToRemote):
969         (WebKit::WebMessagePortChannelProvider::messagePortDisentangled):
970         (WebKit::WebMessagePortChannelProvider::messagePortClosed):
971         (WebKit::WebMessagePortChannelProvider::takeAllMessagesForPort):
972         (WebKit::WebMessagePortChannelProvider::didTakeAllMessagesForPort):
973         (WebKit::WebMessagePortChannelProvider::didCheckRemotePortForActivity):
974         (WebKit::WebMessagePortChannelProvider::postMessageToRemote):
975         (WebKit::WebMessagePortChannelProvider::checkProcessLocalPortForActivity):
976         (WebKit::WebMessagePortChannelProvider::checkRemotePortForActivity):
977         * WebProcess/WebCoreSupport/WebMessagePortChannelProvider.h: Added.
978
979         * WebProcess/WebProcess.cpp:
980         (WebKit::WebProcess::initializeProcess):
981         (WebKit::WebProcess::didTakeAllMessagesForPort):
982         (WebKit::WebProcess::checkProcessLocalPortForActivity):
983         (WebKit::WebProcess::didCheckRemotePortForActivity):
984         (WebKit::WebProcess::messagesAvailableForPort):
985         * WebProcess/WebProcess.h:
986         * WebProcess/WebProcess.messages.in:
987
988 2018-01-22  Youenn Fablet  <youenn@apple.com>
989
990         Bump default cache storage quota to 50MB
991         https://bugs.webkit.org/show_bug.cgi?id=181924
992
993         Reviewed by Chris Dumez.
994
995         Existing web sites use more than 20 MB.
996
997         * UIProcess/WebsiteData/WebsiteDataStore.h:
998
999 2018-01-22  Zan Dobersek  <zdobersek@igalia.com>
1000
1001         Unreviewed build fix after r227292. Fixing a bad copy-paste that broke
1002         the GTK+ debug builds.
1003
1004         * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
1005         (WebKit::convertCairoSurfaceToShareableBitmap):
1006
1007 2018-01-22  Zan Dobersek  <zdobersek@igalia.com>
1008
1009         [Cairo] Refactor PlatformContextCairo::drawSurfaceToContext() into a Cairo operation
1010         https://bugs.webkit.org/show_bug.cgi?id=181930
1011
1012         Reviewed by Carlos Garcia Campos.
1013
1014         Call sites of the PlatformContextCairo::drawSurfaceToContext() method
1015         are adjusted to now call Cairo::drawSurface() and properly pass the
1016         PlatformContextCairo object to the function.
1017
1018         * Shared/cairo/ShareableBitmapCairo.cpp:
1019         (WebKit::ShareableBitmap::paint):
1020         * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
1021         (WebKit::convertCairoSurfaceToShareableBitmap):
1022
1023 2018-01-21  Carlos Garcia Campos  <cgarcia@igalia.com>
1024
1025         Unreviewed. Fix compile warning.
1026
1027         Use #include instead of #import in cross-platform code.
1028
1029         * Shared/WebPreferencesDefaultValues.cpp:
1030
1031 2018-01-21  Ryosuke Niwa  <rniwa@webkit.org>
1032
1033         Turning off custom pasteboard data doesn't actually turn it off in WK2
1034         https://bugs.webkit.org/show_bug.cgi?id=181920
1035         <rdar://problem/36686429>
1036
1037         Reviewed by Wenson Hsieh.
1038
1039         Moved the code to decide when to enable custom pasteboard data from WebCore
1040         since we never enable this feature in WebKit1.
1041
1042         * Shared/WebPreferences.yaml:
1043         * Shared/WebPreferencesDefaultValues.cpp:
1044         (defaultCustomPasteboardDataEnabled): Added.
1045         * Shared/WebPreferencesDefaultValues.h:
1046
1047 2018-01-21  Wenson Hsieh  <wenson_hsieh@apple.com>
1048
1049         Add a new feature flag for EXTRA_ZOOM_MODE and reintroduce AdditionalFeatureDefines.h
1050         https://bugs.webkit.org/show_bug.cgi?id=181918
1051
1052         Reviewed by Tim Horton.
1053
1054         Add EXTRA_ZOOM_MODE to FeatureDefines.xconfig (off by default).
1055
1056         * Configurations/FeatureDefines.xcconfig:
1057
1058 2018-01-21  Eric Carlson  <eric.carlson@apple.com>
1059
1060         Resign NowPlaying status when no media element is eligible
1061         https://bugs.webkit.org/show_bug.cgi?id=181914
1062         <rdar://problem/35294116>
1063
1064         Reviewed by Jer Noble.
1065
1066         * UIProcess/API/Cocoa/WKWebView.mm:
1067         (-[WKWebView _requestActiveNowPlayingSessionInfo:]): Return registeredAsNowPlayingApplication
1068         status.
1069         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1070
1071         * UIProcess/WebPageProxy.cpp:
1072         (WebKit::WebPageProxy::nowPlayingInfoCallback): Ditto.
1073         * UIProcess/WebPageProxy.h:
1074         * UIProcess/WebPageProxy.messages.in:
1075         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
1076         (WebKit::WebPage::requestActiveNowPlayingSessionInfo): Ditto.
1077
1078 2018-01-20  Andy Estes  <aestes@apple.com>
1079
1080         [Apple Pay] Stop eagerly loading PassKit.framework
1081         https://bugs.webkit.org/show_bug.cgi?id=181911
1082         <rdar://problem/36555369>
1083
1084         Reviewed by Tim Horton.
1085
1086         * Shared/WebPageCreationParameters.cpp:
1087         (WebKit::WebPageCreationParameters::encode const):
1088         (WebKit::WebPageCreationParameters::decode):
1089         * Shared/WebPageCreationParameters.h:
1090
1091         Removed availablePaymentNetworks from WebPageCreationParameters.
1092
1093         * UIProcess/API/C/WKPreferences.cpp:
1094         (WKPreferencesSetApplePayEnabled):
1095         * UIProcess/API/Cocoa/WKWebView.mm:
1096         (-[WKWebView _initializeWithConfiguration:]):
1097
1098         Stopped calling WebPaymentCoordinatorProxy::platformSupportsPayments().
1099
1100         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
1101         (WebKit::WebPaymentCoordinatorProxy::availablePaymentNetworks):
1102         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
1103         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in:
1104
1105         Added message AvailablePaymentNetworks, which synchronously returns a Vector of payment
1106         networks.
1107
1108         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1109         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
1110
1111         Returned false if PassKitLibrary() fails.
1112
1113         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard):
1114         (WebKit::WebPaymentCoordinatorProxy::platformOpenPaymentSetup):
1115
1116         Called completionHandler with false if PassKitLibrary() fails.
1117
1118         (WebKit::WebPaymentCoordinatorProxy::platformAvailablePaymentNetworks):
1119         (WebKit::WebPaymentCoordinatorProxy::availablePaymentNetworks):
1120
1121         Renamed availablePaymentNetworks to platformAvailablePaymentNetworks
1122
1123         (WebKit::WebPaymentCoordinatorProxy::platformSupportsPayments): Deleted.
1124
1125         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
1126         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
1127
1128         Called completionHandler with false if PassKitLibrary() fails.
1129
1130         * UIProcess/WebPageProxy.cpp:
1131         (WebKit::WebPageProxy::creationParameters):
1132
1133         Stopped calling WebPaymentCoordinatorProxy::availablePaymentNetworks().
1134
1135         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
1136         (WebKit::WebPaymentCoordinator::availablePaymentNetworks):
1137         (WebKit::WebPaymentCoordinator::validatedPaymentNetwork):
1138         * WebProcess/ApplePay/WebPaymentCoordinator.h:
1139
1140         Implemented PaymentCoordinatorClient::validatedPaymentNetwork(). m_availablePaymentNetworks
1141         starts off as std::nullopt, but is initialized by sending the AvailablePaymentNetworks sync
1142         message the first time it's accessed.
1143
1144         * WebProcess/WebPage/WebPage.cpp:
1145         (WebKit::WebPage::WebPage):
1146
1147         Stopped setting PageConfiguration::availablePaymentNetworks.
1148
1149 2018-01-20  Jer Noble  <jer.noble@apple.com>
1150
1151         Release ASSERT when reloading Vimeo page @ WebCore: WebCore::Document::updateLayout
1152         https://bugs.webkit.org/show_bug.cgi?id=181840
1153         <rdar://problem/36186214>
1154
1155         Reviewed by Simon Fraser.
1156
1157         Updating layout while the document is suspended or stopped is unsafe.
1158
1159         * WebProcess/cocoa/VideoFullscreenManager.mm:
1160         (WebKit::inlineVideoFrame):
1161
1162 2018-01-20  Chris Dumez  <cdumez@apple.com>
1163
1164         DOMCache data sometimes not properly removed when clearing data for a given origin
1165         https://bugs.webkit.org/show_bug.cgi?id=181887
1166         <rdar://problem/36671239>
1167
1168         Reviewed by Youenn Fablet.
1169
1170         * NetworkProcess/cache/CacheStorageEngine.cpp:
1171         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
1172         This code was iterating through folders on disk, then reading the folder's origin
1173         from the origin file on disk. Then, if the origin would match the one we want to
1174         delete, it would regenerate the folder path using cachesRootPath(*folderOrigin).
1175         I don't know how but on my machine, I was ended up in a state where the path
1176         generated by cachesRootPath(*folderOrigin) differed from the actual folder path
1177         we read the origin from (Likely a different salt?). To make the code more robust,
1178         I updated the code to delete "folderPath", which is the path we read the origin
1179         from.
1180
1181 2018-01-19  Zach Li  <zacharyli323@gmail.com>
1182
1183         Expose Safe Browsing SPI
1184         https://bugs.webkit.org/show_bug.cgi?id=181804
1185         <rdar://problem/36626946>
1186
1187         Reviewed by Dan Bernstein.
1188
1189         If client is using Apple internal SDK, then we can just import the header; if not,
1190         then we declare necessary symbols that client will need.
1191
1192         * Configurations/WebKit.xcconfig:
1193         Only link against SafariSafeBrowsing framework on macOS High Sierra
1194         and iOS 11 and above. Weak link against SafariSafeBrowsing framework
1195         because it is not present on the Base system.
1196
1197         * Platform/spi/Cocoa/SafeBrowsingSPI.h: Added.
1198
1199         * WebKit.xcodeproj/project.pbxproj:
1200         Added SafeBrowsingSPI.h.
1201
1202         * WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/11/SafariSafeBrowsing.framework/SafariSafeBrowsing.tbd:
1203         Added.
1204
1205 2018-01-19  Ryan Haddad  <ryanhaddad@apple.com>
1206
1207         Unreviewed build fix, removed unused lambda capture.
1208
1209         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1210         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
1211
1212 2018-01-19  John Wilander  <wilander@apple.com>
1213
1214         Resource Load Statistics: Remove unused calls to WebResourceLoadStatisticsStore:logTestingEvent() to fix API test
1215         https://bugs.webkit.org/show_bug.cgi?id=181890
1216         <rdar://problem/36674772>
1217
1218         Unreviewed API test fix.
1219
1220         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1221         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
1222
1223 2018-01-19  Youenn Fablet  <youenn@apple.com>
1224
1225         Do not go to the storage process when registering a service worker client if there is no service worker registered
1226         https://bugs.webkit.org/show_bug.cgi?id=181740
1227         <rdar://problem/36650400>
1228
1229         Reviewed by Chris Dumez.
1230
1231         UIProcess notifies all web processes to register their service worker clients when spinning the service worker process.
1232         Add private API to set the number of web processes for testing purposes.
1233
1234         * UIProcess/API/Cocoa/WKProcessPool.mm:
1235         (-[WKProcessPool _setMaximumNumberOfProcesses:]):
1236         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1237         * UIProcess/WebProcessPool.cpp:
1238         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
1239         * WebProcess/WebProcess.cpp:
1240         (WebKit::WebProcess::registerServiceWorkerClients):
1241         * WebProcess/WebProcess.h:
1242         * WebProcess/WebProcess.messages.in:
1243
1244 2018-01-19  Dean Jackson  <dino@apple.com>
1245
1246         REGRESSION (r221092): Swipe actions are hard to perform in FastMail app
1247         https://bugs.webkit.org/show_bug.cgi?id=181817
1248         <rdar://problem/35274055>
1249
1250         Reviewed by Simon Fraser.
1251
1252         Add a linked-on-or-after check to set passive touch listeners on document in WebCore.
1253
1254         * CMakeLists.txt:
1255         * Shared/WebPreferences.yaml:
1256         * Shared/WebPreferencesDefaultValues.cpp: Copied from Source/WebKit/UIProcess/Cocoa/VersionChecks.h.
1257         (defaultPassiveTouchListenersAsDefaultOnDocument):
1258         * Shared/WebPreferencesDefaultValues.h:
1259         * UIProcess/Cocoa/VersionChecks.h:
1260         * WebKit.xcodeproj/project.pbxproj:
1261
1262 2018-01-19  Joseph Pecoraro  <pecoraro@apple.com>
1263
1264         [Cocoa] _WKNSWindowExtras.h: Add missing availability annotation
1265         https://bugs.webkit.org/show_bug.cgi?id=181868
1266
1267         Reviewed by Dan Bernstein.
1268
1269         * Shared/API/Cocoa/_WKNSWindowExtras.h:
1270
1271 2018-01-19  John Wilander  <wilander@apple.com>
1272
1273         Resource Load Statistics: Add void to argument list to fix build with -Wstrict-prototypes
1274         https://bugs.webkit.org/show_bug.cgi?id=181870
1275         <rdar://problem/36666750>
1276
1277         Unreviewed build fix.
1278
1279         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1280
1281 2018-01-19  Ryan Haddad  <ryanhaddad@apple.com>
1282
1283         Unreviewed, rolling out r227211.
1284
1285         Breaks iOS Simulator tests.
1286
1287         Reverted changeset:
1288
1289         "Expose Safe Browsing SPI"
1290         https://bugs.webkit.org/show_bug.cgi?id=181804
1291         https://trac.webkit.org/changeset/227211
1292
1293 2018-01-19  John Wilander  <wilander@apple.com>
1294
1295         Resource Load Statistics: Implement callback support for removal of WebsiteDataType::ResourceLoadStatistics
1296         https://bugs.webkit.org/show_bug.cgi?id=181822
1297         https://bugs.webkit.org/show_bug.cgi?id=175263
1298         https://bugs.webkit.org/show_bug.cgi?id=178536
1299         https://bugs.webkit.org/show_bug.cgi?id=181223
1300         https://bugs.webkit.org/show_bug.cgi?id=181482
1301         <rdar://problem/33491222>
1302         <rdar://problem/33805293>
1303         <rdar://problem/36332683>
1304         <rdar://problem/36549026>
1305
1306         Reviewed by Alex Christensen.
1307
1308         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1309         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
1310         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
1311         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1312         (-[WKWebsiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStore]):
1313             Calls the new API with no-op completion handler.
1314         (-[WKWebsiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStore:]):
1315             New API with completion handler.
1316         (-[WKWebsiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours:]):
1317             Calls the new API with no-op completion handler.
1318         (-[WKWebsiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours:completionHandler:]):
1319             New API with completion handler.
1320         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1321         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
1322         (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk):
1323         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1324         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
1325         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
1326         * UIProcess/WebResourceLoadStatisticsStore.h:
1327         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1328         (WebKit::WebsiteDataStore::removeData):
1329         (WebKit::WebsiteDataStore::clearResourceLoadStatisticsInWebProcesses):
1330         * UIProcess/WebsiteData/WebsiteDataStore.h:
1331
1332 2018-01-19  Daniel Bates  <dabates@apple.com>
1333
1334         REGRESSION (r223149): Ref WebPageProxy objects before calling their functionality
1335         https://bugs.webkit.org/show_bug.cgi?id=181863
1336         <rdar://problem/36662452>
1337
1338         Reviewed by Chris Dumez.
1339
1340         More fix ups following r223149. When notifying all pages of a process state change we need to
1341         take care to ref all the pages before iterating over them and notifying them of the change.
1342         Notifying a page of such a state change may ultimately delegate to the embedding client. And
1343         the embedding client can do anything, including deallocating one or more pages.
1344
1345         * UIProcess/WebProcessProxy.cpp:
1346         (WebKit::WebProcessProxy::didBecomeUnresponsive):
1347         (WebKit::WebProcessProxy::didBecomeResponsive):
1348         (WebKit::WebProcessProxy::willChangeIsResponsive):
1349         (WebKit::WebProcessProxy::didChangeIsResponsive):
1350         (WebKit::WebProcessProxy::requestTermination):
1351
1352 2018-01-19  Chris Dumez  <cdumez@apple.com>
1353
1354         The WebContent process should not process incoming IPC while waiting for a sync IPC reply
1355         https://bugs.webkit.org/show_bug.cgi?id=181560
1356
1357         Reviewed by Ryosuke Niwa.
1358
1359         The WebContent process should not process incoming IPC while waiting for a sync IPC reply.
1360         This is causing hard-to-debug crashes because developers often assume the state does not
1361         change during a sendSync() call.
1362
1363         * Platform/IPC/Connection.cpp:
1364         (IPC::Connection::waitForSyncReply):
1365         * Platform/IPC/Connection.h:
1366         (IPC::Connection::setShouldProcessIncomingMessagesWhileWaitingForSyncReply):
1367         * UIProcess/WebProcessProxy.cpp:
1368         (WebKit::WebProcessProxy::testIncomingSyncIPCMessageWhileWaitingForSyncReply):
1369         * UIProcess/WebProcessProxy.h:
1370         * UIProcess/WebProcessProxy.messages.in:
1371         * WebProcess/Network/NetworkProcessConnection.cpp:
1372         (WebKit::NetworkProcessConnection::NetworkProcessConnection):
1373         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
1374         (WebKit::WebToStorageProcessConnection::WebToStorageProcessConnection):
1375         * WebProcess/WebConnectionToUIProcess.cpp:
1376         (WebKit::WebConnectionToUIProcess::WebConnectionToUIProcess):
1377         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1378         (WebKit::WebChromeClient::testIncomingSyncIPCMessageWhileWaitingForSyncReply):
1379         * WebProcess/WebCoreSupport/WebChromeClient.h:
1380         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1381         (WebKit::WebEditorClient::undo):
1382         (WebKit::WebEditorClient::redo):
1383         * WebProcess/WebProcess.cpp:
1384         (WebKit::WebProcess::syncIPCMessageWhileWaitingForSyncReplyForTesting):
1385         * WebProcess/WebProcess.h:
1386         * WebProcess/WebProcess.messages.in:
1387
1388 2018-01-19  Keith Miller  <keith_miller@apple.com>
1389
1390         HaveInternalSDK includes should be "#include?"
1391         https://bugs.webkit.org/show_bug.cgi?id=179670
1392
1393         Reviewed by Dan Bernstein.
1394
1395         * Configurations/Base.xcconfig:
1396
1397 2018-01-19  Daniel Bates  <dabates@apple.com>
1398
1399         Fix misspelling; substitute willDetachRenderer for willDetatchRenderer.
1400
1401         * WebProcess/Plugins/PDF/PDFPlugin.h:
1402         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1403         (WebKit::PDFPlugin::willDetachRenderer):
1404         (WebKit::PDFPlugin::willDetatchRenderer): Deleted.
1405         * WebProcess/Plugins/Plugin.h:
1406         (WebKit::Plugin::willDetachRenderer):
1407         (WebKit::Plugin::willDetatchRenderer): Deleted.
1408         * WebProcess/Plugins/PluginView.cpp:
1409         (WebKit::PluginView::willDetachRenderer):
1410         (WebKit::PluginView::willDetatchRenderer): Deleted.
1411         * WebProcess/Plugins/PluginView.h:
1412
1413 2018-01-19  Zach Li  <zacharyli323@gmail.com>
1414
1415         Expose Safe Browsing SPI
1416         https://bugs.webkit.org/show_bug.cgi?id=181804
1417         <rdar://problem/36626946>
1418
1419         Reviewed by Alex Christensen.
1420
1421         If client is using Apple internal SDK, then we can just import the header; if not,
1422         then we declare necessary symbols that client will need.
1423
1424         * Configurations/WebKit.xcconfig:
1425         Only link against SafariSafeBrowsing framework on macOS High Sierra
1426         and iOS 11 and above. Weak link against SafariSafeBrowsing framework
1427         because it is not present on the Base system.
1428
1429         * Platform/spi/Cocoa/SafeBrowsingSPI.h: Added.
1430
1431         * WebKit.xcodeproj/project.pbxproj:
1432         Added SafeBrowsingSPI.h.
1433
1434         * WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/11/SafariSafeBrowsing.framework/SafariSafeBrowsing.tbd:
1435         Added.
1436
1437 2018-01-18  Chris Dumez  <cdumez@apple.com>
1438
1439         We should be able to terminate service workers that are unresponsive
1440         https://bugs.webkit.org/show_bug.cgi?id=181563
1441         <rdar://problem/35280031>
1442
1443         Reviewed by Alex Christensen.
1444
1445         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1446         (WebKit::WebSWContextManagerConnection::terminateWorker):
1447         Use a 10 second timeout for forcefully exiting the service worker process when
1448         the service worker in question fails to terminate.
1449
1450         (WebKit::WebSWContextManagerConnection::syncTerminateWorker):
1451         Use a 100ms timeout for forcefully exiting the service worker process when
1452         the service worker in question fails to terminate. This method is only called
1453         from the layout tests, which is why we use a very short timeout.
1454
1455 2018-01-18  Ryan Haddad  <ryanhaddad@apple.com>
1456
1457         Unreviewed, suppress deprecation warnings to fix the build with a newer SDK.
1458
1459         * UIProcess/ios/WKPDFPageNumberIndicator.mm:
1460         (-[WKPDFPageNumberIndicator _makeRoundedCorners]):
1461
1462 2018-01-18  Youenn Fablet  <youenn@apple.com>
1463
1464         Do not go to the storage process when loading a main resource if there is no service worker registered
1465         https://bugs.webkit.org/show_bug.cgi?id=181395
1466
1467         Reviewed by Chris Dumez.
1468
1469         Add a new web process creation parameter to know whether there is any service worker registered at web process creation time.
1470         If there is none, the web process will then start to load HTTP resources from the network.
1471         The connection to the storage process is then executed when receiving the first bytes of the main resource.
1472         This connection is needed as other web processes may create service workers at any given time.
1473         If there is one registered service worker, the web process will wait for its connection to the storage process to be active.
1474
1475         * Shared/WebProcessCreationParameters.cpp:
1476         (WebKit::WebProcessCreationParameters::encode const):
1477         (WebKit::WebProcessCreationParameters::decode):
1478         * Shared/WebProcessCreationParameters.h:
1479         * UIProcess/ServiceWorkerProcessProxy.cpp:
1480         (WebKit::ServiceWorkerProcessProxy::hasRegisteredServiceWorkers):
1481         * UIProcess/ServiceWorkerProcessProxy.h:
1482         * UIProcess/WebProcessPool.cpp:
1483         (WebKit::WebProcessPool::initializeNewWebProcess):
1484         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
1485         (WebKit::WebServiceWorkerProvider::existingServiceWorkerConnectionForSession):
1486         * WebProcess/Storage/WebServiceWorkerProvider.h:
1487         * WebProcess/Storage/WebToStorageProcessConnection.h:
1488         (WebKit::WebToStorageProcessConnection::existingServiceWorkerConnectionForSession):
1489         * WebProcess/WebProcess.cpp:
1490         (WebKit::WebProcess::initializeWebProcess):
1491
1492 2018-01-18  Chris Dumez  <cdumez@apple.com>
1493
1494         Regression(r223149): WebProcessProxy::didClose() no longer refs WebPageProxy objects
1495         https://bugs.webkit.org/show_bug.cgi?id=181771
1496         <rdar://problem/36566237>
1497
1498         Reviewed by Brady Eidson.
1499
1500         * UIProcess/WebProcessProxy.cpp:
1501         (WebKit::WebProcessProxy::didClose):
1502         Use copyToVectorOf<RefPtr<WebPageProxy>>() to maintain pre-r223149 behavior
1503         and ref the pages.
1504
1505 2018-01-18  Dan Bernstein  <mitz@apple.com>
1506
1507         [Xcode] Streamline and future-proof target-macOS-version-dependent build setting definitions
1508         https://bugs.webkit.org/show_bug.cgi?id=181803
1509
1510         Reviewed by Tim Horton.
1511
1512         * Configurations/Base.xcconfig: Updated.
1513         * Configurations/DebugRelease.xcconfig: Ditto.
1514         * Configurations/FeatureDefines.xcconfig: Adopted macOSTargetConditionals helpers.
1515         * Configurations/Version.xcconfig: Updated.
1516         * Configurations/macOSTargetConditionals.xcconfig: Added.  Defines helper build settings
1517           useful for defining settings that depend on the target macOS version.
1518
1519 2018-01-18  Chris Dumez  <cdumez@apple.com>
1520
1521         Service Workers restored from persistent storage have 'redundant' state
1522         https://bugs.webkit.org/show_bug.cgi?id=181749
1523         <rdar://problem/36556486>
1524
1525         Reviewed by Youenn Fablet.
1526
1527         Allow service workers to intercept custom protocol loads as this is useful for
1528         API testing.
1529
1530         * WebProcess/Network/WebLoaderStrategy.cpp:
1531         (WebKit::WebLoaderStrategy::scheduleLoad):
1532         (WebKit::WebLoaderStrategy::tryLoadingUsingURLSchemeHandler):
1533         * WebProcess/Network/WebLoaderStrategy.h:
1534
1535 2018-01-18  Brent Fulgham  <bfulgham@apple.com>
1536
1537         REGRESSION(r225858): Sandbox violations due to blocked access to Spotlight search preferences
1538         https://bugs.webkit.org/show_bug.cgi?id=181797
1539         <rdar://problem/36546412>
1540
1541         Reviewed by Eric Carlson.
1542
1543         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: Add the read permission for
1544         'com.apple.lookup.shared' to support DataDetectors.
1545
1546 2018-01-17  John Wilander  <wilander@apple.com>
1547
1548         Resource Load Statistics: Block cookies for prevalent resources without user interaction
1549         https://bugs.webkit.org/show_bug.cgi?id=177394
1550         <rdar://problem/34613960>
1551
1552         Reviewed by Alex Christensen.
1553
1554         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1555             Now has m_hasBeenSetToUseStatelessCookieStorage to handle
1556             cookie blocking.
1557         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1558         (WebKit::NetworkDataTaskCocoa::statelessCookieStorage):
1559             Returns singleton empty, deny-all cookie storage for cookie blocking.
1560             The ugly pragma instructions for clang are because the NSString
1561             parameter for _initWithIdentifier was not marked nullable pre-Sierra.
1562         (WebKit::NetworkDataTaskCocoa::applyCookieBlockingPolicy):
1563             Instead of just decision making, this now applies the policy.
1564         (WebKit::NetworkDataTaskCocoa::applyCookiePartitioningPolicy):
1565             New method.
1566         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
1567             Now blocks cookies for domains where cookies will be purged anyway.
1568         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
1569             Now blocks cookies for domains where cookies will be purged anyway.
1570         (WebKit::shouldChangePartition): Deleted.
1571         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1572         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
1573             Now downgrades for blocked cookies instead of partitioned cookies.
1574         (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
1575             Now downgrades for blocked cookies instead of partitioned cookies.
1576
1577
1578 2018-01-17  Stephan Szabo  <stephan.szabo@sony.com>
1579
1580         [Curl] Use ResourceRequest::encodeWithPlatformData()
1581         https://bugs.webkit.org/show_bug.cgi?id=181768
1582
1583         Reviewed by Alex Christensen.
1584
1585         * Shared/curl/WebCoreArgumentCodersCurl.cpp:
1586         (IPC::ArgumentCoder<ResourceRequest>::encodePlatformData):
1587         (IPC::ArgumentCoder<ResourceRequest>::decodePlatformData):
1588
1589 2018-01-17  Matt Lewis  <jlewis3@apple.com>
1590
1591         Unreviewed, rolling out r227076.
1592
1593         This breaks internal builds
1594
1595         Reverted changeset:
1596
1597         "Resource Load Statistics: Block cookies for prevalent
1598         resources without user interaction"
1599         https://bugs.webkit.org/show_bug.cgi?id=177394
1600         https://trac.webkit.org/changeset/227076
1601
1602 2018-01-17  Michael Catanzaro  <mcatanzaro@igalia.com>
1603
1604         WEBKIT_FRAMEWORK should not modify file-global include directories
1605         https://bugs.webkit.org/show_bug.cgi?id=181656
1606
1607         Reviewed by Konstantin Tokarev.
1608
1609         * PlatformGTK.cmake:
1610         * PlatformWPE.cmake:
1611
1612 2018-01-17  Youenn Fablet  <youenn@apple.com>
1613
1614         Put fetch request keepAlive behind a runtime flag
1615         https://bugs.webkit.org/show_bug.cgi?id=181592
1616
1617         Reviewed by Chris Dumez.
1618
1619         * Shared/WebPreferences.yaml:
1620         * UIProcess/API/C/WKPreferences.cpp:
1621         (WKPreferencesSetFetchAPIKeepAliveEnabled):
1622         (WKPreferencesGetFetchAPIKeepAliveEnabled):
1623         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1624
1625 2018-01-17  John Wilander  <wilander@apple.com>
1626
1627         Resource Load Statistics: Block cookies for prevalent resources without user interaction
1628         https://bugs.webkit.org/show_bug.cgi?id=177394
1629         <rdar://problem/34613960>
1630
1631         Reviewed by Alex Christensen.
1632
1633         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1634             Now has m_hasBeenSetToUseStatelessCookieStorage to handle
1635             cookie blocking.
1636         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1637         (WebKit::NetworkDataTaskCocoa::statelessCookieStorage):
1638             Returns singleton empty, deny-all cookie storage for cookie blocking.
1639         (WebKit::NetworkDataTaskCocoa::applyCookieBlockingPolicy):
1640             Instead of just decision making, this now applies the policy.
1641         (WebKit::NetworkDataTaskCocoa::applyCookiePartitioningPolicy):
1642             New method.
1643         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
1644             Now blocks cookies for domains where cookies will be purged anyway.
1645         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
1646             Now blocks cookies for domains where cookies will be purged anyway.
1647         (WebKit::shouldChangePartition): Deleted.
1648         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1649         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
1650             Now downgrades for blocked cookies instead of partitioned cookies.
1651         (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
1652             Now downgrades for blocked cookies instead of partitioned cookies.
1653
1654 2018-01-17  Daniel Bates  <dabates@apple.com>
1655
1656         REGRESSION (r222795): Cardiogram never signs in
1657         https://bugs.webkit.org/show_bug.cgi?id=181693
1658         <rdar://problem/36286293>
1659
1660         Reviewed by Ryosuke Niwa.
1661
1662         Exempt Cardiogram from the XHR header restrictions in r222795.
1663
1664         Following r222795 only Dashboard widgets are allowed to set arbitrary XHR headers.
1665         However Cardiogram also depends on such functionality.
1666
1667         * Shared/WebPreferences.yaml:
1668         * UIProcess/API/Cocoa/WKWebView.mm:
1669         (shouldAllowSettingAnyXHRHeaderFromFileURLs):
1670         (-[WKWebView _initializeWithConfiguration:]):
1671         * UIProcess/Cocoa/VersionChecks.h:
1672
1673 2018-01-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1674
1675         Add injected bundle SPI to replace subresource URLs when dropping or pasting rich content
1676         https://bugs.webkit.org/show_bug.cgi?id=181637
1677         <rdar://problem/36508471>
1678
1679         Reviewed by Tim Horton.
1680
1681         Add new injected bundle SPI, replacementURLForResource, which clients may use to provide a replacement URL to
1682         represent an archive resource, given the resource's data and MIME type.
1683
1684         * WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h:
1685         (API::InjectedBundle::EditorClient::replacementURLForResource):
1686         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h:
1687         * WebProcess/InjectedBundle/API/c/WKBundlePageEditorClient.h:
1688
1689         Add replacementURLForResource, and also bump the current injected bundle editor client version to 2.
1690
1691         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1692         (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]):
1693         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
1694         (WebKit::InjectedBundlePageEditorClient::replacementURLForResource):
1695         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h:
1696         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1697         (WebKit::WebEditorClient::replacementURLForResource):
1698         * WebProcess/WebCoreSupport/WebEditorClient.h:
1699
1700 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
1701
1702         [Cairo] Don't mirror global alpha and image interpolation quality state values in PlatformContextCairo
1703         https://bugs.webkit.org/show_bug.cgi?id=181725
1704
1705         Reviewed by Carlos Garcia Campos.
1706
1707         * Shared/cairo/ShareableBitmapCairo.cpp:
1708         (WebKit::ShareableBitmap::paint):
1709         Adjust the PlatformContextCairo::drawSurfaceToContext() invocation.
1710         * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
1711         (WebKit::convertCairoSurfaceToShareableBitmap): Ditto.
1712
1713 2018-01-17  Carlos Garcia Campos  <cgarcia@igalia.com>
1714
1715         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.19.6 release.
1716
1717         * gtk/NEWS: Add release notes for 2.19.6.
1718
1719 2018-01-17  Carlos Garcia Campos  <cgarcia@igalia.com>
1720
1721         [GTK] Duplicated symbols in libjavascriptcoregtk and libwebkit2gtk can cause crashes in production builds
1722         https://bugs.webkit.org/show_bug.cgi?id=179914
1723
1724         Reviewed by Žan Doberšek.
1725
1726         Add symbols detected by check-for-global-bss-symbols-in-webkigtk-libs to the version script.
1727
1728         * webkitglib-symbols.map:
1729
1730 2018-01-17  Youenn Fablet  <youenn@apple.com>
1731
1732         Clear Caches volatile storage as a memory optimization.
1733         https://bugs.webkit.org/show_bug.cgi?id=181643
1734
1735         Reviewed by Chris Dumez.
1736
1737         clearMemoryRepresentation clears m_caches which exposes data potentially stored in m_volatileStorage.
1738         Clearing m_volatileStorage allows releasing some memory.
1739
1740         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1741         (WebKit::CacheStorage::Caches::clearMemoryRepresentation):
1742
1743 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
1744
1745         [Cairo] Use one-time ShadowBlur objects when performing shadowing
1746         https://bugs.webkit.org/show_bug.cgi?id=181720
1747
1748         Reviewed by Carlos Garcia Campos.
1749
1750         * Shared/cairo/ShareableBitmapCairo.cpp:
1751         (WebKit::ShareableBitmap::paint):
1752         Adjust the PlatformContextCairo::drawSurfaceToContext() invocation.
1753         * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
1754         (WebKit::convertCairoSurfaceToShareableBitmap): Ditto.
1755
1756 2018-01-16  Fujii Hironori  <Hironori.Fujii@sony.com>
1757
1758         [CMake] Remove WebCoreDerivedSources library target
1759         https://bugs.webkit.org/show_bug.cgi?id=181664
1760
1761         Reviewed by Carlos Garcia Campos.
1762
1763         * CMakeLists.txt: Do not link WebCoreDerivedSources.
1764         * PlatformGTK.cmake: Appended WebCore after WebCorePlatformGTK in WebKit_LIBRARIES.
1765         * PlatformWin.cmake: Ditto.
1766
1767 2018-01-16  Alex Christensen  <achristensen@webkit.org>
1768
1769         Merge sync and async code paths for getting context menus
1770         https://bugs.webkit.org/show_bug.cgi?id=181423
1771
1772         Reviewed by Joseph Pecoraro.
1773
1774         What a mess.  We had a code path for asynchronous context menu generation and a different one for synchronous context menu generation.
1775         This makes it so there is just one.  At the API level we see if there is an asynchronous delegate to call, then synchronous.
1776         There is a subtle theoretical change in behaviour because m_page.contextMenuClient().showContextMenu is now called for the asynchronous
1777         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!
1778
1779         * UIProcess/API/APIContextMenuClient.h:
1780         (API::ContextMenuClient::getContextMenuFromProposedMenu):
1781         (API::ContextMenuClient::getContextMenuFromProposedMenuAsync): Deleted.
1782         * UIProcess/API/C/WKPage.cpp:
1783         (WKPageSetPageContextMenuClient):
1784         * UIProcess/API/glib/WebKitContextMenuClient.cpp:
1785         * UIProcess/WebContextMenuProxy.h:
1786         * UIProcess/gtk/WebContextMenuProxyGtk.cpp:
1787         (WebKit::WebContextMenuProxyGtk::show):
1788         (WebKit::WebContextMenuProxyGtk::showContextMenuWithItems):
1789         * UIProcess/gtk/WebContextMenuProxyGtk.h:
1790         * UIProcess/mac/WebContextMenuProxyMac.h:
1791         * UIProcess/mac/WebContextMenuProxyMac.mm:
1792         (WebKit::WebContextMenuProxyMac::showContextMenuWithItems):
1793         (WebKit::WebContextMenuProxyMac::showContextMenu):
1794         * UIProcess/wpe/WebContextMenuProxyWPE.h:
1795
1796 2018-01-16  Michael Catanzaro  <mcatanzaro@igalia.com>
1797
1798         Don't link WebKit target directly to JavaScriptCore
1799         https://bugs.webkit.org/show_bug.cgi?id=181688
1800
1801         Reviewed by Alex Christensen.
1802
1803         It's safer if we only link to the next lower-layered lib in the stack, so let's just link
1804         directly to WebCore instead.
1805
1806         And WPE doesn't need to specify it twice.
1807
1808         * CMakeLists.txt:
1809         * PlatformMac.cmake:
1810         * PlatformWPE.cmake:
1811
1812 2018-01-16  Eric Carlson  <eric.carlson@apple.com>
1813
1814         AVSampleBufferDisplayLayer should be flushed when application activates
1815         https://bugs.webkit.org/show_bug.cgi?id=181623
1816         <rdar://problem/36487738>
1817
1818         Reviewed by Darin Adler.
1819
1820         * WebProcess/WebPage/ios/WebPageIOS.mm:
1821         (WebKit::WebPage::applicationWillResignActive): Call page.
1822         (WebKit::WebPage::applicationDidEnterBackground): Ditto, let it call libWebRTCProvider.
1823         (WebKit::WebPage::applicationWillEnterForeground): Call page.
1824         (WebKit::WebPage::applicationDidBecomeActive): Ditto, let it call libWebRTCProvider.
1825
1826 2018-01-16  Zach Li  <zachli@apple.com>
1827
1828         Add pop-up policy support in website policies.
1829         https://bugs.webkit.org/show_bug.cgi?id=181544.
1830         rdar://problem/30521400.
1831
1832         Reviewed by Alex Christensen.
1833
1834         * Shared/WebsitePoliciesData.cpp: Encode and decode
1835         pop-up policy.
1836         (WebKit::WebsitePoliciesData::encode const):
1837         (WebKit::WebsitePoliciesData::decode):
1838         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
1839         Apply the pop-up policy from website policies to the
1840         document loader.
1841
1842         * Shared/WebsitePoliciesData.h:
1843
1844         * Shared/WebsitePopUpPolicy.h:
1845         Added for declaring enum WebsitePopUpPolicy.
1846
1847         * UIProcess/API/APIWforebsitePolicies.cpp:
1848         Include pop-up policy in website policies.
1849         (API::WebsitePolicies::WebsitePolicies):
1850         (API::WebsitePolicies::data):
1851         * UIProcess/API/APIWebsitePolicies.h:
1852
1853         * UIProcess/API/C/WKWebsitePolicies.cpp:
1854         Added C API to get and set pop-up policy on
1855         website policies.
1856         (WKWebsitePoliciesGetPopUpPolicy):
1857         (WKWebsitePoliciesSetPopUpPolicy):
1858         * UIProcess/API/C/WKWebsitePolicies.h:
1859
1860         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
1861         Added Obj-C API to get and set pop-up policy
1862         on website policies.
1863         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
1864         (-[_WKWebsitePolicies setPopUpPolicy:]):
1865         (-[_WKWebsitePolicies popUpPolicy]):
1866
1867         * WebKit.xcodeproj/project.pbxproj:
1868         Added WebsitePopUpPolicy.h.
1869
1870 2018-01-16  Fujii Hironori  <Hironori.Fujii@sony.com>
1871
1872         [CMake][Mac] Fix the build errors
1873         https://bugs.webkit.org/show_bug.cgi?id=181665
1874
1875         Reviewed by Alex Christensen.
1876
1877         * CMakeLists.txt: Added TouchBarMenuData.cpp and TouchBarMenuItemData.cpp to compile.
1878         * PlatformMac.cmake: Added _WKApplicationManifest.mm, WKInspectorWKWebView.mm and WKInspectorWindow.mm to compile.
1879         * UIProcess/API/Cocoa/WKProcessPool.mm:
1880         (-[WKProcessPool _webPageContentProcessCount]): Call WebProcessPool::serviceWorkerProxy() only if ENABLE(SERVICE_WORKER).
1881
1882 2018-01-16  Wenson Hsieh  <wenson_hsieh@apple.com>
1883
1884         [Attachment Support] Provide the `src` of an attachment to the UI delegate when an attachment is inserted
1885         https://bugs.webkit.org/show_bug.cgi?id=181638
1886         <rdar://problem/36508702>
1887
1888         Reviewed by Dan Bernstein.
1889
1890         Add a `source` parameter to the `didInsertAttachment` codepath for notifying WebKit2 clients when attachment
1891         elements are inserted into the document.
1892
1893         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1894         * UIProcess/API/Cocoa/WKWebView.mm:
1895         (-[WKWebView _didInsertAttachment:withSource:]):
1896         (-[WKWebView _didInsertAttachment:]): Deleted.
1897         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1898         * UIProcess/Cocoa/PageClientImplCocoa.h:
1899         * UIProcess/Cocoa/PageClientImplCocoa.mm:
1900         (WebKit::PageClientImplCocoa::didInsertAttachment):
1901         * UIProcess/PageClient.h:
1902         (WebKit::PageClient::didInsertAttachment):
1903         * UIProcess/WebPageProxy.cpp:
1904         (WebKit::WebPageProxy::didInsertAttachment):
1905         * UIProcess/WebPageProxy.h:
1906         * UIProcess/WebPageProxy.messages.in:
1907         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1908         (WebKit::WebEditorClient::didInsertAttachment):
1909         * WebProcess/WebCoreSupport/WebEditorClient.h:
1910
1911 2018-01-15  Youenn Fablet  <youenn@apple.com>
1912
1913         ASSERTION FAILED: m_ptr under WebKit::CacheStorage::Caches::writeRecord
1914         https://bugs.webkit.org/show_bug.cgi?id=181401
1915         <rdar://problem/36379022>
1916
1917         Reviewed by Darin Adler.
1918
1919         m_isInitialized is true but m_storage is set to nullptr when calling writeRecord.
1920         The only case seems to be if:
1921         - We are doing persistent storage
1922         - We are traversing the storage to do the initialization. At that point m_storage is set to a correct value.
1923         - clearMemoryRepresentation is called, thus setting m_storage to nullptr and m_isInitialized to false.
1924         We fix this by making clearMemoryRepresentation a no-op if we are initializing the caches.
1925         clearMemoryRepresentation is about cleaning the in-memory information of the caches and the memory representation is empty at init time.
1926         Nullifying m_storage is a memory consumption optimization.
1927
1928         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1929         (WebKit::CacheStorage::Caches::clearMemoryRepresentation):
1930
1931 2018-01-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1932
1933         Unreviewed, speculative build fix after r226899.
1934
1935         Add an empty implementation for PageClient::startDrag.
1936
1937         * UIProcess/PageClient.h:
1938         (WebKit::PageClient::startDrag):
1939
1940 2018-01-12  Brent Fulgham  <bfulgham@apple.com>
1941
1942         [iOS] Remove unneeded accessibility-related sandbox rules
1943         https://bugs.webkit.org/show_bug.cgi?id=181619
1944         <rdar://problem/36485356>
1945
1946         Reviewed by Eric Carlson.
1947
1948         Remove a number of sandbox exceptions that were in place for accessibility support. These are
1949         not needed in the WebContent process, since Safari (not WebKit) handles the accessibility
1950         interactions.
1951
1952         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1953
1954 2018-01-12  Keith Rollin  <krollin@apple.com>
1955
1956         Logged JSON should escape "'s and \'s in strings.
1957         https://bugs.webkit.org/show_bug.cgi?id=181608
1958
1959         Reviewed by Brent Fulgham.
1960
1961         * NetworkProcess/NetworkResourceLoader.cpp:
1962         (WebKit::NetworkResourceLoader::logCookieInformation const):
1963
1964 2018-01-12  Megan Gardner  <megan_gardner@apple.com>
1965
1966         Unreviewed, fixing error in UIKitSPI.h.
1967
1968         * Platform/spi/ios/UIKitSPI.h:
1969         
1970 2018-01-12  Megan Gardner  <megan_gardner@apple.com>
1971
1972         Implement MultiDocument protocol for restoring focus to a WKWebView
1973         https://bugs.webkit.org/show_bug.cgi?id=181510
1974
1975         Reviewed by Dan Bernstein.
1976
1977         Support the UIKit protocol for restoring focus to a what previously had focus.
1978         WebKit already knows what node was previously being focused by the DOM, we merely
1979         need to be asked to turn the focus on again.
1980         Resubmitting https://trac.webkit.org/changeset/226826 as it broke internal builds
1981
1982         * Platform/spi/ios/UIKitSPI.h:
1983         * UIProcess/ios/WKContentViewInteraction.h:
1984         * UIProcess/ios/WKContentViewInteraction.mm:
1985         (-[WKContentView _restoreFocusWithToken:]):
1986         (-[WKContentView _preserveFocusWithToken:destructively:]):
1987
1988 2018-01-12  Youenn Fablet  <youenn@apple.com>
1989
1990         WebProcess should pass the registration identifier and not the worker identifier for fetch events
1991         https://bugs.webkit.org/show_bug.cgi?id=181591
1992
1993         Reviewed by Chris Dumez.
1994
1995         Use service worker registration identifier to compute the active service worker identifier responsible to handle the fetch event.
1996
1997         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1998         (WebKit::WebSWServerConnection::startFetch):
1999         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2000         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2001         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
2002         (WebKit::ServiceWorkerClientFetch::start):
2003         * WebProcess/Storage/WebSWClientConnection.cpp:
2004         (WebKit::WebSWClientConnection::startFetch):
2005         * WebProcess/Storage/WebSWClientConnection.h:
2006         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
2007         (WebKit::shouldHandleFetch):
2008
2009 2018-01-12  Ryan Haddad  <ryanhaddad@apple.com>
2010
2011         Unreviewed, rolling out r226826.
2012
2013         Breaks internal builds.
2014
2015         Reverted changeset:
2016
2017         "Implement MultiDocument protocol for restoring focus to a
2018         WKWebView"
2019         https://bugs.webkit.org/show_bug.cgi?id=181510
2020         https://trac.webkit.org/changeset/226826
2021
2022 2018-01-12  Wenson Hsieh  <wenson_hsieh@apple.com>
2023
2024         [WK2] Unify macOS and iOS codepaths in the UI process when starting a drag
2025         https://bugs.webkit.org/show_bug.cgi?id=181574
2026
2027         Reviewed by Tim Horton.
2028
2029         Rearrange some macOS drag start logic in the UI process so that it uses the same codepaths in WebPageProxy as
2030         iOS. Namely, startDrag should just forward the DragItem and drag image handle along to the appropriate views on
2031         each platform (WKContentView and WebViewImpl).
2032
2033         There should be no change in behavior.
2034
2035         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2036
2037         Both macOS and iOS now funnel through this method.
2038
2039         * UIProcess/Cocoa/WebViewImpl.h:
2040         * UIProcess/Cocoa/WebViewImpl.mm:
2041         (WebKit::WebViewImpl::startDrag):
2042         (WebKit::WebViewImpl::dragImageForView): Deleted.
2043
2044         Rename dragImageForView to startDrag. Move the call to didStartDrag() here, and call dragCancelled() in the
2045         case where we bailed from starting the drag (due to failing to create a drag image).
2046
2047         * UIProcess/PageClient.h:
2048         * UIProcess/ios/PageClientImplIOS.h:
2049         * UIProcess/ios/PageClientImplIOS.mm:
2050         (WebKit::PageClientImpl::setDragImage): Deleted.
2051
2052         Rename setDragImage to startDrag.
2053
2054         * UIProcess/mac/PageClientImplMac.h:
2055         * UIProcess/mac/PageClientImplMac.mm:
2056         (WebKit::PageClientImpl::startDrag):
2057         (WebKit::PageClientImpl::setDragImage): Deleted.
2058         * UIProcess/mac/WebPageProxyMac.mm:
2059         (WebKit::WebPageProxy::startDrag): Deleted.
2060
2061 2018-01-12  Antoine Quint  <graouts@apple.com>
2062
2063         Add support for the frames() timing function
2064         https://bugs.webkit.org/show_bug.cgi?id=181585
2065         <rdar://problem/36463317>
2066
2067         Reviewed by Dean.
2068
2069         Add the ability to endode and decode the frames() timing function.
2070
2071         * Shared/WebCoreArgumentCoders.cpp:
2072         (IPC::ArgumentCoder<FramesTimingFunction>::encode):
2073         (IPC::ArgumentCoder<FramesTimingFunction>::decode):
2074         * Shared/WebCoreArgumentCoders.h:
2075         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
2076         (WebKit::PlatformCAAnimationRemote::Properties::encode const):
2077         (WebKit::PlatformCAAnimationRemote::Properties::decode):
2078
2079 2018-01-11  Keith Miller  <keith_miller@apple.com>
2080
2081         Rename ENABLE_ASYNC_ITERATION to ENABLE_JS_ASYNC_ITERATION
2082         https://bugs.webkit.org/show_bug.cgi?id=181573
2083
2084         Reviewed by Simon Fraser.
2085
2086         * Configurations/FeatureDefines.xcconfig:
2087
2088 2018-01-11  Brent Fulgham  <bfulgham@apple.com>
2089
2090         REGRESSION(r219530): ResourceLoadStatisticsPersistentStorage should be read-only in ephemeral sessions
2091         https://bugs.webkit.org/show_bug.cgi?id=181136
2092         <rdar://problem/36116604>
2093
2094         Reviewed by Chris Dumez.
2095
2096         Some uses of WebKit involve running a UIProcess as an ephemeral session for the life of the process. In this
2097         case, we do not initialize the data path for the set of load statistics triggering an assertion.
2098
2099         We actually intended ephemeral sessions to consume the existing resource load data (presumably captured during
2100         non-ephemeral browsing). This would be a read-only mode, where it would not add new entries to the load
2101         statistics, but would take advantage of existing observations. Currently that does not happen (for this type
2102         of WebKit embed), which forces each run as an ephemeral session to build up in-memory browsing data until it has
2103         enough observations to begin modifying loads.
2104
2105         We need to set the ResourceLoadStatisticsPersistentStorage object to a "read only" mode in this case, so
2106         that it read (but does not write) from this database.
2107
2108         Tested by ephemeral website data TestWebKitAPI tests.
2109
2110         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
2111         (WebKit::ResourceLoadStatisticsPersistentStorage::create): Added to allow creation of the right style of
2112         Persistent Storage.
2113         (WebKit::ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage): Initialize the
2114         new data member.
2115         (WebKit::ResourceLoadStatisticsPersistentStorage::asyncWriteTimerFired): RELEASE_ASSERT that we never run
2116         this method when in "read only" mode.
2117         (WebKit::ResourceLoadStatisticsPersistentStorage::writeMemoryStoreToDisk): Ditto.
2118         (WebKit::ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore): Return early if asked to
2119         schedule a write operation for a "read only" persistent store.
2120         (WebKit::ResourceLoadStatisticsPersistentStorage::finishAllPendingWorkSynchronously): RELEASE_ASSERT if we
2121         ever shut down in "read only" mode with an active write timer.
2122         * UIProcess/ResourceLoadStatisticsPersistentStorage.h:
2123         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2124         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore): Pass a flag indicating whether the
2125         storage session is ephemeral or not.
2126         * UIProcess/WebResourceLoadStatisticsStore.h:
2127
2128 2018-01-11  Keith Rollin  <krollin@apple.com>
2129
2130         Add optional logging of ITP-related user interaction information
2131         https://bugs.webkit.org/show_bug.cgi?id=181556
2132
2133         Reviewed by Brent Fulgham.
2134
2135         In order to support the tracking of the efficacy of Intelligent
2136         Tracking Protection, add some logging indicating when the user
2137         interacts with a page in a way that affects cookie partitioning. This
2138         logging is off by default, and is enabled with `defaults write -g
2139         WebKitLogCookieInformation -bool true`.
2140
2141         * Shared/WebProcessCreationParameters.cpp:
2142         (WebKit::WebProcessCreationParameters::encode const):
2143         (WebKit::WebProcessCreationParameters::decode):
2144         * Shared/WebProcessCreationParameters.h:
2145         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2146         (WebKit::WebProcessPool::platformInitializeWebProcess):
2147         * WebProcess/WebProcess.cpp:
2148         (WebKit::WebProcess::initializeWebProcess):
2149
2150 2018-01-11  Megan Gardner  <megan_gardner@apple.com>
2151
2152         Implement MultiDocument protocol for restoring focus to a WKWebView
2153         https://bugs.webkit.org/show_bug.cgi?id=181510
2154
2155         Reviewed by Dan Bernstein.
2156
2157         Support the UIKit protocol for restoring focus to a what previously had focus.
2158         WebKit already has a method to silently remove and replace focus, without telling the
2159         web process about the unfocus and refocusing, so we're just using that.
2160
2161         * Platform/spi/ios/UIKitSPI.h:
2162         * UIProcess/ios/WKContentViewInteraction.h:
2163         * UIProcess/ios/WKContentViewInteraction.mm:
2164         (-[WKContentView _restoreFocusWithToken:]):
2165         (-[WKContentView _preserveFocusWithToken:destructively:]):
2166
2167
2168 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2169
2170         Don't load inline data when requesting info for an attachment element backed by a file path
2171         https://bugs.webkit.org/show_bug.cgi?id=181550
2172
2173         Reviewed by Tim Horton
2174
2175         See WebCore/ChangeLog for more information.
2176
2177         * UIProcess/API/Cocoa/_WKAttachment.mm:
2178         (-[_WKAttachmentInfo initWithInfo:]):
2179         (-[_WKAttachmentInfo fileLoadingError]):
2180         (-[_WKAttachment requestInfo:]):
2181
2182 2018-01-11  Commit Queue  <commit-queue@webkit.org>
2183
2184         Unreviewed, rolling out r226789 and r226794.
2185         https://bugs.webkit.org/show_bug.cgi?id=181564
2186
2187         broke API tests (Requested by alexchristensen on #webkit).
2188
2189         Reverted changesets:
2190
2191         "Merge sync and async code paths for getting context menus"
2192         https://bugs.webkit.org/show_bug.cgi?id=181423
2193         https://trac.webkit.org/changeset/226789
2194
2195         "Revert changes accidentally committed with r226789."
2196         https://bugs.webkit.org/show_bug.cgi?id=181423
2197         https://trac.webkit.org/changeset/226794
2198
2199 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2200
2201         Send PromisedBlobInfo to the client through DragItem instead of DragClient::prepareToDragPromisedBlob
2202         https://bugs.webkit.org/show_bug.cgi?id=181497
2203
2204         Reviewed by Tim Horton.
2205
2206         Refactor drag and drop support for promised blob data, so that blob info is shipped across to the client layer
2207         via DragItem in the DragClient::startDrag codepath, rather than via a separate prepareToDragPromisedBlob client
2208         codepath that stages promised blob info.
2209
2210         * UIProcess/Cocoa/WebViewImpl.h:
2211         * UIProcess/Cocoa/WebViewImpl.mm:
2212         (WebKit::WebViewImpl::prepareToDragPromisedBlob): Deleted.
2213         * UIProcess/PageClient.h:
2214         (WebKit::PageClient::prepareToDragPromisedBlob): Deleted.
2215         * UIProcess/WebPageProxy.cpp:
2216         (WebKit::WebPageProxy::prepareToDragPromisedBlob): Deleted.
2217         * UIProcess/WebPageProxy.h:
2218         * UIProcess/WebPageProxy.messages.in:
2219         * UIProcess/ios/PageClientImplIOS.h:
2220         * UIProcess/ios/PageClientImplIOS.mm:
2221         (WebKit::PageClientImpl::prepareToDragPromisedBlob): Deleted.
2222         * UIProcess/ios/WKContentViewInteraction.h:
2223         * UIProcess/ios/WKContentViewInteraction.mm:
2224         (-[WKContentView _startDrag:item:]):
2225         * UIProcess/mac/PageClientImplMac.h:
2226         * UIProcess/mac/PageClientImplMac.mm:
2227         (WebKit::PageClientImpl::prepareToDragPromisedBlob): Deleted.
2228         * WebProcess/WebCoreSupport/WebDragClient.cpp:
2229         (WebKit::WebDragClient::prepareToDragPromisedBlob): Deleted.
2230         * WebProcess/WebCoreSupport/WebDragClient.h:
2231         * WebProcess/WebPage/WebPage.cpp:
2232         (WebKit::WebPage::prepareToDragPromisedBlob): Deleted.
2233         * WebProcess/WebPage/WebPage.h:
2234
2235 2018-01-09  Per Arne Vollan  <pvollan@apple.com>
2236
2237         VoiceOver does not work when the WebContent process is using NSRunLoop.
2238         https://bugs.webkit.org/show_bug.cgi?id=181331
2239         <rdar://problem/36408004>
2240
2241         Reviewed by Brent Fulgham.
2242
2243         When the WebContent process is using NSRunLoop instead of the NSApplication run loop,
2244         accessibility must be initialized for VoiceOver to work. This patch also switches to
2245         using NSRunLoop in the WebContent process.
2246
2247         * Configurations/WebContentService.xcconfig:
2248         * Platform/IPC/mac/ConnectionMac.mm:
2249         (IPC::AccessibilityProcessSuspendedNotification): Remove unneccessary workaround.
2250         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist: Switch to NSRunLoop.
2251         * WebProcess/cocoa/WebProcessCocoa.mm:
2252         (WebKit::WebProcess::platformInitializeProcess): Initialize accessibility.
2253
2254 2018-01-11  Don Olmstead  <don.olmstead@sony.com>
2255
2256         WebContextMenuListenerProxy.cpp not including config on first line
2257         https://bugs.webkit.org/show_bug.cgi?id=181552
2258
2259         Reviewed by Alex Christensen.
2260
2261         * UIProcess/WebContextMenuListenerProxy.cpp:
2262
2263 2018-01-11  Youenn Fablet  <youenn@apple.com>
2264
2265         Redirected iframe loading with Request.redirect=follow should fail
2266         https://bugs.webkit.org/show_bug.cgi?id=181491
2267
2268         Reviewed by Alex Christensen.
2269
2270         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
2271         (WebKit::ServiceWorkerClientFetch::validateResponse):
2272
2273 2018-01-11  Youenn Fablet  <youenn@apple.com>
2274
2275         Replace WebRTCLegacyAPIDisabled by WebRTCLegacyAPIEnabled and switch off WebRTC legacy flag by default
2276         https://bugs.webkit.org/show_bug.cgi?id=181480
2277
2278         Reviewed by Eric Carlson.
2279
2280         Renaming preference to WebRTCLegacyAPIEnabled for simplification and removing it from experimental feature.
2281         Set it to off by default.
2282
2283         * Shared/WebPreferences.yaml:
2284         * UIProcess/API/C/WKPreferences.cpp:
2285         (WKPreferencesSetWebRTCLegacyAPIEnabled):
2286         (WKPreferencesGetWebRTCLegacyAPIEnabled):
2287         * UIProcess/API/Cocoa/WKPreferences.mm:
2288         (-[WKPreferences _webRTCLegacyAPIEnabled]):
2289         (-[WKPreferences _setWebRTCLegacyAPIEnabled:]):
2290         * UIProcess/WebProcessPool.cpp:
2291         (WebKit::WebProcessPool::ensureNetworkProcess):
2292         * WebProcess/WebPage/WebPage.cpp:
2293         (WebKit::WebPage::updatePreferences):
2294
2295 2018-01-11  Alex Christensen  <achristensen@webkit.org>
2296
2297         Merge sync and async code paths for getting context menus
2298         https://bugs.webkit.org/show_bug.cgi?id=181423
2299
2300         Reviewed by Joseph Pecoraro.
2301
2302         What a mess.  We had a code path for asynchronous context menu generation and a different one for synchronous context menu generation.
2303         This makes it so there is just one.  At the API level we see if there is an asynchronous delegate to call, then synchronous.
2304         There is a subtle theoretical change in behaviour because m_page.contextMenuClient().showContextMenu is now called for the asynchronous
2305         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!
2306
2307         * UIProcess/API/APIContextMenuClient.h:
2308         (API::ContextMenuClient::getContextMenuFromProposedMenu):
2309         (API::ContextMenuClient::getContextMenuFromProposedMenuAsync): Deleted.
2310         * UIProcess/API/C/WKPage.cpp:
2311         (WKPageSetPageContextMenuClient):
2312         * UIProcess/API/glib/WebKitContextMenuClient.cpp:
2313         * UIProcess/WebContextMenuProxy.h:
2314         * UIProcess/gtk/WebContextMenuProxyGtk.cpp:
2315         (WebKit::WebContextMenuProxyGtk::show):
2316         (WebKit::WebContextMenuProxyGtk::showContextMenuWithItems):
2317         * UIProcess/gtk/WebContextMenuProxyGtk.h:
2318         * UIProcess/mac/WebContextMenuProxyMac.h:
2319         * UIProcess/mac/WebContextMenuProxyMac.mm:
2320         (WebKit::WebContextMenuProxyMac::showContextMenuWithItems):
2321         (WebKit::WebContextMenuProxyMac::showContextMenu):
2322         * UIProcess/wpe/WebContextMenuProxyWPE.h:
2323
2324 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2325
2326         [Attachment Support] Support dragging attachment elements out as files on iOS
2327         https://bugs.webkit.org/show_bug.cgi?id=181199
2328         <rdar://problem/36299316>
2329
2330         Reviewed by Tim Horton, Andy Estes and Joseph Pecoraro.
2331
2332         Implement support for registering and beginning a drag with promised blob info. See below for more detail.
2333
2334         * UIProcess/ios/WKContentViewInteraction.mm:
2335         (-[WKDragSessionContext addTemporaryDirectory:]):
2336         (-[WKDragSessionContext cleanUpTemporaryDirectories]):
2337
2338         Introduce WKDragSessionContext, which represents the localContext of a UIDragSession initiated in WebKit. The
2339         blob promise dragging codepath uses this to register temporary directories when saving blob data to a location
2340         on disk; when all data transfers are finished, or if the drag interaction is being reset, we then use
2341         -cleanUpTemporaryDirectories to remove each temporary directory.
2342
2343         (existingLocalDragSessionContext):
2344         (ensureLocalDragSessionContext):
2345
2346         Helper methods to set the UIDragSession's localContext to a WKDragSessionContext and query for any existing
2347         context.
2348
2349         (-[WKContentView cleanupInteraction]):
2350
2351         Before the content view's UIDragInteraction goes away, clean up any temporary directories added to the
2352         UIDragSession.
2353
2354         (-[WKContentView _prepareToDragPromisedBlob:]):
2355
2356         When dragging with a promised blob, register a new item provider on the pasteboard representing the blob data,
2357         along with any additional metadata associated with the blob. For the promise callback, call out to the network
2358         process to write the blob data to a temporary path; when done, call the NSItemProvider's completion handler with
2359         the temporary blob data location.
2360
2361         (-[WKContentView _itemsForBeginningOrAddingToSessionWithRegistrationList:stagedDragSource:]):
2362         (-[WKContentView dragInteraction:sessionDidTransferItems:]):
2363
2364         Use this delegate hook as an opportunity to remove any temporary directories created when promised blob data is
2365         requested upon drop. Since we know the drag session that has finished transferring data, we simply ask its local
2366         context (a WKDragSessionContext) to remove any temporary filepaths it has created.
2367
2368 2018-01-10  Jeff Miller  <jeffm@apple.com>
2369
2370         -[WKWebView _web_gestureEventWasNotHandledByWebCore:] should call -_gestureEventWasNotHandledByWebCore:
2371         https://bugs.webkit.org/show_bug.cgi?id=181498
2372
2373         Reviewed by Alex Christensen.
2374
2375         WKView's API contract allows clients to override -_gestureEventWasNotHandledByWebCore:, and -[WKView
2376         _web_gestureEventWasNotHandledByWebCore:] calls -_gestureEventWasNotHandledByWebCore: instead of
2377         invoking WebViewImpl::gestureEventWasNotHandledByWebCoreFromViewOnly() directly. WKWebView should do
2378         the same thing.
2379
2380         * UIProcess/API/Cocoa/WKWebView.mm:
2381         (-[WKWebView _web_gestureEventWasNotHandledByWebCore:]):
2382         Call -_gestureEventWasNotHandledByWebCore:, which will call gestureEventWasNotHandledByWebCoreFromViewOnly().
2383
2384 2018-01-10  Wenson Hsieh  <wenson_hsieh@apple.com>
2385
2386         REGRESSION(r222507): Composition highlight doesn't render when using IME
2387         https://bugs.webkit.org/show_bug.cgi?id=181485
2388         <rdar://problem/35896516>
2389
2390         Reviewed by Ryosuke Niwa.
2391
2392         Add plumbing for a `suppressUnderline` argument when setting marked text.
2393
2394         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2395         (WKBundlePageSetComposition):
2396         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
2397         * WebProcess/WebPage/WebPage.cpp:
2398         (WebKit::WebPage::setCompositionForTesting):
2399         * WebProcess/WebPage/WebPage.h:
2400
2401 2018-01-10  Tim Horton  <timothy_horton@apple.com>
2402
2403         REGRESSION (r213590): Swipe from edge to go to previous page is significantly slower than tapping back button on Twitter
2404         https://bugs.webkit.org/show_bug.cgi?id=181269
2405         <rdar://problem/35110344>
2406
2407         Reviewed by Simon Fraser.
2408
2409         * UIProcess/API/Cocoa/WKWebView.mm:
2410         (-[WKWebView _processDidExit]):
2411         (-[WKWebView _didCommitLayerTree:]):
2412         When swiping to a page that set history.scrollRestoration = "manual",
2413         we will never restore the scroll position. We will still restore
2414         "state", but won't have a location. Currently, the code assumes that
2415         it should wait to remove the swipe snapshot until the scroll position
2416         is restored. Instead, wait until the "state" is restored, whether
2417         or not that includes a scroll position/center point restoration.
2418
2419         Do this by making _firstTransactionIDAfterPageRestore an optional,
2420         and reset it after it fires, so that we only run the restoration code
2421         in _didCommitLayerTree for the first commit after state restoration,
2422         not all subsequent commits. Then, tell ViewGestureController that
2423         the scroll position has been restored even if the page opted out.
2424
2425         The reason that this is specific to pushState is that normal,
2426         non-same-document loads bail from waiting for the scroll position
2427         restoration in VGC::didReachMainFrameLoadTerminalState() (see the long
2428         comment there for an explanation).
2429
2430         (-[WKWebView _beginBackSwipeForTesting]):
2431         (-[WKWebView _completeBackSwipeForTesting]):
2432         * Platform/spi/ios/UIKitSPI.h:
2433         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2434         * UIProcess/Cocoa/ViewGestureController.h:
2435         * UIProcess/ios/ViewGestureControllerIOS.mm:
2436         (-[WKSwipeTransitionController transitionForDirection:]):
2437         (WebKit::ViewGestureController::beginSimulatedSwipeInDirectionForTesting):
2438         (WebKit::ViewGestureController::completeSimulatedSwipeInDirectionForTesting):
2439         * UIProcess/mac/ViewGestureControllerMac.mm:
2440         (WebKit::ViewGestureController::beginSimulatedSwipeInDirectionForTesting):
2441         (WebKit::ViewGestureController::completeSimulatedSwipeInDirectionForTesting):
2442         Add a mechanism to forcefully test swipe back. Instead of simulating
2443         events like on Mac, we just talk to the UIKit internals and force
2444         the interaction to start, pause, and then complete when we want.
2445
2446 2018-01-10  Brent Fulgham  <bfulgham@apple.com>
2447
2448         Use protectedThis for the 'updatePrevalentDomainsToPartitionOrBlockCookies' lambda
2449         https://bugs.webkit.org/show_bug.cgi?id=181452
2450         <rdar://problem/36416912>
2451         
2452         Reviewed by Chris Dumez.
2453
2454         We forgot to use a 'protectedThis' back in r225006 for one of the lambdas used by
2455         the WebsiteDataStore for processing.
2456
2457         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2458         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
2459
2460 2018-01-09  John Wilander  <wilander@apple.com>
2461
2462         Storage Access API: Turn feature on by default in WebPreferences.yaml
2463         https://bugs.webkit.org/show_bug.cgi?id=181458
2464
2465         Reviewed by Brent Fulgham.
2466
2467         * Shared/WebPreferences.yaml:
2468
2469 2018-01-09  Alex Christensen  <achristensen@webkit.org>
2470
2471         WKOpenPanelParameters SPI should return autoreleased objects
2472         https://bugs.webkit.org/show_bug.cgi?id=181457
2473         <rdar://problem/35884960>
2474
2475         Reviewed by Tim Horton.
2476
2477         In r226607 I made a mistake by returning an object that has been released.
2478         I instead follow a pattern of leaking and autoreleasing that we use elsewhere in the ObjC API.
2479
2480         * UIProcess/API/Cocoa/WKOpenPanelParameters.mm:
2481         (-[WKOpenPanelParameters _acceptedMIMETypes]):
2482         (-[WKOpenPanelParameters _acceptedFileExtensions]):
2483
2484 2018-01-09  Dan Bernstein  <mitz@apple.com>
2485
2486         Removed some empty directories that were left behind
2487
2488         * WebProcess/Cookies/cf: Removed.
2489         * WebProcess/ios: Removed.
2490
2491 2018-01-09  Paul Knight  <pknight@apple.com>
2492
2493         Don't record dynamic spelling corrections while in an ephemeral browsing session
2494         https://bugs.webkit.org/show_bug.cgi?id=181417
2495         <rdar://problem/33309104>
2496
2497         Dynamic spelling correction responses are kept on disk. Avoid recording
2498         these responses when in an ephemeral session.
2499
2500         Reviewed by Tim Horton and Wenson Hsieh.
2501
2502         * UIProcess/mac/CorrectionPanel.h:
2503         * UIProcess/mac/CorrectionPanel.mm:
2504         (WebKit::CorrectionPanel::recordAutocorrectionResponse):
2505             Add a WebViewImpl parameter so we can query the current session.
2506             Return early before recording the response if the session is
2507             ephemeral.
2508         (WebKit::CorrectionPanel::handleAcceptedReplacement):
2509             Update a caller to include the new parameter.
2510         * UIProcess/mac/PageClientImplMac.mm:
2511         (WebKit::PageClientImpl::recordAutocorrectionResponse):
2512             Ditto.
2513
2514 2018-01-09  Carlos Garcia Campos  <cgarcia@igalia.com>
2515
2516         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.19.5 release.
2517
2518         * gtk/NEWS: Add release notes for 2.19.5.
2519
2520 2018-01-09  Carlos Garcia Campos  <cgarcia@igalia.com>
2521
2522         [GTK] Missing symbols exported in 2.19.4
2523         https://bugs.webkit.org/show_bug.cgi?id=181433
2524
2525         Reviewed by Michael Catanzaro.
2526
2527         Add missing WEBKIT_API to webkit_dom_dom_window_webkit_message_handlers_post_message().
2528
2529         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.h:
2530         * webkitglib-symbols.map: Remove webkit_media_player_debug from local.
2531
2532 2018-01-09  Youenn Fablet  <youenn@apple.com>
2533
2534         SWClientConnection should not keep references to service worker jobs
2535         https://bugs.webkit.org/show_bug.cgi?id=181381
2536
2537         Reviewed by Chris Dumez.
2538
2539         Updated IPC handling based on WebCore refactoring.
2540
2541         * Scripts/webkit/messages.py:
2542         (forward_declarations_and_headers):
2543         (headers_for_type):
2544         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2545         (WebKit::WebSWServerConnection::rejectJobInClient):
2546         (WebKit::WebSWServerConnection::resolveRegistrationJobInClient):
2547         (WebKit::WebSWServerConnection::resolveUnregistrationJobInClient):
2548         (WebKit::WebSWServerConnection::startScriptFetchInClient):
2549         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2550         * WebProcess/Storage/WebSWClientConnection.messages.in:
2551
2552 2018-01-09  Carlos Garcia Campos  <cgarcia@igalia.com>
2553
2554         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.19.4 release.
2555
2556         * gtk/NEWS: Add release notes for 2.19.4.
2557
2558 2018-01-09  Ali Juma  <ajuma@chromium.org>
2559
2560         Implement VisualViewport API events
2561         https://bugs.webkit.org/show_bug.cgi?id=179386
2562
2563         Reviewed by Frédéric Wang.
2564
2565         Change the default value of the VisualViewportAPI experimental feature flag to
2566         DEFAULT_EXPERIMENTAL_FEATURES_ENABLED. This patch completes the implementation
2567         of this feature as specified by https://wicg.github.io/visual-viewport/, so this
2568         feature is now ready for wider testing.
2569
2570         * Shared/WebPreferences.yaml:
2571
2572 2018-01-08  Alex Christensen  <achristensen@webkit.org>
2573
2574         Add WKNavigationDelegate SPI exposing WebProcess crash reason
2575         https://bugs.webkit.org/show_bug.cgi?id=181410
2576         <rdar://problem/36167199>
2577
2578         Reviewed by Wenson Hsieh.
2579
2580         We exposed it in the C SPI.
2581
2582         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
2583         * UIProcess/Cocoa/NavigationState.h:
2584         * UIProcess/Cocoa/NavigationState.mm:
2585         (WebKit::NavigationState::setNavigationDelegate):
2586         (WebKit::toWKProcessTerminationReason):
2587         (WebKit::NavigationState::NavigationClient::processDidTerminate):
2588
2589 2018-01-08  Alex Christensen  <achristensen@webkit.org>
2590
2591         Make ObjC SPI equivalent to WKPageNavigationClient.decidePolicyForPluginLoad
2592         https://bugs.webkit.org/show_bug.cgi?id=181413
2593         <rdar://problem/36169005>
2594
2595         Reviewed by Wenson Hsieh.
2596
2597         * UIProcess/API/APINavigationClient.h:
2598         (API::NavigationClient::decidePolicyForPluginLoad):
2599         * UIProcess/API/C/WKPage.cpp:
2600         (WKPageSetPageNavigationClient):
2601         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
2602         * UIProcess/Cocoa/NavigationState.h:
2603         * UIProcess/Cocoa/NavigationState.mm:
2604         (WebKit::NavigationState::setNavigationDelegate):
2605         (WebKit::toPluginModuleLoadPolicy):
2606         (WebKit::toWKPluginModuleLoadPolicy):
2607         (WebKit::NavigationState::NavigationClient::decidePolicyForPluginLoad):
2608         * UIProcess/WebPageProxy.cpp:
2609         (WebKit::WebPageProxy::findPlugin):
2610
2611 2018-01-08  Ryosuke Niwa  <rniwa@webkit.org>
2612
2613         iOS build fix attempt after r226602.
2614
2615         * UIProcess/API/C/WKContextMenuListener.cpp:
2616         (WKContextMenuListenerUseContextMenuItems):
2617
2618 2018-01-08  Alex Christensen  <achristensen@webkit.org>
2619
2620         Add SPI for WKOpenPanelParameters._acceptedMIMETypes and _acceptedFileExtensions
2621         https://bugs.webkit.org/show_bug.cgi?id=181408
2622         <rdar://problem/35884960>
2623
2624         Reviewed by Tim Horton.
2625
2626         * UIProcess/API/Cocoa/WKOpenPanelParameters.mm:
2627         (-[WKOpenPanelParameters _acceptedMIMETypes]):
2628         (-[WKOpenPanelParameters _acceptedFileExtensions]):
2629         * UIProcess/API/Cocoa/WKOpenPanelParametersInternal.h:
2630         * UIProcess/API/Cocoa/WKOpenPanelParametersPrivate.h: Added.
2631         * WebKit.xcodeproj/project.pbxproj:
2632
2633 2018-01-08  Commit Queue  <commit-queue@webkit.org>
2634
2635         Unreviewed, rolling out r226532 and r226540.
2636         https://bugs.webkit.org/show_bug.cgi?id=181422
2637
2638         jessie says basic browsing does not seem to work (Requested by
2639         alexchristensen on #webkit).
2640
2641         Reverted changesets:
2642
2643         "Add CSP support to service workers"
2644         https://bugs.webkit.org/show_bug.cgi?id=181385
2645         https://trac.webkit.org/changeset/226532
2646
2647         "SWClientConnection should not keep references to service
2648         worker jobs"
2649         https://bugs.webkit.org/show_bug.cgi?id=181381
2650         https://trac.webkit.org/changeset/226540
2651
2652 2018-01-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2653
2654         [Attachment Support] Expose file name and content type of WKAttachment
2655         https://bugs.webkit.org/show_bug.cgi?id=181390
2656         <rdar://problem/36336837>
2657
2658         Reviewed by Tim Horton.
2659
2660         Add support for -[_WKAttachment requestInfo:], which fetches a snapshot of the attachment's state. This API is
2661         meant to be a replacement for -requestData: that provides additional metadata about the attachment.
2662
2663         * Scripts/webkit/messages.py:
2664         (headers_for_type):
2665         * Shared/WebCoreArgumentCoders.cpp:
2666         (IPC::ArgumentCoder<AttachmentInfo>::encode):
2667         (IPC::ArgumentCoder<AttachmentInfo>::decode):
2668         * Shared/WebCoreArgumentCoders.h:
2669
2670         Add IPC support for AttachmentInfo. Note that instead of using (encode|decode)SharedBuffer, we send and receive
2671         data references to the shared buffer.
2672
2673         * UIProcess/API/APIAttachment.cpp:
2674         (API::Attachment::requestInfo):
2675         (API::Attachment::requestData): Deleted.
2676         * UIProcess/API/APIAttachment.h:
2677
2678         Change requestData to requestInfo.
2679
2680         * UIProcess/API/Cocoa/_WKAttachment.h:
2681         * UIProcess/API/Cocoa/_WKAttachment.mm:
2682         (-[_WKAttachmentInfo initWithInfo:]):
2683         (-[_WKAttachmentInfo data]):
2684         (-[_WKAttachmentInfo name]):
2685         (-[_WKAttachmentInfo filePath]):
2686         (-[_WKAttachmentInfo contentType]):
2687         (-[_WKAttachment requestInfo:]):
2688         (-[_WKAttachment requestData:]):
2689
2690         Implement -requestInfo: by calling into APIAttachment, and reimplement -requestData: in terms of -requestInfo:.
2691
2692         * UIProcess/WebPageProxy.cpp:
2693         (WebKit::WebPageProxy::attachmentInfoCallback):
2694         (WebKit::WebPageProxy::requestAttachmentInfo):
2695         (WebKit::WebPageProxy::sharedBufferCallback): Deleted.
2696         (WebKit::WebPageProxy::requestAttachmentData): Deleted.
2697         * UIProcess/WebPageProxy.h:
2698         * UIProcess/WebPageProxy.messages.in:
2699
2700         Rename the SharedBufferCallback IPC message to AttachmentInfoCallback, and make it conditional on
2701         ATTACHMENT_ELEMENT. Rename requestAttachmentData to requestAttachmentInfo.
2702
2703         * WebProcess/WebPage/WebPage.cpp:
2704         (WebKit::WebPage::requestAttachmentInfo):
2705         (WebKit::WebPage::invokeSharedBufferCallback): Deleted.
2706         (WebKit::WebPage::requestAttachmentData): Deleted.
2707
2708         Rename requestAttachmentData to requestAttachmentInfo and adopt HTMLAttachmentElement::requestInfo.
2709
2710         * WebProcess/WebPage/WebPage.h:
2711         * WebProcess/WebPage/WebPage.messages.in:
2712
2713 2018-01-08  Alex Christensen  <achristensen@webkit.org>
2714
2715         Pass around Vector<Ref<WebContextMenuItem>> instead of WKArrayRef or Vector<WebContextMenuItemData>
2716         https://bugs.webkit.org/show_bug.cgi?id=181419
2717
2718         Reviewed by Tim Horton.
2719
2720         Passing a WKArrayRef to an API object is messy and was preventing me from moving things around and making ObjC SPI.
2721         No change in behavior.  Just using different layering abstractions for the same data.
2722
2723         * UIProcess/API/C/WKContextMenuListener.cpp:
2724         (WKContextMenuListenerUseContextMenuItems):
2725         * UIProcess/WebContextMenuListenerProxy.cpp:
2726         (WebKit::WebContextMenuListenerProxy::useContextMenuItems):
2727         * UIProcess/WebContextMenuListenerProxy.h:
2728         * UIProcess/WebContextMenuProxy.h:
2729         * UIProcess/mac/WebContextMenuProxyMac.h:
2730         * UIProcess/mac/WebContextMenuProxyMac.mm:
2731         (WebKit::WebContextMenuProxyMac::showContextMenuWithItems):
2732         (WebKit::WebContextMenuProxyMac::showContextMenu):
2733
2734 2018-01-08  John Wilander  <wilander@apple.com>
2735
2736         Storage Access API: Remove access for all frames under a page when the page is closed
2737         https://bugs.webkit.org/show_bug.cgi?id=181398
2738         <rdar://problem/36357879>
2739
2740         Reviewed by Alex Christensen.
2741
2742         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2743         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage):
2744         * NetworkProcess/NetworkConnectionToWebProcess.h:
2745         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2746         * WebProcess/WebPage/WebPage.cpp:
2747         (WebKit::WebPage::close):
2748
2749 2018-01-08  Youenn Fablet  <youenn@apple.com>
2750
2751         SWClientConnection should not keep references to service worker jobs
2752         https://bugs.webkit.org/show_bug.cgi?id=181381
2753
2754         Reviewed by Chris Dumez.
2755
2756         Updated IPC handling based on WebCore refactoring.
2757
2758         * Scripts/webkit/messages.py:
2759         (forward_declarations_and_headers):
2760         (headers_for_type):
2761         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2762         (WebKit::WebSWServerConnection::rejectJobInClient):
2763         (WebKit::WebSWServerConnection::resolveRegistrationJobInClient):
2764         (WebKit::WebSWServerConnection::resolveUnregistrationJobInClient):
2765         (WebKit::WebSWServerConnection::startScriptFetchInClient):
2766         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2767         * WebProcess/Storage/WebSWClientConnection.messages.in:
2768
2769 2018-01-08  Joseph Pecoraro  <pecoraro@apple.com>
2770
2771         [Cocoa] Web Inspector: Provide a way for clients to check if an NSWindow is a Web Inspector window
2772         https://bugs.webkit.org/show_bug.cgi?id=181361
2773         <rdar://problem/36332865>
2774
2775         Reviewed by Darin Adler.
2776
2777         * WebKit.xcodeproj/project.pbxproj:
2778         New files.
2779
2780         * Shared/API/Cocoa/_WKNSWindowExtras.h: Added.
2781         * Shared/API/Cocoa/_WKNSWindowExtras.mm: Added.
2782         (-[NSWindow _web_isWebInspectorWindow]):
2783         Method to determing if a window is being used for Web Inspector content.
2784
2785         * UIProcess/mac/WKInspectorWindow.h: Added.
2786         * UIProcess/mac/WKInspectorWindow.mm: Added.
2787         Named subclass so we can use isKindOfClass.
2788
2789         * UIProcess/mac/WebInspectorProxyMac.mm:
2790         (WebKit::WebInspectorProxy::createFrontendWindow):
2791         Use the named subclass.
2792
2793 2018-01-08  Tim Horton  <timothy_horton@apple.com>
2794
2795         Build fix for WKPDFView
2796         https://bugs.webkit.org/show_bug.cgi?id=181399
2797         <rdar://problem/36311915>
2798
2799         Reviewed by Simon Fraser.
2800
2801         * UIProcess/ios/WKPDFView.mm:
2802         Disable deprecation warnings in this whole file.
2803
2804 2018-01-08  Youenn Fablet  <youenn@apple.com>
2805
2806         Caches::writeCachesToDisk should assert that it is initialized
2807         https://bugs.webkit.org/show_bug.cgi?id=181383
2808
2809         Reviewed by Alex Christensen.
2810
2811         Add assertion to ensure caches is initialized
2812
2813         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2814         (WebKit::CacheStorage::Caches::writeCachesToDisk):
2815
2816 2018-01-08  Youenn Fablet  <youenn@apple.com>
2817
2818         WebProcessPool::terminateServiceWorkerProcess should protect itself in debug builds
2819         https://bugs.webkit.org/show_bug.cgi?id=181384
2820
2821         Reviewed by Chris Dumez.
2822
2823         * UIProcess/WebProcessPool.cpp:
2824         (WebKit::WebProcessPool::terminateServiceWorkerProcess):
2825
2826 2018-01-08  Frederic Wang  <fwang@igalia.com>
2827
2828         Unreviewed build fix after r226211.
2829
2830         * UIProcess/API/Cocoa/WKPreferencesPrivate.h: Use WK_IOS_TBA for iOS.
2831
2832 2018-01-08  Youenn Fablet  <youenn@apple.com>
2833
2834         navigator.onLine does not work inside service workers
2835         https://bugs.webkit.org/show_bug.cgi?id=181079
2836         <rdar://problem/36178606>
2837
2838         Reviewed by Darin Adler.
2839
2840         Added support for a callback called for each service worker proxy creation.
2841         Callback is used by WTR to inject a self.internals object used for testing.
2842
2843         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
2844         (WKBundleSetServiceWorkerProxyCreationCallback):
2845         * WebProcess/InjectedBundle/API/c/WKBundle.h:
2846         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2847         (WebKit::InjectedBundle::setServiceWorkerProxyCreationCallback):
2848         * WebProcess/InjectedBundle/InjectedBundle.h:
2849
2850 2018-01-07  David Kilzer  <ddkilzer@apple.com>
2851
2852         Enable -Wcast-qual for WebInspectorUI, WebKitLegacy, WebKit projects
2853         <https://webkit.org/b/181256>
2854         <rdar://problem/36281730>
2855
2856         Reviewed by Darin Adler.
2857
2858         * Configurations/Base.xcconfig:
2859         (WARNING_CFLAGS): Add -Wcast-qual.
2860         * NetworkProcess/cache/NetworkCacheCodersCocoa.cpp:
2861         (WTF::Persistence::encodeCertificateChain): Include
2862         TypeCastsCF.h from WTF, and use
2863         checked_cf_cast<SecCertificateRef>() to fix warning.
2864         * Platform/cocoa/WKCrashReporter.mm:
2865         (WebKit::setCrashReportApplicationSpecificInformation):
2866         - Move `oldMessage` check above nullptr check to fix a leak when
2867           passing in nullptr after previously setting the crash string.
2868         - Change C-style cast to const_cast<char*>() to fix warning.
2869         * PluginProcess/mac/PluginProcessShim.mm:
2870         (WebKit::shim_shmat): Change C-style cast to
2871         const_cast<void*>() to fix warning.
2872         * Shared/Authentication/mac/AuthenticationManager.mac.mm:
2873         (WebKit::leafCertificate): Include TypeCastsCF.h from
2874         WTF, and use checked_cf_cast<SecCertificateRef>() to fix
2875         warning.
2876         * Shared/cf/ArgumentCodersCF.cpp:
2877         (IPC::encode): Use static_cast<>(const_cast<void*>() to
2878         fix warnings since the CFTypeID has already been
2879         checked.
2880         * Shared/mac/WebCoreArgumentCodersMac.mm:
2881         (IPC::decodeNSError): Use an `auto` variable to hold the
2882         CFMutableDictionaryRef, then WTFMove() to assign it back to
2883         `userInfo`.
2884         * UIProcess/Cocoa/WebViewImpl.mm:
2885         (WebKit::takeWindowSnapshot): Include TypeCastsCF.h from
2886         WTF, and use checked_cf_cast<CGImageRef>() to fix
2887         warning.
2888
2889 2018-01-07  Konstantin Tokarev  <annulen@yandex.ru>
2890
2891         [cmake] Unset CMAKE_REQUIRED_LIBRARIES after check_function_exists test
2892         https://bugs.webkit.org/show_bug.cgi?id=181371
2893
2894         Reviewed by Michael Catanzaro.
2895
2896         This variable is used by check_function_exists internally, its value
2897         should be never used for anything else.
2898
2899         * CMakeLists.txt:
2900
2901 2018-01-05  Dan Bernstein  <mitz@apple.com>
2902
2903         REGRESSION (r226218): iOS-only assets are installed on macOS
2904         https://bugs.webkit.org/show_bug.cgi?id=181362
2905
2906         Reviewed by Anders Carlsson.
2907
2908         * Configurations/WebKit.xcconfig: Exclude everything under Resources/ios when not targeting
2909           iOS.
2910
2911         * Resources/ios: Added.
2912         * Resources/ios/iOS.xcassets: Moved from Source/WebKit/WebKit.xcassets.
2913         * Resources/ios/iOS.xcassets/LockMini.imageset/NavigationBarLockMini@2x.pdf: Set the
2914           svn:mime-type property.
2915         * Resources/ios/iOS.xcassets/LockMini.imageset/NavigationBarLockMini@3x.pdf: Ditto.
2916
2917         * Resources/mac: Added.
2918         * Resources/mac/mediaIcon.pdf: Moved here…
2919         * Resources/mediaIcon.pdf: …from here.
2920
2921         * WebKit.xcassets: Moved under Resources/ios.
2922
2923         * WebKit.xcodeproj/project.pbxproj: Created an ios group under the Resources group, and
2924           cleaned up the mac group. Removed the Recovered References group.
2925
2926 2018-01-05  John Wilander  <wilander@apple.com>
2927
2928         Storage Access API: Refactor to make naming accurate and explicit, simplify access table, and prepare for access removal for page
2929         https://bugs.webkit.org/show_bug.cgi?id=181357
2930         <rdar://problem/36331031>
2931
2932         Reviewed by Alex Christensen.
2933
2934         This change does the following:
2935         - Changes function and message names to reflect how this feature
2936           was eventually implemented, i.e. access per frame.
2937         - Makes it explicit that the UI process is only involved in
2938           granting storage access and not removing storage access.
2939           The latter is done directly by the web process.
2940         - Simplifies the network process' entry map since only needs to
2941           be able to give access to one domain in one frame at a time.
2942           Access goes away on frame navigation so there can only be one
2943           domain at a time per frame. Also, the map now uses pageIDs as
2944           main keys to prepare for efficient access removal for all
2945           frames under a page.
2946         - Fixes a bug in so that a cross-origin iframe with the same
2947           partition as the top frame correctly is handled as already
2948           having access.
2949
2950         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2951         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForFrame):
2952         (WebKit::NetworkConnectionToWebProcess::removeStorageAccess): Deleted.
2953         * NetworkProcess/NetworkConnectionToWebProcess.h:
2954         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2955         * NetworkProcess/NetworkProcess.cpp:
2956         (WebKit::NetworkProcess::hasStorageAccessForFrame):
2957         (WebKit::NetworkProcess::grantStorageAccessForFrame):
2958         (WebKit::NetworkProcess::hasStorageAccessForPrevalentDomains): Deleted.
2959         (WebKit::NetworkProcess::updateStorageAccessForPrevalentDomains): Deleted.
2960         * NetworkProcess/NetworkProcess.h:
2961         * NetworkProcess/NetworkProcess.messages.in:
2962         * UIProcess/Network/NetworkProcessProxy.cpp:
2963         (WebKit::NetworkProcessProxy::hasStorageAccessForFrame):
2964         (WebKit::NetworkProcessProxy::grantStorageAccessForFrame):
2965         (WebKit::NetworkProcessProxy::hasStorageAccessForPrevalentDomains): Deleted.
2966         (WebKit::NetworkProcessProxy::updateStorageAccessForPrevalentDomains): Deleted.
2967         * UIProcess/Network/NetworkProcessProxy.h:
2968         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2969         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
2970         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
2971         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
2972         * UIProcess/WebResourceLoadStatisticsStore.h:
2973         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2974         (WebKit::WebsiteDataStore::hasStorageAccessForFrameHandler):
2975         (WebKit::WebsiteDataStore::grantStorageAccessForFrameHandler):
2976         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
2977         (WebKit::WebsiteDataStore::hasStorageAccessForPrevalentDomainsHandler): Deleted.
2978         (WebKit::WebsiteDataStore::updateStorageAccessForPrevalentDomainsHandler): Deleted.
2979         * UIProcess/WebsiteData/WebsiteDataStore.h:
2980         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2981         (WebKit::WebFrameLoaderClient::detachedFromParent2):
2982         (WebKit::WebFrameLoaderClient::dispatchWillChangeDocument):
2983
2984 2018-01-05  Youenn Fablet  <youenn@apple.com>
2985
2986         Implement Cache API partitioning based on ClientOrigin
2987         https://bugs.webkit.org/show_bug.cgi?id=181240
2988
2989         Reviewed by Alex Christensen.
2990
2991         open and retrieveCaches now take a ClientOrigin instead of a String.
2992         Updated cache filesystem path computation to take both client origin and top origin.
2993
2994         When clearing an origin, caches whose client origin or top origin matches the origin are cleared.
2995         Caches are added to the web site data of their client origin with their corresponding cache size.
2996         Caches are added to the web site data of their top origin with a size equal to 0.
2997
2998         Updated memory representation dumping used for test to include both top and client origins.
2999
3000         * NetworkProcess/NetworkProcess.cpp:
3001         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
3002         * NetworkProcess/cache/CacheStorageEngine.cpp:
3003         (WebKit::CacheStorage::Engine::cachesRootPath):
3004         (WebKit::CacheStorage::Engine::open):
3005         (WebKit::CacheStorage::Engine::remove):
3006         (WebKit::CacheStorage::Engine::retrieveCaches):
3007         (WebKit::CacheStorage::Engine::readCachesFromDisk):
3008         (WebKit::CacheStorage::Engine::removeCaches):
3009         (WebKit::CacheStorage::Engine::fetchEntries):
3010         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
3011         (WebKit::CacheStorage::Engine::clearMemoryRepresentation):
3012         (WebKit::CacheStorage::Engine::representation):
3013         * NetworkProcess/cache/CacheStorageEngine.h:
3014         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
3015         (WebKit::CacheStorage::Cache::Cache):
3016         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
3017         (WebKit::CacheStorage::Caches::retrieveOriginFromDirectory):
3018         (WebKit::CacheStorage::Caches::Caches):
3019         (WebKit::CacheStorage::Caches::storeOrigin):
3020         (WebKit::CacheStorage::Caches::readOrigin):
3021         (WebKit::CacheStorage::Caches::open):
3022         * NetworkProcess/cache/CacheStorageEngineCaches.h:
3023         (WebKit::CacheStorage::Caches::create):
3024         (WebKit::CacheStorage::Caches::origin const):
3025         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
3026         (WebKit::CacheStorageEngineConnection::open):
3027         (WebKit::CacheStorageEngineConnection::caches):
3028         (WebKit::CacheStorageEngineConnection::clearMemoryRepresentation):
3029         * NetworkProcess/cache/CacheStorageEngineConnection.h:
3030         * NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
3031         * WebProcess/Cache/WebCacheStorageConnection.cpp:
3032         (WebKit::WebCacheStorageConnection::doOpen):
3033         (WebKit::WebCacheStorageConnection::doRetrieveCaches):
3034         (WebKit::WebCacheStorageConnection::clearMemoryRepresentation):
3035         * WebProcess/Cache/WebCacheStorageConnection.h:
3036
3037 2018-01-05  Megan Gardner  <megan_gardner@apple.com>
3038
3039         Show Keyboard when re-launching WKWebView with a previously focused element
3040         https://bugs.webkit.org/show_bug.cgi?id=181353
3041
3042         Reviewed by Tim Horton.
3043
3044         When relaunching an app with a WKWebView, restore the keyboard if there was a previously
3045         focused element that was being assisted. The element was already being tracked, we just
3046         needed to not bail on showing the keyboard for instances where it was a state change that
3047         caused the element to be refocused.
3048
3049         * UIProcess/PageClient.h:
3050         * UIProcess/WebPageProxy.h:
3051         * UIProcess/WebPageProxy.messages.in:
3052         * UIProcess/ios/PageClientImplIOS.h:
3053         * UIProcess/ios/PageClientImplIOS.mm:
3054         (WebKit::PageClientImpl::startAssistingNode):
3055         * UIProcess/ios/WKContentView.h:
3056         * UIProcess/ios/WKContentViewInteraction.h:
3057         * UIProcess/ios/WKContentViewInteraction.mm:
3058         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3059         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:]): Deleted.
3060         * UIProcess/ios/WebPageProxyIOS.mm:
3061         (WebKit::WebPageProxy::startAutoscrollAtPosition):
3062         (WebKit::WebPageProxy::startAssistingNode):
3063         * WebProcess/WebPage/WebPage.cpp:
3064         (WebKit::WebPage::setActivityState):
3065         (WebKit::WebPage::elementDidFocus):
3066         * WebProcess/WebPage/WebPage.h:
3067
3068 2018-01-05  Alex Christensen  <achristensen@webkit.org>
3069
3070         Restrict navigation-time WKWebsiteDataStore swapping to main frame navigations
3071         https://bugs.webkit.org/show_bug.cgi?id=181217
3072
3073         Reviewed by Tim Horton.
3074
3075         If we swap during an iframe navigation, then we get a page in a strange state.
3076         The intent of the main frame navigation WKWebsiteDataStore swap is that
3077         that is a time when we can change storages without a page in an inconsistent state.
3078
3079         * UIProcess/Cocoa/NavigationState.mm:
3080         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
3081
3082 2018-01-05  Alex Christensen  <achristensen@webkit.org>
3083
3084         Add WKBundleFrameCreateFrameHandle
3085         https://bugs.webkit.org/show_bug.cgi?id=181232
3086         <rdar://problem/35926696>
3087
3088         Reviewed by Tim Horton.
3089
3090         InjectedBundle clients wanting to sent a _WKFrameHandle cannot without this function.
3091         Before, they would just send the WKBundleFrameRef which would be changed into a WKFrameRef
3092         in the UIProcess by WebProcessProxy::transformHandlesToObjects, but there is no ObjC equivalent
3093         of WKFrameRef, so we were just getting a WKObject when we wanted a _WKFrameHandle.
3094         We can't change WebProcessProxy::transformHandlesToObjects without being incompatible with the 
3095         existing C API, so let's add a way for clients to say "I want a _WKFrameHandle".
3096
3097         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
3098         (WKBundleFrameCreateFrameHandle):
3099         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
3100
3101 2018-01-05  Wenson Hsieh  <wenson_hsieh@apple.com>
3102
3103         [Attachment Support] Add a way to write blob data to a file URL from the UI process
3104         https://bugs.webkit.org/show_bug.cgi?id=181236
3105
3106         Reviewed by Brady Eidson.
3107
3108         Add support for writing a blob to a designated file path. In WebKit, this is mainly plumbing writeBlobToFilePath
3109         through WebPageProxy to the network process.
3110
3111         * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
3112         (WebKit::NetworkBlobRegistry::writeBlobToFilePath):
3113
3114         Call out to the BlobRegistryImpl to write blobs to the file path. Additionally grant sandbox extensions for any
3115         file-backed blob parts corresponding to the given blob URL.
3116
3117         (WebKit::NetworkBlobRegistry::filesInBlob):
3118
3119         Introduce a version of filesInBlob that doesn't check against the NetworkConnectionToWebProcess. This is used
3120         when the UI process is the driver for writing a blob.
3121
3122         * NetworkProcess/FileAPI/NetworkBlobRegistry.h:
3123         * NetworkProcess/NetworkProcess.cpp:
3124         (WebKit::NetworkProcess::writeBlobToFilePath):
3125
3126         Temporarily grant sandbox access to the given file path.
3127
3128         * NetworkProcess/NetworkProcess.h:
3129         * NetworkProcess/NetworkProcess.messages.in:
3130         * Shared/WebCoreArgumentCoders.cpp:
3131         (IPC::ArgumentCoder<PromisedBlobInfo>::encode):
3132         (IPC::ArgumentCoder<PromisedBlobInfo>::decode):
3133         (IPC::ArgumentCoder<PromisedBlobData>::encode): Deleted.
3134         (IPC::ArgumentCoder<PromisedBlobData>::decode): Deleted.
3135
3136         Remove PromisedBlobData (see WebCore/ChangeLog for more information).
3137
3138         * Shared/WebCoreArgumentCoders.h:
3139         * UIProcess/Network/NetworkProcessProxy.cpp:
3140         (WebKit::NetworkProcessProxy::didClose):
3141
3142         If the network process is terminated, flush any pending callbacks in m_writeBlobToFilePathCallbackMap, passing
3143         in a failure result (success := false) and clearing the callback map.
3144
3145         (WebKit::NetworkProcessProxy::writeBlobToFilePath):
3146         (WebKit::NetworkProcessProxy::didWriteBlobToFilePath):
3147         * UIProcess/Network/NetworkProcessProxy.h:
3148         * UIProcess/Network/NetworkProcessProxy.messages.in:
3149         * UIProcess/WebPageProxy.cpp:
3150         (WebKit::WebPageProxy::writeBlobToFilePath):
3151         * UIProcess/WebPageProxy.h:
3152
3153 2018-01-05  Dan Bernstein  <mitz@apple.com>
3154
3155         Add injected bundle equivalents of DOMHTMLDocument (DOMHTMLDocumentExtensions)
3156         https://bugs.webkit.org/show_bug.cgi?id=181345
3157
3158         Reviewed by Tim Horton.
3159
3160         * WebProcess/InjectedBundle/API/mac/WKDOMDocument.h: Declared new methods.
3161         * WebProcess/InjectedBundle/API/mac/WKDOMDocument.mm:
3162         (-[WKDOMDocument createDocumentFragmentWithMarkupString:baseURL:]): Added. Calls WebCore’s
3163           createFragmentFromMarkup.
3164         (-[WKDOMDocument createDocumentFragmentWithText:]): Added. Calls WebCore’s
3165           createFragmentFromText.
3166
3167 2018-01-05  Don Olmstead  <don.olmstead@sony.com>
3168
3169         [Curl] Add implementation stubs for Network Cache
3170         https://bugs.webkit.org/show_bug.cgi?id=181343
3171
3172         Reviewed by Alex Christensen.
3173
3174         * NetworkProcess/cache/NetworkCacheCodersCurl.cpp: Added.
3175         (WTF::Persistence::Coder<WebCore::CertificateInfo>::encode):
3176         (WTF::Persistence::Coder<WebCore::CertificateInfo>::decode):
3177         * NetworkProcess/cache/NetworkCacheDataCurl.cpp: Added.
3178         (WebKit::NetworkCache::Data::Data):
3179         (WebKit::NetworkCache::Data::empty):
3180         (WebKit::NetworkCache::Data::data const):
3181         (WebKit::NetworkCache::Data::isNull const):
3182         (WebKit::NetworkCache::Data::apply const):
3183         (WebKit::NetworkCache::Data::subrange const):
3184         (WebKit::NetworkCache::concatenate):
3185         (WebKit::NetworkCache::Data::adoptMap):
3186         * NetworkProcess/cache/NetworkCacheIOChannelCurl.cpp: Added.
3187         (WebKit::NetworkCache::IOChannel::IOChannel):
3188         (WebKit::NetworkCache::IOChannel::~IOChannel):
3189         (WebKit::NetworkCache::IOChannel::open):
3190         (WebKit::NetworkCache::IOChannel::read):
3191         (WebKit::NetworkCache::IOChannel::write):
3192         * PlatformWin.cmake:
3193
3194 2018-01-05  Don Olmstead  <don.olmstead@sony.com>
3195
3196         [Curl] Update method declarations in WebKit
3197         https://bugs.webkit.org/show_bug.cgi?id=181342
3198
3199         Reviewed by Alex Christensen.
3200
3201         * NetworkProcess/Downloads/curl/DownloadCurl.cpp:
3202         (WebKit::Download::resume):
3203         * NetworkProcess/curl/RemoteNetworkingContextCurl.cpp:
3204         (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession): Deleted.
3205         (WebKit::RemoteNetworkingContext::blockedError const): Deleted.
3206
3207 2018-01-05  Don Olmstead  <don.olmstead@sony.com>
3208
3209         WebFullScreenManager should compile when ENABLE(VIDEO) is off
3210         https://bugs.webkit.org/show_bug.cgi?id=181338
3211
3212         Reviewed by Alex Christensen.
3213
3214         * WebProcess/FullScreen/WebFullScreenManager.cpp:
3215         (WebKit::WebFullScreenManager::didEnterFullScreen):
3216         (WebKit::WebFullScreenManager::willExitFullScreen):
3217         * WebProcess/FullScreen/WebFullScreenManager.h:
3218
3219 2018-01-05  Andy Estes  <aestes@apple.com>
3220
3221         [Apple Pay] Disable Apple Pay on platforms that don't have PassKit.framework
3222         https://bugs.webkit.org/show_bug.cgi?id=181335
3223         <rdar://problem/36311296>
3224
3225         Reviewed by Brady Eidson.
3226
3227         When Safari is running in the macOS Base System, PassKit.framework is not available.
3228         If we fail to dlopen PassKit, we should disable Apple Pay.
3229
3230         * UIProcess/API/C/WKPreferences.cpp:
3231         (WKPreferencesSetApplePayEnabled):
3232         * UIProcess/API/Cocoa/WKWebView.mm:
3233         (-[WKWebView _initializeWithConfiguration:]):
3234         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
3235         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3236         (WebKit::WebPaymentCoordinatorProxy::availablePaymentNetworks):
3237         (WebKit::WebPaymentCoordinatorProxy::platformSupportsPayments):
3238
3239 2018-01-05  Dan Bernstein  <mitz@apple.com>
3240
3241         Fixed the build following AppKit API deprecations in a recent SDKs
3242
3243         * UIProcess/mac/WKFullScreenWindowController.mm:
3244         (-[WKFullScreenWindowController enterFullScreen:]): Suppressed deprecation warnings.
3245         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]): Ditto.
3246         (-[WKFullScreenWindowController exitFullScreen]): Ditto.
3247         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]): Ditto.
3248         (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]): Ditto.
3249         (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]): Ditto.
3250         (-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]): Ditto.
3251         * UIProcess/mac/WKPrintingView.mm:
3252         (-[WKPrintingView _setAutodisplay:]): Ditto.
3253
3254 2018-01-05  Matt Lewis  <jlewis3@apple.com>
3255
3256         Unreviewed, rolling out r226401.
3257
3258         This caused timeouts on multiple platforms.
3259
3260         Reverted changeset:
3261
3262         "Implement Cache API partitioning based on ClientOrigin"
3263         https://bugs.webkit.org/show_bug.cgi?id=181240
3264         https://trac.webkit.org/changeset/226401
3265
3266 2018-01-05  Joseph Pecoraro  <pecoraro@apple.com>
3267
3268         ServiceWorkers: Enable UserTiming / ResourceTiming
3269         https://bugs.webkit.org/show_bug.cgi?id=181297
3270         <rdar://problem/36307306>
3271
3272         Reviewed by Youenn Fablet.
3273
3274         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
3275         (WebKit::WebSWContextManagerConnection::updatePreferencesStore):
3276         Enable Resource Timing / User Timing for the ServiceWorker process.
3277
3278 2018-01-04  Zan Dobersek  <zdobersek@igalia.com>
3279
3280         Unreviewed GTK+ build fix.
3281
3282         * UIProcess/API/glib/WebKitUserMediaPermissionRequest.cpp:
3283         (webkit_user_media_permission_is_for_audio_device):
3284         Call UserMediaPermissionRequestProxy::requiresAudioCapture().
3285         (webkit_user_media_permission_is_for_video_device):
3286         Call UserMediaPermissionRequestProxy::requiresVideoCapture().
3287
3288 2018-01-04  Don Olmstead  <don.olmstead@sony.com>
3289
3290         [Curl] Fix compilation error in WebFrameNetworkingContext
3291         https://bugs.webkit.org/show_bug.cgi?id=181312
3292
3293         Reviewed by Alex Christensen.
3294
3295         * WebProcess/WebCoreSupport/curl/WebFrameNetworkingContext.cpp:
3296         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
3297
3298 2018-01-04  Tim Horton  <timothy_horton@apple.com>
3299
3300         WKWebView loses minimum layout size overrides that happen while the process is terminated
3301         https://bugs.webkit.org/show_bug.cgi?id=181306
3302         <rdar://problem/34398288>
3303
3304         Reviewed by Dan Bernstein.
3305
3306         * Shared/WebPageCreationParameters.cpp:
3307         (WebKit::WebPageCreationParameters::encode const):
3308         (WebKit::WebPageCreationParameters::decode):
3309         * Shared/WebPageCreationParameters.h:
3310         * UIProcess/API/Cocoa/WKWebView.mm:
3311         (-[WKWebView _didRelaunchProcess]): Deleted.
3312         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3313         * UIProcess/WebPageProxy.cpp:
3314         (WebKit::WebPageProxy::creationParameters):
3315         * UIProcess/WebPageProxy.h:
3316         * UIProcess/ios/PageClientImplIOS.mm:
3317         (WebKit::PageClientImpl::didRelaunchProcess):
3318         * UIProcess/ios/WebPageProxyIOS.mm:
3319         (WebKit::WebPageProxy::setViewportConfigurationMinimumLayoutSize):
3320         (WebKit::WebPageProxy::setForceAlwaysUserScalable):
3321         (WebKit::WebPageProxy::setMaximumUnobscuredSize):
3322         * WebProcess/WebPage/WebPage.cpp:
3323         (WebKit::WebPage::WebPage):
3324         Pass the current viewport minimum layout size and maximum unobscured size
3325         in the WebPageCreationParameters instead of re-sending them in _didRelaunchProcess.
3326
3327         The previous approach was problematic when _dispatchSetMinimumLayoutSize:
3328         was changed to not re-send identical updates, because if the client calls 
3329         _overrideLayoutParametersWithMinimumLayoutSize before the Web Content process
3330         is re-launched (after terminating), we would cache the size, attempt to send it,
3331         fail silently (because the process is not launched), and then in _didRelaunchProcess
3332         we would choose not to re-send (after the process is successfully relaunched)
3333         because we think we already sent the new value.
3334
3335         Add isValid() checks to our message sends. Ideally send() would assert
3336         if the process is not alive to avoid problems like this, but it doesn't (yet).
3337
3338         Get rid of WKWebView's _didRelaunchProcess, because it does nothing now.
3339
3340 2018-01-04  Stephan Szabo  <stephan.szabo@sony.com>
3341
3342         NetworkProcess cache files use functions from unistd.h without explicitly including it
3343         https://bugs.webkit.org/show_bug.cgi?id=181261
3344
3345         Reviewed by Alex Christensen.
3346
3347         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
3348         * NetworkProcess/cache/NetworkCacheData.cpp:
3349
3350 2018-01-04  Keith Rollin  <krollin@apple.com>
3351
3352         Add commas
3353         https://bugs.webkit.org/show_bug.cgi?id=181295
3354         <rdar://problem/35802295>
3355
3356         Reviewed by Brent Fulgham.
3357
3358         Fix a problem introduced in r226226 where the emitted JSON didn't
3359         include some required commas.
3360
3361         * NetworkProcess/NetworkResourceLoader.cpp:
3362         (WebKit::NetworkResourceLoader::logCookieInformation const):
3363
3364 2018-01-04  Eric Carlson  <eric.carlson@apple.com>
3365
3366         [MediaStream] Add Mock screen capture source
3367         https://bugs.webkit.org/show_bug.cgi?id=181291
3368         <rdar://problem/36298164>
3369
3370         Reviewed by Dean Jackson.
3371
3372         * Shared/WebCoreArgumentCoders.cpp:
3373         (IPC::ArgumentCoder<MediaConstraints>::decode):
3374         (IPC::ArgumentCoder<CaptureDevice>::encode): Deleted, moved to CaptureDevice.h
3375         (IPC::ArgumentCoder<CaptureDevice>::decode): Ditto.
3376         * Shared/WebCoreArgumentCoders.h:
3377
3378         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Add _WKCaptureDeviceDisplay.
3379         * UIProcess/Cocoa/UIDelegate.mm:
3380         (WebKit::requestUserMediaAuthorizationForDevices): Deal with display capture.
3381         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): Ditto.
3382
3383         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3384         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied): requiresAudio -> requiresAudioCapture.
3385         (WebKit::UserMediaPermissionRequestManagerProxy::searchForGrantedRequest const): Never reuse
3386         a previously granted display capture request.
3387
3388         * UIProcess/UserMediaPermissionRequestProxy.cpp:
3389         (WebKit::UserMediaPermissionRequestProxy::allow): Search the eligible devices instead of asking
3390         the source center to find devices.
3391         * UIProcess/UserMediaPermissionRequestProxy.h:
3392         (WebKit::UserMediaPermissionRequestProxy::requiresAudioCapture const): Renamed.
3393         (WebKit::UserMediaPermissionRequestProxy::requiresVideoCapture const): Ditto.
3394         (WebKit::UserMediaPermissionRequestProxy::requiresDisplayCapture const): New.
3395         (WebKit::UserMediaPermissionRequestProxy::requiresAudio const): Deleted.
3396         (WebKit::UserMediaPermissionRequestProxy::requiresVideo const): Deleted.
3397
3398 2018-01-04  Youenn Fablet  <youenn@apple.com>
3399
3400         FetchResponse should set its internal response text encoding name
3401         https://bugs.webkit.org/show_bug.cgi?id=181284
3402
3403         Reviewed by Alex Christensen.
3404
3405         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
3406         (WebKit::ServiceWorkerClientFetch::didReceiveResponse): Set default encoding to UTF-8.
3407
3408 2018-01-04  Youenn Fablet  <youenn@apple.com>
3409
3410         Implement Cache API partitioning based on ClientOrigin
3411         https://bugs.webkit.org/show_bug.cgi?id=181240
3412
3413         Reviewed by Alex Christensen.
3414
3415         open and retrieveCaches now take a ClientOrigin instead of a String.
3416         Updated cache filesystem path computation to take both client origin and top origin.
3417
3418         When clearing an origin, caches whose client origin or top origin matches the origin are cleared.
3419         Caches are added to the web site data of their client origin with their corresponding cache size.
3420         Caches are added to the web site data of their top origin with a size equal to 0.
3421
3422         Updated memory representation dumping used for test to include both top and client origins.
3423
3424         * NetworkProcess/NetworkProcess.cpp:
3425         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
3426         * NetworkProcess/cache/CacheStorageEngine.cpp:
3427         (WebKit::CacheStorage::Engine::cachesRootPath):
3428         (WebKit::CacheStorage::Engine::open):
3429         (WebKit::CacheStorage::Engine::remove):
3430         (WebKit::CacheStorage::Engine::retrieveCaches):
3431         (WebKit::CacheStorage::Engine::readCachesFromDisk):
3432         (WebKit::CacheStorage::Engine::removeCaches):
3433         (WebKit::CacheStorage::Engine::fetchEntries):
3434         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
3435         (WebKit::CacheStorage::Engine::clearMemoryRepresentation):
3436         (WebKit::CacheStorage::Engine::representation):
3437         * NetworkProcess/cache/CacheStorageEngine.h:
3438         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
3439         (WebKit::CacheStorage::Cache::Cache):
3440         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
3441         (WebKit::CacheStorage::Caches::retrieveOriginFromDirectory):
3442         (WebKit::CacheStorage::Caches::Caches):
3443         (WebKit::CacheStorage::Caches::storeOrigin):
3444         (WebKit::CacheStorage::Caches::readOrigin):
3445         (WebKit::CacheStorage::Caches::open):
3446         * NetworkProcess/cache/CacheStorageEngineCaches.h:
3447         (WebKit::CacheStorage::Caches::create):
3448         (WebKit::CacheStorage::Caches::origin const):
3449         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
3450         (WebKit::CacheStorageEngineConnection::open):
3451         (WebKit::CacheStorageEngineConnection::caches):
3452         (WebKit::CacheStorageEngineConnection::clearMemoryRepresentation):
3453         * NetworkProcess/cache/CacheStorageEngineConnection.h:
3454         * NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
3455         * WebProcess/Cache/WebCacheStorageConnection.cpp:
3456         (WebKit::WebCacheStorageConnection::doOpen):
3457         (WebKit::WebCacheStorageConnection::doRetrieveCaches):
3458         (WebKit::WebCacheStorageConnection::clearMemoryRepresentation):
3459         * WebProcess/Cache/WebCacheStorageConnection.h:
3460
3461 2018-01-04  Youenn Fablet  <youenn@apple.com>
3462
3463         Service Worker should expose redirect mode for navigation loads as manual
3464         https://bugs.webkit.org/show_bug.cgi?id=181067
3465
3466         Reviewed by Alex Christensen.
3467
3468         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
3469         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
3470
3471 2018-01-03  Wenson Hsieh  <wenson_hsieh@apple.com>
3472
3473         [Attachment Support] Create attachment elements when dropping files on iOS
3474         https://bugs.webkit.org/show_bug.cgi?id=181192
3475         <rdar://problem/36280945>
3476
3477         Reviewed by Tim Horton.
3478
3479         Make some minor adjustments for changes to the pasteboard in WebCore. See WebCore/ChangeLog for more detail.
3480         Teaches WebPasteboardProxy et. al. to plumb PasteboardItemInfo from the UI process to the web process via the
3481         new `InformationForItemAtIndex` codepath.
3482
3483         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
3484         (WebKit::WebPasteboardProxy::informationForItemAtIndex):
3485         (WebKit::WebPasteboardProxy::getFilenamesForDataInteraction): Deleted.
3486         * UIProcess/WebPasteboardProxy.h:
3487         * UIProcess/WebPasteboardProxy.messages.in:
3488         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
3489         (WebKit::WebPlatformStrategies::informationForItemAtIndex):
3490         (WebKit::WebPlatformStrategies::getFilenamesForDataInteraction): Deleted.
3491         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
3492
3493 2018-01-03  Ting-Wei Lan  <lantw44@gmail.com>