Synchronize SecurityOrigin related scheme registries with NetworkProcess
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-03-29  Youenn Fablet  <youenn@apple.com>
2
3         Synchronize SecurityOrigin related scheme registries with NetworkProcess
4         https://bugs.webkit.org/show_bug.cgi?id=184140
5
6         Reviewed by Chris Dumez.
7
8         Add syncing of scheme registries that are used by SecurityOrigin and ContentSecurityPolicy
9         so that we can properly use them in NetworkProcess as we do in WebProcess.
10         The registries that are not synced are:
11         - URLSchemeAsEmptyDocument
12         - URLSchemeDomainRelaxationForbidden
13         - URLSchemeAsCachePartitioned
14         - URLSchemeAsCanDisplayOnlyIfCanRequest
15
16         * NetworkProcess/NetworkProcess.cpp:
17         (WebKit::NetworkProcess::initializeNetworkProcess):
18         (WebKit::NetworkProcess::registerURLSchemeAsSecure const):
19         (WebKit::NetworkProcess::registerURLSchemeAsBypassingContentSecurityPolicy const):
20         (WebKit::NetworkProcess::registerURLSchemeAsLocal const):
21         (WebKit::NetworkProcess::registerURLSchemeAsNoAccess const):
22         (WebKit::NetworkProcess::registerURLSchemeAsDisplayIsolated const):
23         (WebKit::NetworkProcess::registerURLSchemeAsCORSEnabled const):
24         (WebKit::NetworkProcess::registerURLSchemeAsCanDisplayOnlyIfCanRequest const):
25         * NetworkProcess/NetworkProcess.h:
26         * NetworkProcess/NetworkProcess.messages.in:
27         * NetworkProcess/NetworkProcessCreationParameters.cpp:
28         (WebKit::NetworkProcessCreationParameters::encode const):
29         (WebKit::NetworkProcessCreationParameters::decode):
30         * NetworkProcess/NetworkProcessCreationParameters.h:
31         * UIProcess/WebProcessPool.cpp:
32         (WebKit::WebProcessPool::ensureNetworkProcess):
33         (WebKit::WebProcessPool::registerURLSchemeAsSecure):
34         (WebKit::WebProcessPool::registerURLSchemeAsBypassingContentSecurityPolicy):
35         (WebKit::WebProcessPool::registerURLSchemeAsLocal):
36         (WebKit::WebProcessPool::registerURLSchemeAsNoAccess):
37         (WebKit::WebProcessPool::registerURLSchemeAsDisplayIsolated):
38         (WebKit::WebProcessPool::registerURLSchemeAsCORSEnabled):
39         (WebKit::WebProcessPool::registerURLSchemeAsCanDisplayOnlyIfCanRequest):
40
41 2018-03-29  Brent Fulgham  <bfulgham@apple.com>
42
43         REGRESSION(r229480): ERROR: Unhandled web process message 'WebCookieManager:SetHTTPCookieAcceptPolicy'
44         https://bugs.webkit.org/show_bug.cgi?id=184124
45         <rdar://problem/38998971>
46
47         Reviewed by Chris Dumez.
48
49         Cookie accept policy messages were still being sent to the WebContent process after
50         I removed cookie access in r229480. The WebContent process no longer recognizes these
51         messages, and generates logging to that effect.
52         
53         This patch stops sending these unnecessary messages to the WebContent process. Only the
54         Network process needs to receive this information.
55
56         * UIProcess/WebCookieManagerProxy.cpp:
57         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
58
59 2018-03-29  Carlos Eduardo Ramalho  <cadubentzen@gmail.com>
60
61         [WPE] Floating point exception in WebEventFactory::createWebWheelEvent
62         https://bugs.webkit.org/show_bug.cgi?id=184037
63
64         Reviewed by Žan Doberšek.
65
66         * Shared/wpe/WebEventFactory.cpp:
67         (WebKit::WebEventFactory::createWebWheelEvent): Use std::copysign() to avoid division by 0.
68
69 2018-03-28  Zalan Bujtas  <zalan@apple.com>
70
71         Make it possible to override the screen size
72         https://bugs.webkit.org/show_bug.cgi?id=184111
73         <rdar://problem/38972181>
74
75         Reviewed by Tim Horton.
76
77         * Shared/WebPageCreationParameters.cpp:
78         (WebKit::WebPageCreationParameters::encode const):
79         (WebKit::WebPageCreationParameters::decode):
80         * Shared/WebPageCreationParameters.h:
81         * UIProcess/WebPageProxy.cpp:
82         (WebKit::WebPageProxy::creationParameters):
83         * UIProcess/WebPageProxy.h:
84         * UIProcess/ios/WebPageProxyIOS.mm:
85         (WebKit::WebPageProxy::overrideScreenSize):
86         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
87         (WebKit::WebChromeClient::overrideScreenSize const):
88         * WebProcess/WebCoreSupport/WebChromeClient.h:
89         * WebProcess/WebPage/WebPage.cpp:
90         * WebProcess/WebPage/WebPage.h:
91         * WebProcess/WebPage/ios/WebPageIOS.mm:
92         (WebKit::WebPage::overrideScreenSize const):
93
94 2018-03-28  Chris Dumez  <cdumez@apple.com>
95
96         Do process swap when opening a cross-origin URL via window.open(url, '_blank', 'noopener')
97         https://bugs.webkit.org/show_bug.cgi?id=183962
98         <rdar://problem/38817833>
99
100         Reviewed by Brady Eidson.
101
102         Swap WebProcess on for the initial navigation in a new Window that was opened
103         via window.open(), when the new URL is cross-origin compared to the opener's
104         origin. For now, we only swap process if 'noopener' property is set when calling
105         window.open(). This is because we do not support the remote DOMWindows yet.
106
107         * Shared/NavigationActionData.cpp:
108         (WebKit::NavigationActionData::encode const):
109         (WebKit::NavigationActionData::decode):
110         * Shared/NavigationActionData.h:
111         * UIProcess/API/APINavigation.h:
112         (API::Navigation::setIsCrossOriginWindowOpenNavigation):
113         (API::Navigation::isCrossOriginWindowOpenNavigation const):
114         (API::Navigation::setOpener):
115         (API::Navigation::opener const):
116         * UIProcess/WebPageProxy.cpp:
117         (WebKit::WebPageProxy::receivedPolicyDecision):
118         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
119         * UIProcess/WebProcessPool.cpp:
120         (WebKit::WebProcessPool::processForNavigation):
121         * UIProcess/WebProcessPool.h:
122         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
123         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
124
125 2018-03-28  Per Arne Vollan  <pvollan@apple.com>
126
127         Adopt WEBPROCESS_WINDOWSERVER_BLOCKING compiler guard in WebProcess.
128         https://bugs.webkit.org/show_bug.cgi?id=183959
129         <rdar://problem/38965719>
130
131         Reviewed by Brent Fulgham.
132
133         Use the compile guard to guard the call to CGSSetDenyWindowServerConnections.
134
135         * WebProcess/WebProcess.cpp:
136         (WebKit::WebProcess::initializeProcess):
137
138 2018-03-28  Brent Fulgham  <bfulgham@apple.com>
139
140         Unreviewed build fix after r230045.
141
142         * UIProcess/Launcher/mac/ProcessLauncherMac.mm: Add missing include (breaks iOS).
143
144 2018-03-28  Brent Fulgham  <bfulgham@apple.com>
145
146         Protect against invalid mach ports returned by mach_port_request_notification
147         https://bugs.webkit.org/show_bug.cgi?id=184106
148         <rdar://problem/37865316>
149
150         Reviewed by Chris Dumez.
151
152         * Platform/IPC/Connection.h:
153         (IPC::Connection::Identifier::Identifier): Use default initializer syntax.
154         * Platform/IPC/mac/ConnectionMac.mm:
155         (IPC::Connection::open): Drive-by-fix: Include formatted mach error message in logging.
156         (IPC::Connection::receiveSourceEventHandler): Check return value from 'mach_port_request_notification'
157         and clean up if it experienced an error.
158         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
159         (WebKit::ProcessLauncher::launchProcess): Ditto.
160
161 2018-03-28  Dean Jackson  <dino@apple.com>
162
163         WKWebViewContentProvider shouldn't be a UIScrollViewDelegate
164         https://bugs.webkit.org/show_bug.cgi?id=184107
165         <rdar://problem/38967492>
166
167         Reviewed by Tim Horton.
168
169         There is no need for this class to be a UIScrollViewDelegate. Instead
170         the protocol should have an optional method that is effectively
171         scrollViewDidScroll.
172
173         * UIProcess/API/Cocoa/WKWebView.mm:
174         (-[WKWebView scrollViewDidScroll:]): Call web_scrollViewDidScroll
175         if it exists.
176         * UIProcess/Cocoa/WKWebViewContentProvider.h: Remove UIScrollViewDelegate
177         and add an optional web_scrollViewDidScroll.
178         * UIProcess/ios/WKPDFView.mm:
179         (-[WKPDFView web_scrollViewDidScroll:]): Renamed from scrollViewDidScroll.
180         (-[WKPDFView scrollViewDidScroll:]): Deleted.
181         * UIProcess/ios/WKSystemPreviewView.mm:
182         (-[WKSystemPreviewView scrollViewDidScroll:]): Deleted.
183
184 2018-03-28  Wenson Hsieh  <wenson_hsieh@apple.com>
185
186         [Extra zoom mode] Make boosted text autosizing values switchable at runtime
187         https://bugs.webkit.org/show_bug.cgi?id=184092
188         <rdar://problem/38939917>
189
190         Reviewed by Tim Horton.
191
192         Add a private web view preference to switch between normal and boosted text autosizing mode. By default, we use
193         normal text autosizing values.
194
195         * Shared/WebPreferences.yaml:
196         * UIProcess/API/Cocoa/WKPreferences.mm:
197         (-[WKPreferences _setShouldEnableTextAutosizingBoost:]):
198         (-[WKPreferences _shouldEnableTextAutosizingBoost]):
199         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
200
201 2018-03-28  Brent Fulgham  <bfulgham@apple.com>
202
203         Avoid uninitialized mach ports
204         https://bugs.webkit.org/show_bug.cgi?id=184090
205         <rdar://problem/37261129>
206
207         Reviewed by Chris Dumez.
208
209         It is possible for mach_port_allocate to return an error, but we rarely check its return value. The value
210         of the argument passed to mach_port_allocate is not guaranteed to be valid when it returns an error, so
211         there is a potential for us to try to use invalid ports.
212
213         We should always check return values, and ensure that the mach port variables we seek to initialize are
214         kept in a valid state.
215
216         Reviewed by Chris Dumez.
217
218         * NetworkProcess/NetworkProcess.cpp:
219         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess): Initialize new port to a safe default and
220         check the return state of the allocation function.
221         * Platform/IPC/Connection.h:
222         * Platform/IPC/mac/ConnectionMac.mm:
223         (IPC::Connection::open): Ditto.
224         (IPC::Connection::initializeSendSource): Ditto.
225         (IPC::readFromMachPort): Ditto.
226         (IPC::Connection::receiveSourceEventHandler): Ditto.
227         * Platform/SharedMemory.h:
228         * Platform/cocoa/SharedMemoryCocoa.cpp:
229         (WebKit::makeMemoryEntry): Ditto.
230         * Platform/mac/MachUtilities.cpp:
231         (setMachPortQueueLength): Ditto.
232         (setMachExceptionPort): Ditto.
233         * PluginProcess/PluginProcess.cpp:
234         (WebKit::PluginProcess::createWebProcessConnection): Ditto.
235         * StorageProcess/StorageProcess.cpp:
236         (WebKit::StorageProcess::createStorageToWebProcessConnection): Ditto.
237         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
238         (WebKit::ProcessLauncher::launchProcess): Ditto.
239         * WebProcess/WebPage/WebInspector.cpp:
240         (WebKit::WebInspector::openFrontendConnection): Ditto.
241
242 2018-03-28  Michael Catanzaro  <mcatanzaro@igalia.com>
243
244         Fails to build webkitgtk+ after git-svn-id: http://svn.webkit.org/repository/webkit/trunk@229877 268f45cc-cd09-0410-ab3c-d52691b4dbfc
245         https://bugs.webkit.org/show_bug.cgi?id=184081
246
247         Unreviewed, switch to use UNUSED_PARAM()
248
249         * UIProcess/WebPageProxy.cpp:
250         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
251
252 2018-03-28  Tim Horton  <timothy_horton@apple.com>
253
254         Make use of HAVE(CORE_ANIMATION_RENDER_SERVER) in more places
255         https://bugs.webkit.org/show_bug.cgi?id=184072
256         <rdar://problem/38946530>
257
258         Reviewed by Dan Bernstein.
259
260         * Platform/mac/LayerHostingContext.mm:
261         (WebKit::LayerHostingContext::createForExternalHostingProcess):
262         * UIProcess/mac/ViewSnapshotStore.h:
263         * UIProcess/mac/ViewSnapshotStore.mm:
264         (WebKit::ViewSnapshot::clearImage):
265
266 2018-03-28  Wenson Hsieh  <wenson_hsieh@apple.com>
267
268         Revert an unnecessary workaround when zooming focused form controls
269         https://bugs.webkit.org/show_bug.cgi?id=184067
270         <rdar://problem/38805254>
271
272         Reviewed by Tim Horton.
273
274         Reverts an unintended change introduced in r227984.
275
276         * UIProcess/ios/WKContentViewInteraction.mm:
277         (-[WKContentView _displayFormNodeInputView]):
278
279 2018-03-28  Miguel Gomez  <magomez@igalia.com>
280
281         [GTK][WPE] Remove UpdateAtlas
282         https://bugs.webkit.org/show_bug.cgi?id=184042
283
284         Reviewed by Žan Doberšek.
285
286         Remove all the code related to UpdateAtlas handling.
287
288         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
289         (WebKit::CoordinatedGraphicsScene::updateTilesIfNeeded):
290         (WebKit::CoordinatedGraphicsScene::commitSceneState):
291         (WebKit::CoordinatedGraphicsScene::purgeGLResources):
292         (WebKit::CoordinatedGraphicsScene::syncUpdateAtlases): Deleted.
293         (WebKit::CoordinatedGraphicsScene::createUpdateAtlas): Deleted.
294         (WebKit::CoordinatedGraphicsScene::removeUpdateAtlas): Deleted.
295         (WebKit::CoordinatedGraphicsScene::releaseUpdateAtlases): Deleted.
296         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
297         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
298         (WebKit::ThreadedCompositor::renderLayerTree):
299         (WebKit::ThreadedCompositor::releaseUpdateAtlases): Deleted.
300         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
301         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
302         (WebKit::WebChromeClient::delegatedScrollRequested):
303         (WebKit::WebChromeClient::resetUpdateAtlasForTesting): Deleted.
304         * WebProcess/WebCoreSupport/WebChromeClient.h:
305         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
306         (WebKit::AcceleratedDrawingArea::resetUpdateAtlasForTesting): Deleted.
307         * WebProcess/WebPage/AcceleratedDrawingArea.h:
308         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
309         (WebKit::CompositingCoordinator::CompositingCoordinator):
310         (WebKit::CompositingCoordinator::flushPendingLayerChanges):
311         (WebKit::CompositingCoordinator::clearPendingStateChanges):
312         (WebKit::CompositingCoordinator::renderNextFrame):
313         (WebKit::CompositingCoordinator::purgeBackingStores):
314         (WebKit::CompositingCoordinator::createUpdateAtlas): Deleted.
315         (WebKit::CompositingCoordinator::removeUpdateAtlas): Deleted.
316         (WebKit::CompositingCoordinator::getCoordinatedBuffer): Deleted.
317         (): Deleted.
318         (WebKit::CompositingCoordinator::scheduleReleaseInactiveAtlases): Deleted.
319         (WebKit::CompositingCoordinator::releaseInactiveAtlasesTimerFired): Deleted.
320         (WebKit::CompositingCoordinator::releaseAtlases): Deleted.
321         (WebKit::CompositingCoordinator::clearUpdateAtlases): Deleted.
322         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
323         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
324         (WebKit::CoordinatedLayerTreeHost::clearUpdateAtlases): Deleted.
325         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
326         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
327         (WebKit::ThreadedCoordinatedLayerTreeHost::releaseUpdateAtlases): Deleted.
328         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
329         * WebProcess/WebPage/DrawingArea.h:
330         * WebProcess/WebPage/LayerTreeHost.h:
331         (WebKit::LayerTreeHost::setIsDiscardable):
332
333 2018-03-28  Carlos Garcia Campos  <cgarcia@igalia.com>
334
335         REGRESSION(r229998): WebDriver: MiniBrowser is crashing in a lot of tests after r229998
336         https://bugs.webkit.org/show_bug.cgi?id=184075
337
338         Reviewed by Žan Doberšek.
339
340         This is because we are using a value after it has been moved.
341
342         * UIProcess/Automation/WebAutomationSession.cpp:
343         (WebKit::WebAutomationSession::setWindowFrameOfBrowsingContext): Save a reference to page in a local variable
344         before using it when it's also going to be moved in the lambda capture.
345
346 2018-03-27  Michael Catanzaro  <mcatanzaro@igalia.com>
347
348         Unreviewed, fix typo in variable name
349
350         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
351         (webkitWebViewBaseCrossingNotifyEvent):
352
353 2018-03-27  Per Arne Vollan  <pvollan@apple.com>
354
355         The layout test fast/canvas/webgl/read-pixels-test.html is timing out.
356         https://bugs.webkit.org/show_bug.cgi?id=183923
357         <rdar://problem/38756869>
358
359         Reviewed by Brent Fulgham.
360
361         Send OpenGL display mask to the WebContent process when the display ID is changing.
362
363         * UIProcess/WebPageProxy.cpp:
364         (WebKit::WebPageProxy::windowScreenDidChange):
365         * WebProcess/WebPage/WebPage.h:
366         * WebProcess/WebPage/WebPage.messages.in:
367         * WebProcess/WebPage/mac/WebPageMac.mm:
368         (WebKit::WebPage::openGLDisplayMaskChanged):
369
370 2018-03-27  Youenn Fablet  <youenn@apple.com>
371
372         Move request checking out of PingLoad for future reuse in NetworkLoad
373         https://bugs.webkit.org/show_bug.cgi?id=183865
374
375         Reviewed by Chris Dumez.
376
377         Introduce NetworkLoadChecker as a way to validate requests before sending them in the network process.
378         Validation encompasses: CORS checks, CSP and Content Extensions on both main request and redirected requests if any.
379
380         Make PingLoad use NetworkLoadChecker. Future patch should make NetworkLoad to use it as well whenever needed.
381
382         Make NetworkCORSPreflightChecker takes a CompletionHandler instead of a Function.
383         Ensure this callback is called even if preflight is not completed by returning a Canceled error.
384
385         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
386         (WebKit::NetworkCORSPreflightChecker::~NetworkCORSPreflightChecker):
387         (WebKit::NetworkCORSPreflightChecker::returnResult):
388         (WebKit::NetworkCORSPreflightChecker::willPerformHTTPRedirection):
389         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
390         (WebKit::NetworkCORSPreflightChecker::didCompleteWithError):
391         * NetworkProcess/NetworkCORSPreflightChecker.h:
392         * NetworkProcess/NetworkLoadChecker.cpp: Added.
393         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
394         (WebKit::NetworkLoadChecker::check):
395         (WebKit::NetworkLoadChecker::checkRedirection):
396         (WebKit::NetworkLoadChecker::returnError):
397         (WebKit::NetworkLoadChecker::checkRequest):
398         (WebKit::NetworkLoadChecker::checkCORSRequest):
399         (WebKit::NetworkLoadChecker::checkCORSRedirectedRequest):
400         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
401         (WebKit::NetworkLoadChecker::doesNotNeedCORSCheck const):
402         (WebKit::NetworkLoadChecker::contentSecurityPolicy const):
403         (WebKit::NetworkLoadChecker::contentExtensionsBackend):
404         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
405         * NetworkProcess/NetworkLoadChecker.h: Added.
406         (WebKit::NetworkLoadChecker::setCSPResponseHeaders):
407         (WebKit::NetworkLoadChecker::setContentExtensionRuleLists):
408         (WebKit::NetworkLoadChecker::url const):
409         (WebKit::NetworkLoadChecker::storedCredentialsPolicy const):
410         (WebKit::NetworkLoadChecker::isChecking const):
411         (WebKit::NetworkLoadChecker::isRedirected const):
412         * NetworkProcess/PingLoad.cpp:
413         (WebKit::PingLoad::PingLoad):
414         (WebKit::PingLoad::~PingLoad):
415         (WebKit::PingLoad::willPerformHTTPRedirection):
416         (WebKit::PingLoad::didReceiveChallenge):
417         (WebKit::PingLoad::wasBlocked):
418         (WebKit::PingLoad::cannotShowURL):
419         (WebKit::PingLoad::timeoutTimerFired):
420         (WebKit::PingLoad::currentURL const):
421         * NetworkProcess/PingLoad.h:
422         * WebKit.xcodeproj/project.pbxproj:
423
424 2018-03-27  Jiewen Tan  <jiewen_tan@apple.com>
425
426         [WebAuthN] Implement authenticatorGetAssertion
427         https://bugs.webkit.org/show_bug.cgi?id=183881
428         <rdar://problem/37258628>
429
430         Reviewed by Brent Fulgham.
431
432         * Shared/WebPreferences.yaml:
433         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.cpp:
434         (WebKit::WebCredentialsMessengerProxy::makeCredential):
435         (WebKit::WebCredentialsMessengerProxy::getAssertion):
436         (WebKit::WebCredentialsMessengerProxy::getAssertionReply):
437         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.h:
438         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.messages.in:
439         * WebProcess/CredentialManagement/WebCredentialsMessenger.cpp:
440         (WebKit::WebCredentialsMessenger::getAssertion):
441         (WebKit::WebCredentialsMessenger::getAssertionReply):
442         * WebProcess/CredentialManagement/WebCredentialsMessenger.messages.in:
443
444 2018-03-27  Chris Dumez  <cdumez@apple.com>
445
446         Avoid constructing SecurityOrigin objects from non-main threads
447         https://bugs.webkit.org/show_bug.cgi?id=184024
448
449         Reviewed by Youenn Fablet.
450
451         Avoid constructing SecurityOrigin objects from non-main threads as much as possible.
452
453         * WebProcess/Storage/WebSWClientConnection.cpp:
454         (WebKit::WebSWClientConnection::mayHaveServiceWorkerRegisteredForOrigin const):
455         (WebKit::WebSWClientConnection::matchRegistration):
456         (WebKit::WebSWClientConnection::getRegistrations):
457         * WebProcess/Storage/WebSWClientConnection.h:
458         * WebProcess/Storage/WebSWOriginTable.cpp:
459         (WebKit::WebSWOriginTable::contains const):
460         * WebProcess/Storage/WebSWOriginTable.h:
461
462 2018-03-27  Chris Dumez  <cdumez@apple.com>
463
464         Move online state detection from the WebProcess to the NetworkProcess
465         https://bugs.webkit.org/show_bug.cgi?id=183989
466         <rdar://problem/37093299>
467
468         Reviewed by Youenn Fablet.
469
470         Move online state detection from the WebProcess to the NetworkProcess. This avoid executing the same (expensive) code in
471         EACH web process whenever a network interface's state changes. Now, the Network Process monitors network interfaces
472         and determines the online state whenever an interface's state changes. If the onLine state changes, it notifies all
473         its connected WebProcesses via IPC.
474
475         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
476         (WebKit::NetworkConnectionToWebProcess::setOnLineState):
477         * NetworkProcess/NetworkConnectionToWebProcess.h:
478         * NetworkProcess/NetworkProcess.cpp:
479         (WebKit::NetworkProcess::NetworkProcess):
480         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
481         * WebProcess/Network/NetworkProcessConnection.cpp:
482         (WebKit::NetworkProcessConnection::setOnLineState):
483         * WebProcess/Network/NetworkProcessConnection.h:
484         * WebProcess/Network/NetworkProcessConnection.messages.in:
485         * WebProcess/Network/WebLoaderStrategy.cpp:
486         (WebKit::WebLoaderStrategy::isOnLine const):
487         (WebKit::WebLoaderStrategy::addOnlineStateChangeListener):
488         (WebKit::WebLoaderStrategy::setOnLineState):
489         * WebProcess/Network/WebLoaderStrategy.h:
490
491 2018-03-27  Wenson Hsieh  <wenson_hsieh@apple.com>
492
493         [Extra zoom mode] Add support for new focused form control overlay behaviors
494         https://bugs.webkit.org/show_bug.cgi?id=184043
495         <rdar://problem/38758727>
496
497         Reviewed by Tim Horton.
498
499         See below for more details.
500
501         * UIProcess/ios/WKContentViewInteraction.mm:
502         (-[WKContentView _willStartScrollingOrZooming]):
503         (-[WKContentView _didEndScrollingOrZooming]):
504
505         Suppress focused form control navigation while the scroll view is undergoing a scroll or zoom animation (e.g.,
506         when moving from one focused form control to another).
507
508         (-[WKContentView textInputController:didCommitText:withSuggestion:]):
509
510         When dismissing an input view controller, allow focused form control navigation only after updating assisted
511         node information to ensure that focus rects aren't stale as the user begins to navigate between forms.
512
513         (-[WKContentView rectForFocusedFormControlController:inCoordinateSpace:]):
514         (-[WKContentView nextRectForFocusedFormControlController:inCoordinateSpace:]):
515         (-[WKContentView previousRectForFocusedFormControlController:inCoordinateSpace:]):
516         (-[WKContentView scrollViewForFocusedFormControlController:]):
517         (-[WKContentView highlightedRectForFocusedFormControlController:inCoordinateSpace:]): Deleted.
518
519         Implement some new focused form overlay delegate hooks to vend the scroll view, as well as the rects of next and
520         previous focusable form controls.
521
522 2018-03-27  Brent Fulgham  <bfulgham@apple.com>
523
524         Further refine cookie read/write logging
525         https://bugs.webkit.org/show_bug.cgi?id=184044
526         <rdar://problem/38915610>
527
528         Reviewed by Chris Dumez.
529
530         Cookie logging was passing the partition, rather than the first party, when logging, which
531         prevented logging in cases where partitioning or blocking was active. This patch corrects
532         these calls so that logging is generated in these cases, too.
533
534         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
535         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM): Call log routines if needed.
536         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM): Ditto.
537         * NetworkProcess/NetworkResourceLoader.cpp:
538         (WebKit::escapeIDForJSON): Make available to use in multiple functions.
539         (WebKit::NetworkResourceLoader::logCookieInformation const): Revise to use shared
540         convenience functions.
541         (WebKit::logBlockedCookieInformation): Added.
542         (WebKit::logCookieInformationInternal): Added.
543         (WebKit::NetworkResourceLoader::logCookieInformation): Revise to use shared
544         convenience functions.
545         * NetworkProcess/NetworkResourceLoader.h:
546
547 2018-03-27  Brian Burg  <bburg@apple.com>
548
549         Web Automation: support enter/exit fullscreen and hide/restore window operations
550         https://bugs.webkit.org/show_bug.cgi?id=182837
551         <rdar://problem/37580732>
552
553         Reviewed by Tim Horton.
554
555         The W3C specification is more explicit about when to exit fullscreen and
556         restore the window for a browsing context. So, WebKit needs to have support
557         for performing these operations on behalf of a driver.
558
559         Based on prototyping, it is sufficient to use a JavaScript atom to enter
560         fullscreen mode. This is included in the patch as EnterFullscreen.js and
561         can be used to implement the §10.7.5 Fullscreen Window command.
562
563         Other window operations cannot be peformed from JavaScript, so we need to
564         delegate these operations to the session client (i.e., Safari).
565         This patch adds session client callouts for restoring, minimizing, and
566         switching to a browsing context.
567
568         Exiting fullscreen happens implicitly (per specification) when setting a
569         window frame without an actual frame, or when switching/restoring/minimizing a window.
570         If needed, a driver can call Set Window Rect in this way to unfullscreen a context.
571         Similarly, a driver can restore a minimized window using Set Window Rect.
572
573         * UIProcess/API/APIAutomationSessionClient.h:
574         (API::AutomationSessionClient::requestHideWindowOfPage):
575         (API::AutomationSessionClient::requestRestoreWindowOfPage):
576         (API::AutomationSessionClient::requestSwitchToPage):
577         Add new API client methods.
578
579         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
580         Add new Cocoa API delegate methods.
581
582         * UIProcess/Automation/Automation.json:
583         Make the switch to browsing context command asynchronous, since this functionality
584         is not always synchronous, and we prefer to use completion handlers in the delegates.
585
586         Add new protocol method for hiding the window of a browsing context.
587         This is expected to minimize/miniaturize a window for desktop window managers.
588
589         * UIProcess/Automation/WebAutomationSession.h:
590         * UIProcess/Automation/WebAutomationSession.cpp:
591         (WebKit::WebAutomationSession::switchToBrowsingContext):
592         Make this function asynchronous. Call out to the session client.
593
594         (WebKit::WebAutomationSession::setWindowFrameOfBrowsingContext):
595         Follow the steps in the specification to restore window and exit fullscreen.
596
597         (WebKit::WebAutomationSession::hideWindowOfBrowsingContext):
598         Exit fullscreen and call out to the session client.
599
600         (WebKit::WebAutomationSession::exitFullscreenWindowForPage):
601         This is a little strange. Because there is no async API for exiting fullscreen
602         from C++ code, we hook into willEnterFullScreen and didExitFullScreen and send
603         out the response if the page exited fullscreen after we requested it to do so.
604         Because the W3C specification mandates that drivers only process one command at
605         a time, there will only ever be one callback installed by this method at a time.
606
607         (WebKit::WebAutomationSession::restoreWindowForPage):
608         (WebKit::WebAutomationSession::hideWindowForPage):
609         Call out to the session client.
610
611         (WebKit::WebAutomationSession::didEnterFullScreenForPage):
612         (WebKit::WebAutomationSession::didExitFullScreenForPage):
613         Add methods to be called by instrumentation hooks in WebFullScreenManagerProxy.
614
615         * UIProcess/Automation/atoms/EnterFullscreen.js: Added.
616         (enterFullscreen):
617
618         * UIProcess/Cocoa/AutomationSessionClient.h:
619         * UIProcess/Cocoa/AutomationSessionClient.mm:
620         (WebKit::AutomationSessionClient::AutomationSessionClient):
621         (WebKit::AutomationSessionClient::requestSwitchToPage):
622         (WebKit::AutomationSessionClient::requestHideWindowOfPage):
623         (WebKit::AutomationSessionClient::requestRestoreWindowOfPage):
624         (WebKit::AutomationSessionClient::isShowingJavaScriptDialogOnPage):
625         Add boilerplate to convert C++ API client to Objective-C delegate methods.
626
627         * UIProcess/WebFullScreenManagerProxy.cpp:
628         (WebKit::WebFullScreenManagerProxy::didEnterFullScreen):
629         (WebKit::WebFullScreenManagerProxy::didExitFullScreen):
630         Notify the automation session if the page is under automation and
631         enters or exits fullscreen.
632
633         * WebKit.xcodeproj/project.pbxproj:
634         Add EnterFullscreen.js to the list of WebDriver atoms. These are copied
635         as WebKit2 private headers and used by driver implementations.
636
637 2018-03-27  Eric Carlson  <eric.carlson@apple.com>
638
639         Make AVFoundationEnabled preference available on iOS
640         https://bugs.webkit.org/show_bug.cgi?id=183876
641         <rdar://problem/38726459>
642
643         Reviewed by Youenn Fablet.
644
645         * Shared/WebPreferences.yaml: Set AVFoundationEnabled with DEFAULT_AVFOUNDATION_ENABLED.
646         * Shared/WebPreferencesDefaultValues.h:
647
648         * UIProcess/API/Cocoa/WKPreferences.mm:
649         (-[WKPreferences _setAVFoundationEnabled:]): Enable for iOS.
650         (-[WKPreferences _avFoundationEnabled]): Ditto.
651         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
652
653 2018-03-26  Tim Horton  <timothy_horton@apple.com>
654
655         Adopt WK_ALTERNATE_FRAMEWORKS_DIR in WebKit
656         https://bugs.webkit.org/show_bug.cgi?id=184030
657         <rdar://problem/38895281>
658
659         Reviewed by Dan Bernstein.
660
661         * Configurations/Base.xcconfig:
662         * Configurations/BaseTarget.xcconfig:
663         * Configurations/WebKit.xcconfig:
664
665 2018-03-26  Tim Horton  <timothy_horton@apple.com>
666
667         Add and adopt HAVE(CORE_ANIMATION_RENDER_SERVER)
668         https://bugs.webkit.org/show_bug.cgi?id=184026
669         <rdar://problem/38883321>
670
671         Reviewed by Sam Weinig.
672
673         * UIProcess/API/Cocoa/WKWebView.mm:
674         (-[WKWebView _takeViewSnapshot]):
675         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
676
677 2018-03-26  Wenson Hsieh  <wenson_hsieh@apple.com>
678
679         [Extra zoom mode] Refactor input view controller presentation and dismissal helpers
680         https://bugs.webkit.org/show_bug.cgi?id=184020
681         Work towards <rdar://problem/38758727>
682
683         Reviewed by Tim Horton.
684
685         We currently have separate presentation and dismissal helpers for each type of view controller corresponding to
686         a focused element type. This is excessive, considering that all of these helpers are only invoked from one place
687         (either -presentViewControllerForCurrentAssistedNode or -dismissAllInputViewControllers), with the exception of
688         the focused form control overlay.
689
690         This refactoring allows us to then adjust the timing of first responder restoration logic, such that the focused
691         form control view controller can receive forwarded events from the web view. See below for more detail.
692
693         * UIProcess/ios/WKContentViewInteraction.mm:
694         (-[WKContentView presentFocusedFormControlViewController:]):
695         (-[WKContentView dismissFocusedFormControlViewController:]):
696
697         Remove logic to restore the web view as first responder.
698
699         (-[WKContentView presentViewControllerForCurrentAssistedNode]):
700         (-[WKContentView dismissAllInputViewControllers]):
701
702         Restore first responder after dismissing a view controller that was presented when focusing a form control, only
703         if the web view was first responder before presentation.
704
705         (-[WKContentView presentDatePickerViewController:]): Deleted.
706         (-[WKContentView dismissDatePickerViewController:]): Deleted.
707         (-[WKContentView presentTimePickerViewController:]): Deleted.
708         (-[WKContentView dismissTimePickerViewController:]): Deleted.
709         (-[WKContentView presentSelectMenuViewController:]): Deleted.
710         (-[WKContentView dismissSelectMenuViewController:]): Deleted.
711         (-[WKContentView dismissNumberPadViewController:]): Deleted.
712         (-[WKContentView presentNumberPadViewController:]): Deleted.
713         (-[WKContentView presentTextInputViewController:]): Deleted.
714         (-[WKContentView dismissTextInputViewController:]): Deleted.
715
716 2018-03-06  Brian Burg  <bburg@apple.com>
717
718         Web Automation: provide a way to ask clients for a new tab or window
719         https://bugs.webkit.org/show_bug.cgi?id=183381
720         <rdar://problem/38167301>
721
722         Reviewed by Timothy Hatcher.
723
724         Add support for specifying browsing context options when requesting
725         a new browsing context from the automation session client/delegate.
726         This is currently just used for specifying tab vs window, but could
727         also be used for things like toggling certain browser chrome or features.
728
729         There is no guarantee that the client has a notion of tabs vs windows,
730         so this option is purely advisory and should not cause the command to
731         fail if it cannot be honored.
732
733         This behavior caused by specifying this option is client-specific, so no
734         new tests are included in WebKit for this change.
735
736         * UIProcess/API/APIAutomationSessionClient.h:
737         (API::AutomationSessionClient::didRequestNewPageWithOptions):
738         (API::AutomationSessionClient::didRequestNewWindow): Deleted.
739         Add options parameter.
740
741         * UIProcess/API/glib/WebKitAutomationSession.cpp:
742         Adjust to new signature. More work is needed to plumb this information
743         to the public API for GTK/WPE and support it in WebKitGTK driver.
744
745         * UIProcess/Automation/Automation.json: Add new optional parameter.
746
747         * UIProcess/Automation/WebAutomationSession.h:
748         * UIProcess/Automation/WebAutomationSession.cpp:
749         (WebKit::WebAutomationSession::createBrowsingContext):
750         Convert the protocol option to an API option.
751
752         * UIProcess/Cocoa/AutomationSessionClient.h:
753         * UIProcess/Cocoa/AutomationSessionClient.mm:
754         (WebKit::AutomationSessionClient::AutomationSessionClient):
755         (WebKit::toAPI):
756         (WebKit::AutomationSessionClient::didRequestNewPageWithOptions):
757         (WebKit::AutomationSessionClient::didRequestNewWindow): Deleted.
758         Convert the internal option to a Cocoa SPI option and pass it along.
759
760         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
761         Adjust delegate methods to include options. Clients need to adopt the new signature(s).
762
763 2018-03-26  Wenson Hsieh  <wenson_hsieh@apple.com>
764
765         [Extra zoom mode] Add plumbing for next and previous focusable element rects
766         https://bugs.webkit.org/show_bug.cgi?id=184016
767         Work towards <rdar://problem/38758727>
768
769         Reviewed by Tim Horton.
770
771         When building up AssistedNodeInformation, we currently compute the element rect of the current focused element,
772         as well as flags indicating whether or not there are next or previous focusable elements. For
773         <rdar://problem/38758727>, we additionally send the rects of the next or previous focusable elements as well.
774
775         * Shared/AssistedNodeInformation.cpp:
776         (WebKit::AssistedNodeInformation::encode const):
777         (WebKit::AssistedNodeInformation::decode):
778
779         IPC support for nextNodeRect and previousNodeRect.
780
781         * Shared/AssistedNodeInformation.h:
782         * WebProcess/WebPage/ios/WebPageIOS.mm:
783         (WebKit::elementRectInRootViewCoordinates):
784
785         Add a helper to compute an element's rect in root view coordinates. We use this to compute the rects of the
786         current focused element as well as those of the next and previous elements, if any.
787
788         (WebKit::WebPage::getAssistedNodeInformation):
789         (WebKit::hasAssistableElement): Deleted.
790
791         Since we need the next or previous focusable element to get its rect, we don't need this helper anymore.
792
793 2018-03-26  Chris Dumez  <cdumez@apple.com>
794
795         Use SecurityOriginData more consistently in Service Worker code
796         https://bugs.webkit.org/show_bug.cgi?id=183969
797
798         Reviewed by Darin Adler.
799
800         Use SecurityOriginData more consistently in Service Worker code to avoid constructing
801         SecurityOrigin objects unnecessarily.
802
803         * NetworkProcess/NetworkResourceLoadParameters.cpp:
804         (WebKit::NetworkResourceLoadParameters::encode const):
805         * Shared/API/c/WKSecurityOriginRef.cpp:
806         (WKSecurityOriginCopyDatabaseIdentifier):
807         * StorageProcess/ServiceWorker/WebSWOriginStore.cpp:
808         (WebKit::WebSWOriginStore::addToStore):
809         (WebKit::WebSWOriginStore::removeFromStore):
810         * StorageProcess/ServiceWorker/WebSWOriginStore.h:
811         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
812         (WebKit::WebSWServerConnection::scheduleJobInServer):
813         (WebKit::WebSWServerConnection::registerServiceWorkerClient):
814         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
815         (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
816         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
817         * StorageProcess/StorageProcess.cpp:
818         (WebKit::StorageProcess::connectionToContextProcessWasClosed):
819         (WebKit::StorageProcess::needsServerToContextConnectionForOrigin const):
820         (WebKit::StorageProcess::createStorageToWebProcessConnection):
821         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
822         (WebKit::StorageProcess::serverToContextConnectionForOrigin):
823         (WebKit::StorageProcess::createServerToContextConnection):
824         (WebKit::StorageProcess::swContextConnectionMayNoLongerBeNeeded):
825         * StorageProcess/StorageProcess.h:
826         * UIProcess/API/APIFrameInfo.cpp:
827         (API::FrameInfo::create):
828         * UIProcess/API/C/WKApplicationCacheManager.cpp:
829         (WKApplicationCacheManagerDeleteEntriesForOrigin):
830         * UIProcess/API/C/WKKeyValueStorageManager.cpp:
831         (WKKeyValueStorageManagerDeleteEntriesForOrigin):
832         * UIProcess/API/C/WKResourceCacheManager.cpp:
833         (WKResourceCacheManagerClearCacheForOrigin):
834         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
835         (WKWebsiteDataStoreRemoveFetchCacheForOrigin):
836         (WKWebsiteDataStoreGetFetchCacheSizeForOrigin):
837         * UIProcess/ServiceWorkerProcessProxy.cpp:
838         (WebKit::ServiceWorkerProcessProxy::create):
839         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
840         (WebKit::ServiceWorkerProcessProxy::getLaunchOptions):
841         * UIProcess/ServiceWorkerProcessProxy.h:
842         * UIProcess/Storage/StorageProcessProxy.cpp:
843         (WebKit::StorageProcessProxy::getStorageProcessConnection):
844         * UIProcess/WebProcessPool.cpp:
845         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
846         (WebKit::WebProcessPool::disconnectProcess):
847         (WebKit::WebProcessPool::updateProcessAssertions):
848         * UIProcess/WebProcessPool.h:
849         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
850         (WebKit::WebsiteDataStore::fetchDataAndApply):
851         * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp:
852         (WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation):
853         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
854         (WKBundlePageCopyOriginsWithApplicationCache):
855         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
856         (WebKit::UserMediaPermissionRequestManager::sendUserMediaRequest):
857         (WebKit::UserMediaPermissionRequestManager::enumerateMediaDevices):
858         * WebProcess/Storage/WebSWClientConnection.cpp:
859         (WebKit::WebSWClientConnection::registerServiceWorkerClient):
860         (WebKit::WebSWClientConnection::matchRegistration):
861         (WebKit::WebSWClientConnection::whenRegistrationReady):
862         (WebKit::WebSWClientConnection::getRegistrations):
863         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
864         (WebKit::WebChromeClient::exceededDatabaseQuota):
865         (WebKit::WebChromeClient::reachedApplicationCacheOriginQuota):
866         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
867         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
868         * WebProcess/WebProcess.cpp:
869         (WebKit::WebProcess::fetchWebsiteData):
870         * WebProcess/WebStorage/StorageAreaImpl.cpp:
871         (WebKit::StorageAreaImpl::securityOrigin const):
872         * WebProcess/WebStorage/StorageAreaImpl.h:
873         * WebProcess/WebStorage/StorageAreaMap.cpp:
874         (WebKit::StorageAreaMap::StorageAreaMap):
875         (WebKit::StorageAreaMap::dispatchSessionStorageEvent):
876         (WebKit::StorageAreaMap::dispatchLocalStorageEvent):
877         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
878         (WebKit::StorageNamespaceImpl::didDestroyStorageAreaMap):
879
880 2018-03-26  Brent Fulgham  <bfulgham@apple.com>
881
882         Warn against cookie access in the WebContent process using ProcessPrivilege assertions
883         https://bugs.webkit.org/show_bug.cgi?id=183911
884         <rdar://problem/38762306>
885
886         Reviewed by Youenn Fablet.
887
888         Add a set of ProcessPrivilege assertions to enforce the rule that the WebContent process
889         should never call Cookie API directly. That should only happen in the Networking or
890         UIProcess. 
891
892         * NetworkProcess/Cookies/mac/WebCookieManagerMac.mm:
893         (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy):
894         (WebKit::WebCookieManager::platformGetHTTPCookieAcceptPolicy):
895         * NetworkProcess/NetworkProcess.cpp:
896         (WebKit::NetworkProcess::initializeNetworkProcess):
897         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
898         (WebKit::NetworkDataTaskCocoa::applyCookieBlockingPolicy):
899         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
900         (WebKit::NetworkProcess::setSharedHTTPCookieStorage):
901         (WebKit::NetworkProcess::syncAllCookies):
902         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
903         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
904         * NetworkProcess/mac/RemoteNetworkingContext.mm:
905         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
906         * PluginProcess/PluginProcess.cpp:
907         (WebKit::PluginProcess::initializeProcess):
908         * Shared/cf/CookieStorageUtilsCF.mm:
909         (WebKit::cookieStorageFromIdentifyingData):
910         (WebKit::identifyingDataFromCookieStorage):
911         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
912         (WebKit::WebProcessPool::platformInitializeWebProcess):
913         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
914         (WebKit::privateBrowsingSession):
915         * UIProcess/WebProcessPool.cpp:
916         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
917         (WebKit::WebsiteDataStore::parameters):
918         * UIProcess/mac/WebCookieManagerProxyMac.mm:
919         (WebKit::WebCookieManagerProxy::persistHTTPCookieAcceptPolicy):
920         * WebProcess/InjectedBundle/InjectedBundle.cpp:
921         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
922         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
923         (WebKit::WebFrameLoaderClient::createNetworkingContext):
924         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
925         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
926         (WebKit::WebFrameNetworkingContext::storageSession const):
927         * WebProcess/WebProcess.cpp:
928         (WebKit::WebProcess::initializeProcess):
929
930 2018-03-26  Alex Christensen  <achristensen@webkit.org>
931
932         Merge ResourceHandleClient::willCacheResponseAsync with ResourceHandleClient::willCacheResponse
933         https://bugs.webkit.org/show_bug.cgi?id=183965
934
935         Reviewed by Chris Dumez.
936
937         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
938         (WebKit::WebFrameLoaderClient::willCacheResponse const):
939         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
940
941 2018-03-25  Carlos Garcia Campos  <cgarcia@igalia.com>
942
943         [GTK][WPE] Add API to convert between DOM and JSCValue
944         https://bugs.webkit.org/show_bug.cgi?id=183448
945
946         Reviewed by Michael Catanzaro.
947
948         Add methods to get a JSCValue for a WebKitDOMObject and to create a WebKitDOMNode from a JSCValue. Deprecate
949         most of the GTK+ DOM bindings API and move the non-deprecated parts to glib dir to be exposed by WPE too.
950
951         * PlatformGTK.cmake:
952         * PlatformWPE.cmake:
953         * SourcesGTK.txt:
954         * SourcesWPE.txt:
955         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
956         * WebProcess/InjectedBundle/API/glib/DOM/DOMObjectCache.cpp: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/DOMObjectCache.cpp.
957         * WebProcess/InjectedBundle/API/glib/DOM/DOMObjectCache.h: Copied from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/DOMObjectCache.h.
958         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMDocument.cpp: Added.
959         (WebKit::kit):
960         (WebKit::core):
961         (WebKit::wrapDocument):
962         (webkit_dom_document_class_init):
963         (webkit_dom_document_init):
964         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMDocumentPrivate.h: Copied from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentPrivate.h.
965         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMElement.cpp: Added.
966         (WebKit::kit):
967         (WebKit::core):
968         (WebKit::wrapElement):
969         (webkit_dom_element_class_init):
970         (webkit_dom_element_init):
971         (webkit_dom_element_html_input_element_is_user_edited):
972         (webkit_dom_element_html_input_element_get_auto_filled):
973         (webkit_dom_element_html_input_element_set_auto_filled):
974         (webkit_dom_element_html_input_element_set_editing_value):
975         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMElementPrivate.h: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElementPrivate.h.
976         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMNode.cpp: Added.
977         (_WebKitDOMNodePrivate::~_WebKitDOMNodePrivate):
978         (WebKit::kit):
979         (WebKit::core):
980         (WebKit::wrapNode):
981         (webkitDOMNodeConstructor):
982         (webkitDOMNodeFinalize):
983         (webkit_dom_node_init):
984         (webkit_dom_node_class_init):
985         (webkitDOMNodeSetCoreObject):
986         (webkitDOMNodeGetCoreObject):
987         (webkit_dom_node_for_js_value):
988         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMNodePrivate.h: Copied from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodePrivate.h.
989         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMObject.cpp: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMObject.cpp.
990         (webkitDOMObjectSetProperty):
991         (webkit_dom_object_class_init):
992         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMPrivate.cpp: Added.
993         (WebKit::wrap):
994         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMPrivate.h: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/DOMObjectCache.h.
995         * WebProcess/InjectedBundle/API/glib/WebKitFrame.cpp:
996         (webkit_frame_get_js_value_for_dom_object):
997         (webkit_frame_get_js_value_for_dom_object_in_script_world):
998         * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
999         (webkit_web_page_class_init):
1000         (webkitWebPageCreate):
1001         (webkit_web_page_get_dom_document):
1002         * WebProcess/InjectedBundle/API/gtk/DOM/GObjectEventListener.cpp:
1003         (WebKit::GObjectEventListener::handleEvent):
1004         * WebProcess/InjectedBundle/API/gtk/DOM/GObjectNodeFilterCondition.cpp:
1005         * WebProcess/InjectedBundle/API/gtk/DOM/GObjectXPathNSResolver.cpp:
1006         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMAttr.cpp:
1007         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMAttr.h:
1008         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMBlob.cpp:
1009         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMBlob.h:
1010         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCDATASection.cpp:
1011         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCDATASection.h:
1012         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRule.cpp:
1013         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRule.h:
1014         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRuleList.cpp:
1015         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRuleList.h:
1016         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleDeclaration.cpp:
1017         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleDeclaration.h:
1018         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleSheet.cpp:
1019         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleSheet.h:
1020         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSValue.cpp:
1021         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSValue.h:
1022         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCharacterData.cpp:
1023         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCharacterData.h:
1024         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.cpp:
1025         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.h:
1026         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.cpp:
1027         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.h:
1028         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMComment.cpp:
1029         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMComment.h:
1030         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMImplementation.cpp:
1031         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMImplementation.h:
1032         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMSelection.cpp:
1033         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMSelection.h:
1034         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMTokenList.cpp:
1035         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMTokenList.h:
1036         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.cpp:
1037         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.h:
1038         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDeprecated.cpp:
1039         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.h:
1040         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentFragment.cpp:
1041         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentFragment.h:
1042         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.cpp.
1043         (webkitDOMDocumentDOMEventTargetInit):
1044         (webkitDOMDocumentInstallProperties):
1045         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentType.cpp:
1046         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentType.h:
1047         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.h:
1048         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElementGtk.cpp: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp.
1049         (webkitDOMElementDOMEventTargetInit):
1050         (webkitDOMElementInstallProperties):
1051         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMEvent.cpp:
1052         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMEvent.h:
1053         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMEventTarget.cpp:
1054         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMEventTarget.h:
1055         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMFile.cpp:
1056         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMFile.h:
1057         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMFileList.cpp:
1058         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMFileList.h:
1059         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAnchorElement.cpp:
1060         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAnchorElement.h:
1061         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAppletElement.cpp:
1062         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAppletElement.h:
1063         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAreaElement.cpp:
1064         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAreaElement.h:
1065         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBRElement.cpp:
1066         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBRElement.h:
1067         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBaseElement.cpp:
1068         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBaseElement.h:
1069         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBodyElement.cpp:
1070         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBodyElement.h:
1071         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLButtonElement.cpp:
1072         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLButtonElement.h:
1073         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLCanvasElement.cpp:
1074         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLCanvasElement.h:
1075         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLCollection.cpp:
1076         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLCollection.h:
1077         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDListElement.cpp:
1078         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDListElement.h:
1079         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDirectoryElement.cpp:
1080         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDirectoryElement.h:
1081         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDivElement.cpp:
1082         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDivElement.h:
1083         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDocument.cpp:
1084         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDocument.h:
1085         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLElement.cpp:
1086         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLElement.h:
1087         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLEmbedElement.cpp:
1088         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLEmbedElement.h:
1089         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFieldSetElement.cpp:
1090         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFieldSetElement.h:
1091         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFontElement.cpp:
1092         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFontElement.h:
1093         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFormElement.cpp:
1094         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFormElement.h:
1095         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameElement.cpp:
1096         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameElement.h:
1097         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameSetElement.cpp:
1098         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameSetElement.h:
1099         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHRElement.cpp:
1100         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHRElement.h:
1101         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHeadElement.cpp:
1102         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHeadElement.h:
1103         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHeadingElement.cpp:
1104         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHeadingElement.h:
1105         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHtmlElement.cpp:
1106         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHtmlElement.h:
1107         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLIFrameElement.cpp:
1108         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLIFrameElement.h:
1109         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLImageElement.cpp:
1110         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLImageElement.h:
1111         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLInputElement.cpp:
1112         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLInputElement.h:
1113         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLIElement.cpp:
1114         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLIElement.h:
1115         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLabelElement.cpp:
1116         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLabelElement.h:
1117         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLegendElement.cpp:
1118         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLegendElement.h:
1119         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLinkElement.cpp:
1120         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLinkElement.h:
1121         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMapElement.cpp:
1122         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMapElement.h:
1123         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMarqueeElement.cpp:
1124         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMarqueeElement.h:
1125         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMenuElement.cpp:
1126         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMenuElement.h:
1127         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMetaElement.cpp:
1128         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMetaElement.h:
1129         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLModElement.cpp:
1130         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLModElement.h:
1131         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOListElement.cpp:
1132         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOListElement.h:
1133         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLObjectElement.cpp:
1134         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLObjectElement.h:
1135         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptGroupElement.cpp:
1136         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptGroupElement.h:
1137         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptionElement.cpp:
1138         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptionElement.h:
1139         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptionsCollection.cpp:
1140         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptionsCollection.h:
1141         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLParagraphElement.cpp:
1142         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLParagraphElement.h:
1143         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLParamElement.cpp:
1144         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLParamElement.h:
1145         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLPreElement.cpp:
1146         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLPreElement.h:
1147         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLPrivate.cpp:
1148         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLQuoteElement.cpp:
1149         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLQuoteElement.h:
1150         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLScriptElement.cpp:
1151         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLScriptElement.h:
1152         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLSelectElement.cpp:
1153         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLSelectElement.h:
1154         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLStyleElement.cpp:
1155         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLStyleElement.h:
1156         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableCaptionElement.cpp:
1157         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableCaptionElement.h:
1158         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableCellElement.cpp:
1159         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableCellElement.h:
1160         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableColElement.cpp:
1161         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableColElement.h:
1162         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableElement.cpp:
1163         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableElement.h:
1164         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableRowElement.cpp:
1165         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableRowElement.h:
1166         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableSectionElement.cpp:
1167         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableSectionElement.h:
1168         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTextAreaElement.cpp:
1169         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTextAreaElement.h:
1170         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTitleElement.cpp:
1171         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTitleElement.h:
1172         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLUListElement.cpp:
1173         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLUListElement.h:
1174         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMKeyboardEvent.cpp:
1175         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMKeyboardEvent.h:
1176         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMediaList.cpp:
1177         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMediaList.h:
1178         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMouseEvent.cpp:
1179         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMouseEvent.h:
1180         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNamedNodeMap.cpp:
1181         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNamedNodeMap.h:
1182         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNode.h:
1183         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeFilter.cpp:
1184         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeFilter.h:
1185         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeGtk.cpp: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNode.cpp.
1186         (webkitDOMNodeDOMEventTargetInit):
1187         (webkitDOMNodeInstallProperties):
1188         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeIterator.cpp:
1189         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeIterator.h:
1190         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeList.cpp:
1191         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeList.h:
1192         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMObject.h:
1193         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivateGtk.cpp: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivate.cpp.
1194         (WebKit::wrapNodeGtk):
1195         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivateGtk.h: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivate.h.
1196         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMProcessingInstruction.cpp:
1197         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMProcessingInstruction.h:
1198         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMRange.cpp:
1199         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMRange.h:
1200         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMStyleSheet.cpp:
1201         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMStyleSheet.h:
1202         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMStyleSheetList.cpp:
1203         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMStyleSheetList.h:
1204         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMText.cpp:
1205         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMText.h:
1206         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMTreeWalker.cpp:
1207         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMTreeWalker.h:
1208         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMUIEvent.cpp:
1209         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMUIEvent.h:
1210         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMWheelEvent.cpp:
1211         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMWheelEvent.h:
1212         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathExpression.cpp:
1213         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathExpression.h:
1214         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathNSResolver.cpp:
1215         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathNSResolver.h:
1216         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathResult.cpp:
1217         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathResult.h:
1218         * WebProcess/InjectedBundle/API/gtk/DOM/docs/webkitdomgtk-4.0-sections.txt:
1219         * WebProcess/InjectedBundle/API/gtk/WebKitFrame.h:
1220         * WebProcess/InjectedBundle/API/wpe/DOM/WebKitDOMDefines.h: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentPrivate.h.
1221         * WebProcess/InjectedBundle/API/wpe/DOM/WebKitDOMDocument.h: Added.
1222         * WebProcess/InjectedBundle/API/wpe/DOM/WebKitDOMElement.h: Added.
1223         * WebProcess/InjectedBundle/API/wpe/DOM/WebKitDOMNode.h: Added.
1224         * WebProcess/InjectedBundle/API/wpe/DOM/WebKitDOMObject.h: Copied from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMObject.h.
1225         * WebProcess/InjectedBundle/API/wpe/DOM/webkitdom.h: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodePrivate.h.
1226         * WebProcess/InjectedBundle/API/wpe/WebKitFrame.h:
1227         * WebProcess/InjectedBundle/API/wpe/WebKitWebHitTestResult.h: Added.
1228         * WebProcess/InjectedBundle/API/wpe/WebKitWebPage.h:
1229         * WebProcess/InjectedBundle/API/wpe/WebKitWebProcessEnumTypes.cpp.template: Added.
1230         * WebProcess/InjectedBundle/API/wpe/WebKitWebProcessEnumTypes.h.template: Copied from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMObjectPrivate.h.
1231         * WebProcess/InjectedBundle/API/wpe/webkit-web-extension.h:
1232
1233 2018-03-26  Zan Dobersek  <zdobersek@igalia.com>
1234
1235         [CoordGraphics] Clean up CoordinatedGraphicsScene construct-time initializations
1236         https://bugs.webkit.org/show_bug.cgi?id=184002
1237
1238         Reviewed by Carlos Garcia Campos.
1239
1240         Move the CoordinatedGraphicsScene constant-expression initializations
1241         from constructor to the point of declaration.
1242
1243         Default the CoordinatedGraphicsScene destructor.
1244
1245         The m_scrollPosition member variable is unused in this class, while the
1246         similarly-named m_renderedContentsScrollPosition tracks scroll position
1247         of the scene. Remove the latter and use m_scrollPosition in its place.
1248
1249         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1250         (WebKit::CoordinatedGraphicsScene::CoordinatedGraphicsScene):
1251         (WebKit::CoordinatedGraphicsScene::adjustPositionForFixedLayers):
1252         (WebKit::CoordinatedGraphicsScene::commitSceneState):
1253         (WebKit::CoordinatedGraphicsScene::~CoordinatedGraphicsScene): Deleted.
1254         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
1255
1256 2018-03-25  Michael Catanzaro  <mcatanzaro@igalia.com>
1257
1258         [GTK] WebKitWebProcessEnumTypes.h missing from webkit-web-extension.h
1259         https://bugs.webkit.org/show_bug.cgi?id=183998
1260
1261         Reviewed by Carlos Garcia Campos.
1262
1263         * WebProcess/InjectedBundle/API/gtk/webkit-web-extension.h:
1264
1265 2018-03-25  Carlos Garcia Campos  <cgarcia@igalia.com>
1266
1267         [GTK] Unresolved type warnings when generating gir
1268         https://bugs.webkit.org/show_bug.cgi?id=183926
1269
1270         Reviewed by Michael Catanzaro.
1271
1272         Skip deprecated functions using JSC C API from introspection.
1273
1274         * UIProcess/API/glib/WebKitJavascriptResult.cpp:
1275         * UIProcess/API/glib/WebKitWebView.cpp:
1276         * WebProcess/InjectedBundle/API/glib/WebKitFrame.cpp:
1277
1278 2018-03-25  Commit Queue  <commit-queue@webkit.org>
1279
1280         Unreviewed, rolling out r229954.
1281         https://bugs.webkit.org/show_bug.cgi?id=184000
1282
1283         Caused many layout tests to crash on Apple High Sierra,
1284         Sierra, iOS Simulator and GTK Linux Debug test bots (Requested
1285         by dydz on #webkit).
1286
1287         Reverted changeset:
1288
1289         "Use SecurityOriginData more consistently in Service Worker
1290         code"
1291         https://bugs.webkit.org/show_bug.cgi?id=183969
1292         https://trac.webkit.org/changeset/229954
1293
1294 2018-03-23  Brian Burg  <bburg@apple.com>
1295
1296         Web Automation: remove unnecessary member variable WebAutomationSession
1297         https://bugs.webkit.org/show_bug.cgi?id=183971
1298
1299         Reviewed by Timothy Hatcher.
1300
1301         The concept of the "active" browsing context is something in the WebDriver
1302         specification, but we were a bit too literal when first implementing this.
1303         There's no actual need for this on the browser side since most commands
1304         require implicitly switching to the target window passed in with the
1305         Automation command. The driver, however, still needs to track the current
1306         browsing context and current top-level browsing context.
1307
1308         For returning whether a browsing context is active,  we can just look at
1309         the page's activity state to know whether the page is active or not. For
1310         a normal browser, only one page is going to be visible and focused at a time.
1311
1312         * UIProcess/Automation/WebAutomationSession.h:
1313         * UIProcess/Automation/WebAutomationSession.cpp:
1314         (WebKit::WebAutomationSession::buildBrowsingContextForPage):
1315         Consult the page's activity state to determine whether it's active.
1316
1317         (WebKit::WebAutomationSession::createBrowsingContext):
1318         (WebKit::WebAutomationSession::closeBrowsingContext):
1319         (WebKit::WebAutomationSession::switchToBrowsingContext):
1320         (WebKit::WebAutomationSession::handleRunOpenPanel):
1321         Stop reading and writing the current browsing context handle.
1322
1323         * UIProcess/WebPageProxy.h:
1324         (WebKit::WebPageProxy::isViewFocused const):
1325         (WebKit::WebPageProxy::isViewWindowActive const):
1326         Add new accessor.
1327
1328 2018-03-25  Tim Horton  <timothy_horton@apple.com>
1329
1330         Add and adopt ENABLE(AIRPLAY_PICKER)
1331         https://bugs.webkit.org/show_bug.cgi?id=183992
1332
1333         Reviewed by Daniel Bates.
1334
1335         * UIProcess/ios/WKContentViewInteraction.h:
1336         * UIProcess/ios/WKContentViewInteraction.mm:
1337         (-[WKContentView _showPlaybackTargetPicker:fromRect:]):
1338         * UIProcess/ios/forms/WKAirPlayRoutePicker.h:
1339         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
1340
1341 2018-03-25  Tim Horton  <timothy_horton@apple.com>
1342
1343         Move WKAnimationDelegate to its own header
1344         https://bugs.webkit.org/show_bug.cgi?id=183976
1345         <rdar://problem/38822299>
1346
1347         Reviewed by Dan Bernstein.
1348
1349         * Shared/RemoteLayerTree/WKAnimationDelegate.h: Added.
1350         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
1351         * WebKit.xcodeproj/project.pbxproj:
1352         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
1353         RemoteLayerTreeHost uses a forward declaration of WKAnimationDelegate,
1354         so we're just getting lucky that an -invalidate method exists on
1355         some other object. Instead, move WKAnimationDelegate to its own
1356         header, and include it in the places we use it.
1357
1358 2018-03-24  Tim Horton  <timothy_horton@apple.com>
1359
1360         Adopt WK_PLATFORM_NAME in WebKit
1361         https://bugs.webkit.org/show_bug.cgi?id=183978
1362
1363         Reviewed by Dan Bernstein.
1364
1365         * Configurations/WebKit.xcconfig:
1366         * WebKit.xcodeproj/project.pbxproj:
1367         * mac/MigrateHeadersFromWebKitLegacy.make:
1368         * mac/postprocess-framework-headers.sh:
1369
1370 2018-03-24  Tim Horton  <timothy_horton@apple.com>
1371
1372         Ignore sandbox_init_with_parameters deprecation warnings
1373         https://bugs.webkit.org/show_bug.cgi?id=183979
1374
1375         Reviewed by Dan Bernstein.
1376
1377         * Shared/ios/ChildProcessIOS.mm:
1378         (WebKit::ChildProcess::initializeSandbox):
1379
1380 2018-03-24  Chris Dumez  <cdumez@apple.com>
1381
1382         Use SecurityOriginData more consistently in Service Worker code
1383         https://bugs.webkit.org/show_bug.cgi?id=183969
1384
1385         Reviewed by Darin Adler.
1386
1387         Use SecurityOriginData more consistently in Service Worker code to avoid constructing
1388         SecurityOrigin objects unnecessarily.
1389
1390         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1391         (WebKit::NetworkResourceLoadParameters::encode const):
1392         * Shared/API/c/WKSecurityOriginRef.cpp:
1393         (WKSecurityOriginCopyDatabaseIdentifier):
1394         * StorageProcess/ServiceWorker/WebSWOriginStore.cpp:
1395         (WebKit::WebSWOriginStore::addToStore):
1396         (WebKit::WebSWOriginStore::removeFromStore):
1397         * StorageProcess/ServiceWorker/WebSWOriginStore.h:
1398         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1399         (WebKit::WebSWServerConnection::scheduleJobInServer):
1400         (WebKit::WebSWServerConnection::registerServiceWorkerClient):
1401         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
1402         (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
1403         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
1404         * StorageProcess/StorageProcess.cpp:
1405         (WebKit::StorageProcess::connectionToContextProcessWasClosed):
1406         (WebKit::StorageProcess::needsServerToContextConnectionForOrigin const):
1407         (WebKit::StorageProcess::createStorageToWebProcessConnection):
1408         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
1409         (WebKit::StorageProcess::serverToContextConnectionForOrigin):
1410         (WebKit::StorageProcess::createServerToContextConnection):
1411         (WebKit::StorageProcess::swContextConnectionMayNoLongerBeNeeded):
1412         * StorageProcess/StorageProcess.h:
1413         * UIProcess/API/APIFrameInfo.cpp:
1414         (API::FrameInfo::create):
1415         * UIProcess/API/C/WKApplicationCacheManager.cpp:
1416         (WKApplicationCacheManagerDeleteEntriesForOrigin):
1417         * UIProcess/API/C/WKKeyValueStorageManager.cpp:
1418         (WKKeyValueStorageManagerDeleteEntriesForOrigin):
1419         * UIProcess/API/C/WKResourceCacheManager.cpp:
1420         (WKResourceCacheManagerClearCacheForOrigin):
1421         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1422         (WKWebsiteDataStoreRemoveFetchCacheForOrigin):
1423         (WKWebsiteDataStoreGetFetchCacheSizeForOrigin):
1424         * UIProcess/ServiceWorkerProcessProxy.cpp:
1425         (WebKit::ServiceWorkerProcessProxy::create):
1426         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
1427         (WebKit::ServiceWorkerProcessProxy::getLaunchOptions):
1428         * UIProcess/ServiceWorkerProcessProxy.h:
1429         * UIProcess/Storage/StorageProcessProxy.cpp:
1430         (WebKit::StorageProcessProxy::getStorageProcessConnection):
1431         * UIProcess/WebProcessPool.cpp:
1432         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
1433         (WebKit::WebProcessPool::disconnectProcess):
1434         (WebKit::WebProcessPool::updateProcessAssertions):
1435         * UIProcess/WebProcessPool.h:
1436         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1437         (WebKit::WebsiteDataStore::fetchDataAndApply):
1438         * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp:
1439         (WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation):
1440         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1441         (WKBundlePageCopyOriginsWithApplicationCache):
1442         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
1443         (WebKit::UserMediaPermissionRequestManager::sendUserMediaRequest):
1444         (WebKit::UserMediaPermissionRequestManager::enumerateMediaDevices):
1445         * WebProcess/Storage/WebSWClientConnection.cpp:
1446         (WebKit::WebSWClientConnection::registerServiceWorkerClient):
1447         (WebKit::WebSWClientConnection::matchRegistration):
1448         (WebKit::WebSWClientConnection::whenRegistrationReady):
1449         (WebKit::WebSWClientConnection::getRegistrations):
1450         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1451         (WebKit::WebChromeClient::exceededDatabaseQuota):
1452         (WebKit::WebChromeClient::reachedApplicationCacheOriginQuota):
1453         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1454         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1455         * WebProcess/WebProcess.cpp:
1456         (WebKit::WebProcess::fetchWebsiteData):
1457         * WebProcess/WebStorage/StorageAreaImpl.cpp:
1458         (WebKit::StorageAreaImpl::securityOrigin const):
1459         * WebProcess/WebStorage/StorageAreaImpl.h:
1460         * WebProcess/WebStorage/StorageAreaMap.cpp:
1461         (WebKit::StorageAreaMap::StorageAreaMap):
1462         (WebKit::StorageAreaMap::dispatchSessionStorageEvent):
1463         (WebKit::StorageAreaMap::dispatchLocalStorageEvent):
1464         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
1465         (WebKit::StorageNamespaceImpl::didDestroyStorageAreaMap):
1466
1467 2018-03-24  Tim Horton  <timothy_horton@apple.com>
1468
1469         Fix the !ENABLE(MEDIA_STREAM) build
1470         https://bugs.webkit.org/show_bug.cgi?id=183977
1471
1472         Reviewed by Wenson Hsieh.
1473
1474         * UIProcess/Cocoa/UIDelegate.mm:
1475         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
1476         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
1477         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1478         * WebProcess/cocoa/UserMediaCaptureManager.messages.in:
1479
1480 2018-03-24  Tim Horton  <timothy_horton@apple.com>
1481
1482         WKFileUploadPanel shouldn't depend on WebKitLegacy
1483         https://bugs.webkit.org/show_bug.cgi?id=183981
1484
1485         Reviewed by Wenson Hsieh.
1486
1487         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1488         (-[WKFileUploadPanel _uploadItemForImageData:imageName:successBlock:failureBlock:]):
1489         Just use the underlying WebCore function instead of the
1490         unnecessary NSFileManager category method.
1491
1492 2018-03-23  Tim Horton  <timothy_horton@apple.com>
1493
1494         Fix the build with no pasteboard
1495         https://bugs.webkit.org/show_bug.cgi?id=183973
1496
1497         Reviewed by Dan Bernstein.
1498
1499         * Configurations/FeatureDefines.xcconfig:
1500
1501 2018-03-23  Megan Gardner  <megan_gardner@apple.com>
1502
1503         Enable unified text selection in select cases for gradual testing
1504         https://bugs.webkit.org/show_bug.cgi?id=183967
1505         <rdar://problem/38815328>
1506
1507         Reviewed by Tim Horton.
1508         
1509         Enable in select places for a more gradual switch, as this is a big change and we want to make sure
1510         it works before switching completely.
1511
1512         * UIProcess/ios/WKContentViewInteraction.mm:
1513         (-[WKContentView useSelectionAssistantWithGranularity:]):
1514
1515 2018-03-23  John Wilander  <wilander@apple.com>
1516
1517         Resource Load Statistics: Pick up ITP debug mode flag from defaults
1518         https://bugs.webkit.org/show_bug.cgi?id=183956
1519         <rdar://problem/38559574>
1520
1521         Reviewed by Brent Fulgham.
1522
1523         * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
1524         (WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
1525
1526 2018-03-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1527
1528         [Extra zoom mode] Adopt list view controller UI for select menus
1529         https://bugs.webkit.org/show_bug.cgi?id=183944
1530         <rdar://problem/38799062>
1531
1532         Reviewed by Tim Horton.
1533
1534         Move UIProcess/WKSelectMenuListViewController.* to UIProcess/ios/forms, where it was intended to go.
1535
1536         * UIProcess/ios/forms/WKSelectMenuListViewController.h: Renamed from Source/WebKit/UIProcess/WKSelectMenuListViewController.h.
1537         * UIProcess/ios/forms/WKSelectMenuListViewController.mm: Renamed from Source/WebKit/UIProcess/WKSelectMenuListViewController.mm.
1538         * WebKit.xcodeproj/project.pbxproj:
1539
1540 2018-03-23  Chris Dumez  <cdumez@apple.com>
1541
1542         Promptly terminate service worker processes when they are no longer needed
1543         https://bugs.webkit.org/show_bug.cgi?id=183873
1544         <rdar://problem/38676995>
1545
1546         Reviewed by Youenn Fablet.
1547
1548         The StorageProcess now keeps track of service worker clients for each security
1549         origin. When there is no longer any clients for a given security origin, the
1550         StorageProcess asks the service worker process for the given origin to terminate
1551         and severs its connection to it.
1552
1553         * Shared/Storage/StorageProcessCreationParameters.h:
1554         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
1555         (WebKit::WebSWServerToContextConnection::connectionMayNoLongerBeNeeded):
1556         (WebKit::WebSWServerToContextConnection::terminate):
1557         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
1558         * StorageProcess/StorageProcess.cpp:
1559         (WebKit::StorageProcess::connectionToContextProcessWasClosed):
1560         (WebKit::StorageProcess::needsServerToContextConnectionForOrigin const):
1561         (WebKit::StorageProcess::initializeWebsiteDataStore):
1562         (WebKit::StorageProcess::swServerForSession):
1563         (WebKit::StorageProcess::swContextConnectionMayNoLongerBeNeeded):
1564         (WebKit::StorageProcess::disableServiceWorkerProcessTerminationDelay):
1565         * StorageProcess/StorageProcess.h:
1566         * StorageProcess/StorageProcess.messages.in:
1567         * UIProcess/API/Cocoa/WKProcessPool.mm:
1568         (-[WKProcessPool _disableServiceWorkerProcessTerminationDelay]):
1569         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1570         * UIProcess/WebProcessPool.cpp:
1571         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
1572         (WebKit::WebProcessPool::disableServiceWorkerProcessTerminationDelay):
1573         * UIProcess/WebProcessPool.h:
1574         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1575         (WebKit::WebSWContextManagerConnection::terminateProcess):
1576         * WebProcess/Storage/WebSWContextManagerConnection.h:
1577         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
1578
1579 2018-03-23  Brady Eidson  <beidson@apple.com>
1580
1581         Go to back/forward list items after a process-swapped navigation.
1582         <rdar://problem/38690544> and https://bugs.webkit.org/show_bug.cgi?id=183920
1583
1584         Reviewed by Andy Estes.
1585
1586         This takes the initial work of "process swap a normal navigation" and extends it to
1587         process swapping for back/forward item navigations.
1588
1589         * Scripts/webkit/messages.py:
1590
1591         Make sure state objects are serialized to the UI Process back/forward list items, as otherwise
1592         they will be lost in process-swap scenarios:
1593         * Shared/SessionState.cpp:
1594         (WebKit::PageState::encode const):
1595         (WebKit::PageState::decode):
1596         * Shared/SessionState.h:
1597
1598         Make a new variant of APINavigation specifically for back/forward list items.
1599         * UIProcess/API/APINavigation.cpp:
1600         (API::Navigation::Navigation):
1601         (API::Navigation::loggingURL const):
1602         * UIProcess/API/APINavigation.h:
1603         (API::Navigation::create):
1604         (API::Navigation::backForwardListItem):
1605         (API::Navigation::backForwardFrameLoadType const):
1606
1607         * UIProcess/API/C/WKPage.cpp:
1608         (WKPageGoToBackForwardListItem):
1609
1610         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
1611         (-[WKBrowsingContextController goToBackForwardListItem:]):
1612
1613         * UIProcess/API/Cocoa/WKWebView.mm:
1614         (-[WKWebView goToBackForwardListItem:]):
1615
1616         * UIProcess/WebNavigationState.cpp:
1617         (WebKit::WebNavigationState::createLoadRequestNavigation):
1618         (WebKit::WebNavigationState::createBackForwardNavigation):
1619         * UIProcess/WebNavigationState.h:
1620
1621         * UIProcess/WebPageProxy.cpp:
1622         (WebKit::WebPageProxy::reattachToWebProcessForReload):
1623         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
1624         (WebKit::WebPageProxy::goForward):
1625         (WebKit::WebPageProxy::goBack):
1626         (WebKit::WebPageProxy::goToBackForwardItem):
1627         (WebKit::WebPageProxy::receivedPolicyDecision):
1628         (WebKit::WebPageProxy::continueNavigationInNewProcess): Handle back/forward navigations differently than others.
1629         (WebKit::WebPageProxy::restoreFromSessionState):
1630         * UIProcess/WebPageProxy.h:
1631
1632         * UIProcess/WebProcessProxy.cpp:
1633         (WebKit::WebProcessProxy::addOrUpdateBackForwardItem): Renamed from "addBackForwardItem" for clarity
1634         (WebKit::WebProcessProxy::addBackForwardItem): Deleted.
1635         * UIProcess/WebProcessProxy.h:
1636         * UIProcess/WebProcessProxy.messages.in:
1637
1638         * UIProcess/ios/ViewGestureControllerIOS.mm:
1639         (WebKit::ViewGestureController::endSwipeGesture):
1640
1641         * UIProcess/mac/ViewGestureControllerMac.mm:
1642         (WebKit::ViewGestureController::endSwipeGesture):
1643
1644         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
1645         (WebKit::toPageState):
1646         (WebKit::toHistoryItem):
1647
1648         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
1649         (WebKit::updateBackForwardItem):
1650
1651         * WebProcess/WebPage/WebPage.cpp:
1652         (WebKit::WebPage::goToBackForwardItem): Combined "goBack" and "goForward" with this method,
1653           passing the appropriate FrameLoadType around as needed to remember the specific type.
1654         (WebKit::WebPage::goForward): Deleted.
1655         (WebKit::WebPage::goBack): Deleted.
1656         * WebProcess/WebPage/WebPage.h:
1657         * WebProcess/WebPage/WebPage.messages.in:
1658
1659 2018-03-23  Megan Gardner  <megan_gardner@apple.com>
1660
1661         Don't use the presence of a textSelectionAssistant as a proxy for if we are in content editable.
1662         https://bugs.webkit.org/show_bug.cgi?id=183804
1663
1664         Reviewed by Tim Horton.
1665
1666         We need to stop using the presence of a textSelectionAssistant as a proxy for if we are selecting in a content editable
1667         or not. As we are planning on switching to only using a textSelectionAssistant for selection, these checks need to 
1668         be more direct in checking what we actually need to know i.e. are we selecting in a content editable.
1669
1670         * Platform/spi/ios/UIKitSPI.h:
1671         * UIProcess/ios/WKContentViewInteraction.mm:
1672         (hasAssistedNode):
1673         (-[WKContentView inputView]):
1674         (-[WKContentView _selectionClipRect]):
1675         (-[WKContentView gestureRecognizer:canBePreventedByGestureRecognizer:]):
1676         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
1677         (-[WKContentView gestureRecognizerShouldBegin:]):
1678         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
1679         (-[WKContentView webSelectionRects]):
1680         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1681         (-[WKContentView _autofillContext]):
1682
1683 2018-03-23  Youenn Fablet  <youenn@apple.com>
1684
1685         WebProcessPool should not ask to register all clients for each service worker process creation
1686         https://bugs.webkit.org/show_bug.cgi?id=183941
1687
1688         Reviewed by Chris Dumez.
1689
1690         Call registerServiceWorkerClients when there is no service worker process.
1691         Update service worker clients to register all of them no matter the session ID.
1692
1693         * UIProcess/WebProcessPool.cpp:
1694         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
1695         * WebProcess/WebProcess.cpp:
1696         (WebKit::WebProcess::registerServiceWorkerClients):
1697         * WebProcess/WebProcess.h:
1698         * WebProcess/WebProcess.messages.in:
1699
1700 2018-03-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1701
1702         [Extra zoom mode] Adopt list view controller UI for select menus
1703         https://bugs.webkit.org/show_bug.cgi?id=183944
1704         <rdar://problem/38799062>
1705
1706         Reviewed by Andy Estes.
1707
1708         Rename WKSelectMenuViewController to WKSelectMenuListViewController, and also rename the relevant
1709         WebKitAdditions harness files. See corresponding changes for more details.
1710
1711         * UIProcess/WKSelectMenuListViewController.h: Renamed from Source/WebKit/UIProcess/ios/forms/WKSelectMenuViewController.h.
1712         * UIProcess/WKSelectMenuListViewController.mm: Renamed from Source/WebKit/UIProcess/ios/forms/WKSelectMenuViewController.mm.
1713         * UIProcess/ios/WKContentViewInteraction.h:
1714         * UIProcess/ios/WKContentViewInteraction.mm:
1715         (-[WKContentView presentSelectMenuViewController:]):
1716         (-[WKContentView dismissSelectMenuViewController:]):
1717         (-[WKContentView selectMenu:didSelectItemAtIndex:]):
1718         (-[WKContentView numberOfItemsInSelectMenu:]):
1719         (-[WKContentView selectMenu:displayTextForItemAtIndex:]):
1720         (-[WKContentView selectMenu:didCheckItemAtIndex:checked:]):
1721         (-[WKContentView selectMenuUsesMultipleSelection:]):
1722         (-[WKContentView selectMenu:hasSelectedOptionAtIndex:]):
1723         (-[WKContentView _wheelChangedWithEvent:]):
1724
1725         Overriding wheel events and re-dispatching them is no longer needed after r229437, so we can just remove special
1726         handling for select menus here.
1727
1728         (-[WKContentView didCancelSelectionInSelectMenu:]): Deleted.
1729         (-[WKContentView selectMenuSupportsMultipleSelection:]): Deleted.
1730         (-[WKContentView selectMenu:hasCheckedOptionAtIndex:]): Deleted.
1731         (-[WKContentView startingIndexForSelectMenu:]): Deleted.
1732
1733         The starting index for a select menu is no longer relevant when using list view controllers for input, so we can
1734         just remove this delegate hook altogether.
1735
1736         * WebKit.xcodeproj/project.pbxproj:
1737
1738 2018-03-23  Youenn Fablet  <youenn@apple.com>
1739
1740         CacheStorage::Caches should clear m_caches when clearing its representation even though it is not yet initialized
1741         https://bugs.webkit.org/show_bug.cgi?id=183945
1742
1743         Reviewed by Chris Dumez.
1744
1745         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1746         (WebKit::CacheStorage::Caches::clearMemoryRepresentation):
1747         In case we clear Caches in the middle of the initialization, m_caches might not be empty
1748         but m_isInitialized is not yet set to true since we are computing the Caches size.
1749         Update the assertion and clear m_caches in that case.
1750
1751 2018-03-23  David Kilzer  <ddkilzer@apple.com>
1752
1753         Stop using dispatch_set_target_queue()
1754         <https://webkit.org/b/183908>
1755         <rdar://problem/33553533>
1756
1757         Reviewed by Daniel Bates.
1758
1759         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
1760         (WebKit::NetworkCache::IOChannel::IOChannel): Remove the call to
1761         dispatch_set_target_queue() since this is handled in the
1762         dispatch_io_create() call above.
1763
1764 2018-03-23  Youenn Fablet  <youenn@apple.com>
1765
1766         CacheStorage::Engine should not ref itself when hopping to a background thread
1767         https://bugs.webkit.org/show_bug.cgi?id=183925
1768         <rdar://problem/38580483>
1769
1770         Reviewed by Chris Dumez.
1771
1772         Add support for weak pointers to CacheStorage Engine.
1773         Use weak pointer when hopping to background threads.
1774         Store callbacks in CacheStorage::Engine maps to keep them being destroyed in the main thread only.
1775         Made some callbacks CompletionHandler as a bonus.
1776
1777         Made sure to use just one Engine for all private sessions.
1778
1779         * NetworkProcess/cache/CacheStorageEngine.cpp:
1780         (WebKit::CacheStorage::Engine::~Engine):
1781         (WebKit::CacheStorage::Engine::from):
1782         (WebKit::CacheStorage::Engine::initialize):
1783         (WebKit::CacheStorage::Engine::writeFile):
1784         (WebKit::CacheStorage::Engine::readFile):
1785         * NetworkProcess/cache/CacheStorageEngine.h:
1786         (WebKit::CacheStorage::Engine::weakPtrFactory):
1787
1788 2018-03-23  Ryan Haddad  <ryanhaddad@apple.com>
1789
1790         Unreviewed build fix.
1791
1792         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1793
1794 2018-03-23  Miguel Gomez  <magomez@igalia.com>
1795
1796         [GTK][WPE] Avoid software color conversion inside BitmapTextureGL
1797         https://bugs.webkit.org/show_bug.cgi?id=183892
1798
1799         Remove the UpdateContentsFlag parameter when calling BitmapTexture::updateContents().
1800
1801         Reviewed by Žan Doberšek.
1802
1803         * Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp:
1804         (WebKit::CoordinatedBackingStoreTile::swapBuffers):
1805
1806 2018-03-23  Michael Catanzaro  <mcatanzaro@igalia.com>
1807
1808         [WPE][GTK] Fix -Wswitch warnings after r229778
1809         https://bugs.webkit.org/show_bug.cgi?id=183927
1810
1811         Reviewed by Carlos Garcia Campos.
1812
1813         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
1814         (WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse): Log a warning if Suspend is
1815         received as a PolicyAction
1816         * UIProcess/API/glib/WebKitNavigationClient.cpp: Ignore the ProcessSwap termination reason,
1817         which should be invisible to WebKit clients
1818
1819 2018-03-22  Chris Dumez  <cdumez@apple.com>
1820
1821         Include security origin in the service worker process name
1822         https://bugs.webkit.org/show_bug.cgi?id=183913
1823
1824         Reviewed by Youenn Fablet.
1825
1826         Include security origin in the service worker process name to facilitate debugging. This way, we
1827         can differentiate which service worker process is used for which origin in activity monitor.
1828
1829         * Shared/ChildProcess.h:
1830         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
1831         (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
1832         * UIProcess/ServiceWorkerProcessProxy.cpp:
1833         (WebKit::ServiceWorkerProcessProxy::getLaunchOptions):
1834         * WebProcess/cocoa/WebProcessCocoa.mm:
1835         (WebKit::WebProcess::initializeProcessName):
1836
1837 2018-03-22  Michael Catanzaro  <mcatanzaro@igalia.com>
1838
1839         Unreviewed, silence unused variable warning
1840
1841         * UIProcess/WebPageProxy.cpp:
1842         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1843
1844 2018-03-22  Dan Bernstein  <mitz@apple.com>
1845
1846         WKWebView doesn’t expose its spellCheckerDocumentTag
1847         https://bugs.webkit.org/show_bug.cgi?id=183797
1848         <rdar://problem/38678089>
1849
1850         Reviewed by Tim Horton.
1851
1852         * UIProcess/API/Cocoa/WKWebView.mm:
1853         (-[WKWebView _spellCheckerDocumentTag]): Added this getter which calls through to the WebViewImpl.
1854         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Declared _spellCheckerDocumentTag property.
1855
1856 2018-03-22  Chris Dumez  <cdumez@apple.com>
1857
1858         Use the same SWServer for all ephemeral sessions
1859         https://bugs.webkit.org/show_bug.cgi?id=183921
1860         <rdar://problem/36873075>
1861
1862         Reviewed by Youenn Fablet.
1863
1864         Use the same SWServer for all ephemeral sessions. SWServers never go away and we create
1865         one per sessionID. When browsing doing private browsing in Safari (and other fetching
1866         favorite icons), the sessionID is ephemeral and keeps changing. This means that we kept
1867         constructing new SWServers that would never go away. Each SWServer has a thread so we
1868         would eventually hit the thread limit for the storage process.
1869
1870         * StorageProcess/StorageProcess.cpp:
1871         (WebKit::StorageProcess::swServerForSession):
1872
1873 2018-03-22  Michael Catanzaro  <mcatanzaro@igalia.com>
1874
1875         Unreviewed, fix format string warnings in service worker code
1876
1877         On Linux x86_64, uint64_t is unsigned long, not unsigned long long.
1878
1879         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1880         (WebKit::WebSWServerConnection::startFetch):
1881         (WebKit::WebSWServerConnection::didFinishFetch):
1882         (WebKit::WebSWServerConnection::didFailFetch):
1883         (WebKit::WebSWServerConnection::didNotHandleFetch):
1884
1885 2018-03-22  Daniel Bates  <dabates@apple.com>
1886
1887         Expose SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest() as WebKit SPI
1888         https://bugs.webkit.org/show_bug.cgi?id=183907
1889         <rdar://problem/38759127>
1890
1891         Reviewed by Alex Christensen.
1892
1893         Adds both modern Objective-C SPI and C SPI to allow an embedding client to register a scheme
1894         whose content should be displayed/loaded if and only if it can be requested. Disregarding an
1895         app that enables universal access, by using this SPI WebKit will refuse to display cross-origin
1896         content for the registered schemes.
1897
1898         We need to add C SPI for embedding clients that have not transitioned to the modern Objective-
1899         C API/SPI.
1900
1901         * Shared/WebProcessCreationParameters.cpp:
1902         (WebKit::WebProcessCreationParameters::encode const):
1903         (WebKit::WebProcessCreationParameters::decode):
1904         * Shared/WebProcessCreationParameters.h:
1905         * UIProcess/API/C/WKContext.cpp:
1906         (WKContextRegisterURLSchemeAsCanDisplayOnlyIfCanRequest):
1907         * UIProcess/API/C/WKContextPrivate.h:
1908         * UIProcess/API/Cocoa/WKProcessPool.mm:
1909         (-[WKProcessPool _registerURLSchemeAsCanDisplayOnlyIfCanRequest:]):
1910         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1911         * UIProcess/WebProcessPool.cpp:
1912         (WebKit::WebProcessPool::initializeNewWebProcess):
1913         (WebKit::WebProcessPool::registerURLSchemeAsCanDisplayOnlyIfCanRequest):
1914         * UIProcess/WebProcessPool.h:
1915         * WebProcess/WebProcess.cpp:
1916         (WebKit::WebProcess::initializeWebProcess):
1917         (WebKit::WebProcess::registerURLSchemeAsCanDisplayOnlyIfCanRequest const):
1918         * WebProcess/WebProcess.h:
1919         * WebProcess/WebProcess.messages.in:
1920
1921 2018-03-22  Tim Horton  <timothy_horton@apple.com>
1922
1923         Improve readability of WebCore's OTHER_LDFLAGS
1924         https://bugs.webkit.org/show_bug.cgi?id=183909
1925         <rdar://problem/38760992>
1926
1927         Reviewed by Dan Bernstein.
1928
1929         * Configurations/Base.xcconfig:
1930         * Configurations/FeatureDefines.xcconfig:
1931
1932 2018-03-22  Zan Dobersek  <zdobersek@igalia.com>
1933
1934         [TexMap] Make TextureMapperContextAttributes thread-specific
1935         https://bugs.webkit.org/show_bug.cgi?id=183895
1936
1937         Reviewed by Carlos Garcia Campos.
1938
1939         CoordinatedGraphicsScene, as an implementor of the
1940         TextureMapperPlatformLayerProxy::Compositor interface, doesn't have to
1941         implement the texmapGL() method anymore.
1942
1943         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1944         (WebKit::CoordinatedGraphicsScene::onNewBufferAvailable):
1945         (WebKit::CoordinatedGraphicsScene::texmapGL): Deleted.
1946         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
1947
1948 2018-03-21  Frederic Wang  <fwang@igalia.com>
1949
1950         Unreviewed, update comment added in r229801.
1951
1952         * WebProcess/WebPage/ios/FindControllerIOS.mm:
1953         (WebKit::FindController::didFindString): Remove "On Mobile" and mention bug 183889.
1954
1955 2018-03-21  Chris Dumez  <cdumez@apple.com>
1956
1957         Regression(r229831): ProcessSwap.Basic API test is crashing
1958         https://bugs.webkit.org/show_bug.cgi?id=183884
1959
1960         Reviewed by Brady Eidson.
1961
1962         This code should only be called for navigation policy decisions.
1963         It used to work without this check because of an early return, which
1964         was dropped in r229831.
1965
1966         * UIProcess/WebPageProxy.cpp:
1967         (WebKit::WebPageProxy::receivedPolicyDecision):
1968
1969 2018-03-21  Wenson Hsieh  <wenson_hsieh@apple.com>
1970
1971         [Extra zoom mode] Add new SPI hooks for clients to vend an input session context view
1972         https://bugs.webkit.org/show_bug.cgi?id=183866
1973         <rdar://problem/38692256>
1974
1975         Reviewed by Tim Horton.
1976
1977         Add new SPI hooks to _WKInputDelegate allowing internal clients to provide a view that gives additional context
1978         when editing form controls, on top of the default label or placeholder text displayed by WebKit. The height
1979         delegate is invoked first, giving the client an opportunity to lay out the context view to fit the given size;
1980         the actual view is then queried.
1981
1982         If the view changes, clients may tell WebKit to reload the context view via SPI on WKFormInputSession; this call
1983         to reload is plumbed through to the currently presented list view controller (at the moment, this is only the
1984         text input list view controller).
1985
1986         * UIProcess/API/Cocoa/_WKFormInputSession.h:
1987         * UIProcess/API/Cocoa/_WKInputDelegate.h:
1988
1989         Add the new SPI hooks, described above.
1990
1991         * UIProcess/ios/WKContentViewInteraction.h:
1992         * UIProcess/ios/WKContentViewInteraction.mm:
1993         (-[WKFormInputSession reloadFocusedElementContextView]):
1994
1995         Plumb the context view reload hook through WKContentView to WKTextInputListViewController.
1996
1997         (-[WKContentView setupInteraction]):
1998         (-[WKContentView _stopAssistingNode]):
1999         (-[WKContentView reloadContextViewForPresentedListViewController]):
2000         (-[WKContentView focusedFormControllerDidUpdateSuggestions:]):
2001
2002         Slight tweak to only reload text suggestions if we are not blurring the focused element. Without this extra
2003         condition, the list view controller's inner table view would get reloaded when the form input session's text
2004         suggestions are set to nil when the list view controller is dismissed, causing a visible stutter in the
2005         dismissal animation of view controller.
2006
2007 2018-03-21  Chris Dumez  <cdumez@apple.com>
2008
2009         WebKitTestRunner crashed in com.apple.WebKit: WebKit::WebProcessPool::terminateServiceWorkerProcesses
2010         https://bugs.webkit.org/show_bug.cgi?id=183875
2011
2012         Reviewed by Brent Fulgham.
2013
2014         Protect |this| while we're iterating over m_serviceWorkerProcesses and terminating
2015         each service worker process. It is possible for the WebProcess pool to get destroyed
2016         as a result of terminating a service worker process.
2017
2018         This change is covered by layout tests that are currently crashing on the ASAN bots.
2019
2020         * UIProcess/WebProcessPool.cpp:
2021         (WebKit::WebProcessPool::terminateServiceWorkerProcesses):
2022
2023 2018-03-21  Eric Carlson  <eric.carlson@apple.com>
2024
2025         Fix typo in inactive media stream timeout default value
2026         https://bugs.webkit.org/show_bug.cgi?id=183872
2027         <rdar://problem/38723903>
2028
2029         Reviewed by Jer Noble.
2030
2031         * Shared/WebPreferences.yaml: Fix typo.
2032         * Shared/WebPreferencesDefaultValues.h: Ditto.
2033
2034 2018-03-21  Chris Dumez  <cdumez@apple.com>
2035
2036         Make policy decisions asynchronous
2037         https://bugs.webkit.org/show_bug.cgi?id=180568
2038         <rdar://problem/37131297>
2039
2040         Reviewed by Alex Christensen.
2041
2042         Get rid of synchronous IPC and synchronous code paths for policy delegates.
2043         Policy decisions are now all made asynchronously and rely on asynchronous
2044         IPC.
2045
2046         This code change is based on work by Alex Christensen.
2047
2048         * UIProcess/WebPageProxy.cpp:
2049         (WebKit::WebPageProxy::receivedPolicyDecision):
2050         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2051         (WebKit::WebPageProxy::decidePolicyForResponse):
2052         * UIProcess/WebPageProxy.h:
2053         * UIProcess/WebPageProxy.messages.in:
2054         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2055         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
2056         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2057
2058 2018-03-21  Chris Dumez  <cdumez@apple.com>
2059
2060         ScrollViewInsetTests.RestoreInitialContentOffsetAfterCrash API test is failing with async delegates
2061         https://bugs.webkit.org/show_bug.cgi?id=183787
2062
2063         Reviewed by Wenson Hsieh.
2064
2065         Without asynchronous policy delegates, when the client requests a navigation, we would:
2066         1. Do a synchronous navigation policy check
2067         2. If the client allows the navigation, start the provisional load
2068
2069         Starting the provisional load would freeze the layer tree until first meaningful
2070         layout via WebFrameLoaderClient::provisionalLoadStarted() -> WebPage::didStartPageTransition().
2071
2072         When constructing a WebView and then requesting a load right away. This would make sure
2073         we do not commit a layer tree for the initial about:blank page because the layer tree
2074         would be frozen until we have something meaningful to show for the following load.
2075
2076         However, with asynchronous policy delegates, we are able to do a layer tree commit
2077         during the asynchronous navigation policy check because the layer tree is not frozen
2078         yet (provisional load has not started) and the process is not stuck on synchronous
2079         IPC. When constructing a WebView and then requesting a load right away, this would
2080         allow a layer tree commit for about:blank to happen before we've even started the
2081         load. This would cause some API tests to fail on iOS.
2082
2083         To address the issue, we try and maintain pre-existing behavior by freezing the
2084         layer tree during navigation policy decision.
2085
2086         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2087         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2088         (WebKit::WebFrameLoaderClient::didDecidePolicyForNavigationAction):
2089         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2090         * WebProcess/WebPage/WebPage.cpp:
2091         (WebKit::WebPage::didStartNavigationPolicyCheck):
2092         (WebKit::WebPage::didCompleteNavigationPolicyCheck):
2093         * WebProcess/WebPage/WebPage.h:
2094
2095 2018-03-21  Brent Fulgham  <bfulgham@apple.com>
2096
2097         Allow the WebContent process to read ViewBridge preferences
2098         https://bugs.webkit.org/show_bug.cgi?id=183862
2099         <rdar://problem/38459456>
2100
2101         Reviewed by Eric Carlson.
2102
2103         * WebProcess/com.apple.WebProcess.sb.in:
2104
2105 2018-03-21  Frederic Wang  <fwang@igalia.com>
2106
2107         [iOS] Text highlighted by the Find UI overlaps with NBC news header on google.com
2108         https://bugs.webkit.org/show_bug.cgi?id=183658
2109
2110         Reviewed by Tim Horton.
2111
2112         On Mobile, many sites have overlay headers or footers that may overlap with the highlighted
2113         text inside a scrollable overflow node. To workaround that issue, this commit changes the
2114         behavior so that the text is revealed at the center of the overflow node.
2115
2116         * WebProcess/WebPage/ios/FindControllerIOS.mm:
2117         (WebKit::FindController::didFindString): Use alignCenterAlways instead of alignToEdgeIfNeeded.
2118
2119 2018-03-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2120
2121         [GTK][WPE] JSC bindings not introspectable
2122         https://bugs.webkit.org/show_bug.cgi?id=136989
2123
2124         Reviewed by Michael Catanzaro.
2125
2126         Deprecate the functions that are not introspectable due to JSC C API in GTK+ port and remove them in WPE
2127         port. Add alternative functions using the new JSC GLib API. We no longer need to keep a global context attached
2128         to every view. We can simply create a temporary global context on demand and release it after 1 second. This
2129         also allows us to remove WebPageProxy::javascriptGlobalContext() and all the related code.
2130
2131         * PlatformGTK.cmake:
2132         * PlatformWPE.cmake:
2133         * UIProcess/API/glib/WebKitJavascriptResult.cpp:
2134         (_WebKitJavascriptResult::_WebKitJavascriptResult):
2135         (webkitJavascriptResultCreate):
2136         (webkit_javascript_result_get_global_context):
2137         (webkit_javascript_result_get_value):
2138         (webkit_javascript_result_get_js_value):
2139         * UIProcess/API/glib/WebKitJavascriptResultPrivate.h:
2140         (SharedJavascriptContext::singleton):
2141         (SharedJavascriptContext::SharedJavascriptContext):
2142         (SharedJavascriptContext::getOrCreateContext):
2143         (SharedJavascriptContext::releaseContext):
2144         * UIProcess/API/glib/WebKitUserContentManager.cpp:
2145         * UIProcess/API/glib/WebKitWebView.cpp:
2146         (webkit_web_view_get_javascript_global_context):
2147         (webkitWebViewRunJavaScriptCallback):
2148         * UIProcess/API/gtk/PageClientImpl.cpp:
2149         * UIProcess/API/gtk/PageClientImpl.h:
2150         * UIProcess/API/gtk/WebKitJavascriptResult.h:
2151         * UIProcess/API/gtk/WebKitWebView.h:
2152         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
2153         * UIProcess/API/wpe/APIViewClient.h:
2154         (API::ViewClient::handleDownloadRequest):
2155         * UIProcess/API/wpe/PageClientImpl.cpp:
2156         * UIProcess/API/wpe/PageClientImpl.h:
2157         * UIProcess/API/wpe/WPEView.cpp:
2158         * UIProcess/API/wpe/WPEView.h:
2159         * UIProcess/API/wpe/WebKitJavascriptResult.h:
2160         * UIProcess/API/wpe/WebKitWebView.h:
2161         * UIProcess/PageClient.h:
2162         * UIProcess/WebPageProxy.h:
2163         * UIProcess/gtk/WebPageProxyGtk.cpp:
2164         * UIProcess/wpe/WebPageProxyWPE.cpp:
2165         * WebProcess/InjectedBundle/API/glib/WebKitFrame.cpp:
2166         (webkit_frame_get_js_context):
2167         (webkit_frame_get_js_context_for_script_world):
2168         * WebProcess/InjectedBundle/API/gtk/WebKitFrame.h:
2169         * WebProcess/InjectedBundle/API/wpe/WebKitFrame.h:
2170
2171 2018-03-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2172
2173         [GTK][WPE] Initial implementation of JavaScriptCore glib bindings
2174         https://bugs.webkit.org/show_bug.cgi?id=164061
2175
2176         Reviewed by Michael Catanzaro.
2177
2178         Set decorator and deprecation_guard options in API docs config files, since they are no longer common to all
2179         libraries.
2180
2181         * PlatformGTK.cmake:
2182
2183 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
2184
2185         [CoordGraphics] Simplify CoordinatedGraphicsScene activation
2186         https://bugs.webkit.org/show_bug.cgi?id=183772
2187
2188         Reviewed by Carlos Garcia Campos.
2189
2190         Simplify CoordinatedGraphicsScene::setActive() into a simple setter of
2191         the m_isActive member variable. We don't have to call renderNextFrame()
2192         anymore as that was only necessary to unblock CoordinatedLayerTreeHost,
2193         but that can be avoided if m_isWaitingForRenderer in that class is
2194         initialized to false.
2195
2196         CoordinatedGraphicsSceneClient::renderNextFrame() virtual method and its
2197         ThreadedCompositor implementation are removed. renderNextFrame() in the
2198         CoordinatedGraphicsScene class can also be removed, along with the
2199         unused dispatchOnMainThread() and dispatchOnClientRunLoop() methods and
2200         the associated m_clientRunLoop member variable.
2201
2202         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2203         (WebKit::CoordinatedGraphicsScene::CoordinatedGraphicsScene):
2204         (WebKit::CoordinatedGraphicsScene::dispatchOnMainThread): Deleted.
2205         (WebKit::CoordinatedGraphicsScene::dispatchOnClientRunLoop): Deleted.
2206         (WebKit::CoordinatedGraphicsScene::renderNextFrame): Deleted.
2207         (WebKit::CoordinatedGraphicsScene::setActive): Deleted.
2208         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
2209         (WebKit::CoordinatedGraphicsSceneClient::~CoordinatedGraphicsSceneClient):
2210         (WebKit::CoordinatedGraphicsScene::setActive):
2211         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2212         (WebKit::m_displayRefreshMonitor):
2213         (WebKit::ThreadedCompositor::setNativeSurfaceHandleForCompositing):
2214         (WebKit::ThreadedCompositor::renderNextFrame): Deleted.
2215         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
2216         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
2217
2218 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
2219
2220         [TexMap] Have TextureMapperLayer::applyAnimationsRecursively() return running animation status
2221         https://bugs.webkit.org/show_bug.cgi?id=183771
2222
2223         Reviewed by Carlos Garcia Campos.
2224
2225         In CoordinatedGraphicsScene::paintToCurrentGLContext(), retrieve
2226         information about any running animation in the scene via the
2227         TextureMapperLayer::applyAnimationsRecursively() call. Use that boolean
2228         value at the end up the method, instead of again traversing the
2229         TextureMapperLayer tree to determine whether any running animations are
2230         present.
2231
2232         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2233         (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
2234
2235 2018-03-20  Tim Horton  <timothy_horton@apple.com>
2236
2237         Enable the minimal simulator feature flag when appropriate
2238         https://bugs.webkit.org/show_bug.cgi?id=183807
2239
2240         Reviewed by Dan Bernstein.
2241
2242         * Configurations/FeatureDefines.xcconfig:
2243
2244 2018-03-19  Ryosuke Niwa  <rniwa@webkit.org>
2245
2246         Expose content attributes on _WKLinkIconParameters
2247         https://bugs.webkit.org/show_bug.cgi?id=183768
2248
2249         Reviewed by Alex Christensen.
2250
2251         Added _WKLinkIconParameters.attributes to expose content attributes of a link element
2252         which defined a favicon, touch icon, or pre-compressed touch icon.
2253
2254         * UIProcess/API/Cocoa/_WKLinkIconParameters.h:
2255         (_WKLinkIconParameters.attributes): Added.
2256         * UIProcess/API/Cocoa/_WKLinkIconParameters.mm:
2257         (_WKLinkIconParameters._attributes): Added.
2258         (-[_WKLinkIconParameters _initWithLinkIcon:]): Convert the hash map from WebCore to a NSDictionary.
2259         (-[_WKLinkIconParameters attributes]): Added.
2260
2261 2018-03-20  Wenson Hsieh  <wenson_hsieh@apple.com>
2262
2263         Add AssistedNodeInformation plumbing for form control placeholder text and label text
2264         https://bugs.webkit.org/show_bug.cgi?id=183802
2265         <rdar://problem/38686273>
2266
2267         Reviewed by Tim Horton.
2268
2269         Surfaces some additional information about the currently focused element to the input delegate in the UI process.
2270         See comments below for more details.
2271
2272         Test: WebKit.FocusedElementInfo
2273
2274         * Shared/AssistedNodeInformation.cpp:
2275         (WebKit::AssistedNodeInformation::encode const):
2276         (WebKit::AssistedNodeInformation::decode):
2277         * Shared/AssistedNodeInformation.h:
2278
2279         Add `placeholder` and `label` to AssistedNodeInformation, which capture the value of the placeholder attribute
2280         and the text of the first associated label element for the focused form control. Also add boilerplate encoder/
2281         decoder support for these members.
2282
2283         * UIProcess/API/Cocoa/_WKFocusedElementInfo.h:
2284
2285         Augment _WKFocusedElementInfo to include placeholder and label.
2286
2287         * UIProcess/ios/WKContentViewInteraction.mm:
2288         (-[WKFocusedElementInfo initWithAssistedNodeInformation:isUserInitiated:userObject:]):
2289         (-[WKFocusedElementInfo label]):
2290         (-[WKFocusedElementInfo placeholder]):
2291         * WebProcess/WebPage/ios/WebPageIOS.mm:
2292         (WebKit::WebPage::getAssistedNodeInformation):
2293
2294         For input elements and textareas, set the placeholder to the value of the placeholder attribute. For all
2295         elements with associated labels, grab the inner text of the first label that is not empty, ignoring all labels
2296         that are `display: none` (i.e. not being rendered).
2297
2298 2018-03-20  Brady Eidson  <beidson@apple.com>
2299
2300         First piece of process swapping on navigation.
2301         https://bugs.webkit.org/show_bug.cgi?id=183665
2302
2303         Reviewed by Andy Estes.
2304
2305         This patch adds the first pieces of the following feature:
2306         "When a navigation originating inside a WKWebView goes to a different origin,
2307          swap to a new WebProcess for that navigation"
2308
2309         There are significant bugs to be resolved and significant optimizations to be made.
2310         Which is why the feature is disabled by default.
2311
2312         Besides the core logic implementing the feature, this patch does a lot of related 
2313         work such as:
2314         - Removing some now-invalid ASSERTs
2315         - Adding some ASSERTs
2316         - Update various switch states to handle the new "Suspend" policy and "NavigationSwap"
2317           process termination reason
2318
2319         * NetworkProcess/NetworkDataTaskBlob.cpp:
2320         (WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse):
2321
2322         * NetworkProcess/capture/NetworkDataTaskReplay.cpp:
2323         (WebKit::NetworkCapture::NetworkDataTaskReplay::didReceiveResponse):
2324
2325         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2326         (toNSURLSessionResponseDisposition):
2327
2328         * Platform/Logging.h:
2329
2330         * Shared/LoadParameters.cpp:
2331         (WebKit::LoadParameters::encode const):
2332         (WebKit::LoadParameters::decode):
2333         * Shared/LoadParameters.h:
2334
2335         * Shared/ProcessTerminationReason.h: Add "NavigationSwap" as a process termination reason.
2336
2337         * UIProcess/API/APINavigation.h:
2338
2339         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2340         (API::ProcessPoolConfiguration::copy):
2341
2342         * UIProcess/API/C/WKAPICast.h:
2343         (WebKit::toAPI):
2344
2345         * UIProcess/Cocoa/NavigationState.mm:
2346         (WebKit::wkProcessTerminationReason):
2347
2348         * UIProcess/WebFramePolicyListenerProxy.cpp:
2349         (WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy):
2350         * UIProcess/WebFramePolicyListenerProxy.h:
2351         (WebKit::WebFramePolicyListenerProxy::create):
2352         (WebKit::WebFramePolicyListenerProxy::policyListenerType const):
2353
2354         * UIProcess/WebFrameProxy.cpp:
2355         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
2356         (WebKit::WebFrameProxy::activePolicyListenerProxy):
2357         * UIProcess/WebFrameProxy.h:
2358
2359         * UIProcess/WebNavigationState.cpp:
2360         (WebKit::WebNavigationState::navigation):
2361         (WebKit::WebNavigationState::takeNavigation):
2362
2363         * UIProcess/WebPageProxy.cpp:
2364         (WebKit::WebPageProxy::reattachToWebProcess):
2365         (WebKit::WebPageProxy::attachToProcessForNavigation): Pretend that the existing process 
2366           terminated using the new "NavigationSwap" reason, then manually start the next load.
2367         (WebKit::WebPageProxy::loadRequest):
2368         (WebKit::WebPageProxy::loadRequestWithNavigation):
2369         (WebKit::WebPageProxy::receivedPolicyDecision):
2370         (WebKit::WebPageProxy::continueNavigationInNewProcess):
2371         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2372         (WebKit::WebPageProxy::decidePolicyForResponse):
2373         (WebKit::WebPageProxy::processDidTerminate):
2374         (WebKit::WebPageProxy::resetState):
2375         (WebKit::WebPageProxy::resetStateAfterProcessExited):
2376         * UIProcess/WebPageProxy.h:
2377
2378         * UIProcess/WebProcessPool.cpp:
2379         (WebKit::WebProcessPool::processForNavigation): Determine which process should be used
2380           for a proposed navigation, creating a new one if necessary.
2381         * UIProcess/WebProcessPool.h:
2382
2383         * UIProcess/WebStorage/StorageManager.cpp:
2384         (WebKit::StorageManager::SessionStorageNamespace::setAllowedConnection):
2385
2386         * WebProcess/WebPage/WebPage.cpp:
2387         (WebKit::WebPage::loadRequest):
2388
2389 2018-03-20  Youenn Fablet  <youenn@apple.com>
2390
2391         ServiceWorkerClientFetch::didReceiveData should check for m_encodedDataLength
2392         https://bugs.webkit.org/show_bug.cgi?id=183668
2393
2394         Reviewed by Chris Dumez.
2395
2396         Crash happens when releasing a RefPtr<SharedBuffer> buffer that is null.
2397         It happens because ServiceWorkerClientFetch can call m_loader->didReceiveBuffer at two different places.
2398         Either when receiving an IPC call or as part of completion handler for the response validation check.
2399         At each call site, we release the buffer to pass it to the loader and we set m_encodedLength to zero.
2400         The fix is to add the m_encodedLength check like done in the case of response validation check completion handler.
2401
2402         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
2403         (WebKit::ServiceWorkerClientFetch::didReceiveData):
2404
2405 2018-03-20  Jeff Miller  <jeffm@apple.com>
2406
2407         Expose aggressiveTileRetentionEnabled in WKPreferences SPI to match C SPI
2408         https://bugs.webkit.org/show_bug.cgi?id=183790
2409
2410         Reviewed by Alex Christensen.
2411         
2412         Expose this property on macOS only.
2413
2414         * UIProcess/API/Cocoa/WKPreferences.mm:
2415         (-[WKPreferences _setAggressiveTileRetentionEnabled:]):
2416         (-[WKPreferences _aggressiveTileRetentionEnabled]):
2417         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2418
2419 2018-03-20  Tim Horton  <timothy_horton@apple.com>
2420
2421         Add and adopt WK_PLATFORM_NAME and adjust default feature defines
2422         https://bugs.webkit.org/show_bug.cgi?id=183758
2423         <rdar://problem/38017644>
2424
2425         Reviewed by Dan Bernstein.
2426
2427         * Configurations/FeatureDefines.xcconfig:
2428
2429 2018-03-20  Chris Dumez  <cdumez@apple.com>
2430
2431         Unreviewed, rolling out r229726 and r229763.
2432
2433         Caused some API test failures on iOS
2434
2435         Reverted changesets:
2436
2437         "Make policy decisions asynchronous"
2438         https://bugs.webkit.org/show_bug.cgi?id=180568
2439         https://trac.webkit.org/changeset/229726
2440
2441         "Rebaseline three webarchive tests for WK2 after r229726."
2442         https://bugs.webkit.org/show_bug.cgi?id=180568
2443         https://trac.webkit.org/changeset/229763
2444
2445 2018-03-20  Brent Fulgham  <bfulgham@apple.com>
2446
2447         [iOS] Grant IOKit preference access for the Home button
2448         https://bugs.webkit.org/show_bug.cgi?id=183754
2449         <rdar://problem/38179704>
2450
2451         Reviewed by Eric Carlson.
2452
2453         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2454
2455 2018-03-20  Wenson Hsieh  <wenson_hsieh@apple.com>
2456
2457         [Extra zoom mode] Adopt updated input view controller machinery for text input
2458         https://bugs.webkit.org/show_bug.cgi?id=183765
2459         <rdar://problem/36926269>
2460
2461         Reviewed by Tim Horton.
2462
2463         Adopt new classes for extra zoomed text inputs. Massage WKTextInputViewController into WKTextInputListView-
2464         Controller and introduce WKFormControlListViewController, the eventual replacement for the base class
2465         WKTextFormControlViewController that will act as the base class of all list-view-controller-based input UI in
2466         extra zoom mode.
2467
2468         * UIProcess/ios/WKContentViewInteraction.h:
2469         * UIProcess/ios/WKContentViewInteraction.mm:
2470         (-[WKContentView presentTextInputViewController:]):
2471         (-[WKContentView dismissTextInputViewController:]):
2472         (-[WKContentView focusedFormControllerDidUpdateSuggestions:]):
2473         (-[WKContentView _wheelChangedWithEvent:]):
2474         * UIProcess/ios/forms/WKFormControlListViewController.h: Copied from Source/WebKit/UIProcess/ios/forms/WKTextInputViewController.h.
2475         * UIProcess/ios/forms/WKFormControlListViewController.mm: Renamed from Source/WebKit/UIProcess/ios/forms/WKTextInputViewController.mm.
2476         * UIProcess/ios/forms/WKTextInputListViewController.h: Copied from Source/WebKit/UIProcess/ios/forms/WKTextInputViewController.h.
2477         * UIProcess/ios/forms/WKTextInputListViewController.mm: Renamed from Source/WebKit/UIProcess/ios/forms/WKTextInputViewController.h.
2478         * WebKit.xcodeproj/project.pbxproj:
2479
2480 2018-03-19  Megan Gardner  <megan_gardner@apple.com>
2481
2482         Clear style colors when setting default appearance
2483         https://bugs.webkit.org/show_bug.cgi?id=183759
2484
2485         Reviewed by Tim Horton.
2486
2487         Colors are cached and need to be cleared and recalculated.
2488
2489         * WebProcess/WebPage/WebPage.cpp:
2490         (WebKit::WebPage::setDefaultAppearance):
2491
2492 2018-03-19  Chris Dumez  <cdumez@apple.com>
2493
2494         WKWebView.ClearAppCache is a flaky API test failure on High Sierra.
2495         https://bugs.webkit.org/show_bug.cgi?id=181546
2496         <rdar://problem/36444327>
2497
2498         Reviewed by Ryosuke Niwa.
2499
2500         in LocalStorageDatabaseTracker::deleteDatabasesModifiedSince(), add origin
2501         to originIdentifiersToDelete if we cannot determine the last modification
2502         time of the database file. This likely means the database file does not
2503         exist. However, we still needs to make sure the origin gets removed from
2504         the origins database and there may be *.wal / *.shm variants of the database
2505         that are still on disk and need to be deleted.
2506
2507         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
2508         (WebKit::LocalStorageDatabaseTracker::deleteDatabasesModifiedSince):
2509
2510 2018-03-19  Chris Dumez  <cdumez@apple.com>
2511
2512         Have one service worker process per security origin
2513         https://bugs.webkit.org/show_bug.cgi?id=183600
2514         <rdar://problem/35280128>
2515
2516         Reviewed by Brady Eidson.
2517
2518         Split service workers from different origins into their own processes
2519         for security reasons.
2520
2521         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2522         (WebKit::WebSWServerConnection::startFetch):
2523         (WebKit::WebSWServerConnection::postMessageToServiceWorker):
2524         (WebKit::WebSWServerConnection::scheduleJobInServer):
2525         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
2526         (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
2527         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
2528         * StorageProcess/StorageProcess.cpp:
2529         (WebKit::StorageProcess::connectionToContextProcessFromIPCConnection):
2530         (WebKit::StorageProcess::didClose):
2531         (WebKit::StorageProcess::connectionToContextProcessWasClosed):
2532         (WebKit::StorageProcess::needsServerToContextConnectionForOrigin const):
2533         (WebKit::StorageProcess::didReceiveMessage):
2534         (WebKit::StorageProcess::createStorageToWebProcessConnection):
2535         (WebKit::StorageProcess::serverToContextConnectionForOrigin):
2536         (WebKit::StorageProcess::createServerToContextConnection):
2537         * StorageProcess/StorageProcess.h:
2538         * StorageProcess/StorageProcess.messages.in:
2539         * StorageProcess/StorageToWebProcessConnection.cpp:
2540         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
2541         (WebKit::StorageToWebProcessConnection::didClose):
2542         * StorageProcess/StorageToWebProcessConnection.h:
2543         * UIProcess/API/C/WKContext.cpp:
2544         (WKContextTerminateServiceWorkerProcess):
2545         * UIProcess/API/Cocoa/WKProcessPool.mm:
2546         (-[WKProcessPool _terminateServiceWorkerProcesses]):
2547         (-[WKProcessPool _webPageContentProcessCount]):
2548         (-[WKProcessPool _serviceWorkerProcessCount]):
2549         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2550         * UIProcess/Network/NetworkProcessProxy.cpp:
2551         (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
2552         (WebKit::NetworkProcessProxy::canAuthenticateAgainstProtectionSpace):
2553         * UIProcess/ServiceWorkerProcessProxy.cpp:
2554         (WebKit::ServiceWorkerProcessProxy::create):
2555         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
2556         * UIProcess/ServiceWorkerProcessProxy.h:
2557         (isType):
2558         * UIProcess/Storage/StorageProcessProxy.cpp:
2559         (WebKit::StorageProcessProxy::getStorageProcessConnection):
2560         (WebKit::StorageProcessProxy::didFinishLaunching):
2561         (WebKit::StorageProcessProxy::establishWorkerContextConnectionToStorageProcess):
2562         (WebKit::StorageProcessProxy::establishWorkerContextConnectionToStorageProcessForExplicitSession):
2563         * UIProcess/Storage/StorageProcessProxy.h:
2564         * UIProcess/Storage/StorageProcessProxy.messages.in:
2565         * UIProcess/WebProcessPool.cpp:
2566         (WebKit::WebProcessPool::getStorageProcessConnection):
2567         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
2568         (WebKit::WebProcessPool::createNewWebProcess):
2569         (WebKit::WebProcessPool::disconnectProcess):
2570         (WebKit::WebProcessPool::createNewWebProcessRespectingProcessCountLimit):
2571         (WebKit::WebProcessPool::createWebPage):
2572         (WebKit::WebProcessPool::updateServiceWorkerUserAgent):
2573         (WebKit::WebProcessPool::mayHaveRegisteredServiceWorkers):
2574         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
2575         (WebKit::WebProcessPool::terminateServiceWorkerProcesses):
2576         (WebKit::WebProcessPool::updateProcessAssertions):
2577         (WebKit::WebProcessPool::serviceWorkerProcessProxyFromPageID const):
2578         * UIProcess/WebProcessPool.h:
2579         * UIProcess/WebProcessProxy.cpp:
2580         (WebKit::WebProcessProxy::getStorageProcessConnection):
2581
2582 2018-03-19  Jiewen Tan  <jiewen_tan@apple.com>
2583
2584         Unreviewed, another quick fix for r229699
2585
2586         Restricts ENABLE_WEB_AUTHN to only macOS and iOS.
2587
2588         * Configurations/FeatureDefines.xcconfig:
2589
2590 2018-03-19  Chris Dumez  <cdumez@apple.com>
2591
2592         Make policy decisions asynchronous
2593         https://bugs.webkit.org/show_bug.cgi?id=180568
2594         <rdar://problem/37131297>
2595
2596         Reviewed by Alex Christensen.
2597
2598         Get rid of synchronous IPC and synchronous code paths for policy delegates.
2599         Policy decisions are now all made asynchronously and rely on asynchronous
2600         IPC.
2601
2602         This code change is based on work by Alex Christensen.
2603
2604         * UIProcess/WebPageProxy.cpp:
2605         (WebKit::WebPageProxy::receivedPolicyDecision):
2606         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2607         (WebKit::WebPageProxy::decidePolicyForResponse):
2608         * UIProcess/WebPageProxy.h:
2609         * UIProcess/WebPageProxy.messages.in:
2610         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2611         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
2612         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2613
2614 2018-03-19  Brian Burg  <bburg@apple.com>
2615
2616         Web Inspector: clean up WKWebView configuration code
2617         https://bugs.webkit.org/show_bug.cgi?id=183747
2618         <rdar://problem/38629343>
2619
2620         Reviewed by Timothy Hatcher.
2621
2622         * UIProcess/mac/WKInspectorViewController.mm:
2623         (-[WKInspectorViewController webView]): Always use system
2624         appearance for Inspector's web content.
2625
2626 2018-03-19  Eric Carlson  <eric.carlson@apple.com>
2627
2628         [Extra zoom mode] Require fullscreen for video playback
2629         https://bugs.webkit.org/show_bug.cgi?id=183742
2630         <rdar://problem/38235862>
2631
2632         Reviewed by Jer Noble.
2633
2634         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
2635         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
2636         (-[WKVideoFullScreenViewController initWithAVPlayerViewController:]):
2637         (-[WKVideoFullScreenViewController viewDidLoad]):
2638         (-[WKVideoFullScreenViewController prefersStatusBarHidden]):
2639         (WebKit::VideoFullscreenModelContext::presentingViewController):
2640         (WebKit::VideoFullscreenModelContext::createVideoFullscreenViewController):
2641         * WebProcess/cocoa/VideoFullscreenManager.mm:
2642         (WebKit::VideoFullscreenManager::didEnterFullscreen):
2643
2644 2018-03-19  Daniel Bates  <dabates@apple.com>
2645
2646         test-webkitpy no longer runs WebKit2 tests
2647         https://bugs.webkit.org/show_bug.cgi?id=183724
2648
2649         Reviewed by Alexey Proskuryakov.
2650
2651         Fixes an issue where Python emits errors "global name reset_results is not defined" when
2652         running tests in messages_unittest.py using test-webkitpy.
2653
2654         Currently messages_unittest.py conditionally defines the global variable reset_results
2655         when run as the main program (i.e. __name__ == "__main__"). When messages_unittest.py is
2656         imported as a module as test-webkitpy does then it is not considered the main program
2657         ;=> the top-level script environment is not __main__ ;=> we do not define the global
2658         variable reset_results. Instead we should unconditionally define the global variable
2659         reset_results.
2660
2661         * Scripts/webkit/messages_unittest.py:
2662
2663 2018-03-19  Per Arne Vollan  <pvollan@apple.com>
2664
2665         When the WebContent process is blocked from accessing the WindowServer, the call CVDisplayLinkCreateWithCGDisplay will fail.
2666         https://bugs.webkit.org/show_bug.cgi?id=183604
2667         <rdar://problem/38305109>
2668
2669         Reviewed by Brent Fulgham.
2670
2671         * UIProcess/WebPageProxy.h:
2672         * UIProcess/WebPageProxy.messages.in:
2673         * UIProcess/mac/DisplayLink.cpp: Added.
2674         (WebKit::DisplayLink::DisplayLink):
2675         (WebKit::DisplayLink::~DisplayLink):
2676         (WebKit::DisplayLink::displayLinkCallback):
2677         * UIProcess/mac/DisplayLink.h: Added.
2678         * UIProcess/mac/WebPageProxyMac.mm:
2679         (WebKit::WebPageProxy::startDisplayRefreshMonitor):
2680         (WebKit::WebPageProxy::stopDisplayRefreshMonitor):
2681         * WebKit.xcodeproj/project.pbxproj:
2682         * WebProcess/WebPage/DrawingArea.cpp:
2683         (WebKit::DrawingArea::createDisplayRefreshMonitor):
2684         * WebProcess/WebPage/DrawingArea.h:
2685         * WebProcess/WebPage/DrawingArea.messages.in:
2686         * WebProcess/WebPage/mac/DrawingAreaMac.cpp: Added.
2687         (WebKit::DisplayRefreshMonitorMac::create):
2688         (WebKit::DisplayRefreshMonitorMac::DisplayRefreshMonitorMac):
2689         (WebKit::DisplayRefreshMonitorMac::~DisplayRefreshMonitorMac):
2690         (WebKit::DisplayRefreshMonitorMac::requestRefreshCallback):
2691         (WebKit::DisplayRefreshMonitorMac::displayLinkFired):
2692         (WebKit::DrawingArea::screenWasRefreshed):
2693         (WebKit::DrawingArea::createDisplayRefreshMonitor):
2694
2695 2018-03-17  Jiewen Tan  <jiewen_tan@apple.com>
2696
2697         [WebAuthN] Implement authenticatorMakeCredential
2698         https://bugs.webkit.org/show_bug.cgi?id=183527
2699         <rdar://problem/35275886>
2700
2701         Reviewed by Brent Fulgham.
2702
2703         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.cpp:
2704         (WebKit::WebCredentialsMessengerProxy::WebCredentialsMessengerProxy):
2705         (WebKit::WebCredentialsMessengerProxy::makeCredential):
2706         (WebKit::WebCredentialsMessengerProxy::getAssertion):
2707         (WebKit::WebCredentialsMessengerProxy::isUserVerifyingPlatformAuthenticatorAvailable):
2708         (WebKit::WebCredentialsMessengerProxy::exceptionReply):
2709         (WebKit::WebCredentialsMessengerProxy::makeCredentialReply):
2710         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.h:
2711         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.messages.in:
2712         * UIProcess/CredentialManagement/cocoa/WebCredentialsMessengerProxyCocoa.mm: Removed.
2713         * WebKit.xcodeproj/project.pbxproj:
2714         * WebProcess/CredentialManagement/WebCredentialsMessenger.cpp:
2715         (WebKit::WebCredentialsMessenger::makeCredential):
2716         (WebKit::WebCredentialsMessenger::makeCredentialReply):
2717         * WebProcess/CredentialManagement/WebCredentialsMessenger.h:
2718         * WebProcess/CredentialManagement/WebCredentialsMessenger.messages.in:
2719
2720 2018-03-17  Daniel Bates  <dabates@apple.com>
2721
2722         Tests fail in messages_unittest.py
2723         https://bugs.webkit.org/show_bug.cgi?id=183725
2724
2725         Partial revert of r222113. The messages generator machinery does not know when
2726         it is sufficient to emit an include for wtf/Forward.h as opposed to a concrete
2727         header.
2728
2729         * Scripts/webkit/LegacyMessages-expected.h:
2730         * Scripts/webkit/Messages-expected.h:
2731
2732 2018-03-16  Wenson Hsieh  <wenson_hsieh@apple.com>
2733
2734         Unreviewed, rolling out r229688.
2735
2736         There's a solution that doesn't require this SPI.
2737
2738         Reverted changeset:
2739
2740         "Add SPI to expose width and height anchors for WKWebView's
2741         content view"
2742         https://bugs.webkit.org/show_bug.cgi?id=183711
2743         https://trac.webkit.org/changeset/229688
2744
2745 2018-03-16  Wenson Hsieh  <wenson_hsieh@apple.com>
2746
2747         Add SPI to expose width and height anchors for WKWebView's content view
2748         https://bugs.webkit.org/show_bug.cgi?id=183711
2749         <rdar://problem/38562899>
2750
2751         Reviewed by Tim Horton.
2752
2753         Add _contentWidthAnchor and _contentHeightAnchor SPI to WKWebView for internal clients to be able to reason
2754         about the size of the content view on iOS using autolayout.
2755
2756         Test: WebKit.AutoLayoutPositionHeaderAndFooterViewsInScrollView.
2757
2758         * UIProcess/API/Cocoa/WKWebView.mm:
2759         (-[WKWebView _contentWidthAnchor]):
2760         (-[WKWebView _contentHeightAnchor]):
2761         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2762
2763 2018-03-16  Megan Gardner  <megan_gardner@apple.com>
2764
2765         Add _useSystemAppearance to WKView
2766         https://bugs.webkit.org/show_bug.cgi?id=183706
2767         <rdar://problem/38516584>
2768
2769         Reviewed by Tim Horton.
2770
2771         Plumb useSystemAppearance and other supporting functions to WKView
2772
2773         * UIProcess/API/Cocoa/WKViewPrivate.h:
2774         * UIProcess/API/Cocoa/WKWebView.mm:
2775         (-[WKWebView _initializeWithConfiguration:]):
2776         (-[WKWebView _useSystemAppearance]):
2777         (-[WKWebView _setUseSystemAppearance:]):
2778         (-[WKWebView effectiveAppearanceDidChange]):
2779         * UIProcess/API/mac/WKView.mm:
2780         (-[WKView effectiveAppearanceDidChange]):
2781         (-[WKView _setUseSystemAppearance:]):
2782         (-[WKView _useSystemAppearance]):
2783         (-[WKView _setDefaultAppearance:]):
2784         * UIProcess/Cocoa/WebViewImpl.h:
2785         * UIProcess/Cocoa/WebViewImpl.mm:
2786         (WebKit::WebViewImpl::setUseSystemAppearance):
2787         (WebKit::WebViewImpl::useSystemAppearance):
2788         (WebKit::WebViewImpl::setDefaultAppearance):
2789
2790 2018-03-16  Brent Fulgham  <bfulgham@apple.com>
2791
2792         Set a trap to catch an infrequent form-related nullptr crash
2793         https://bugs.webkit.org/show_bug.cgi?id=183704
2794         <rdar://problem/37579354>
2795
2796         Reviewed by Ryosuke Niwa.
2797
2798         Add a RELEASE_ASSERT to see if we ever encounter a nullptr WebCore frame.
2799
2800         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2801         (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):
2802
2803 2018-03-16  Jer Noble  <jer.noble@apple.com>
2804
2805         Make Fullscreen API an Experimental Feature
2806         https://bugs.webkit.org/show_bug.cgi?id=183662
2807
2808         Reviewed by Jon Lee.
2809
2810         Add the ability to have a conditional for whether an Experimental Feature is "visible", separate from
2811         whether the preference is available, for definining platform-specific Experimental Features.
2812
2813         * Scripts/GeneratePreferences.rb:
2814         * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb:
2815         * Shared/WebPreferences.yaml:
2816
2817 2018-03-16  Megan Gardner  <megan_gardner@apple.com>
2818
2819         Ensure that style is updated when the effective appearance changes
2820         https://bugs.webkit.org/show_bug.cgi?id=183690
2821         <rdar://problem/38385900>
2822
2823         Reviewed by Tim Horton and Wenson Hsieh.
2824
2825         Respond to and respect the effective appearance changing.
2826
2827         * UIProcess/API/Cocoa/WKWebView.mm:
2828         (-[WKWebView effectiveAppearanceDidChange]):
2829         * WebProcess/WebPage/WebPage.cpp:
2830         (WebKit::WebPage::setDefaultAppearance):
2831
2832 2018-03-16  Chris Dumez  <cdumez@apple.com>
2833
2834         URLSchemeHandler.Basic API test fails with async policy delegates
2835         https://bugs.webkit.org/show_bug.cgi?id=183678
2836
2837         Reviewed by Alex Christensen.
2838
2839         The issue is that the client calls _didPerformRedirection / didReceiveResponse / didReceiveData / didFinish
2840         on the URLScheme task one after the one, synchronously. However, redirects and responses can be processed
2841         asynchronously. To address the issue, we now queue operations requested by the client if we're waiting
2842         for an async policy delegate.
2843
2844         * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
2845         (WebKit::WebURLSchemeTaskProxy::didPerformRedirection):
2846         (WebKit::WebURLSchemeTaskProxy::didReceiveResponse):
2847         (WebKit::WebURLSchemeTaskProxy::didReceiveData):
2848         (WebKit::WebURLSchemeTaskProxy::didComplete):
2849         (WebKit::WebURLSchemeTaskProxy::processNextPendingTask):
2850         * WebProcess/WebPage/WebURLSchemeTaskProxy.h:
2851         (WebKit::WebURLSchemeTaskProxy::queueTask):
2852
2853 2018-03-16  Claudio Saavedra  <csaavedra@igalia.com>
2854
2855         Suppress GCC warnings by using #include instead of #import
2856
2857         Unreviewed.
2858         * UIProcess/SystemPreviewController.cpp:
2859
2860 2018-03-15  Keith Rollin  <krollin@apple.com>
2861
2862         Telemetry for stalled webpage loads
2863         https://bugs.webkit.org/show_bug.cgi?id=183221
2864         <rdar://problem/36549013>
2865
2866         Reviewed by Chris Dumez.
2867
2868         Add telemetry for page loads, tracking the pages that succeed, fail,
2869         or are canceled. This information will be used to track the overall
2870         health of our page loading as time goes on.
2871
2872         * UIProcess/WebPageProxy.cpp:
2873         (WebKit::WebPageProxy::close):
2874         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
2875         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
2876         (WebKit::WebPageProxy::didFinishLoadForFrame):
2877         (WebKit::WebPageProxy::didFailLoadForFrame):
2878         (WebKit::WebPageProxy::reportPageLoadResult):
2879         * UIProcess/WebPageProxy.h:
2880         (WebKit::WebPageProxy::reportPageLoadResult):
2881
2882 2018-03-15  Wenson Hsieh  <wenson_hsieh@apple.com>
2883
2884         [iOS WK2] Hit-testing fails when specifying a large top content inset
2885         https://bugs.webkit.org/show_bug.cgi?id=183648
2886         <rdar://problem/38421894>
2887
2888         Reviewed by Tim Horton.
2889
2890         Currently, in the process of computing unobscured content rect in the UI process on iOS, we subtract away parts
2891         of the view that are obscured by insets (e.g. MobileSafari's chrome). The helper method -[WKWebView
2892         _computeContentInset] is intended to compute these obscuring insets around the view, but it takes scroll view
2893         insets into account. This means that if WKWebView's inner scroll view has content insets, we'll end up shrinking
2894         the unobscured content rect as if the insetted region obscures the viewport; this causes visible content on the
2895         page to be uninteractible, since WKWebView erroneously thinks it's obscured.
2896
2897         To address this, we rename _computeContentInset to _computeObscuredInset, and make it _not_ affected by the
2898         scroll view's content insets. From code inspection and testing, all but one of the former call sites of
2899         _computeContentInset really need the obscured inset instead (see below). The one exception, -[WKWebView
2900         _adjustedContentOffset:], takes a scroll position from the page and maps it to a content offset in the inner
2901         UIScrollView (see below for more details).
2902
2903         Tests:  ScrollViewInsetTests.InnerHeightWithLargeTopContentInset
2904                 ScrollViewInsetTests.InnerHeightWithLargeBottomContentInset
2905                 ScrollViewInsetTests.RestoreInitialContentOffsetAfterCrash
2906                 ScrollViewInsetTests.RestoreInitialContentOffsetAfterNavigation
2907
2908         * UIProcess/API/Cocoa/WKWebView.mm:
2909         (-[WKWebView _setHasCustomContentView:loadedMIMEType:]):
2910         (-[WKWebView _initialContentOffsetForScrollView]):
2911
2912         See -_contentOffsetAdjustedForObscuredInset: below.
2913
2914         (-[WKWebView _contentOffsetAdjustedForObscuredInset:]):
2915
2916         Formerly -_adjustedContentOffset:. -_contentOffsetAdjustedForObscuredInset: no longer takes scroll view content
2917         inset into account, and only cares about insets that obscure the view. This means that the scroll position
2918         (0, 0) in the document now maps to the content offset in the inner UIScrollView, such that the top of the page
2919         is aligned with the top of the viewport.
2920
2921         However, many call sites of -_adjustedContentOffset: were intended to compute the initial, top-left-most content
2922         offset in the scroll view to scroll to when resetting the web view (i.e., they pass in CGPointZero for the
2923         scroll position). An example of this is the scroll position to jump to after web content process termination, or
2924         the scroll position after main frame navigation. In these cases, we actually want to jump to the top of the
2925         scroll view, so we do want to use the version of the computed content insets that accounts for scroll view
2926         insets.
2927
2928         Since these cases are limited to finding the top-left-most scroll position, we pull this out into a separate
2929         helper method (-_initialContentOffsetForScrollView) and replace calls to
2930         `-[self _adjustedContentOffset:CGPointZero]` with this instead.
2931
2932         (-[WKWebView _computedObscuredInset]):
2933
2934         A version of -_computeContentInset that doesn't care about scroll view insets. Used whereever we need to account
2935         for obscured insets rather than the combination of content insets and unobscured insets (e.g.
2936         -_initialContentOffsetForScrollView).
2937
2938         (-[WKWebView _processDidExit]):
2939         (-[WKWebView _didCommitLayerTree:]):
2940         (-[WKWebView _dynamicViewportUpdateChangedTargetToScale:position:nextValidLayerTreeTransactionID:]):
2941         (-[WKWebView _scrollToContentScrollPosition:scrollOrigin:]):
2942         (-[WKWebView scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
2943         (-[WKWebView _updateVisibleContentRects]):
2944         (-[WKWebView _navigationGestureDidBegin]):
2945
2946         In all these places where we inset the view bounds to compute the unobscured region of the viewport, it doesn't
2947         make sense to additionally inset by the scroll view's content insets, since (1) the scroll view's content insets
2948         don't obscure the viewport, and (2) it's perfectly valid for the inner scroll view to have arbitrarily large
2949         content insets.
2950
2951         (-[WKWebView _adjustedContentOffset:]): Deleted.
2952
2953         Renamed to -_contentOffsetAdjustedForObscuredInset:.
2954
2955         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2956         * UIProcess/ios/WKPDFView.mm:
2957         (-[WKPDFView _offsetForPageNumberIndicator]):
2958
2959         Similar to -_scrollToFragment: (see below).
2960
2961         (-[WKPDFView _scrollToFragment:]):
2962
2963         This helper figures out which content offset to scroll to, given the y-origin of a page in a PDF document. If
2964         insets are added to the scroll view, we end up scrolling to the wrong content offset since we'll add the height
2965         of the top content inset (imagine that the top content inset is enormous — then we'll scroll an amount equal to
2966         the top content inset _past_ the point where the y-origin of the page is at the top of the viewport).
2967
2968 2018-03-15  Brent Fulgham  <bfulgham@apple.com>
2969
2970         [macOS] Correct sandbox violations during Flash playback under ToT WebKit
2971         https://bugs.webkit.org/show_bug.cgi?id=183672
2972         <rdar://problem/38510839>
2973
2974         Reviewed by Eric Carlson.
2975
2976         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
2977         * WebProcess/com.apple.WebProcess.sb.in:
2978
2979 2018-03-15  Brent Fulgham  <bfulgham@apple.com>
2980
2981         REGRESSION(r229484): Plugins often require CGS Connections to draw
2982         https://bugs.webkit.org/show_bug.cgi?id=183663
2983         <rdar://problem/38439218>
2984
2985         Reviewed by Per Arne Vollan.
2986
2987         Flash requires an active CGSConnection to work properly. Since we don't want the WebContent
2988         process to have on, create a new plugin process-specific layer host creation method that
2989         gives this access.
2990
2991         * Platform/mac/LayerHostingContext.h:
2992         * Platform/mac/LayerHostingContext.mm:
2993         (WebKit::LayerHostingContext::createForExternalPluginHostingProcess): Added.
2994         * PluginProcess/mac/PluginControllerProxyMac.mm:
2995         (WebKit::PluginControllerProxy::updateLayerHostingContext): Use the new creation
2996         method.
2997
2998 2018-03-15  Zan Dobersek  <zdobersek@igalia.com>
2999
3000         [TexMap] Remove TextureMapperLayer::texture()
3001         https://bugs.webkit.org/show_bug.cgi?id=183635
3002
3003         Reviewed by Michael Catanzaro.
3004
3005         Remove the CoordinatedBackingStore::texture() override since the virtual
3006         method is also being removed.
3007
3008         * Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp:
3009         (WebKit::CoordinatedBackingStore::texture const): Deleted.
3010         * Shared/CoordinatedGraphics/CoordinatedBackingStore.h:
3011
3012 2018-03-14  John Wilander  <wilander@apple.com>
3013
3014         Resource Load Statistics: Add clearing of storage access to WebResourceLoadStatisticsStore::clearInMemory()
3015         https://bugs.webkit.org/show_bug.cgi?id=183641
3016         <rdar://problem/38469497>
3017
3018         Reviewed by Brent Fulgham and Chris Dumez.
3019
3020         This change is to stabilize existing layout tests by removing
3021         all storage access entries on a call to 
3022         WebResourceLoadStatisticsStore::clearInMemory().
3023         See Ryan Haddad's comment in https://bugs.webkit.org/show_bug.cgi?id=183620.
3024
3025         Almost all of the code changes are piping to get this
3026         call from the WebResourceLoadStatisticsStore to
3027         WebCore::NetworkStorageSession where entries reside.
3028
3029         * NetworkProcess/NetworkProcess.cpp:
3030         (WebKit::NetworkProcess::removeAllStorageAccess):
3031         * NetworkProcess/NetworkProcess.h:
3032         * NetworkProcess/NetworkProcess.messages.in:
3033         * UIProcess/Network/NetworkProcessProxy.cpp:
3034         (WebKit::NetworkProcessProxy::removeAllStorageAccess):
3035         * UIProcess/Network/NetworkProcessProxy.h:
3036         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3037         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
3038         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
3039         (WebKit::WebResourceLoadStatisticsStore::clearInMemory):
3040             Now also clears all storage access entries in the network process.
3041         * UIProcess/WebResourceLoadStatisticsStore.h:
3042         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3043         (WebKit::WebsiteDataStore::removeAllStorageAccessHandler):
3044         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
3045         * UIProcess/WebsiteData/WebsiteDataStore.h:
3046
3047 2018-03-14  Ryan Haddad  <ryanhaddad@apple.com>
3048
3049         Unreviewed, rolling out r229613.
3050
3051         Caused API test failures
3052
3053         Reverted changeset:
3054
3055         "Make policy decisions asynchronous"
3056         https://bugs.webkit.org/show_bug.cgi?id=180568
3057         https://trac.webkit.org/changeset/229613
3058
3059 2018-03-14  Chris Dumez  <cdumez@apple.com>
3060
3061         Reduce use of SWServerToContextConnection::globalServerToContextConnection()
3062         https://bugs.webkit.org/show_bug.cgi?id=183626
3063
3064         Reviewed by Youenn Fablet.
3065
3066         Reduce use of SWServerToContextConnection::globalServerToContextConnection() as we are moving
3067         towards having multiple context connections.
3068
3069         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3070         (WebKit::WebSWServerConnection::startFetch):
3071         (WebKit::WebSWServerConnection::postMessageToServiceWorker):
3072
3073 2018-03-14  Chris Dumez  <cdumez@apple.com>
3074
3075         Make policy decisions asynchronous
3076         https://bugs.webkit.org/show_bug.cgi?id=180568
3077         <rdar://problem/37131297>
3078
3079         Reviewed by Alex Christensen.
3080
3081         Get rid of synchronous IPC and synchronous code paths for policy delegates.
3082         Policy decisions are now all made asynchronously and rely on asynchronous
3083         IPC.
3084
3085         This code change is based on work by Alex Christensen.
3086
3087         * UIProcess/WebPageProxy.cpp:
3088         (WebKit::WebPageProxy::receivedPolicyDecision):
3089         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3090         (WebKit::WebPageProxy::decidePolicyForResponse):
3091         * UIProcess/WebPageProxy.h:
3092         * UIProcess/WebPageProxy.messages.in:
3093         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3094         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
3095         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3096
3097 2018-03-14  Chris Dumez  <cdumez@apple.com>
3098
3099         Drop unnecessary StorageToWebProcessConnection::workerContextProcessConnectionCreated()
3100         https://bugs.webkit.org/show_bug.cgi?id=183624
3101
3102         Reviewed by Youenn Fablet.
3103
3104         Drop unnecessary StorageToWebProcessConnection::workerContextProcessConnectionCreated()
3105         since it was going through all SWServers. Calling workerContextProcessConnectionCreated()
3106         on every StorageToWebProcessConnection was thus doing redundant work.
3107
3108         * StorageProcess/StorageProcess.cpp:
3109         (WebKit::StorageProcess::createStorageToWebProcessConnection):
3110         * StorageProcess/StorageToWebProcessConnection.cpp:
3111         (WebKit::StorageToWebProcessConnection::establishSWServerConnection):
3112         (WebKit::StorageToWebProcessConnection::workerContextProcessConnectionCreated): Deleted.
3113         * StorageProcess/StorageToWebProcessConnection.h:
3114
3115 2018-03-14  Tim Horton  <timothy_horton@apple.com>
3116
3117         Fix the build after r229567
3118
3119         * Configurations/FeatureDefines.xcconfig:
3120
3121 2018-03-13  John Wilander  <wilander@apple.com>
3122
3123         Resource Load Statistics: Immediately forward cookie access for domains with previous user interaction when there's an opener document
3124         https://bugs.webkit.org/show_bug.cgi?id=183620
3125         <rdar://problem/38431469>
3126
3127         Reviewed by Brent Fulgham.
3128
3129         It turns out the fix in https://bugs.webkit.org/show_bug.cgi?id=183577
3130         wasn't enough to address the compatibility issues with popups. Some of
3131         them just detect their unpartitioned cookies, auto-dismiss themselves,
3132         and expect their unpartitioned cookies to be available under the opener
3133         afterwards. We should grant them access if the popup's domain has had
3134         user interaction _previously_.
3135
3136         Note that we still need https://bugs.webkit.org/show_bug.cgi?id=183577
3137         because if the popup's domain has not received user interaction
3138         previously, we will not grant it storage access on just the window open.
3139
3140         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3141         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
3142         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessUnderOpener): Deleted.
3143             Renamed WebResourceLoadStatisticsStore::grantStorageAccessUnderOpener()
3144             to WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener()
3145             since there is now a case where access will not be granted, i.e. when
3146             the popup domain has not had user interaction previously.
3147         * UIProcess/WebResourceLoadStatisticsStore.h:
3148         * UIProcess/WebResourceLoadStatisticsStore.messages.in:
3149              Similar renaming.
3150         * WebProcess/WebProcess.cpp:
3151         (WebProcess::WebProcess):
3152              Similar renaming.
3153
3154 2018-03-13  Jer Noble  <jer.noble@apple.com>
3155
3156         Add missing artwork for fullscreen mode.
3157         https://bugs.webkit.org/show_bug.cgi?id=183618
3158
3159         Reviewed by Jon Lee.
3160
3161         * Resources/ios/iOS.xcassets/Done.imageset/Contents.json: Added.
3162         * Resources/ios/iOS.xcassets/Done.imageset/Done.pdf: Added.
3163         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/Contents.json: Added.
3164         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/StartPictureInPictureButton@1x.png: Added.
3165         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/StartPictureInPictureButton@2x.png: Added.
3166         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/StartPictureInPictureButton@3x.png: Added.
3167         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/Contents.json: Added.
3168         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/StopPictureInPictureButton@1x.png: Added.
3169         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/StopPictureInPictureButton@2x.png: Added.
3170         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/StopPictureInPictureButton@3x.png: Added.
3171
3172 2018-03-13  Brian Burg  <bburg@apple.com>
3173
3174         [WK2] Web Inspector: NavigationAction for opening a link in a new tab should have a UserGestureIndicator
3175         https://bugs.webkit.org/show_bug.cgi?id=183612
3176         <rdar://problem/38388641>
3177
3178         Reviewed by Timothy Hatcher.
3179
3180         The current gesture token will be attached to the NavigationAction at construction time,
3181         so set up a UserGestureIndicator when creating the action and sending it out.
3182
3183         * WebProcess/WebPage/WebInspector.cpp:
3184         (WebKit::WebInspector::openInNewTab):
3185
3186 2018-03-13  Dean Jackson  <dino@apple.com>
3187
3188         WKSystemPreviewView needs to implement some of UIScrollViewDelegate
3189         https://bugs.webkit.org/show_bug.cgi?id=183607
3190         <rdar://problem/38427622>
3191
3192         Reviewed by Antoine Quint.
3193
3194         Add an empty implementation of scrollViewDidScroll.
3195
3196         * UIProcess/ios/WKSystemPreviewView.mm:
3197         (-[WKSystemPreviewView scrollViewDidScroll:]):
3198
3199 2018-03-13  Jiewen Tan  <jiewen_tan@apple.com>
3200
3201         Soft-link LocalAuthentication.Framework
3202         https://bugs.webkit.org/show_bug.cgi?id=183587
3203         <rdar://problem/38219763>
3204
3205         Reviewed by Brian Burg.
3206
3207         * UIProcess/CredentialManagement/cocoa/WebCredentialsMessengerProxyCocoa.mm:
3208         (WebKit::WebCredentialsMessengerProxy::platformIsUserVerifyingPlatformAuthenticatorAvailable):
3209         * WebKit.xcodeproj/project.pbxproj:
3210
3211 2018-03-12  Dean Jackson  <dino@apple.com>
3212
3213         Add a WKWebViewContentProvider for system previews
3214         https://bugs.webkit.org/show_bug.cgi?id=183582
3215         <rdar://problem/38393569>
3216
3217         Reviewed by Tim Horton.
3218
3219         Implement WKSystemPreviewView, which conforms to WKWebViewContentProvider, in
3220         order to view content as a "system preview". This effectively replaces the
3221         SystemPreviewController, which will be removed soon.
3222
3223         Some of the required methods of WKWebViewContentProvider are not necessary on
3224         this instance, so a follow-up patch will clean the protocol up a bit.
3225
3226         * UIProcess/Cocoa/NavigationState.mm: Don't trigger a SystemPreview when downloading.
3227         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
3228
3229         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
3230         (-[WKWebViewContentProviderRegistry init]): Register the WKSystemPreviewView for
3231         MIME types retrieved from WebKitAdditions.
3232
3233         * UIProcess/ios/WKSystemPreviewView.h: Added.
3234         * UIProcess/ios/WKSystemPreviewView.mm: Added.
3235
3236         (-[WKSystemPreviewView web_initWithFrame:webView:]):
3237         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]): This is the
3238         method that actually creates a QuickLook preview and provides the data.
3239         (-[WKSystemPreviewView web_setMinimumSize:]):
3240         (-[WKSystemPreviewView web_setOverlaidAccessoryViewsInset:]):
3241         (-[WKSystemPreviewView web_computedContentInsetDidChange]):
3242         (-[WKSystemPreviewView web_setFixedOverlayView:]):
3243         (-[WKSystemPreviewView web_didSameDocumentNavigation:]):
3244         (-[WKSystemPreviewView web_countStringMatches:options:maxCount:]):
3245         (-[WKSystemPreviewView web_findString:options:maxCount:]):
3246         (-[WKSystemPreviewView web_hideFindUI]):
3247
3248         (-[WKSystemPreviewView numberOfPreviewItemsInPreviewController:]): QuickLook delegates.
3249         (-[WKSystemPreviewView previewController:previewItemAtIndex:]):
3250         (-[WKSystemPreviewView provideDataForItem:]):
3251         (-[WKSystemPreviewView previewControllerWillDismiss:]):
3252
3253         * WebKit.xcodeproj/project.pbxproj: Add new files.
3254
3255 2018-03-12  John Wilander  <wilander@apple.com>
3256
3257         Resource Load Statistics: Immediately forward cookie access at user interaction when there's an opener document
3258         https://bugs.webkit.org/show_bug.cgi?id=183577
3259         <rdar://problem/38266987>
3260
3261         Reviewed by Brent Fulgham.
3262
3263         * NetworkProcess/NetworkProcess.cpp:
3264         (WebKit::NetworkProcess::hasStorageAccessForFrame):
3265             Now also checks for general page access.
3266         (WebKit::NetworkProcess::grantStorageAccess):
3267             Renamed from grantStorageAccessForFrame since the frameID now is optional.
3268         (WebKit::NetworkProcess::grantStorageAccessForFrame): Deleted.
3269             Renamed since the frameID now is optional.
3270         * NetworkProcess/NetworkProcess.h:
3271             Renaming since the frameID now is optional.
3272         * NetworkProcess/NetworkProcess.messages.in:
3273             Renaming since the frameID now is optional.
3274         * NetworkProcess/NetworkResourceLoader.cpp:
3275         (WebKit::NetworkResourceLoader::logCookieInformation):
3276             Consequence of function renaming.
3277         * UIProcess/Network/NetworkProcessProxy.cpp:
3278         (WebKit::NetworkProcessProxy::grantStorageAccess):
3279         (WebKit::NetworkProcessProxy::grantStorageAccessForFrame): Deleted.
3280             Renaming since the frameID now is optional.
3281         * UIProcess/Network/NetworkProcessProxy.h:
3282         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3283         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
3284             Renaming since the frameID now is optional.
3285         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
3286             Handler renaming since the frameID now is optional.
3287         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessUnderOpener):
3288             New function for that grants cookie access under a whole page.
3289         * UIProcess/WebResourceLoadStatisticsStore.h:
3290             Member renaming since the frameID now is optional.
3291         * UIProcess/WebResourceLoadStatisticsStore.messages.in:
3292             New message received straight from WebCore::ResourceLoadObserver.
3293         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3294         (WebKit::WebsiteDataStore::grantStorageAccessHandler):
3295             Renamed and made frameID optional.
3296         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
3297             Consequence of renaming and making frameID optional.
3298         (WebKit::WebsiteDataStore::grantStorageAccessForFrameHandler): Deleted.
3299             Renamed and made frameID optional.
3300         * UIProcess/WebsiteData/WebsiteDataStore.h:
3301         * WebProcess/WebProcess.cpp:
3302         (WebProcess::WebProcess):
3303             Now calls setGrantStorageAccessUnderOpenerCallback() on the shared
3304             WebCore::ResourceLoadObserver.
3305
3306 2018-03-12  Tim Horton  <timothy_horton@apple.com>
3307
3308         Stop using SDK conditionals to control feature definitions
3309         https://bugs.webkit.org/show_bug.cgi?id=183430
3310         <rdar://problem/38251619>
3311
3312         Reviewed by Dan Bernstein.
3313
3314         * Configurations/FeatureDefines.xcconfig:
3315         * Configurations/WebKitTargetConditionals.xcconfig: Renamed.
3316
3317 2018-03-12  Yoav Weiss  <yoav@yoav.ws>
3318
3319         Runtime flag for link prefetch and remove link subresource.
3320         https://bugs.webkit.org/show_bug.cgi?id=183540
3321
3322         Reviewed by Chris Dumez.
3323
3324         Remove the LINK_PREFETCH build time flag.
3325
3326         * Configurations/FeatureDefines.xcconfig:
3327         * WebProcess/Network/WebLoaderStrategy.cpp:
3328         (WebKit::maximumBufferingTime):
3329
3330 2018-03-12  Chris Dumez  <cdumez@apple.com>
3331
3332         Load may get committed before receiving policy for the resource response
3333         https://bugs.webkit.org/show_bug.cgi?id=183579
3334         <rdar://problem/38268780>
3335
3336         Reviewed by Youenn Fablet.
3337
3338         r228852 updated WebResourceLoader::didReceiveResponse to only send the
3339         ContinueDidReceiveResponse IPC back to the Networkprocess *after* the
3340         policy decision for the resource response has been made. This is necessary
3341         now that policy decisions can be made asynchronously.
3342
3343         However, one of the 2 code paths in NetworkProcess side (code path when
3344         the resource is already in the HTTP disk cache) failed to wait for the
3345         ContinueDidReceiveResponse IPC before sending over the data to the WebProcess.
3346         As a result, the WebProcess could commit the load before even receiving the
3347         policy response from the client.        
3348
3349         * NetworkProcess/NetworkResourceLoader.cpp:
3350         (WebKit::NetworkResourceLoader::continueDidReceiveResponse):
3351         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
3352         (WebKit::NetworkResourceLoader::continueProcessingCachedEntryAfterDidReceiveResponse):
3353         * NetworkProcess/NetworkResourceLoader.h:
3354         Make sure NetworkResourceLoader::didRetrieveCacheEntry() does not start sending the data
3355         until the network process gets the ContinueDidReceiveResponse IPC back from the WebProcess.
3356
3357         * WebProcess/Network/WebResourceLoader.cpp:
3358         (WebKit::WebResourceLoader::didReceiveResponse):
3359         (WebKit::WebResourceLoader::didReceiveData):
3360         * WebProcess/Network/WebResourceLoader.h:
3361         Add assertion to make sure didReceiveData() never gets called before didReceiveResponse's
3362         completion handler has been called. If this hits, then the load may get committed even
3363         though the client did not reply to the policy for the resource response yet.
3364
3365 2018-03-12  Ali Juma  <ajuma@chromium.org>
3366
3367         http/tests/workers/service/service-worker-download.https.html times out with async policy delegates
3368         https://bugs.webkit.org/show_bug.cgi?id=183479
3369
3370         Reviewed by Youenn Fablet.
3371
3372         Ensure that ServiceWorkerFetchClient::m_isCheckingResponse is set before code that depends on it
3373         executes. This bit was set by code that's posted to the runloop using 'callOnMainThread' in
3374         ServiceWorkerFetchClient::didReceiveResponse. But when didReceiveResponse is executing, tasks for
3375         handling didReceiveData, didFail, or didFinish may already have been posted to the runloop, and in
3376         that case would execute before m_isCheckingResponse gets set, and then incorrectly fail to 
3377         early-out. Fix this by directly setting m_isCheckingResponse in didReceiveResponse.
3378
3379         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
3380         (WebKit::ServiceWorkerClientFetch::start):
3381         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
3382
3383 2018-03-12  Wenson Hsieh  <wenson_hsieh@apple.com>
3384
3385         REGRESSION(r211643): Dismissing WKActionSheet should not also dismiss its presenting view controller
3386         https://bugs.webkit.org/show_bug.cgi?id=183549
3387         <rdar://problem/34960698>
3388
3389         Reviewed by Andy Estes.
3390
3391         Fixes the bug by dismissing the presented view controller (i.e. the action sheet or the view controller being
3392         presented during rotation) rather than the presenting view controller.
3393
3394         Test: ActionSheetTests.DismissingActionSheetShouldNotDismissPresentingViewController
3395
3396         * UIProcess/ios/WKActionSheet.mm:
3397         (-[WKActionSheet doneWithSheet:]):
3398
3399 2018-03-12  Javier Fernandez  <jfernandez@igalia.com>
3400
3401         Remove GridLayout runtime flag
3402         https://bugs.webkit.org/show_bug.cgi?id=183484
3403
3404         Reviewed by Myles C. Maxfield.
3405
3406         The Grid Layout feature has been enabled by default for almost a
3407         year, so I think it's time to remove the runtime flag and the
3408         codepath run when the feature is disabled.
3409
3410         * Shared/WebPreferences.yaml:
3411         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3412         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
3413
3414 2018-03-11  Wenson Hsieh  <wenson_hsieh@apple.com>
3415
3416         Fix the internal iOS build after r229512
3417         https://bugs.webkit.org/show_bug.cgi?id=183550
3418
3419         Reviewed by Zalan Bujtas.
3420
3421         Fixes a typo in a header import, as well as a nullability error. `SecTrustEvaluate()` takes in a nonnull outparam,
3422         which was removed in r229512;